mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-15 15:16:37 +00:00
Fix windows.rs
Signed-off-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
This commit is contained in:
parent
51e475293e
commit
1add356939
1 changed files with 2 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
use std::mem;
|
||||
use std::{mem, ptr};
|
||||
use windows_sys::Win32::{
|
||||
Foundation::{FreeLibrary, HMODULE, S_OK},
|
||||
System::{
|
||||
|
@ -16,7 +16,7 @@ struct LibraryHandle(HMODULE);
|
|||
impl LibraryHandle {
|
||||
fn new(name: &[u8]) -> Option<Self> {
|
||||
let handle = unsafe { LoadLibraryA(name.as_ptr() as _) };
|
||||
(handle != 0).then(|| Self(handle))
|
||||
(handle != ptr::null_mut()).then(|| Self(handle))
|
||||
}
|
||||
|
||||
/// Get a function pointer to a function in the library.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue