formatting

This commit is contained in:
Ashwin Naren
2025-03-05 11:07:20 -08:00
committed by Noa
parent ddf2e591c6
commit b4929d258d
4 changed files with 18 additions and 17 deletions

View File

@@ -153,7 +153,7 @@ pub mod windows {
let p_id_info = if unsafe {
GetFileInformationByHandleEx(
h as _,
h as _,
FileIdInfo,
&mut id_info as *mut _ as *mut _,
std::mem::size_of_val(&id_info) as u32,

View File

@@ -303,7 +303,12 @@ mod _overlapped {
vm: &VirtualMachine,
) -> PyResult<isize> {
let r = unsafe {
windows_sys::Win32::System::IO::CreateIoCompletionPort(handle as _, port as _, key, concurrency) as isize
windows_sys::Win32::System::IO::CreateIoCompletionPort(
handle as _,
port as _,
key,
concurrency,
) as isize
};
if r as usize == 0 {
return Err(errno_err(vm));

View File

@@ -36,7 +36,9 @@ mod _socket {
#[cfg(windows)]
mod c {
pub use windows_sys::Win32::NetworkManagement::IpHelper::{if_indextoname, if_nametoindex};
pub use windows_sys::Win32::Networking::WinSock::{INADDR_ANY, INADDR_LOOPBACK, INADDR_BROADCAST, INADDR_NONE};
pub use windows_sys::Win32::Networking::WinSock::{
INADDR_ANY, INADDR_BROADCAST, INADDR_LOOPBACK, INADDR_NONE,
};
pub use windows_sys::Win32::Networking::WinSock::{
AF_APPLETALK, AF_DECnet, AF_IPX, AF_LINK, AI_ADDRCONFIG, AI_ALL, AI_CANONNAME,
@@ -1757,12 +1759,7 @@ mod _socket {
.map(|s| s.to_cstring(vm))
.transpose()?;
let cstr_proto = cstr_opt_as_ptr(&cstr_proto);
let serv = unsafe {
c::getservbyname(
cstr_name.as_ptr() as _,
cstr_proto as _,
)
};
let serv = unsafe { c::getservbyname(cstr_name.as_ptr() as _, cstr_proto as _) };
if serv.is_null() {
return Err(vm.new_os_error("service/proto not found".to_owned()));
}

View File

@@ -275,18 +275,14 @@ mod _winapi {
Ok((
HANDLE(procinfo.hProcess as _),
HANDLE(procinfo.hThread as _),
HANDLE(procinfo.hThread as _),
procinfo.dwProcessId,
procinfo.dwThreadId,
))
}
#[pyfunction]
fn OpenProcess(
desired_access: u32,
inherit_handle: bool,
process_id: u32,
) -> isize {
fn OpenProcess(desired_access: u32, inherit_handle: bool, process_id: u32) -> isize {
unsafe {
windows_sys::Win32::System::Threading::OpenProcess(
desired_access,
@@ -438,7 +434,8 @@ mod _winapi {
#[pyfunction]
fn WaitForSingleObject(h: HANDLE, ms: u32, vm: &VirtualMachine) -> PyResult<u32> {
let ret = unsafe { windows_sys::Win32::System::Threading::WaitForSingleObject(h.0 as _, ms) };
let ret =
unsafe { windows_sys::Win32::System::Threading::WaitForSingleObject(h.0 as _, ms) };
if ret == windows_sys::Win32::Foundation::WAIT_FAILED {
Err(errno_err(vm))
} else {
@@ -512,6 +509,8 @@ mod _winapi {
#[pyfunction]
fn ReleaseMutex(handle: isize) -> WindowsSysResult<BOOL> {
WindowsSysResult(unsafe { windows_sys::Win32::System::Threading::ReleaseMutex(handle as _) })
WindowsSysResult(unsafe {
windows_sys::Win32::System::Threading::ReleaseMutex(handle as _)
})
}
}