Skip to content

Commit 5c5f66a

Browse files
committed
Use LoadLibraryA instead of LoadLibraryW
We're loading an ascii-only name anyway so no need to do utf-16 weirdness.
1 parent 5a0fc38 commit 5c5f66a

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

src/dbghelp.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,22 +106,9 @@ macro_rules! dbghelp {
106106
/// Panics if library is already loaded.
107107
fn open(&mut self) -> Result<(), ()> {
108108
assert!(self.dll.is_null());
109-
let lib = [
110-
'd' as u16,
111-
'b' as u16,
112-
'g' as u16,
113-
'h' as u16,
114-
'e' as u16,
115-
'l' as u16,
116-
'p' as u16,
117-
'.' as u16,
118-
'd' as u16,
119-
'l' as u16,
120-
'l' as u16,
121-
0,
122-
];
109+
let lib = b"dbghelp.dll\0";
123110
unsafe {
124-
self.dll = LoadLibraryW(lib.as_ptr());
111+
self.dll = LoadLibraryA(lib.as_ptr() as *const i8);
125112
if self.dll.is_null() {
126113
Err(())
127114
} else {

src/windows.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ ffi! {
339339
pub fn GetCurrentProcess() -> HANDLE;
340340
pub fn GetCurrentThread() -> HANDLE;
341341
pub fn RtlCaptureContext(ContextRecord: PCONTEXT) -> ();
342-
pub fn LoadLibraryW(a: *const u16) -> HMODULE;
342+
pub fn LoadLibraryA(a: *const i8) -> HMODULE;
343343
pub fn FreeLibrary(h: HMODULE) -> BOOL;
344344
pub fn GetProcAddress(h: HMODULE, name: *const i8) -> FARPROC;
345345
pub fn OpenProcess(
@@ -567,7 +567,7 @@ ffi! {
567567
// pub High: LONG64,
568568
// }
569569

570-
// pub type PNEON128 = *mut NEON128;
570+
// pub type PNEON128 = *mut NEON128;
571571

572572
#[repr(C)]
573573
pub struct CONTEXT_u {
@@ -578,7 +578,7 @@ ffi! {
578578

579579
pub const ARM_MAX_BREAKPOINTS: usize = 8;
580580
pub const ARM_MAX_WATCHPOINTS: usize = 1;
581-
581+
582582
#[repr(C)]
583583
pub struct CONTEXT {
584584
pub ContextFlags: DWORD,

0 commit comments

Comments
 (0)