Skip to content

Commit 2581015

Browse files
committed
Replace winapi with windows-sys
1 parent 6e28498 commit 2581015

File tree

3 files changed

+83
-81
lines changed

3 files changed

+83
-81
lines changed

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ keywords = ["dlopen", "load", "shared", "dylib"]
1414
categories = ["api-bindings"]
1515
rust-version = "1.40.0"
1616

17-
[target.'cfg(windows)'.dependencies.winapi]
18-
version = "0.3"
17+
[target.'cfg(windows)'.dependencies.windows-sys]
18+
version = "0.45"
1919
features = [
20-
"errhandlingapi",
21-
"libloaderapi",
20+
"Win32_Foundation",
21+
"Win32_System_Diagnostics_Debug",
22+
"Win32_System_LibraryLoader",
2223
]
2324

2425
[target.'cfg(unix)'.dependencies.cfg-if]

src/os/windows/mod.rs

Lines changed: 69 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,39 @@
22
// same rustdoc build visible.
33
#[cfg(all(libloading_docs, not(windows)))]
44
mod windows_imports {
5-
pub(super) enum WORD {}
6-
pub(super) struct DWORD;
7-
pub(super) enum HMODULE {}
5+
pub(super) enum HINSTANCE {}
86
pub(super) enum FARPROC {}
7+
pub(super) enum LOAD_LIBRARY_FLAGS {}
98

109
pub(super) mod consts {
11-
use super::DWORD;
12-
pub(crate) const LOAD_IGNORE_CODE_AUTHZ_LEVEL: DWORD = DWORD;
13-
pub(crate) const LOAD_LIBRARY_AS_DATAFILE: DWORD = DWORD;
14-
pub(crate) const LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE: DWORD = DWORD;
15-
pub(crate) const LOAD_LIBRARY_AS_IMAGE_RESOURCE: DWORD = DWORD;
16-
pub(crate) const LOAD_LIBRARY_SEARCH_APPLICATION_DIR: DWORD = DWORD;
17-
pub(crate) const LOAD_LIBRARY_SEARCH_DEFAULT_DIRS: DWORD = DWORD;
18-
pub(crate) const LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR: DWORD = DWORD;
19-
pub(crate) const LOAD_LIBRARY_SEARCH_SYSTEM32: DWORD = DWORD;
20-
pub(crate) const LOAD_LIBRARY_SEARCH_USER_DIRS: DWORD = DWORD;
21-
pub(crate) const LOAD_WITH_ALTERED_SEARCH_PATH: DWORD = DWORD;
22-
pub(crate) const LOAD_LIBRARY_REQUIRE_SIGNED_TARGET: DWORD = DWORD;
23-
pub(crate) const LOAD_LIBRARY_SAFE_CURRENT_DIRS: DWORD = DWORD;
10+
pub(crate) const LOAD_IGNORE_CODE_AUTHZ_LEVEL: u32 = 0;
11+
pub(crate) const LOAD_LIBRARY_AS_DATAFILE: u32 = 0;
12+
pub(crate) const LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE: u32 = 0;
13+
pub(crate) const LOAD_LIBRARY_AS_IMAGE_RESOURCE: u32 = 0;
14+
pub(crate) const LOAD_LIBRARY_SEARCH_APPLICATION_DIR: u32 = 0;
15+
pub(crate) const LOAD_LIBRARY_SEARCH_DEFAULT_DIRS: u32 = 0;
16+
pub(crate) const LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR: u32 = 0;
17+
pub(crate) const LOAD_LIBRARY_SEARCH_SYSTEM32: u32 = 0;
18+
pub(crate) const LOAD_LIBRARY_SEARCH_USER_DIRS: u32 = 0;
19+
pub(crate) const LOAD_WITH_ALTERED_SEARCH_PATH: u32 = 0;
20+
pub(crate) const LOAD_LIBRARY_REQUIRE_SIGNED_TARGET: u32 = 0;
21+
pub(crate) const LOAD_LIBRARY_SAFE_CURRENT_DIRS: u32 = 0;
2422
}
2523
}
2624
#[cfg(any(not(libloading_docs), windows))]
2725
mod windows_imports {
28-
extern crate winapi;
29-
pub(super) use self::winapi::shared::minwindef::{WORD, DWORD, HMODULE, FARPROC};
30-
pub(super) use self::winapi::shared::ntdef::WCHAR;
31-
pub(super) use self::winapi::um::{errhandlingapi, libloaderapi};
26+
extern crate windows_sys;
27+
pub(super) use self::windows_sys::Win32::Foundation::{GetLastError, FARPROC, HINSTANCE};
28+
pub(super) use self::windows_sys::Win32::System::Diagnostics::Debug as debug_api;
29+
pub(super) use self::windows_sys::Win32::System::Diagnostics::Debug::SEM_FAILCRITICALERRORS;
30+
31+
pub(super) use self::windows_sys::Win32::System::LibraryLoader as library_loader;
32+
pub(super) use self::windows_sys::Win32::System::LibraryLoader::LOAD_LIBRARY_FLAGS;
33+
3234
pub(super) use std::os::windows::ffi::{OsStrExt, OsStringExt};
33-
pub(super) const SEM_FAILCE: DWORD = 1;
3435

3536
pub(super) mod consts {
36-
pub(crate) use super::winapi::um::libloaderapi::{
37+
pub(crate) use super::windows_sys::Win32::System::LibraryLoader::{
3738
LOAD_IGNORE_CODE_AUTHZ_LEVEL,
3839
LOAD_LIBRARY_AS_DATAFILE,
3940
LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE,
@@ -56,7 +57,7 @@ use std::ffi::{OsStr, OsString};
5657
use std::{fmt, io, marker, mem, ptr};
5758

5859
/// The platform-specific counterpart of the cross-platform [`Library`](crate::Library).
59-
pub struct Library(HMODULE);
60+
pub struct Library(HINSTANCE);
6061

6162
unsafe impl Send for Library {}
6263
// Now, this is sort-of-tricky. MSDN documentation does not really make any claims as to safety of
@@ -116,9 +117,9 @@ impl Library {
116117
/// [MSDN]: https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulehandleexw
117118
pub fn this() -> Result<Library, crate::Error> {
118119
unsafe {
119-
let mut handle: HMODULE = std::ptr::null_mut();
120+
let mut handle: HINSTANCE = 0;
120121
with_get_last_error(|source| crate::Error::GetModuleHandleExW { source }, || {
121-
let result = libloaderapi::GetModuleHandleExW(0, std::ptr::null_mut(), &mut handle);
122+
let result = library_loader::GetModuleHandleExW(0, std::ptr::null_mut(), &mut handle);
122123
if result == 0 {
123124
None
124125
} else {
@@ -149,11 +150,11 @@ impl Library {
149150
let wide_filename: Vec<u16> = filename.as_ref().encode_wide().chain(Some(0)).collect();
150151

151152
let ret = unsafe {
152-
let mut handle: HMODULE = std::ptr::null_mut();
153+
let mut handle: HINSTANCE = 0;
153154
with_get_last_error(|source| crate::Error::GetModuleHandleExW { source }, || {
154155
// Make sure no winapi calls as a result of drop happen inside this closure, because
155156
// otherwise that might change the return value of the GetLastError.
156-
let result = libloaderapi::GetModuleHandleExW(0, wide_filename.as_ptr(), &mut handle);
157+
let result = library_loader::GetModuleHandleExW(0, wide_filename.as_ptr(), &mut handle);
157158
if result == 0 {
158159
None
159160
} else {
@@ -186,16 +187,15 @@ impl Library {
186187
/// Additionally, the callers of this function must also ensure that execution of the
187188
/// termination routines contained within the library is safe as well. These routines may be
188189
/// executed when the library is unloaded.
189-
pub unsafe fn load_with_flags<P: AsRef<OsStr>>(filename: P, flags: DWORD) -> Result<Library, crate::Error> {
190+
pub unsafe fn load_with_flags<P: AsRef<OsStr>>(filename: P, flags: LOAD_LIBRARY_FLAGS) -> Result<Library, crate::Error> {
190191
let wide_filename: Vec<u16> = filename.as_ref().encode_wide().chain(Some(0)).collect();
191192
let _guard = ErrorModeGuard::new();
192193

193194
let ret = with_get_last_error(|source| crate::Error::LoadLibraryExW { source }, || {
194195
// Make sure no winapi calls as a result of drop happen inside this closure, because
195196
// otherwise that might change the return value of the GetLastError.
196-
let handle =
197-
libloaderapi::LoadLibraryExW(wide_filename.as_ptr(), std::ptr::null_mut(), flags);
198-
if handle.is_null() {
197+
let handle = library_loader::LoadLibraryExW(wide_filename.as_ptr(), 0, flags);
198+
if handle == 0 {
199199
None
200200
} else {
201201
Some(Library(handle))
@@ -221,8 +221,8 @@ impl Library {
221221
ensure_compatible_types::<T, FARPROC>()?;
222222
let symbol = cstr_cow_from_bytes(symbol)?;
223223
with_get_last_error(|source| crate::Error::GetProcAddress { source }, || {
224-
let symbol = libloaderapi::GetProcAddress(self.0, symbol.as_ptr());
225-
if symbol.is_null() {
224+
let symbol = library_loader::GetProcAddress(self.0, symbol.as_ptr().cast());
225+
if symbol.is_none() {
226226
None
227227
} else {
228228
Some(Symbol {
@@ -238,12 +238,12 @@ impl Library {
238238
/// # Safety
239239
///
240240
/// Users of this API must specify the correct type of the function or variable loaded.
241-
pub unsafe fn get_ordinal<T>(&self, ordinal: WORD) -> Result<Symbol<T>, crate::Error> {
241+
pub unsafe fn get_ordinal<T>(&self, ordinal: u16) -> Result<Symbol<T>, crate::Error> {
242242
ensure_compatible_types::<T, FARPROC>()?;
243243
with_get_last_error(|source| crate::Error::GetProcAddress { source }, || {
244-
let ordinal = ordinal as usize as *mut _;
245-
let symbol = libloaderapi::GetProcAddress(self.0, ordinal);
246-
if symbol.is_null() {
244+
let ordinal = ordinal as usize as *const _;
245+
let symbol = library_loader::GetProcAddress(self.0, ordinal);
246+
if symbol.is_none() {
247247
None
248248
} else {
249249
Some(Symbol {
@@ -255,7 +255,7 @@ impl Library {
255255
}
256256

257257
/// Convert the `Library` to a raw handle.
258-
pub fn into_raw(self) -> HMODULE {
258+
pub fn into_raw(self) -> HINSTANCE {
259259
let handle = self.0;
260260
mem::forget(self);
261261
handle
@@ -268,7 +268,7 @@ impl Library {
268268
/// The handle must be the result of a successful call of `LoadLibraryA`, `LoadLibraryW`,
269269
/// `LoadLibraryExW`, or `LoadLibraryExA`, or a handle previously returned by the
270270
/// `Library::into_raw` call.
271-
pub unsafe fn from_raw(handle: HMODULE) -> Library {
271+
pub unsafe fn from_raw(handle: HINSTANCE) -> Library {
272272
Library(handle)
273273
}
274274

@@ -280,7 +280,7 @@ impl Library {
280280
/// The underlying data structures may still get leaked if an error does occur.
281281
pub fn close(self) -> Result<(), crate::Error> {
282282
let result = with_get_last_error(|source| crate::Error::FreeLibrary { source }, || {
283-
if unsafe { libloaderapi::FreeLibrary(self.0) == 0 } {
283+
if unsafe { library_loader::FreeLibrary(self.0) == 0 } {
284284
None
285285
} else {
286286
Some(())
@@ -296,7 +296,7 @@ impl Library {
296296

297297
impl Drop for Library {
298298
fn drop(&mut self) {
299-
unsafe { libloaderapi::FreeLibrary(self.0); }
299+
unsafe { library_loader::FreeLibrary(self.0); }
300300
}
301301
}
302302

@@ -305,17 +305,17 @@ impl fmt::Debug for Library {
305305
unsafe {
306306
// FIXME: use Maybeuninit::uninit_array when stable
307307
let mut buf =
308-
mem::MaybeUninit::<[mem::MaybeUninit::<WCHAR>; 1024]>::uninit().assume_init();
309-
let len = libloaderapi::GetModuleFileNameW(self.0,
308+
mem::MaybeUninit::<[mem::MaybeUninit<u16>; 1024]>::uninit().assume_init();
309+
let len = library_loader::GetModuleFileNameW(self.0,
310310
buf[..].as_mut_ptr().cast(), 1024) as usize;
311311
if len == 0 {
312-
f.write_str(&format!("Library@{:p}", self.0))
312+
f.write_str(&format!("Library@{:#x}", self.0))
313313
} else {
314314
let string: OsString = OsString::from_wide(
315315
// FIXME: use Maybeuninit::slice_get_ref when stable
316-
&*(&buf[..len] as *const [_] as *const [WCHAR])
316+
&*(&buf[..len] as *const [_] as *const [u16]),
317317
);
318-
f.write_str(&format!("Library@{:p} from {:?}", self.0, string))
318+
f.write_str(&format!("Library@{:#x} from {:?}", self.0, string))
319319
}
320320
}
321321
}
@@ -340,7 +340,7 @@ impl<T> Symbol<T> {
340340
impl<T> Symbol<Option<T>> {
341341
/// Lift Option out of the symbol.
342342
pub fn lift_option(self) -> Option<Symbol<T>> {
343-
if self.pointer.is_null() {
343+
if self.pointer.is_none() {
344344
None
345345
} else {
346346
Some(Symbol {
@@ -365,31 +365,34 @@ impl<T> ::std::ops::Deref for Symbol<T> {
365365
fn deref(&self) -> &T {
366366
unsafe {
367367
// Additional reference level for a dereference on `deref` return value.
368-
&*(&self.pointer as *const *mut _ as *const T)
368+
&*(&self.pointer.unwrap() as *const _ as *const T)
369369
}
370370
}
371371
}
372372

373373
impl<T> fmt::Debug for Symbol<T> {
374374
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
375-
f.write_str(&format!("Symbol@{:p}", self.pointer))
375+
match self.pointer {
376+
None => f.write_str("Symbol@0x0"),
377+
Some(ptr) => f.write_str(&format!("Symbol@{:p}", ptr as *const ())),
378+
}
376379
}
377380
}
378381

379-
struct ErrorModeGuard(DWORD);
382+
struct ErrorModeGuard(debug_api::THREAD_ERROR_MODE);
380383

381384
impl ErrorModeGuard {
382385
#[allow(clippy::if_same_then_else)]
383386
fn new() -> Option<ErrorModeGuard> {
384387
unsafe {
385388
let mut previous_mode = 0;
386-
if errhandlingapi::SetThreadErrorMode(SEM_FAILCE, &mut previous_mode) == 0 {
389+
if debug_api::SetThreadErrorMode(SEM_FAILCRITICALERRORS, &mut previous_mode) == 0 {
387390
// How in the world is it possible for what is essentially a simple variable swap
388391
// to fail? For now we just ignore the error -- the worst that can happen here is
389392
// the previous mode staying on and user seeing a dialog error on older Windows
390393
// machines.
391394
None
392-
} else if previous_mode == SEM_FAILCE {
395+
} else if previous_mode == SEM_FAILCRITICALERRORS {
393396
None
394397
} else {
395398
Some(ErrorModeGuard(previous_mode))
@@ -401,7 +404,7 @@ impl ErrorModeGuard {
401404
impl Drop for ErrorModeGuard {
402405
fn drop(&mut self) {
403406
unsafe {
404-
errhandlingapi::SetThreadErrorMode(self.0, ptr::null_mut());
407+
debug_api::SetThreadErrorMode(self.0, ptr::null_mut());
405408
}
406409
}
407410
}
@@ -410,7 +413,7 @@ fn with_get_last_error<T, F>(wrap: fn(crate::error::WindowsError) -> crate::Erro
410413
-> Result<T, Option<crate::Error>>
411414
where F: FnOnce() -> Option<T> {
412415
closure().ok_or_else(|| {
413-
let error = unsafe { errhandlingapi::GetLastError() };
416+
let error = unsafe { GetLastError() };
414417
if error == 0 {
415418
None
416419
} else {
@@ -425,7 +428,7 @@ where F: FnOnce() -> Option<T> {
425428
/// recommended for use in setup programs that must run extracted DLLs during installation.
426429
///
427430
/// See [flag documentation on MSDN](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters).
428-
pub const LOAD_IGNORE_CODE_AUTHZ_LEVEL: DWORD = consts::LOAD_IGNORE_CODE_AUTHZ_LEVEL;
431+
pub const LOAD_IGNORE_CODE_AUTHZ_LEVEL: u32 = consts::LOAD_IGNORE_CODE_AUTHZ_LEVEL;
429432

430433
/// Map the file into the calling process’ virtual address space as if it were a data file.
431434
///
@@ -435,7 +438,7 @@ pub const LOAD_IGNORE_CODE_AUTHZ_LEVEL: DWORD = consts::LOAD_IGNORE_CODE_AUTHZ_L
435438
/// messages or resources from it.
436439
///
437440
/// See [flag documentation on MSDN](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters).
438-
pub const LOAD_LIBRARY_AS_DATAFILE: DWORD = consts::LOAD_LIBRARY_AS_DATAFILE;
441+
pub const LOAD_LIBRARY_AS_DATAFILE: u32 = consts::LOAD_LIBRARY_AS_DATAFILE;
439442

440443
/// Map the file into the calling process’ virtual address space as if it were a data file.
441444
///
@@ -444,7 +447,7 @@ pub const LOAD_LIBRARY_AS_DATAFILE: DWORD = consts::LOAD_LIBRARY_AS_DATAFILE;
444447
/// while it is in use. However, the DLL can still be opened by other processes.
445448
///
446449
/// See [flag documentation on MSDN](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters).
447-
pub const LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE: DWORD = consts::LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE;
450+
pub const LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE: u32 = consts::LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE;
448451

449452
/// Map the file into the process’ virtual address space as an image file.
450453
///
@@ -456,15 +459,15 @@ pub const LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE: DWORD = consts::LOAD_LIBRARY_AS_DA
456459
/// [`LOAD_LIBRARY_AS_DATAFILE`].
457460
///
458461
/// See [flag documentation on MSDN](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters).
459-
pub const LOAD_LIBRARY_AS_IMAGE_RESOURCE: DWORD = consts::LOAD_LIBRARY_AS_IMAGE_RESOURCE;
462+
pub const LOAD_LIBRARY_AS_IMAGE_RESOURCE: u32 = consts::LOAD_LIBRARY_AS_IMAGE_RESOURCE;
460463

461464
/// Search the application's installation directory for the DLL and its dependencies.
462465
///
463466
/// Directories in the standard search path are not searched. This value cannot be combined with
464467
/// [`LOAD_WITH_ALTERED_SEARCH_PATH`].
465468
///
466469
/// See [flag documentation on MSDN](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters).
467-
pub const LOAD_LIBRARY_SEARCH_APPLICATION_DIR: DWORD = consts::LOAD_LIBRARY_SEARCH_APPLICATION_DIR;
470+
pub const LOAD_LIBRARY_SEARCH_APPLICATION_DIR: u32 = consts::LOAD_LIBRARY_SEARCH_APPLICATION_DIR;
468471

469472
/// Search default directories when looking for the DLL and its dependencies.
470473
///
@@ -474,7 +477,7 @@ pub const LOAD_LIBRARY_SEARCH_APPLICATION_DIR: DWORD = consts::LOAD_LIBRARY_SEAR
474477
/// [`LOAD_WITH_ALTERED_SEARCH_PATH`].
475478
///
476479
/// See [flag documentation on MSDN](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters).
477-
pub const LOAD_LIBRARY_SEARCH_DEFAULT_DIRS: DWORD = consts::LOAD_LIBRARY_SEARCH_DEFAULT_DIRS;
480+
pub const LOAD_LIBRARY_SEARCH_DEFAULT_DIRS: u32 = consts::LOAD_LIBRARY_SEARCH_DEFAULT_DIRS;
478481

479482
/// Directory that contains the DLL is temporarily added to the beginning of the list of
480483
/// directories that are searched for the DLL’s dependencies.
@@ -485,15 +488,15 @@ pub const LOAD_LIBRARY_SEARCH_DEFAULT_DIRS: DWORD = consts::LOAD_LIBRARY_SEARCH_
485488
/// with [`LOAD_WITH_ALTERED_SEARCH_PATH`].
486489
///
487490
/// See [flag documentation on MSDN](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters).
488-
pub const LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR: DWORD = consts::LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR;
491+
pub const LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR: u32 = consts::LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR;
489492

490493
/// Search `%windows%\system32` for the DLL and its dependencies.
491494
///
492495
/// Directories in the standard search path are not searched. This value cannot be combined with
493496
/// [`LOAD_WITH_ALTERED_SEARCH_PATH`].
494497
///
495498
/// See [flag documentation on MSDN](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters).
496-
pub const LOAD_LIBRARY_SEARCH_SYSTEM32: DWORD = consts::LOAD_LIBRARY_SEARCH_SYSTEM32;
499+
pub const LOAD_LIBRARY_SEARCH_SYSTEM32: u32 = consts::LOAD_LIBRARY_SEARCH_SYSTEM32;
497500

498501
/// Directories added using the `AddDllDirectory` or the `SetDllDirectory` function are searched
499502
/// for the DLL and its dependencies.
@@ -503,7 +506,7 @@ pub const LOAD_LIBRARY_SEARCH_SYSTEM32: DWORD = consts::LOAD_LIBRARY_SEARCH_SYST
503506
/// combined with [`LOAD_WITH_ALTERED_SEARCH_PATH`].
504507
///
505508
/// See [flag documentation on MSDN](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters).
506-
pub const LOAD_LIBRARY_SEARCH_USER_DIRS: DWORD = consts::LOAD_LIBRARY_SEARCH_USER_DIRS;
509+
pub const LOAD_LIBRARY_SEARCH_USER_DIRS: u32 = consts::LOAD_LIBRARY_SEARCH_USER_DIRS;
507510

508511
/// If `filename` specifies an absolute path, the system uses the alternate file search strategy
509512
/// discussed in the [Remarks section] to find associated executable modules that the specified
@@ -518,15 +521,15 @@ pub const LOAD_LIBRARY_SEARCH_USER_DIRS: DWORD = consts::LOAD_LIBRARY_SEARCH_USE
518521
/// See [flag documentation on MSDN](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters).
519522
///
520523
/// [Remarks]: https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#remarks
521-
pub const LOAD_WITH_ALTERED_SEARCH_PATH: DWORD = consts::LOAD_WITH_ALTERED_SEARCH_PATH;
524+
pub const LOAD_WITH_ALTERED_SEARCH_PATH: u32 = consts::LOAD_WITH_ALTERED_SEARCH_PATH;
522525

523526
/// Specifies that the digital signature of the binary image must be checked at load time.
524527
///
525528
/// See [flag documentation on MSDN](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters).
526-
pub const LOAD_LIBRARY_REQUIRE_SIGNED_TARGET: DWORD = consts::LOAD_LIBRARY_REQUIRE_SIGNED_TARGET;
529+
pub const LOAD_LIBRARY_REQUIRE_SIGNED_TARGET: u32 = consts::LOAD_LIBRARY_REQUIRE_SIGNED_TARGET;
527530

528531
/// Allow loading a DLL for execution from the current directory only if it is under a directory in
529532
/// the Safe load list.
530533
///
531534
/// See [flag documentation on MSDN](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters).
532-
pub const LOAD_LIBRARY_SAFE_CURRENT_DIRS: DWORD = consts::LOAD_LIBRARY_SAFE_CURRENT_DIRS;
535+
pub const LOAD_LIBRARY_SAFE_CURRENT_DIRS: u32 = consts::LOAD_LIBRARY_SAFE_CURRENT_DIRS;

0 commit comments

Comments
 (0)