Skip to content

Commit 2eca161

Browse files
committed
Remove dependency on GetModuleHandleW and CreateEventW
Just use the `A` variants instead (already imported anyways)
1 parent f81e905 commit 2eca161

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

library/std/src/sys/windows/handle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl Handle {
2323
pub fn new_event(manual: bool, init: bool) -> io::Result<Handle> {
2424
unsafe {
2525
let event =
26-
c::CreateEventW(ptr::null_mut(), manual as c::BOOL, init as c::BOOL, ptr::null());
26+
c::CreateEventA(ptr::null_mut(), manual as c::BOOL, init as c::BOOL, ptr::null());
2727
if event.is_null() {
2828
Err(io::Error::last_os_error())
2929
} else {

library/std/src/sys/windows/os.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ pub fn error_string(mut errnum: i32) -> String {
3636
// `[MS-ERREF]`: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a
3737
if (errnum & c::FACILITY_NT_BIT as i32) != 0 {
3838
// format according to https://support.microsoft.com/en-us/help/259693
39-
const NTDLL_DLL: &[u16] = &[
40-
'N' as _, 'T' as _, 'D' as _, 'L' as _, 'L' as _, '.' as _, 'D' as _, 'L' as _,
41-
'L' as _, 0,
42-
];
43-
module = c::GetModuleHandleW(NTDLL_DLL.as_ptr());
39+
module = c::GetModuleHandleA(c"NTDLL.DLL".as_ptr().cast());
4440

4541
if !module.is_null() {
4642
errnum ^= c::FACILITY_NT_BIT as i32;

0 commit comments

Comments
 (0)