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 newdev bindings #952

Open
wants to merge 2 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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ namedpipeapi = []
namespaceapi = []
nb30 = []
ncrypt = []
newdev = []
ntlsa = []
ntsecapi = []
oaidl = []
Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ const DATA: &'static [(&'static str, &'static [&'static str], &'static [&'static
("namespaceapi", &["minwinbase", "minwindef", "ntdef", "winnt"], &["kernel32"]),
("nb30", &["minwindef", "winnt"], &["netapi32"]),
("ncrypt", &["basetsd", "bcrypt", "minwindef", "winnt"], &["ncrypt"]),
("newdev", &["minwindef", "ntdef", "setupapi", "windef"], &["newdev"]),
("ntlsa", &["basetsd", "guiddef", "lsalookup", "minwindef", "ntdef", "ntsecapi", "subauth", "winnt"], &["advapi32"]),
("ntsecapi", &["basetsd", "guiddef", "lsalookup", "minwindef", "ntdef", "sspi", "subauth", "winnt"], &["advapi32"]),
("oaidl", &["basetsd", "guiddef", "minwindef", "rpcndr", "unknwnbase", "winnt", "wtypes", "wtypesbase"], &[]),
Expand Down
1 change: 1 addition & 0 deletions src/um/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ pub mod gl;
#[cfg(feature = "namespaceapi")] pub mod namespaceapi;
#[cfg(feature = "nb30")] pub mod nb30;
#[cfg(feature = "ncrypt")] pub mod ncrypt;
#[cfg(feature = "newdev")] pub mod newdev;
#[cfg(feature = "ntlsa")] pub mod ntlsa;
#[cfg(feature = "ntsecapi")] pub mod ntsecapi;
#[cfg(feature = "oaidl")] pub mod oaidl;
Expand Down
73 changes: 73 additions & 0 deletions src/um/newdev.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// 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 shared::minwindef::{BOOL, DWORD, PBOOL};
use shared::ntdef::{LPCSTR, LPCWSTR};
use shared::windef::HWND;
use um::setupapi::{HDEVINFO, PSP_DEVINFO_DATA};
pub const INSTALLFLAG_FORCE: DWORD = 0x00000001;
pub const INSTALLFLAG_READONLY: DWORD = 0x00000002;
pub const INSTALLFLAG_NONINTERACTIVE: DWORD = 0x00000004;
extern "system" {
pub fn UpdateDriverForPlugAndPlayDevicesA(
hwndParent: HWND,
HardwareId: LPCSTR,
FullInfPath: LPCSTR,
InstallFlags: DWORD,
pRebootRequired: PBOOL,
) -> BOOL;
pub fn UpdateDriverForPlugAndPlayDevicesW(
hwndParent: HWND,
HardwareId: LPCWSTR,
FullInfPath: LPCWSTR,
InstallFlags: DWORD,
pRebootRequired: PBOOL,
) -> BOOL;
}
pub const DIIRFLAG_INF_ALREADY_COPIED: DWORD = 0x00000001;
pub const DIIRFLAG_FORCE_INF: DWORD = 0x00000002;
pub const DIIRFLAG_HW_USING_THE_INF: DWORD = 0x00000004;
pub const DIIRFLAG_HOTPATCH: DWORD = 0x00000008;
pub const DIIRFLAG_NOBACKUP: DWORD = 0x00000010;
pub const DIIRFLAG_PRE_CONFIGURE_INF: DWORD = 0x00000020;
pub const DIIRFLAG_INSTALL_AS_SET: DWORD = 0x00000040;
extern "system" {
pub fn DiInstallDriverW(
hwndParent: HWND,
InfPath: LPCWSTR,
Flags: DWORD,
NeedReboot: PBOOL,
) -> BOOL;
pub fn DiInstallDriverA(
hwndParent: HWND,
InfPath: LPCSTR,
Flags: DWORD,
NeedReboot: PBOOL,
) -> BOOL;
pub fn DiUninstallDevice(
hwndParent: HWND,
DeviceInfoSet: HDEVINFO,
DeviceInfoData: PSP_DEVINFO_DATA,
Flags: DWORD,
NeedReboot: PBOOL,
) -> BOOL;
pub fn DiShowUpdateDevice(
hwndParent: HWND,
DeviceInfoSet: HDEVINFO,
DeviceInfoData: PSP_DEVINFO_DATA,
Flags: DWORD,
NeedReboot: PBOOL,
) -> BOOL;
}
pub const ROLLBACK_FLAG_NO_UI: DWORD = 0x00000001;
extern "system" {
pub fn DiRollbackDriver(
DeviceInfoSet: HDEVINFO,
DeviceInfoData: PSP_DEVINFO_DATA,
hwndParent: HWND,
Flags: DWORD,
NeedReboot: PBOOL,
) -> BOOL;
}