1 | #![allow ( |
2 | non_snake_case, |
3 | non_upper_case_globals, |
4 | non_camel_case_types, |
5 | dead_code, |
6 | clippy::all |
7 | )] |
8 | |
9 | windows_link::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); |
10 | windows_link::link!("oleaut32.dll" "system" fn GetErrorInfo(dwreserved : u32, pperrinfo : *mut * mut core::ffi::c_void) -> HRESULT); |
11 | windows_link::link!("kernel32.dll" "system" fn GetLastError() -> WIN32_ERROR); |
12 | windows_link::link!("kernel32.dll" "system" fn GetProcessHeap() -> HANDLE); |
13 | windows_link::link!("kernel32.dll" "system" fn HeapFree(hheap : HANDLE, dwflags : HEAP_FLAGS, lpmem : *const core::ffi::c_void) -> BOOL); |
14 | windows_link::link!("kernel32.dll" "system" fn LoadLibraryExA(lplibfilename : PCSTR, hfile : HANDLE, dwflags : LOAD_LIBRARY_FLAGS) -> HMODULE); |
15 | windows_link::link!("api-ms-win-core-winrt-error-l1-1-0.dll" "system" fn RoOriginateErrorW(error : HRESULT, cchmax : u32, message : PCWSTR) -> BOOL); |
16 | windows_link::link!("oleaut32.dll" "system" fn SetErrorInfo(dwreserved : u32, perrinfo : * mut core::ffi::c_void) -> HRESULT); |
17 | windows_link::link!("oleaut32.dll" "system" fn SysFreeString(bstrstring : BSTR)); |
18 | windows_link::link!("oleaut32.dll" "system" fn SysStringLen(pbstr : BSTR) -> u32); |
19 | pub type BOOL = i32; |
20 | pub type BSTR = *const u16; |
21 | pub const ERROR_INVALID_DATA: WIN32_ERROR = 13u32; |
22 | pub const ERROR_NO_UNICODE_TRANSLATION: WIN32_ERROR = 1113u32; |
23 | pub const E_UNEXPECTED: HRESULT = 0x8000FFFF_u32 as _; |
24 | pub const FORMAT_MESSAGE_ALLOCATE_BUFFER: FORMAT_MESSAGE_OPTIONS = 256u32; |
25 | pub const FORMAT_MESSAGE_FROM_HMODULE: FORMAT_MESSAGE_OPTIONS = 2048u32; |
26 | pub const FORMAT_MESSAGE_FROM_SYSTEM: FORMAT_MESSAGE_OPTIONS = 4096u32; |
27 | pub const FORMAT_MESSAGE_IGNORE_INSERTS: FORMAT_MESSAGE_OPTIONS = 512u32; |
28 | pub type FORMAT_MESSAGE_OPTIONS = u32; |
29 | #[repr (C)] |
30 | #[derive (Clone, Copy)] |
31 | pub struct GUID { |
32 | pub data1: u32, |
33 | pub data2: u16, |
34 | pub data3: u16, |
35 | pub data4: [u8; 8], |
36 | } |
37 | impl GUID { |
38 | pub const fn from_u128(uuid: u128) -> Self { |
39 | Self { |
40 | data1: (uuid >> 96) as u32, |
41 | data2: (uuid >> 80 & 0xffff) as u16, |
42 | data3: (uuid >> 64 & 0xffff) as u16, |
43 | data4: (uuid as u64).to_be_bytes(), |
44 | } |
45 | } |
46 | } |
47 | pub type HANDLE = *mut core::ffi::c_void; |
48 | pub type HEAP_FLAGS = u32; |
49 | pub type HINSTANCE = *mut core::ffi::c_void; |
50 | pub type HMODULE = *mut core::ffi::c_void; |
51 | pub type HRESULT = i32; |
52 | pub const IID_IErrorInfo: GUID = GUID::from_u128(uuid:0x1cf2b120_547d_101b_8e65_08002b2bd119); |
53 | #[repr (C)] |
54 | pub struct IErrorInfo_Vtbl { |
55 | pub base__: IUnknown_Vtbl, |
56 | pub GetGUID: unsafe extern "system" fn(*mut core::ffi::c_void, *mut GUID) -> HRESULT, |
57 | pub GetSource: unsafe extern "system" fn(*mut core::ffi::c_void, *mut BSTR) -> HRESULT, |
58 | pub GetDescription: unsafe extern "system" fn(*mut core::ffi::c_void, *mut BSTR) -> HRESULT, |
59 | pub GetHelpFile: unsafe extern "system" fn(*mut core::ffi::c_void, *mut BSTR) -> HRESULT, |
60 | pub GetHelpContext: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> HRESULT, |
61 | } |
62 | pub const IID_IRestrictedErrorInfo: GUID = GUID::from_u128(uuid:0x82ba7092_4c88_427d_a7bc_16dd93feb67e); |
63 | #[repr (C)] |
64 | pub struct IRestrictedErrorInfo_Vtbl { |
65 | pub base__: IUnknown_Vtbl, |
66 | pub GetErrorDetails: unsafe extern "system" fn( |
67 | *mut core::ffi::c_void, |
68 | *mut BSTR, |
69 | *mut HRESULT, |
70 | *mut BSTR, |
71 | *mut BSTR, |
72 | ) -> HRESULT, |
73 | pub GetReference: unsafe extern "system" fn(*mut core::ffi::c_void, *mut BSTR) -> HRESULT, |
74 | } |
75 | pub const IID_IUnknown: GUID = GUID::from_u128(uuid:0x00000000_0000_0000_c000_000000000046); |
76 | #[repr (C)] |
77 | pub struct IUnknown_Vtbl { |
78 | pub QueryInterface: unsafe extern "system" fn( |
79 | this: *mut core::ffi::c_void, |
80 | iid: *const GUID, |
81 | interface: *mut *mut core::ffi::c_void, |
82 | ) -> HRESULT, |
83 | pub AddRef: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, |
84 | pub Release: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, |
85 | } |
86 | pub type LOAD_LIBRARY_FLAGS = u32; |
87 | pub const LOAD_LIBRARY_SEARCH_DEFAULT_DIRS: LOAD_LIBRARY_FLAGS = 4096u32; |
88 | pub type PCSTR = *const u8; |
89 | pub type PCWSTR = *const u16; |
90 | pub type PWSTR = *mut u16; |
91 | pub type WIN32_ERROR = u32; |
92 | |