fix win32 build.rs
This commit is contained in:
parent
b769ae433b
commit
c447db6db6
@ -500,7 +500,7 @@ pub mod shmem {
|
|||||||
impl Drop for Win32ShMem {
|
impl Drop for Win32ShMem {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
UnmapViewOfFile(self.map);
|
UnmapViewOfFile(self.map as *const c_void);
|
||||||
CloseHandle(self.handle);
|
CloseHandle(self.handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -509,14 +509,14 @@ pub mod shmem {
|
|||||||
impl Win32ShMem {
|
impl Win32ShMem {
|
||||||
pub fn from_str(map_str_bytes: &[u8; 20], map_size: usize) -> Result<Self, Error> {
|
pub fn from_str(map_str_bytes: &[u8; 20], map_size: usize) -> Result<Self, Error> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let handle = OpenFileMappingA(FILE_MAP_ALL_ACCESS, false, map_str_bytes);
|
let handle = OpenFileMappingA(FILE_MAP_ALL_ACCESS, false, map_str_bytes as *const u8);
|
||||||
if handle == ptr::null() {
|
if handle == HANDLE(0) {
|
||||||
return Err(Error::Unknown(format!(
|
return Err(Error::Unknown(format!(
|
||||||
"Cannot open shared memory {}",
|
"Cannot open shared memory {}",
|
||||||
String::from_utf8_lossy(map_str_bytes)
|
String::from_utf8_lossy(map_str_bytes)
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
let map = MapViewOfFile(handle.clone(), FILE_MAP_ALL_ACCESS, 0, 0, map_size as u32)
|
let map = MapViewOfFile(handle.clone(), FILE_MAP_ALL_ACCESS, 0, 0, map_size)
|
||||||
as *mut u8;
|
as *mut u8;
|
||||||
if map == ptr::null_mut() {
|
if map == ptr::null_mut() {
|
||||||
return Err(Error::Unknown(format!(
|
return Err(Error::Unknown(format!(
|
||||||
@ -527,9 +527,9 @@ pub mod shmem {
|
|||||||
}
|
}
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
shm_str: map_str_bytes.clone(),
|
shm_str: map_str_bytes.clone(),
|
||||||
handle,
|
handle: handle,
|
||||||
map,
|
map; map,
|
||||||
map_size,
|
map_size: map_size,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,16 +543,16 @@ pub mod shmem {
|
|||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
PAGE_READWRITE,
|
PAGE_READWRITE,
|
||||||
0,
|
0,
|
||||||
map_size,
|
map_size as u32,
|
||||||
map_str_bytes,
|
map_str_bytes as *const u8,
|
||||||
);
|
);
|
||||||
if handle == ptr::null() {
|
if handle == HANDLE(0) {
|
||||||
return Err(Error::Unknown(format!(
|
return Err(Error::Unknown(format!(
|
||||||
"Cannot create shared memory {}",
|
"Cannot create shared memory {}",
|
||||||
String::from_utf8_lossy(map_str_bytes)
|
String::from_utf8_lossy(map_str_bytes)
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
let map = MapViewOfFile(handle.clone(), FILE_MAP_ALL_ACCESS, 0, 0, map_size as u32)
|
let map = MapViewOfFile(handle.clone(), FILE_MAP_ALL_ACCESS, 0, 0, map_size)
|
||||||
as *mut u8;
|
as *mut u8;
|
||||||
if map == ptr::null_mut() {
|
if map == ptr::null_mut() {
|
||||||
return Err(Error::Unknown(format!(
|
return Err(Error::Unknown(format!(
|
||||||
@ -563,9 +563,9 @@ pub mod shmem {
|
|||||||
}
|
}
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
shm_str: map_str_bytes[0..20].clone(),
|
shm_str: map_str_bytes[0..20].clone(),
|
||||||
handle,
|
handle: handle,
|
||||||
map,
|
map: map,
|
||||||
map_size,
|
map_size: map_size,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user