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