This commit is contained in:
Kenny Kerr 2022-02-03 14:03:33 -08:00
parent a75875b0bf
commit 385cf26f45
3 changed files with 8 additions and 8 deletions

View File

@ -23,7 +23,7 @@ libc = "0.2.95"
redox_syscall = "0.2.8"
[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.29", features = [
windows-sys = { version = "0.32", features = [
"Win32_Foundation",
"Win32_System_LibraryLoader",
"Win32_System_SystemServices",

View File

@ -56,17 +56,17 @@ impl KeyedEvent {
#[allow(non_snake_case)]
pub fn create() -> Option<KeyedEvent> {
unsafe {
let ntdll = GetModuleHandleA(b"ntdll.dll\0".as_ptr() as *mut u8);
let ntdll = GetModuleHandleA(b"ntdll.dll\0".as_ptr());
if ntdll == 0 {
return None;
}
let NtCreateKeyedEvent =
GetProcAddress(ntdll, b"NtCreateKeyedEvent\0".as_ptr() as *mut u8)?;
GetProcAddress(ntdll, b"NtCreateKeyedEvent\0".as_ptr())?;
let NtReleaseKeyedEvent =
GetProcAddress(ntdll, b"NtReleaseKeyedEvent\0".as_ptr() as *mut u8)?;
GetProcAddress(ntdll, b"NtReleaseKeyedEvent\0".as_ptr())?;
let NtWaitForKeyedEvent =
GetProcAddress(ntdll, b"NtWaitForKeyedEvent\0".as_ptr() as *mut u8)?;
GetProcAddress(ntdll, b"NtWaitForKeyedEvent\0".as_ptr())?;
let NtCreateKeyedEvent: extern "system" fn(
KeyedEventHandle: *mut HANDLE,

View File

@ -36,14 +36,14 @@ impl WaitAddress {
// MSDN claims that that WaitOnAddress and WakeByAddressSingle are
// located in kernel32.dll, but they are lying...
let synch_dll =
GetModuleHandleA(b"api-ms-win-core-synch-l1-2-0.dll\0".as_ptr() as *mut u8);
GetModuleHandleA(b"api-ms-win-core-synch-l1-2-0.dll\0".as_ptr());
if synch_dll == 0 {
return None;
}
let WaitOnAddress = GetProcAddress(synch_dll, b"WaitOnAddress\0".as_ptr() as *mut u8)?;
let WaitOnAddress = GetProcAddress(synch_dll, b"WaitOnAddress\0".as_ptr())?;
let WakeByAddressSingle =
GetProcAddress(synch_dll, b"WakeByAddressSingle\0".as_ptr() as *mut u8)?;
GetProcAddress(synch_dll, b"WakeByAddressSingle\0".as_ptr())?;
Some(WaitAddress {
WaitOnAddress: mem::transmute(WaitOnAddress),