Rollup merge of #127320 - ChrisDenton:win-sys, r=Mark-Simulacrum

Update windows-bindgen to 0.58.0

This also switches from the bespoke `std` generated bindings to the normal `sys` ones everyone else uses.

This has almost no difference except that the  `sys` bindings use the `windows_targets::links!` macro for FFI imports, which we implement manually. This does cause the diff to look much larger than it really is but the bulk of the changes are mostly contained to the generated code.
This commit is contained in:
Guillaume Gomez 2024-07-05 11:33:16 +02:00 committed by GitHub
commit 80a9717091
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 168 additions and 856 deletions

View File

@ -6356,9 +6356,9 @@ dependencies = [
[[package]] [[package]]
name = "windows-bindgen" name = "windows-bindgen"
version = "0.57.0" version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ccb96113d6277ba543c0f77e1c5494af8094bf9daf9b85acdc3f1b620e7c7b4" checksum = "91cd28d93c692351f3a6e5615567c56756e330bee1c99c6bdd57bfc5ab15f589"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"rayon", "rayon",
@ -6379,9 +6379,9 @@ dependencies = [
[[package]] [[package]]
name = "windows-metadata" name = "windows-metadata"
version = "0.57.0" version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8308d076825b9d9e5abc64f8113e96d02b2aeeba869b20fdd65c7e70cda13dfc" checksum = "2e837f3c3012cfe9e7086302a93f441a7999439be1ad4c530d55d2f6d2921809"
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"

View File

@ -13,6 +13,8 @@
use crate::os::windows::io::{AsRawHandle, BorrowedHandle}; use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
use crate::ptr; use crate::ptr;
mod windows_targets;
mod windows_sys; mod windows_sys;
pub use windows_sys::*; pub use windows_sys::*;
@ -504,11 +506,8 @@ pub struct EXCEPTION_POINTERS {
#[cfg(target_arch = "arm")] #[cfg(target_arch = "arm")]
pub enum CONTEXT {} pub enum CONTEXT {}
}} }}
// WSAStartup is only redefined here so that we can override WSADATA for Arm32
#[link(name = "ws2_32")] windows_targets::link!("ws2_32.dll" "system" fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32);
extern "system" {
pub fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32;
}
#[cfg(target_arch = "arm")] #[cfg(target_arch = "arm")]
#[repr(C)] #[repr(C)]
pub struct WSADATA { pub struct WSADATA {

View File

@ -1,5 +1,5 @@
--out windows_sys.rs --out windows_sys.rs
--config flatten std --config flatten sys
--filter --filter
!Windows.Win32.Foundation.INVALID_HANDLE_VALUE !Windows.Win32.Foundation.INVALID_HANDLE_VALUE
Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED

View File

@ -1,843 +1,136 @@
// Bindings generated by `windows-bindgen` 0.57.0 // Bindings generated by `windows-bindgen` 0.58.0
#![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)] #![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)]
#[link(name = "advapi32")] windows_targets::link!("advapi32.dll" "system" fn OpenProcessToken(processhandle : HANDLE, desiredaccess : TOKEN_ACCESS_MASK, tokenhandle : *mut HANDLE) -> BOOL);
extern "system" { windows_targets::link!("advapi32.dll" "system" "SystemFunction036" fn RtlGenRandom(randombuffer : *mut core::ffi::c_void, randombufferlength : u32) -> BOOLEAN);
pub fn OpenProcessToken( windows_targets::link!("kernel32.dll" "system" fn AcquireSRWLockExclusive(srwlock : *mut SRWLOCK));
processhandle: HANDLE, windows_targets::link!("kernel32.dll" "system" fn AcquireSRWLockShared(srwlock : *mut SRWLOCK));
desiredaccess: TOKEN_ACCESS_MASK, windows_targets::link!("kernel32.dll" "system" fn CancelIo(hfile : HANDLE) -> BOOL);
tokenhandle: *mut HANDLE, windows_targets::link!("kernel32.dll" "system" fn CloseHandle(hobject : HANDLE) -> BOOL);
) -> BOOL; windows_targets::link!("kernel32.dll" "system" fn CompareStringOrdinal(lpstring1 : PCWSTR, cchcount1 : i32, lpstring2 : PCWSTR, cchcount2 : i32, bignorecase : BOOL) -> COMPARESTRING_RESULT);
} windows_targets::link!("kernel32.dll" "system" fn CopyFileExW(lpexistingfilename : PCWSTR, lpnewfilename : PCWSTR, lpprogressroutine : LPPROGRESS_ROUTINE, lpdata : *const core::ffi::c_void, pbcancel : *mut BOOL, dwcopyflags : u32) -> BOOL);
#[link(name = "advapi32")] windows_targets::link!("kernel32.dll" "system" fn CreateDirectoryW(lppathname : PCWSTR, lpsecurityattributes : *const SECURITY_ATTRIBUTES) -> BOOL);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn CreateEventW(lpeventattributes : *const SECURITY_ATTRIBUTES, bmanualreset : BOOL, binitialstate : BOOL, lpname : PCWSTR) -> HANDLE);
#[link_name = "SystemFunction036"] windows_targets::link!("kernel32.dll" "system" fn CreateFileW(lpfilename : PCWSTR, dwdesiredaccess : u32, dwsharemode : FILE_SHARE_MODE, lpsecurityattributes : *const SECURITY_ATTRIBUTES, dwcreationdisposition : FILE_CREATION_DISPOSITION, dwflagsandattributes : FILE_FLAGS_AND_ATTRIBUTES, htemplatefile : HANDLE) -> HANDLE);
pub fn RtlGenRandom(randombuffer: *mut core::ffi::c_void, randombufferlength: u32) -> BOOLEAN; windows_targets::link!("kernel32.dll" "system" fn CreateHardLinkW(lpfilename : PCWSTR, lpexistingfilename : PCWSTR, lpsecurityattributes : *const SECURITY_ATTRIBUTES) -> BOOL);
} windows_targets::link!("kernel32.dll" "system" fn CreateNamedPipeW(lpname : PCWSTR, dwopenmode : FILE_FLAGS_AND_ATTRIBUTES, dwpipemode : NAMED_PIPE_MODE, nmaxinstances : u32, noutbuffersize : u32, ninbuffersize : u32, ndefaulttimeout : u32, lpsecurityattributes : *const SECURITY_ATTRIBUTES) -> HANDLE);
#[link(name = "kernel32")] windows_targets::link!("kernel32.dll" "system" fn CreateProcessW(lpapplicationname : PCWSTR, lpcommandline : PWSTR, lpprocessattributes : *const SECURITY_ATTRIBUTES, lpthreadattributes : *const SECURITY_ATTRIBUTES, binherithandles : BOOL, dwcreationflags : PROCESS_CREATION_FLAGS, lpenvironment : *const core::ffi::c_void, lpcurrentdirectory : PCWSTR, lpstartupinfo : *const STARTUPINFOW, lpprocessinformation : *mut PROCESS_INFORMATION) -> BOOL);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn CreateSymbolicLinkW(lpsymlinkfilename : PCWSTR, lptargetfilename : PCWSTR, dwflags : SYMBOLIC_LINK_FLAGS) -> BOOLEAN);
pub fn AcquireSRWLockExclusive(srwlock: *mut SRWLOCK); windows_targets::link!("kernel32.dll" "system" fn CreateThread(lpthreadattributes : *const SECURITY_ATTRIBUTES, dwstacksize : usize, lpstartaddress : LPTHREAD_START_ROUTINE, lpparameter : *const core::ffi::c_void, dwcreationflags : THREAD_CREATION_FLAGS, lpthreadid : *mut u32) -> HANDLE);
} windows_targets::link!("kernel32.dll" "system" fn CreateWaitableTimerExW(lptimerattributes : *const SECURITY_ATTRIBUTES, lptimername : PCWSTR, dwflags : u32, dwdesiredaccess : u32) -> HANDLE);
#[link(name = "kernel32")] windows_targets::link!("kernel32.dll" "system" fn DeleteFileW(lpfilename : PCWSTR) -> BOOL);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn DeleteProcThreadAttributeList(lpattributelist : LPPROC_THREAD_ATTRIBUTE_LIST));
pub fn AcquireSRWLockShared(srwlock: *mut SRWLOCK); windows_targets::link!("kernel32.dll" "system" fn DeviceIoControl(hdevice : HANDLE, dwiocontrolcode : u32, lpinbuffer : *const core::ffi::c_void, ninbuffersize : u32, lpoutbuffer : *mut core::ffi::c_void, noutbuffersize : u32, lpbytesreturned : *mut u32, lpoverlapped : *mut OVERLAPPED) -> BOOL);
} windows_targets::link!("kernel32.dll" "system" fn DuplicateHandle(hsourceprocesshandle : HANDLE, hsourcehandle : HANDLE, htargetprocesshandle : HANDLE, lptargethandle : *mut HANDLE, dwdesiredaccess : u32, binherithandle : BOOL, dwoptions : DUPLICATE_HANDLE_OPTIONS) -> BOOL);
#[link(name = "kernel32")] windows_targets::link!("kernel32.dll" "system" fn ExitProcess(uexitcode : u32) -> !);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn FindClose(hfindfile : HANDLE) -> BOOL);
pub fn CancelIo(hfile: HANDLE) -> BOOL; windows_targets::link!("kernel32.dll" "system" fn FindFirstFileW(lpfilename : PCWSTR, lpfindfiledata : *mut WIN32_FIND_DATAW) -> HANDLE);
} windows_targets::link!("kernel32.dll" "system" fn FindNextFileW(hfindfile : HANDLE, lpfindfiledata : *mut WIN32_FIND_DATAW) -> BOOL);
#[link(name = "kernel32")] windows_targets::link!("kernel32.dll" "system" fn FlushFileBuffers(hfile : HANDLE) -> BOOL);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn FormatMessageW(dwflags : FORMAT_MESSAGE_OPTIONS, lpsource : *const core::ffi::c_void, dwmessageid : u32, dwlanguageid : u32, lpbuffer : PWSTR, nsize : u32, arguments : *const *const i8) -> u32);
pub fn CloseHandle(hobject: HANDLE) -> BOOL; windows_targets::link!("kernel32.dll" "system" fn FreeEnvironmentStringsW(penv : PCWSTR) -> BOOL);
} windows_targets::link!("kernel32.dll" "system" fn GetActiveProcessorCount(groupnumber : u16) -> u32);
#[link(name = "kernel32")] windows_targets::link!("kernel32.dll" "system" fn GetCommandLineW() -> PCWSTR);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn GetConsoleMode(hconsolehandle : HANDLE, lpmode : *mut CONSOLE_MODE) -> BOOL);
pub fn CompareStringOrdinal( windows_targets::link!("kernel32.dll" "system" fn GetCurrentDirectoryW(nbufferlength : u32, lpbuffer : PWSTR) -> u32);
lpstring1: PCWSTR, windows_targets::link!("kernel32.dll" "system" fn GetCurrentProcess() -> HANDLE);
cchcount1: i32, windows_targets::link!("kernel32.dll" "system" fn GetCurrentProcessId() -> u32);
lpstring2: PCWSTR, windows_targets::link!("kernel32.dll" "system" fn GetCurrentThread() -> HANDLE);
cchcount2: i32, windows_targets::link!("kernel32.dll" "system" fn GetEnvironmentStringsW() -> PWSTR);
bignorecase: BOOL, windows_targets::link!("kernel32.dll" "system" fn GetEnvironmentVariableW(lpname : PCWSTR, lpbuffer : PWSTR, nsize : u32) -> u32);
) -> COMPARESTRING_RESULT; windows_targets::link!("kernel32.dll" "system" fn GetExitCodeProcess(hprocess : HANDLE, lpexitcode : *mut u32) -> BOOL);
} windows_targets::link!("kernel32.dll" "system" fn GetFileAttributesW(lpfilename : PCWSTR) -> u32);
#[link(name = "kernel32")] windows_targets::link!("kernel32.dll" "system" fn GetFileInformationByHandle(hfile : HANDLE, lpfileinformation : *mut BY_HANDLE_FILE_INFORMATION) -> BOOL);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn GetFileInformationByHandleEx(hfile : HANDLE, fileinformationclass : FILE_INFO_BY_HANDLE_CLASS, lpfileinformation : *mut core::ffi::c_void, dwbuffersize : u32) -> BOOL);
pub fn CopyFileExW( windows_targets::link!("kernel32.dll" "system" fn GetFileType(hfile : HANDLE) -> FILE_TYPE);
lpexistingfilename: PCWSTR, windows_targets::link!("kernel32.dll" "system" fn GetFinalPathNameByHandleW(hfile : HANDLE, lpszfilepath : PWSTR, cchfilepath : u32, dwflags : GETFINALPATHNAMEBYHANDLE_FLAGS) -> u32);
lpnewfilename: PCWSTR, windows_targets::link!("kernel32.dll" "system" fn GetFullPathNameW(lpfilename : PCWSTR, nbufferlength : u32, lpbuffer : PWSTR, lpfilepart : *mut PWSTR) -> u32);
lpprogressroutine: LPPROGRESS_ROUTINE, windows_targets::link!("kernel32.dll" "system" fn GetLastError() -> WIN32_ERROR);
lpdata: *const core::ffi::c_void, windows_targets::link!("kernel32.dll" "system" fn GetModuleFileNameW(hmodule : HMODULE, lpfilename : PWSTR, nsize : u32) -> u32);
pbcancel: *mut BOOL, windows_targets::link!("kernel32.dll" "system" fn GetModuleHandleA(lpmodulename : PCSTR) -> HMODULE);
dwcopyflags: u32, windows_targets::link!("kernel32.dll" "system" fn GetModuleHandleW(lpmodulename : PCWSTR) -> HMODULE);
) -> BOOL; windows_targets::link!("kernel32.dll" "system" fn GetOverlappedResult(hfile : HANDLE, lpoverlapped : *const OVERLAPPED, lpnumberofbytestransferred : *mut u32, bwait : BOOL) -> BOOL);
} windows_targets::link!("kernel32.dll" "system" fn GetProcAddress(hmodule : HMODULE, lpprocname : PCSTR) -> FARPROC);
#[link(name = "kernel32")] windows_targets::link!("kernel32.dll" "system" fn GetProcessId(process : HANDLE) -> u32);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn GetStdHandle(nstdhandle : STD_HANDLE) -> HANDLE);
pub fn CreateDirectoryW( windows_targets::link!("kernel32.dll" "system" fn GetSystemDirectoryW(lpbuffer : PWSTR, usize : u32) -> u32);
lppathname: PCWSTR, windows_targets::link!("kernel32.dll" "system" fn GetSystemInfo(lpsysteminfo : *mut SYSTEM_INFO));
lpsecurityattributes: *const SECURITY_ATTRIBUTES, windows_targets::link!("kernel32.dll" "system" fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime : *mut FILETIME));
) -> BOOL; windows_targets::link!("kernel32.dll" "system" fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime : *mut FILETIME));
} windows_targets::link!("kernel32.dll" "system" fn GetTempPathW(nbufferlength : u32, lpbuffer : PWSTR) -> u32);
#[link(name = "kernel32")] windows_targets::link!("kernel32.dll" "system" fn GetWindowsDirectoryW(lpbuffer : PWSTR, usize : u32) -> u32);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn InitOnceBeginInitialize(lpinitonce : *mut INIT_ONCE, dwflags : u32, fpending : *mut BOOL, lpcontext : *mut *mut core::ffi::c_void) -> BOOL);
pub fn CreateEventW( windows_targets::link!("kernel32.dll" "system" fn InitOnceComplete(lpinitonce : *mut INIT_ONCE, dwflags : u32, lpcontext : *const core::ffi::c_void) -> BOOL);
lpeventattributes: *const SECURITY_ATTRIBUTES, windows_targets::link!("kernel32.dll" "system" fn InitializeProcThreadAttributeList(lpattributelist : LPPROC_THREAD_ATTRIBUTE_LIST, dwattributecount : u32, dwflags : u32, lpsize : *mut usize) -> BOOL);
bmanualreset: BOOL, windows_targets::link!("kernel32.dll" "system" fn LocalFree(hmem : HLOCAL) -> HLOCAL);
binitialstate: BOOL, windows_targets::link!("kernel32.dll" "system" fn MoveFileExW(lpexistingfilename : PCWSTR, lpnewfilename : PCWSTR, dwflags : MOVE_FILE_FLAGS) -> BOOL);
lpname: PCWSTR, windows_targets::link!("kernel32.dll" "system" fn MultiByteToWideChar(codepage : u32, dwflags : MULTI_BYTE_TO_WIDE_CHAR_FLAGS, lpmultibytestr : PCSTR, cbmultibyte : i32, lpwidecharstr : PWSTR, cchwidechar : i32) -> i32);
) -> HANDLE; windows_targets::link!("kernel32.dll" "system" fn QueryPerformanceCounter(lpperformancecount : *mut i64) -> BOOL);
} windows_targets::link!("kernel32.dll" "system" fn QueryPerformanceFrequency(lpfrequency : *mut i64) -> BOOL);
#[link(name = "kernel32")] windows_targets::link!("kernel32.dll" "system" fn ReadConsoleW(hconsoleinput : HANDLE, lpbuffer : *mut core::ffi::c_void, nnumberofcharstoread : u32, lpnumberofcharsread : *mut u32, pinputcontrol : *const CONSOLE_READCONSOLE_CONTROL) -> BOOL);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn ReadFile(hfile : HANDLE, lpbuffer : *mut u8, nnumberofbytestoread : u32, lpnumberofbytesread : *mut u32, lpoverlapped : *mut OVERLAPPED) -> BOOL);
pub fn CreateFileW( windows_targets::link!("kernel32.dll" "system" fn ReadFileEx(hfile : HANDLE, lpbuffer : *mut u8, nnumberofbytestoread : u32, lpoverlapped : *mut OVERLAPPED, lpcompletionroutine : LPOVERLAPPED_COMPLETION_ROUTINE) -> BOOL);
lpfilename: PCWSTR, windows_targets::link!("kernel32.dll" "system" fn ReleaseSRWLockExclusive(srwlock : *mut SRWLOCK));
dwdesiredaccess: u32, windows_targets::link!("kernel32.dll" "system" fn ReleaseSRWLockShared(srwlock : *mut SRWLOCK));
dwsharemode: FILE_SHARE_MODE, windows_targets::link!("kernel32.dll" "system" fn RemoveDirectoryW(lppathname : PCWSTR) -> BOOL);
lpsecurityattributes: *const SECURITY_ATTRIBUTES, windows_targets::link!("kernel32.dll" "system" fn SetCurrentDirectoryW(lppathname : PCWSTR) -> BOOL);
dwcreationdisposition: FILE_CREATION_DISPOSITION, windows_targets::link!("kernel32.dll" "system" fn SetEnvironmentVariableW(lpname : PCWSTR, lpvalue : PCWSTR) -> BOOL);
dwflagsandattributes: FILE_FLAGS_AND_ATTRIBUTES, windows_targets::link!("kernel32.dll" "system" fn SetFileAttributesW(lpfilename : PCWSTR, dwfileattributes : FILE_FLAGS_AND_ATTRIBUTES) -> BOOL);
htemplatefile: HANDLE, windows_targets::link!("kernel32.dll" "system" fn SetFileInformationByHandle(hfile : HANDLE, fileinformationclass : FILE_INFO_BY_HANDLE_CLASS, lpfileinformation : *const core::ffi::c_void, dwbuffersize : u32) -> BOOL);
) -> HANDLE; windows_targets::link!("kernel32.dll" "system" fn SetFilePointerEx(hfile : HANDLE, lidistancetomove : i64, lpnewfilepointer : *mut i64, dwmovemethod : SET_FILE_POINTER_MOVE_METHOD) -> BOOL);
} windows_targets::link!("kernel32.dll" "system" fn SetFileTime(hfile : HANDLE, lpcreationtime : *const FILETIME, lplastaccesstime : *const FILETIME, lplastwritetime : *const FILETIME) -> BOOL);
#[link(name = "kernel32")] windows_targets::link!("kernel32.dll" "system" fn SetHandleInformation(hobject : HANDLE, dwmask : u32, dwflags : HANDLE_FLAGS) -> BOOL);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn SetLastError(dwerrcode : WIN32_ERROR));
pub fn CreateHardLinkW( windows_targets::link!("kernel32.dll" "system" fn SetThreadStackGuarantee(stacksizeinbytes : *mut u32) -> BOOL);
lpfilename: PCWSTR, windows_targets::link!("kernel32.dll" "system" fn SetWaitableTimer(htimer : HANDLE, lpduetime : *const i64, lperiod : i32, pfncompletionroutine : PTIMERAPCROUTINE, lpargtocompletionroutine : *const core::ffi::c_void, fresume : BOOL) -> BOOL);
lpexistingfilename: PCWSTR, windows_targets::link!("kernel32.dll" "system" fn Sleep(dwmilliseconds : u32));
lpsecurityattributes: *const SECURITY_ATTRIBUTES, windows_targets::link!("kernel32.dll" "system" fn SleepConditionVariableSRW(conditionvariable : *mut CONDITION_VARIABLE, srwlock : *mut SRWLOCK, dwmilliseconds : u32, flags : u32) -> BOOL);
) -> BOOL; windows_targets::link!("kernel32.dll" "system" fn SleepEx(dwmilliseconds : u32, balertable : BOOL) -> u32);
} windows_targets::link!("kernel32.dll" "system" fn SwitchToThread() -> BOOL);
#[link(name = "kernel32")] windows_targets::link!("kernel32.dll" "system" fn TerminateProcess(hprocess : HANDLE, uexitcode : u32) -> BOOL);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn TlsAlloc() -> u32);
pub fn CreateNamedPipeW( windows_targets::link!("kernel32.dll" "system" fn TlsFree(dwtlsindex : u32) -> BOOL);
lpname: PCWSTR, windows_targets::link!("kernel32.dll" "system" fn TlsGetValue(dwtlsindex : u32) -> *mut core::ffi::c_void);
dwopenmode: FILE_FLAGS_AND_ATTRIBUTES, windows_targets::link!("kernel32.dll" "system" fn TlsSetValue(dwtlsindex : u32, lptlsvalue : *const core::ffi::c_void) -> BOOL);
dwpipemode: NAMED_PIPE_MODE, windows_targets::link!("kernel32.dll" "system" fn TryAcquireSRWLockExclusive(srwlock : *mut SRWLOCK) -> BOOLEAN);
nmaxinstances: u32, windows_targets::link!("kernel32.dll" "system" fn TryAcquireSRWLockShared(srwlock : *mut SRWLOCK) -> BOOLEAN);
noutbuffersize: u32, windows_targets::link!("kernel32.dll" "system" fn UpdateProcThreadAttribute(lpattributelist : LPPROC_THREAD_ATTRIBUTE_LIST, dwflags : u32, attribute : usize, lpvalue : *const core::ffi::c_void, cbsize : usize, lppreviousvalue : *mut core::ffi::c_void, lpreturnsize : *const usize) -> BOOL);
ninbuffersize: u32, windows_targets::link!("kernel32.dll" "system" fn WaitForMultipleObjects(ncount : u32, lphandles : *const HANDLE, bwaitall : BOOL, dwmilliseconds : u32) -> WAIT_EVENT);
ndefaulttimeout: u32, windows_targets::link!("kernel32.dll" "system" fn WaitForSingleObject(hhandle : HANDLE, dwmilliseconds : u32) -> WAIT_EVENT);
lpsecurityattributes: *const SECURITY_ATTRIBUTES, windows_targets::link!("kernel32.dll" "system" fn WakeAllConditionVariable(conditionvariable : *mut CONDITION_VARIABLE));
) -> HANDLE; windows_targets::link!("kernel32.dll" "system" fn WakeConditionVariable(conditionvariable : *mut CONDITION_VARIABLE));
} windows_targets::link!("kernel32.dll" "system" fn WideCharToMultiByte(codepage : u32, dwflags : u32, lpwidecharstr : PCWSTR, cchwidechar : i32, lpmultibytestr : PSTR, cbmultibyte : i32, lpdefaultchar : PCSTR, lpuseddefaultchar : *mut BOOL) -> i32);
#[link(name = "kernel32")] windows_targets::link!("kernel32.dll" "system" fn WriteConsoleW(hconsoleoutput : HANDLE, lpbuffer : PCWSTR, nnumberofcharstowrite : u32, lpnumberofcharswritten : *mut u32, lpreserved : *const core::ffi::c_void) -> BOOL);
extern "system" { windows_targets::link!("kernel32.dll" "system" fn WriteFileEx(hfile : HANDLE, lpbuffer : *const u8, nnumberofbytestowrite : u32, lpoverlapped : *mut OVERLAPPED, lpcompletionroutine : LPOVERLAPPED_COMPLETION_ROUTINE) -> BOOL);
pub fn CreateProcessW( windows_targets::link!("ntdll.dll" "system" fn NtCreateFile(filehandle : *mut HANDLE, desiredaccess : FILE_ACCESS_RIGHTS, objectattributes : *const OBJECT_ATTRIBUTES, iostatusblock : *mut IO_STATUS_BLOCK, allocationsize : *const i64, fileattributes : FILE_FLAGS_AND_ATTRIBUTES, shareaccess : FILE_SHARE_MODE, createdisposition : NTCREATEFILE_CREATE_DISPOSITION, createoptions : NTCREATEFILE_CREATE_OPTIONS, eabuffer : *const core::ffi::c_void, ealength : u32) -> NTSTATUS);
lpapplicationname: PCWSTR, windows_targets::link!("ntdll.dll" "system" fn NtReadFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *mut core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS);
lpcommandline: PWSTR, windows_targets::link!("ntdll.dll" "system" fn NtWriteFile(filehandle : HANDLE, event : HANDLE, apcroutine : PIO_APC_ROUTINE, apccontext : *const core::ffi::c_void, iostatusblock : *mut IO_STATUS_BLOCK, buffer : *const core::ffi::c_void, length : u32, byteoffset : *const i64, key : *const u32) -> NTSTATUS);
lpprocessattributes: *const SECURITY_ATTRIBUTES, windows_targets::link!("ntdll.dll" "system" fn RtlNtStatusToDosError(status : NTSTATUS) -> u32);
lpthreadattributes: *const SECURITY_ATTRIBUTES, windows_targets::link!("userenv.dll" "system" fn GetUserProfileDirectoryW(htoken : HANDLE, lpprofiledir : PWSTR, lpcchsize : *mut u32) -> BOOL);
binherithandles: BOOL, windows_targets::link!("ws2_32.dll" "system" fn WSACleanup() -> i32);
dwcreationflags: PROCESS_CREATION_FLAGS, windows_targets::link!("ws2_32.dll" "system" fn WSADuplicateSocketW(s : SOCKET, dwprocessid : u32, lpprotocolinfo : *mut WSAPROTOCOL_INFOW) -> i32);
lpenvironment: *const core::ffi::c_void, windows_targets::link!("ws2_32.dll" "system" fn WSAGetLastError() -> WSA_ERROR);
lpcurrentdirectory: PCWSTR, windows_targets::link!("ws2_32.dll" "system" fn WSARecv(s : SOCKET, lpbuffers : *const WSABUF, dwbuffercount : u32, lpnumberofbytesrecvd : *mut u32, lpflags : *mut u32, lpoverlapped : *mut OVERLAPPED, lpcompletionroutine : LPWSAOVERLAPPED_COMPLETION_ROUTINE) -> i32);
lpstartupinfo: *const STARTUPINFOW, windows_targets::link!("ws2_32.dll" "system" fn WSASend(s : SOCKET, lpbuffers : *const WSABUF, dwbuffercount : u32, lpnumberofbytessent : *mut u32, dwflags : u32, lpoverlapped : *mut OVERLAPPED, lpcompletionroutine : LPWSAOVERLAPPED_COMPLETION_ROUTINE) -> i32);
lpprocessinformation: *mut PROCESS_INFORMATION, windows_targets::link!("ws2_32.dll" "system" fn WSASocketW(af : i32, r#type : i32, protocol : i32, lpprotocolinfo : *const WSAPROTOCOL_INFOW, g : u32, dwflags : u32) -> SOCKET);
) -> BOOL; windows_targets::link!("ws2_32.dll" "system" fn accept(s : SOCKET, addr : *mut SOCKADDR, addrlen : *mut i32) -> SOCKET);
} windows_targets::link!("ws2_32.dll" "system" fn bind(s : SOCKET, name : *const SOCKADDR, namelen : i32) -> i32);
#[link(name = "kernel32")] windows_targets::link!("ws2_32.dll" "system" fn closesocket(s : SOCKET) -> i32);
extern "system" { windows_targets::link!("ws2_32.dll" "system" fn connect(s : SOCKET, name : *const SOCKADDR, namelen : i32) -> i32);
pub fn CreateSymbolicLinkW( windows_targets::link!("ws2_32.dll" "system" fn freeaddrinfo(paddrinfo : *const ADDRINFOA));
lpsymlinkfilename: PCWSTR, windows_targets::link!("ws2_32.dll" "system" fn getaddrinfo(pnodename : PCSTR, pservicename : PCSTR, phints : *const ADDRINFOA, ppresult : *mut *mut ADDRINFOA) -> i32);
lptargetfilename: PCWSTR, windows_targets::link!("ws2_32.dll" "system" fn getpeername(s : SOCKET, name : *mut SOCKADDR, namelen : *mut i32) -> i32);
dwflags: SYMBOLIC_LINK_FLAGS, windows_targets::link!("ws2_32.dll" "system" fn getsockname(s : SOCKET, name : *mut SOCKADDR, namelen : *mut i32) -> i32);
) -> BOOLEAN; windows_targets::link!("ws2_32.dll" "system" fn getsockopt(s : SOCKET, level : i32, optname : i32, optval : PSTR, optlen : *mut i32) -> i32);
} windows_targets::link!("ws2_32.dll" "system" fn ioctlsocket(s : SOCKET, cmd : i32, argp : *mut u32) -> i32);
#[link(name = "kernel32")] windows_targets::link!("ws2_32.dll" "system" fn listen(s : SOCKET, backlog : i32) -> i32);
extern "system" { windows_targets::link!("ws2_32.dll" "system" fn recv(s : SOCKET, buf : PSTR, len : i32, flags : SEND_RECV_FLAGS) -> i32);
pub fn CreateThread( windows_targets::link!("ws2_32.dll" "system" fn recvfrom(s : SOCKET, buf : PSTR, len : i32, flags : i32, from : *mut SOCKADDR, fromlen : *mut i32) -> i32);
lpthreadattributes: *const SECURITY_ATTRIBUTES, windows_targets::link!("ws2_32.dll" "system" fn select(nfds : i32, readfds : *mut FD_SET, writefds : *mut FD_SET, exceptfds : *mut FD_SET, timeout : *const TIMEVAL) -> i32);
dwstacksize: usize, windows_targets::link!("ws2_32.dll" "system" fn send(s : SOCKET, buf : PCSTR, len : i32, flags : SEND_RECV_FLAGS) -> i32);
lpstartaddress: LPTHREAD_START_ROUTINE, windows_targets::link!("ws2_32.dll" "system" fn sendto(s : SOCKET, buf : PCSTR, len : i32, flags : i32, to : *const SOCKADDR, tolen : i32) -> i32);
lpparameter: *const core::ffi::c_void, windows_targets::link!("ws2_32.dll" "system" fn setsockopt(s : SOCKET, level : i32, optname : i32, optval : PCSTR, optlen : i32) -> i32);
dwcreationflags: THREAD_CREATION_FLAGS, windows_targets::link!("ws2_32.dll" "system" fn shutdown(s : SOCKET, how : WINSOCK_SHUTDOWN_HOW) -> i32);
lpthreadid: *mut u32,
) -> HANDLE;
}
#[link(name = "kernel32")]
extern "system" {
pub fn CreateWaitableTimerExW(
lptimerattributes: *const SECURITY_ATTRIBUTES,
lptimername: PCWSTR,
dwflags: u32,
dwdesiredaccess: u32,
) -> HANDLE;
}
#[link(name = "kernel32")]
extern "system" {
pub fn DeleteFileW(lpfilename: PCWSTR) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn DeleteProcThreadAttributeList(lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST);
}
#[link(name = "kernel32")]
extern "system" {
pub fn DeviceIoControl(
hdevice: HANDLE,
dwiocontrolcode: u32,
lpinbuffer: *const core::ffi::c_void,
ninbuffersize: u32,
lpoutbuffer: *mut core::ffi::c_void,
noutbuffersize: u32,
lpbytesreturned: *mut u32,
lpoverlapped: *mut OVERLAPPED,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn DuplicateHandle(
hsourceprocesshandle: HANDLE,
hsourcehandle: HANDLE,
htargetprocesshandle: HANDLE,
lptargethandle: *mut HANDLE,
dwdesiredaccess: u32,
binherithandle: BOOL,
dwoptions: DUPLICATE_HANDLE_OPTIONS,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn ExitProcess(uexitcode: u32) -> !;
}
#[link(name = "kernel32")]
extern "system" {
pub fn FindClose(hfindfile: HANDLE) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn FindFirstFileW(lpfilename: PCWSTR, lpfindfiledata: *mut WIN32_FIND_DATAW) -> HANDLE;
}
#[link(name = "kernel32")]
extern "system" {
pub fn FindNextFileW(hfindfile: HANDLE, lpfindfiledata: *mut WIN32_FIND_DATAW) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn FlushFileBuffers(hfile: HANDLE) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn FormatMessageW(
dwflags: FORMAT_MESSAGE_OPTIONS,
lpsource: *const core::ffi::c_void,
dwmessageid: u32,
dwlanguageid: u32,
lpbuffer: PWSTR,
nsize: u32,
arguments: *const *const i8,
) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn FreeEnvironmentStringsW(penv: PCWSTR) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetActiveProcessorCount(groupnumber: u16) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetCommandLineW() -> PCWSTR;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetConsoleMode(hconsolehandle: HANDLE, lpmode: *mut CONSOLE_MODE) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetCurrentDirectoryW(nbufferlength: u32, lpbuffer: PWSTR) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetCurrentProcess() -> HANDLE;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetCurrentProcessId() -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetCurrentThread() -> HANDLE;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetEnvironmentStringsW() -> PWSTR;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetEnvironmentVariableW(lpname: PCWSTR, lpbuffer: PWSTR, nsize: u32) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetExitCodeProcess(hprocess: HANDLE, lpexitcode: *mut u32) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetFileAttributesW(lpfilename: PCWSTR) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetFileInformationByHandle(
hfile: HANDLE,
lpfileinformation: *mut BY_HANDLE_FILE_INFORMATION,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetFileInformationByHandleEx(
hfile: HANDLE,
fileinformationclass: FILE_INFO_BY_HANDLE_CLASS,
lpfileinformation: *mut core::ffi::c_void,
dwbuffersize: u32,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetFileType(hfile: HANDLE) -> FILE_TYPE;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetFinalPathNameByHandleW(
hfile: HANDLE,
lpszfilepath: PWSTR,
cchfilepath: u32,
dwflags: GETFINALPATHNAMEBYHANDLE_FLAGS,
) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetFullPathNameW(
lpfilename: PCWSTR,
nbufferlength: u32,
lpbuffer: PWSTR,
lpfilepart: *mut PWSTR,
) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetLastError() -> WIN32_ERROR;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetModuleFileNameW(hmodule: HMODULE, lpfilename: PWSTR, nsize: u32) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetModuleHandleA(lpmodulename: PCSTR) -> HMODULE;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetModuleHandleW(lpmodulename: PCWSTR) -> HMODULE;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetOverlappedResult(
hfile: HANDLE,
lpoverlapped: *const OVERLAPPED,
lpnumberofbytestransferred: *mut u32,
bwait: BOOL,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetProcAddress(hmodule: HMODULE, lpprocname: PCSTR) -> FARPROC;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetProcessId(process: HANDLE) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetStdHandle(nstdhandle: STD_HANDLE) -> HANDLE;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetSystemDirectoryW(lpbuffer: PWSTR, usize: u32) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetSystemInfo(lpsysteminfo: *mut SYSTEM_INFO);
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime: *mut FILETIME);
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime: *mut FILETIME);
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetTempPathW(nbufferlength: u32, lpbuffer: PWSTR) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn GetWindowsDirectoryW(lpbuffer: PWSTR, usize: u32) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn InitOnceBeginInitialize(
lpinitonce: *mut INIT_ONCE,
dwflags: u32,
fpending: *mut BOOL,
lpcontext: *mut *mut core::ffi::c_void,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn InitOnceComplete(
lpinitonce: *mut INIT_ONCE,
dwflags: u32,
lpcontext: *const core::ffi::c_void,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn InitializeProcThreadAttributeList(
lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST,
dwattributecount: u32,
dwflags: u32,
lpsize: *mut usize,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn LocalFree(hmem: HLOCAL) -> HLOCAL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn MoveFileExW(
lpexistingfilename: PCWSTR,
lpnewfilename: PCWSTR,
dwflags: MOVE_FILE_FLAGS,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn MultiByteToWideChar(
codepage: u32,
dwflags: MULTI_BYTE_TO_WIDE_CHAR_FLAGS,
lpmultibytestr: PCSTR,
cbmultibyte: i32,
lpwidecharstr: PWSTR,
cchwidechar: i32,
) -> i32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn QueryPerformanceCounter(lpperformancecount: *mut i64) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn QueryPerformanceFrequency(lpfrequency: *mut i64) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn ReadConsoleW(
hconsoleinput: HANDLE,
lpbuffer: *mut core::ffi::c_void,
nnumberofcharstoread: u32,
lpnumberofcharsread: *mut u32,
pinputcontrol: *const CONSOLE_READCONSOLE_CONTROL,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn ReadFile(
hfile: HANDLE,
lpbuffer: *mut u8,
nnumberofbytestoread: u32,
lpnumberofbytesread: *mut u32,
lpoverlapped: *mut OVERLAPPED,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn ReadFileEx(
hfile: HANDLE,
lpbuffer: *mut u8,
nnumberofbytestoread: u32,
lpoverlapped: *mut OVERLAPPED,
lpcompletionroutine: LPOVERLAPPED_COMPLETION_ROUTINE,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn ReleaseSRWLockExclusive(srwlock: *mut SRWLOCK);
}
#[link(name = "kernel32")]
extern "system" {
pub fn ReleaseSRWLockShared(srwlock: *mut SRWLOCK);
}
#[link(name = "kernel32")]
extern "system" {
pub fn RemoveDirectoryW(lppathname: PCWSTR) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn SetCurrentDirectoryW(lppathname: PCWSTR) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn SetEnvironmentVariableW(lpname: PCWSTR, lpvalue: PCWSTR) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn SetFileAttributesW(
lpfilename: PCWSTR,
dwfileattributes: FILE_FLAGS_AND_ATTRIBUTES,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn SetFileInformationByHandle(
hfile: HANDLE,
fileinformationclass: FILE_INFO_BY_HANDLE_CLASS,
lpfileinformation: *const core::ffi::c_void,
dwbuffersize: u32,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn SetFilePointerEx(
hfile: HANDLE,
lidistancetomove: i64,
lpnewfilepointer: *mut i64,
dwmovemethod: SET_FILE_POINTER_MOVE_METHOD,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn SetFileTime(
hfile: HANDLE,
lpcreationtime: *const FILETIME,
lplastaccesstime: *const FILETIME,
lplastwritetime: *const FILETIME,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn SetHandleInformation(hobject: HANDLE, dwmask: u32, dwflags: HANDLE_FLAGS) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn SetLastError(dwerrcode: WIN32_ERROR);
}
#[link(name = "kernel32")]
extern "system" {
pub fn SetThreadStackGuarantee(stacksizeinbytes: *mut u32) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn SetWaitableTimer(
htimer: HANDLE,
lpduetime: *const i64,
lperiod: i32,
pfncompletionroutine: PTIMERAPCROUTINE,
lpargtocompletionroutine: *const core::ffi::c_void,
fresume: BOOL,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn Sleep(dwmilliseconds: u32);
}
#[link(name = "kernel32")]
extern "system" {
pub fn SleepConditionVariableSRW(
conditionvariable: *mut CONDITION_VARIABLE,
srwlock: *mut SRWLOCK,
dwmilliseconds: u32,
flags: u32,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn SleepEx(dwmilliseconds: u32, balertable: BOOL) -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn SwitchToThread() -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn TerminateProcess(hprocess: HANDLE, uexitcode: u32) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn TlsAlloc() -> u32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn TlsFree(dwtlsindex: u32) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn TlsGetValue(dwtlsindex: u32) -> *mut core::ffi::c_void;
}
#[link(name = "kernel32")]
extern "system" {
pub fn TlsSetValue(dwtlsindex: u32, lptlsvalue: *const core::ffi::c_void) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn TryAcquireSRWLockExclusive(srwlock: *mut SRWLOCK) -> BOOLEAN;
}
#[link(name = "kernel32")]
extern "system" {
pub fn TryAcquireSRWLockShared(srwlock: *mut SRWLOCK) -> BOOLEAN;
}
#[link(name = "kernel32")]
extern "system" {
pub fn UpdateProcThreadAttribute(
lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST,
dwflags: u32,
attribute: usize,
lpvalue: *const core::ffi::c_void,
cbsize: usize,
lppreviousvalue: *mut core::ffi::c_void,
lpreturnsize: *const usize,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn WaitForMultipleObjects(
ncount: u32,
lphandles: *const HANDLE,
bwaitall: BOOL,
dwmilliseconds: u32,
) -> WAIT_EVENT;
}
#[link(name = "kernel32")]
extern "system" {
pub fn WaitForSingleObject(hhandle: HANDLE, dwmilliseconds: u32) -> WAIT_EVENT;
}
#[link(name = "kernel32")]
extern "system" {
pub fn WakeAllConditionVariable(conditionvariable: *mut CONDITION_VARIABLE);
}
#[link(name = "kernel32")]
extern "system" {
pub fn WakeConditionVariable(conditionvariable: *mut CONDITION_VARIABLE);
}
#[link(name = "kernel32")]
extern "system" {
pub fn WideCharToMultiByte(
codepage: u32,
dwflags: u32,
lpwidecharstr: PCWSTR,
cchwidechar: i32,
lpmultibytestr: PSTR,
cbmultibyte: i32,
lpdefaultchar: PCSTR,
lpuseddefaultchar: *mut BOOL,
) -> i32;
}
#[link(name = "kernel32")]
extern "system" {
pub fn WriteConsoleW(
hconsoleoutput: HANDLE,
lpbuffer: *const core::ffi::c_void,
nnumberofcharstowrite: u32,
lpnumberofcharswritten: *mut u32,
lpreserved: *const core::ffi::c_void,
) -> BOOL;
}
#[link(name = "kernel32")]
extern "system" {
pub fn WriteFileEx(
hfile: HANDLE,
lpbuffer: *const u8,
nnumberofbytestowrite: u32,
lpoverlapped: *mut OVERLAPPED,
lpcompletionroutine: LPOVERLAPPED_COMPLETION_ROUTINE,
) -> BOOL;
}
#[link(name = "ntdll")]
extern "system" {
pub fn NtCreateFile(
filehandle: *mut HANDLE,
desiredaccess: FILE_ACCESS_RIGHTS,
objectattributes: *const OBJECT_ATTRIBUTES,
iostatusblock: *mut IO_STATUS_BLOCK,
allocationsize: *const i64,
fileattributes: FILE_FLAGS_AND_ATTRIBUTES,
shareaccess: FILE_SHARE_MODE,
createdisposition: NTCREATEFILE_CREATE_DISPOSITION,
createoptions: NTCREATEFILE_CREATE_OPTIONS,
eabuffer: *const core::ffi::c_void,
ealength: u32,
) -> NTSTATUS;
}
#[link(name = "ntdll")]
extern "system" {
pub fn NtReadFile(
filehandle: HANDLE,
event: HANDLE,
apcroutine: PIO_APC_ROUTINE,
apccontext: *const core::ffi::c_void,
iostatusblock: *mut IO_STATUS_BLOCK,
buffer: *mut core::ffi::c_void,
length: u32,
byteoffset: *const i64,
key: *const u32,
) -> NTSTATUS;
}
#[link(name = "ntdll")]
extern "system" {
pub fn NtWriteFile(
filehandle: HANDLE,
event: HANDLE,
apcroutine: PIO_APC_ROUTINE,
apccontext: *const core::ffi::c_void,
iostatusblock: *mut IO_STATUS_BLOCK,
buffer: *const core::ffi::c_void,
length: u32,
byteoffset: *const i64,
key: *const u32,
) -> NTSTATUS;
}
#[link(name = "ntdll")]
extern "system" {
pub fn RtlNtStatusToDosError(status: NTSTATUS) -> u32;
}
#[link(name = "userenv")]
extern "system" {
pub fn GetUserProfileDirectoryW(
htoken: HANDLE,
lpprofiledir: PWSTR,
lpcchsize: *mut u32,
) -> BOOL;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn WSACleanup() -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn WSADuplicateSocketW(
s: SOCKET,
dwprocessid: u32,
lpprotocolinfo: *mut WSAPROTOCOL_INFOW,
) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn WSAGetLastError() -> WSA_ERROR;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn WSARecv(
s: SOCKET,
lpbuffers: *const WSABUF,
dwbuffercount: u32,
lpnumberofbytesrecvd: *mut u32,
lpflags: *mut u32,
lpoverlapped: *mut OVERLAPPED,
lpcompletionroutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn WSASend(
s: SOCKET,
lpbuffers: *const WSABUF,
dwbuffercount: u32,
lpnumberofbytessent: *mut u32,
dwflags: u32,
lpoverlapped: *mut OVERLAPPED,
lpcompletionroutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn WSASocketW(
af: i32,
r#type: i32,
protocol: i32,
lpprotocolinfo: *const WSAPROTOCOL_INFOW,
g: u32,
dwflags: u32,
) -> SOCKET;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn accept(s: SOCKET, addr: *mut SOCKADDR, addrlen: *mut i32) -> SOCKET;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn bind(s: SOCKET, name: *const SOCKADDR, namelen: i32) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn closesocket(s: SOCKET) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn connect(s: SOCKET, name: *const SOCKADDR, namelen: i32) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn freeaddrinfo(paddrinfo: *const ADDRINFOA);
}
#[link(name = "ws2_32")]
extern "system" {
pub fn getaddrinfo(
pnodename: PCSTR,
pservicename: PCSTR,
phints: *const ADDRINFOA,
ppresult: *mut *mut ADDRINFOA,
) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn getpeername(s: SOCKET, name: *mut SOCKADDR, namelen: *mut i32) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn getsockname(s: SOCKET, name: *mut SOCKADDR, namelen: *mut i32) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn getsockopt(s: SOCKET, level: i32, optname: i32, optval: PSTR, optlen: *mut i32) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn ioctlsocket(s: SOCKET, cmd: i32, argp: *mut u32) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn listen(s: SOCKET, backlog: i32) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn recv(s: SOCKET, buf: PSTR, len: i32, flags: SEND_RECV_FLAGS) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn recvfrom(
s: SOCKET,
buf: PSTR,
len: i32,
flags: i32,
from: *mut SOCKADDR,
fromlen: *mut i32,
) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn select(
nfds: i32,
readfds: *mut FD_SET,
writefds: *mut FD_SET,
exceptfds: *mut FD_SET,
timeout: *const TIMEVAL,
) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn send(s: SOCKET, buf: PCSTR, len: i32, flags: SEND_RECV_FLAGS) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn sendto(
s: SOCKET,
buf: PCSTR,
len: i32,
flags: i32,
to: *const SOCKADDR,
tolen: i32,
) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn setsockopt(s: SOCKET, level: i32, optname: i32, optval: PCSTR, optlen: i32) -> i32;
}
#[link(name = "ws2_32")]
extern "system" {
pub fn shutdown(s: SOCKET, how: WINSOCK_SHUTDOWN_HOW) -> i32;
}
pub const ABOVE_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 32768u32; pub const ABOVE_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 32768u32;
pub type ADDRESS_FAMILY = u16; pub type ADDRESS_FAMILY = u16;
#[repr(C)] #[repr(C)]
@ -3991,3 +3284,4 @@ pub struct XSAVE_FORMAT {
pub Reserved4: [u8; 224], pub Reserved4: [u8; 224],
} }
// ignore-tidy-filelength // ignore-tidy-filelength
use super::windows_targets;

View File

@ -0,0 +1,24 @@
//! Provides the `link!` macro used by the generated windows bindings.
//!
//! This is a simple wrapper around an `extern` block with a `#[link]` attribute.
//! It's very roughly equivalent to the windows-targets crate.
pub macro link {
($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => (
// Note: the windows-targets crate uses a pre-built Windows.lib import library which we don't
// have in this repo. So instead we always link kernel32.lib and add the rest of the import
// libraries below by using an empty extern block. This works because extern blocks are not
// connected to the library given in the #[link] attribute.
#[link(name = "kernel32")]
extern $abi {
$(#[link_name=$link_name])?
pub fn $($function)*;
}
)
}
#[link(name = "advapi32")]
#[link(name = "ntdll")]
#[link(name = "userenv")]
#[link(name = "ws2_32")]
extern "C" {}

View File

@ -232,13 +232,7 @@ fn write_u16s(handle: c::HANDLE, data: &[u16]) -> io::Result<usize> {
debug_assert!(data.len() < u32::MAX as usize); debug_assert!(data.len() < u32::MAX as usize);
let mut written = 0; let mut written = 0;
cvt(unsafe { cvt(unsafe {
c::WriteConsoleW( c::WriteConsoleW(handle, data.as_ptr(), data.len() as u32, &mut written, ptr::null_mut())
handle,
data.as_ptr() as c::LPCVOID,
data.len() as u32,
&mut written,
ptr::null_mut(),
)
})?; })?;
Ok(written as usize) Ok(written as usize)
} }

View File

@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies.windows-bindgen] [dependencies.windows-bindgen]
version = "0.57.0" version = "0.58.0"

View File

@ -17,6 +17,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let mut f = std::fs::File::options().append(true).open("windows_sys.rs")?; let mut f = std::fs::File::options().append(true).open("windows_sys.rs")?;
writeln!(&mut f, "// ignore-tidy-filelength")?; writeln!(&mut f, "// ignore-tidy-filelength")?;
writeln!(&mut f, "use super::windows_targets;")?;
Ok(()) Ok(())
} }