Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit acab24b

Browse filesBrowse files
committed
windows-rs upgrade to 0.59
1 parent 465627f commit acab24b
Copy full SHA for acab24b

File tree

7 files changed

+148
-25
lines changed
Filter options

7 files changed

+148
-25
lines changed

‎Cargo.lock

Copy file name to clipboardExpand all lines: Cargo.lock
+129-12Lines changed: 129 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

Copy file name to clipboardExpand all lines: Cargo.toml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ thiserror = "1.0"
181181
thread_local = "1.1.4"
182182
unicode_names2 = "1.2.0"
183183
widestring = "1.1.0"
184-
windows-sys = "0.52.0"
184+
windows-sys = "0.59.0"
185185
wasm-bindgen = "0.2.92"
186186

187187
# Lints

‎common/src/fileutils.rs

Copy file name to clipboardExpand all lines: common/src/fileutils.rs
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub mod windows {
2525
use crate::suppress_iph;
2626
use crate::windows::ToWideString;
2727
use libc::{S_IFCHR, S_IFDIR, S_IFMT};
28-
use std::ffi::{CString, OsStr, OsString};
28+
use std::ffi::{c_int, c_void, CString, OsStr, OsString};
2929
use std::os::windows::ffi::OsStrExt;
3030
use std::sync::OnceLock;
3131
use windows_sys::core::PCWSTR;
@@ -113,10 +113,10 @@ pub mod windows {
113113
if h.is_err() {
114114
unsafe { SetLastError(ERROR_INVALID_HANDLE) };
115115
}
116-
let h = h?;
116+
let mut h = c_int::from(h? as i32);
117117
// reset stat?
118118

119-
let file_type = unsafe { GetFileType(h) };
119+
let file_type = unsafe { GetFileType(&mut h as *mut c_int as *mut c_void) };
120120
if file_type == FILE_TYPE_UNKNOWN {
121121
return Err(std::io::Error::last_os_error());
122122
}
@@ -138,10 +138,10 @@ pub mod windows {
138138
let mut basic_info: FILE_BASIC_INFO = unsafe { std::mem::zeroed() };
139139
let mut id_info: FILE_ID_INFO = unsafe { std::mem::zeroed() };
140140

141-
if unsafe { GetFileInformationByHandle(h, &mut info) } == 0
141+
if unsafe { GetFileInformationByHandle(&mut h as *mut c_int as *mut c_void, &mut info) } == 0
142142
|| unsafe {
143143
GetFileInformationByHandleEx(
144-
h,
144+
&mut h as *mut c_int as *mut c_void,
145145
FileBasicInfo,
146146
&mut basic_info as *mut _ as *mut _,
147147
std::mem::size_of_val(&basic_info) as u32,
@@ -153,7 +153,7 @@ pub mod windows {
153153

154154
let p_id_info = if unsafe {
155155
GetFileInformationByHandleEx(
156-
h,
156+
&mut h as *mut c_int as *mut c_void,
157157
FileIdInfo,
158158
&mut id_info as *mut _ as *mut _,
159159
std::mem::size_of_val(&id_info) as u32,
@@ -320,7 +320,7 @@ pub mod windows {
320320
.get_or_init(|| {
321321
let library_name = OsString::from("api-ms-win-core-file-l2-1-4").to_wide_with_nul();
322322
let module = unsafe { LoadLibraryW(library_name.as_ptr()) };
323-
if module == 0 {
323+
if module == c_int::from(0) as *mut c_int as *mut c_void {
324324
return None;
325325
}
326326
let name = CString::new("GetFileInformationByName").unwrap();

‎vm/Cargo.toml

Copy file name to clipboardExpand all lines: vm/Cargo.toml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ num_cpus = "1.13.1"
107107
junction = { workspace = true }
108108
schannel = { workspace = true }
109109
widestring = { workspace = true }
110-
winreg = "0.52"
110+
winreg = "0.55"
111111

112112
[target.'cfg(windows)'.dependencies.windows]
113-
version = "0.52.0"
113+
version = "0.59.0"
114114
features = [
115115
"Win32_Foundation",
116116
"Win32_System_LibraryLoader",

‎vm/src/stdlib/nt.rs

Copy file name to clipboardExpand all lines: vm/src/stdlib/nt.rs
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub(crate) mod module {
2525
mem::MaybeUninit,
2626
os::windows::ffi::{OsStrExt, OsStringExt},
2727
};
28+
use std::ffi::{c_int, c_void};
2829
use windows_sys::Win32::{
2930
Foundation::{self, INVALID_HANDLE_VALUE},
3031
Storage::FileSystem,
@@ -144,7 +145,7 @@ pub(crate) mod module {
144145
}
145146

146147
let h = unsafe { Threading::OpenProcess(Threading::PROCESS_ALL_ACCESS, 0, pid) };
147-
if h == 0 {
148+
if h == c_int::from(0) as *mut c_int as *mut c_void {
148149
return Err(errno_err(vm));
149150
}
150151
let ret = unsafe { Threading::TerminateProcess(h, sig) };
@@ -166,7 +167,7 @@ pub(crate) mod module {
166167
_ => return Err(vm.new_value_error("bad file descriptor".to_owned())),
167168
};
168169
let h = unsafe { Console::GetStdHandle(stdhandle) };
169-
if h == 0 {
170+
if h == c_int::from(0) as *mut c_int as *mut c_void {
170171
return Err(vm.new_os_error("handle cannot be retrieved".to_owned()));
171172
}
172173
if h == INVALID_HANDLE_VALUE {

‎vm/src/stdlib/winapi.rs

Copy file name to clipboardExpand all lines: vm/src/stdlib/winapi.rs
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pub(crate) use _winapi::make_module;
33

44
#[pymodule]
55
mod _winapi {
6+
use std::ffi::{c_int, c_void};
67
use crate::{
78
builtins::PyStrRef,
89
common::windows::ToWideString,
@@ -116,6 +117,8 @@ mod _winapi {
116117
.to_pyresult(vm)?;
117118
target.assume_init()
118119
};
120+
let target = c_int::from(target as i32);
121+
119122
Ok(HANDLE(target))
120123
}
121124

@@ -436,6 +439,7 @@ mod _winapi {
436439
#[pyfunction]
437440
fn GetModuleFileName(handle: isize, vm: &VirtualMachine) -> PyResult<String> {
438441
let mut path: Vec<u16> = vec![0; MAX_PATH as usize];
442+
let handle = c_int::from(handle as i32) as *mut c_int as *mut c_void;
439443
let handle = HINSTANCE(handle);
440444

441445
let length =

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.