Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some functions from Msi and MsiQuery #957

Open
wants to merge 5 commits into
base: 0.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ mmsystem = []
msaatext = []
mscat = []
mschapp = []
msi = []
msiquery = []
mssip = []
mswsock = []
namedpipeapi = []
Expand Down
2 changes: 2 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ const DATA: &'static [(&'static str, &'static [&'static str], &'static [&'static
("msaatext", &[], &[]),
("mscat", &["guiddef", "minwindef", "mssip", "wincrypt", "winnt"], &[]),
("mschapp", &["basetsd", "minwindef", "winnt"], &["advapi32"]),
("msi", &["minwindef"], &["msi"]),
("msiquery", &["minwindef", "msi", "winnt"], &["msi"]),
("mssip", &["guiddef", "minwindef", "mscat", "wincrypt", "winnt"], &["crypt32"]),
("mswsock", &["minwinbase", "minwindef", "mswsockdef", "winnt", "winsock2", "ws2def"], &["mswsock"]),
("namedpipeapi", &["minwinbase", "minwindef", "winnt"], &["advapi32", "kernel32"]),
Expand Down
2 changes: 2 additions & 0 deletions src/um/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ pub mod gl;
#[cfg(feature = "msaatext")] pub mod msaatext;
#[cfg(feature = "mscat")] pub mod mscat;
#[cfg(feature = "mschapp")] pub mod mschapp;
#[cfg(feature = "msi")] pub mod msi;
#[cfg(feature = "msiquery")] pub mod msiquery;
#[cfg(feature = "mssip")] pub mod mssip;
#[cfg(feature = "mswsock")] pub mod mswsock;
#[cfg(feature = "namedpipeapi")] pub mod namedpipeapi;
Expand Down
33 changes: 33 additions & 0 deletions src/um/msi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.
use ctypes::c_ulong;
use shared::minwindef::UINT;
pub type MSIHANDLE = c_ulong;
extern "system" {
pub fn MsiCloseHandle(hAny: MSIHANDLE) -> UINT;
pub fn MsiCloseAllHandles() -> UINT;
}
ENUM!{enum INSTALLMESSAGE {
INSTALLMESSAGE_FATALEXIT = 0x00000000,
INSTALLMESSAGE_ERROR = 0x01000000,
INSTALLMESSAGE_WARNING = 0x02000000,
INSTALLMESSAGE_USER = 0x03000000,
INSTALLMESSAGE_INFO = 0x04000000,
INSTALLMESSAGE_FILESINUSE = 0x05000000,
INSTALLMESSAGE_RESOLVESOURCE = 0x06000000,
INSTALLMESSAGE_OUTOFDISKSPACE = 0x07000000,
INSTALLMESSAGE_ACTIONSTART = 0x08000000,
INSTALLMESSAGE_ACTIONDATA = 0x09000000,
INSTALLMESSAGE_PROGRESS = 0x0A000000,
INSTALLMESSAGE_COMMONDATA = 0x0B000000,
INSTALLMESSAGE_INITIALIZE = 0x0C000000,
INSTALLMESSAGE_TERMINATE = 0x0D000000,
INSTALLMESSAGE_SHOWDIALOG = 0x0E000000,
INSTALLMESSAGE_PERFORMANCE = 0x0F000000,
INSTALLMESSAGE_RMFILESINUSE = 0x19000000,
INSTALLMESSAGE_INSTALLSTART = 0x1A000000,
INSTALLMESSAGE_INSTALLEND = 0x1B000000,
}}
64 changes: 64 additions & 0 deletions src/um/msiquery.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.
use ctypes::c_int;
use shared::minwindef::{BOOL, LPDWORD, UINT};
use um::msi::{INSTALLMESSAGE, MSIHANDLE};
use um::winnt::{LPCSTR, LPCWSTR, LPSTR, LPWSTR};
extern "system" {
pub fn MsiCreateRecord(cParams: UINT) -> MSIHANDLE;
pub fn MsiRecordIsNull(hRecord: MSIHANDLE, iField: UINT) -> BOOL;
pub fn MsiRecordDataSize(hRecord: MSIHANDLE, iField: UINT) -> UINT;
pub fn MsiRecordSetInteger(hRecord: MSIHANDLE, iField: UINT, iValue: c_int) -> UINT;
pub fn MsiRecordSetStringA(hRecord: MSIHANDLE, iField: UINT, szValue: LPCSTR) -> UINT;
pub fn MsiRecordSetStringW(hRecord: MSIHANDLE, iField: UINT, szValue: LPCWSTR) -> UINT;
pub fn MsiSetPropertyA(
hInstall: MSIHANDLE,
szName: LPCSTR,
szValue: LPCSTR
) -> UINT;
pub fn MsiSetPropertyW(
hInstall: MSIHANDLE,
szName: LPCWSTR,
szValue: LPCWSTR
) -> UINT;
pub fn MsiGetPropertyA(
hInstall: MSIHANDLE,
szName: LPCSTR,
szValueBuf: LPSTR,
pcchValueBuf: LPDWORD
) -> UINT;
pub fn MsiGetPropertyW(
hInstall: MSIHANDLE,
szName: LPCWSTR,
szValueBuf: LPWSTR,
pcchValueBuf: LPDWORD
) -> UINT;
pub fn MsiDoActionA(
hInstall: MSIHANDLE,
zzAction: LPCSTR
) -> UINT;
pub fn MsiDoActionW(
hInstall: MSIHANDLE,
zzAction: LPCWSTR
) -> UINT;
pub fn MsiProcessMessage(
hInstall: MSIHANDLE,
eMessageType: INSTALLMESSAGE,
hRecord: MSIHANDLE,
) -> c_int;
pub fn MsiGetTargetPathA(
hInstall: MSIHANDLE,
szFolder: LPCSTR,
szPathBuf: LPSTR,
pcchPathBuf: LPDWORD
) -> UINT;
pub fn MsiGetTargetPathW(
hInstall: MSIHANDLE,
szFolder: LPCWSTR,
szPathBuf: LPWSTR,
pcchPathBuf: LPDWORD
) -> UINT;
}