From 9961fddef167947afab18dc989f50f8a9ab7e9d3 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Thu, 13 Jan 2022 22:20:07 -0800 Subject: [PATCH] windows --- crates/libs/windows/src/core/bindings.rs | 40 ++++++++++++------------ crates/tools/bindings/src/main.rs | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/crates/libs/windows/src/core/bindings.rs b/crates/libs/windows/src/core/bindings.rs index 4bd61737dd..a376587693 100644 --- a/crates/libs/windows/src/core/bindings.rs +++ b/crates/libs/windows/src/core/bindings.rs @@ -1329,7 +1329,7 @@ pub const CLASS_E_CLASSNOTAVAILABLE: ::windows::core::HRESULT = ::windows::core: pub unsafe fn CloseHandle<'a, Param0: ::windows::core::IntoParam<'a, HANDLE>>(hobject: Param0) -> BOOL { #[cfg(windows)] { - #[link(name = "kernel32")] + #[link(name = "windows")] extern "system" { fn CloseHandle(hobject: HANDLE) -> BOOL; } @@ -1346,7 +1346,7 @@ pub type FARPROC = ::core::option::Option isize>; pub unsafe fn GetLastError() -> WIN32_ERROR { #[cfg(windows)] { - #[link(name = "kernel32")] + #[link(name = "windows")] extern "system" { fn GetLastError() -> WIN32_ERROR; } @@ -1548,7 +1548,7 @@ pub const S_OK: ::windows::core::HRESULT = ::windows::core::HRESULT(0i32); pub unsafe fn SysAllocStringLen<'a, Param0: ::windows::core::IntoParam<'a, PWSTR>>(strin: Param0, ui: u32) -> BSTR { #[cfg(windows)] { - #[link(name = "oleaut32")] + #[link(name = "windows")] extern "system" { fn SysAllocStringLen(strin: PWSTR, ui: u32) -> BSTR; } @@ -1561,7 +1561,7 @@ pub unsafe fn SysAllocStringLen<'a, Param0: ::windows::core::IntoParam<'a, PWSTR pub unsafe fn SysFreeString<'a, Param0: ::windows::core::IntoParam<'a, BSTR>>(bstrstring: Param0) { #[cfg(windows)] { - #[link(name = "oleaut32")] + #[link(name = "windows")] extern "system" { fn SysFreeString(bstrstring: ::core::mem::ManuallyDrop); } @@ -1574,7 +1574,7 @@ pub unsafe fn SysFreeString<'a, Param0: ::windows::core::IntoParam<'a, BSTR>>(bs pub unsafe fn SysStringLen<'a, Param0: ::windows::core::IntoParam<'a, BSTR>>(pbstr: Param0) -> u32 { #[cfg(windows)] { - #[link(name = "oleaut32")] + #[link(name = "windows")] extern "system" { fn SysStringLen(pbstr: ::core::mem::ManuallyDrop) -> u32; } @@ -1619,7 +1619,7 @@ impl ::core::default::Default for SECURITY_ATTRIBUTES { pub unsafe fn CoCreateGuid() -> ::windows::core::Result<::windows::core::GUID> { #[cfg(windows)] { - #[link(name = "ole32")] + #[link(name = "windows")] extern "system" { fn CoCreateGuid(pguid: *mut ::windows::core::GUID) -> ::windows::core::HRESULT; } @@ -1633,7 +1633,7 @@ pub unsafe fn CoCreateGuid() -> ::windows::core::Result<::windows::core::GUID> { pub unsafe fn CoTaskMemAlloc(cb: usize) -> *mut ::core::ffi::c_void { #[cfg(windows)] { - #[link(name = "ole32")] + #[link(name = "windows")] extern "system" { fn CoTaskMemAlloc(cb: usize) -> *mut ::core::ffi::c_void; } @@ -1646,7 +1646,7 @@ pub unsafe fn CoTaskMemAlloc(cb: usize) -> *mut ::core::ffi::c_void { pub unsafe fn CoTaskMemFree(pv: *const ::core::ffi::c_void) { #[cfg(windows)] { - #[link(name = "ole32")] + #[link(name = "windows")] extern "system" { fn CoTaskMemFree(pv: *const ::core::ffi::c_void); } @@ -1659,7 +1659,7 @@ pub unsafe fn CoTaskMemFree(pv: *const ::core::ffi::c_void) { pub unsafe fn GetErrorInfo(dwreserved: u32) -> ::windows::core::Result { #[cfg(windows)] { - #[link(name = "oleaut32")] + #[link(name = "windows")] extern "system" { fn GetErrorInfo(dwreserved: u32, pperrinfo: *mut ::windows::core::RawPtr) -> ::windows::core::HRESULT; } @@ -1795,7 +1795,7 @@ pub struct IErrorInfoVtbl( pub unsafe fn SetErrorInfo<'a, Param1: ::windows::core::IntoParam<'a, IErrorInfo>>(dwreserved: u32, perrinfo: Param1) -> ::windows::core::Result<()> { #[cfg(windows)] { - #[link(name = "oleaut32")] + #[link(name = "windows")] extern "system" { fn SetErrorInfo(dwreserved: u32, perrinfo: ::windows::core::RawPtr) -> ::windows::core::HRESULT; } @@ -1815,7 +1815,7 @@ pub const FORMAT_MESSAGE_IGNORE_INSERTS: FORMAT_MESSAGE_OPTIONS = 512u32; pub unsafe 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 { #[cfg(windows)] { - #[link(name = "kernel32")] + #[link(name = "windows")] extern "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; } @@ -1828,7 +1828,7 @@ pub unsafe fn FormatMessageW(dwflags: FORMAT_MESSAGE_OPTIONS, lpsource: *const : pub unsafe fn FreeLibrary<'a, Param0: ::windows::core::IntoParam<'a, HINSTANCE>>(hlibmodule: Param0) -> BOOL { #[cfg(windows)] { - #[link(name = "kernel32")] + #[link(name = "windows")] extern "system" { fn FreeLibrary(hlibmodule: HINSTANCE) -> BOOL; } @@ -1841,7 +1841,7 @@ pub unsafe fn FreeLibrary<'a, Param0: ::windows::core::IntoParam<'a, HINSTANCE>> pub unsafe fn GetProcAddress<'a, Param0: ::windows::core::IntoParam<'a, HINSTANCE>, Param1: ::windows::core::IntoParam<'a, PSTR>>(hmodule: Param0, lpprocname: Param1) -> FARPROC { #[cfg(windows)] { - #[link(name = "kernel32")] + #[link(name = "windows")] extern "system" { fn GetProcAddress(hmodule: HINSTANCE, lpprocname: PSTR) -> FARPROC; } @@ -1854,7 +1854,7 @@ pub unsafe fn GetProcAddress<'a, Param0: ::windows::core::IntoParam<'a, HINSTANC pub unsafe fn LoadLibraryA<'a, Param0: ::windows::core::IntoParam<'a, PSTR>>(lplibfilename: Param0) -> HINSTANCE { #[cfg(windows)] { - #[link(name = "kernel32")] + #[link(name = "windows")] extern "system" { fn LoadLibraryA(lplibfilename: PSTR) -> HINSTANCE; } @@ -1867,7 +1867,7 @@ pub unsafe fn LoadLibraryA<'a, Param0: ::windows::core::IntoParam<'a, PSTR>>(lpl pub unsafe fn GetProcessHeap() -> HeapHandle { #[cfg(windows)] { - #[link(name = "kernel32")] + #[link(name = "windows")] extern "system" { fn GetProcessHeap() -> HeapHandle; } @@ -1898,7 +1898,7 @@ pub const HEAP_CREATE_HARDENED: HEAP_FLAGS = 512u32; pub unsafe fn HeapAlloc<'a, Param0: ::windows::core::IntoParam<'a, HeapHandle>>(hheap: Param0, dwflags: HEAP_FLAGS, dwbytes: usize) -> *mut ::core::ffi::c_void { #[cfg(windows)] { - #[link(name = "kernel32")] + #[link(name = "windows")] extern "system" { fn HeapAlloc(hheap: HeapHandle, dwflags: HEAP_FLAGS, dwbytes: usize) -> *mut ::core::ffi::c_void; } @@ -1911,7 +1911,7 @@ pub unsafe fn HeapAlloc<'a, Param0: ::windows::core::IntoParam<'a, HeapHandle>>( pub unsafe fn HeapFree<'a, Param0: ::windows::core::IntoParam<'a, HeapHandle>>(hheap: Param0, dwflags: HEAP_FLAGS, lpmem: *const ::core::ffi::c_void) -> BOOL { #[cfg(windows)] { - #[link(name = "kernel32")] + #[link(name = "windows")] extern "system" { fn HeapFree(hheap: HeapHandle, dwflags: HEAP_FLAGS, lpmem: *const ::core::ffi::c_void) -> BOOL; } @@ -1958,7 +1958,7 @@ unsafe impl ::windows::core::Abi for HeapHandle { pub unsafe fn CreateEventA<'a, Param1: ::windows::core::IntoParam<'a, BOOL>, Param2: ::windows::core::IntoParam<'a, BOOL>, Param3: ::windows::core::IntoParam<'a, PSTR>>(lpeventattributes: *const SECURITY_ATTRIBUTES, bmanualreset: Param1, binitialstate: Param2, lpname: Param3) -> HANDLE { #[cfg(windows)] { - #[link(name = "kernel32")] + #[link(name = "windows")] extern "system" { fn CreateEventA(lpeventattributes: *const SECURITY_ATTRIBUTES, bmanualreset: BOOL, binitialstate: BOOL, lpname: PSTR) -> HANDLE; } @@ -1971,7 +1971,7 @@ pub unsafe fn CreateEventA<'a, Param1: ::windows::core::IntoParam<'a, BOOL>, Par pub unsafe fn SetEvent<'a, Param0: ::windows::core::IntoParam<'a, HANDLE>>(hevent: Param0) -> BOOL { #[cfg(windows)] { - #[link(name = "kernel32")] + #[link(name = "windows")] extern "system" { fn SetEvent(hevent: HANDLE) -> BOOL; } @@ -1984,7 +1984,7 @@ pub unsafe fn SetEvent<'a, Param0: ::windows::core::IntoParam<'a, HANDLE>>(heven pub unsafe fn WaitForSingleObject<'a, Param0: ::windows::core::IntoParam<'a, HANDLE>>(hhandle: Param0, dwmilliseconds: u32) -> u32 { #[cfg(windows)] { - #[link(name = "kernel32")] + #[link(name = "windows")] extern "system" { fn WaitForSingleObject(hhandle: HANDLE, dwmilliseconds: u32) -> u32; } diff --git a/crates/tools/bindings/src/main.rs b/crates/tools/bindings/src/main.rs index 7fa4ca16a6..9d632b9467 100644 --- a/crates/tools/bindings/src/main.rs +++ b/crates/tools/bindings/src/main.rs @@ -58,7 +58,7 @@ fn main() -> std::io::Result<()> { ]; let mut tokens = "#![allow(non_snake_case, non_upper_case_globals, dead_code, non_camel_case_types, clippy::upper_case_acronyms, clippy::derivable_impls)]".to_string(); - let gen = bindgen::Gen { min_enum: true, min_inherit: true, flatten: true, ..Default::default() }; + let gen = bindgen::Gen { namespace: "Windows.", min_enum: true, min_inherit: true, flatten: true, ..Default::default() }; for name in types { tokens += &bindgen::gen_type(name, &gen);