diff --git a/crates/tests/misc/standalone/src/b_arch.rs b/crates/tests/misc/standalone/src/b_arch.rs index 062fa9e195..0f3890c23d 100644 --- a/crates/tests/misc/standalone/src/b_arch.rs +++ b/crates/tests/misc/standalone/src/b_arch.rs @@ -15,35 +15,35 @@ windows_targets::link!("user32.dll" "system" fn GetWindowLongPtrW(hwnd : HWND, n #[cfg(target_pointer_width = "32")] pub use GetWindowLongW as GetWindowLongPtrW; windows_targets::link!("user32.dll" "system" fn GetWindowLongW(hwnd : HWND, nindex : WINDOW_LONG_PTR_INDEX) -> i32); -pub type WINDOW_LONG_PTR_INDEX = i32; pub type HANDLE = *mut core::ffi::c_void; pub type HWND = *mut core::ffi::c_void; +pub type PSTR = *mut u8; +pub type WINDOW_LONG_PTR_INDEX = i32; #[repr(C)] -#[cfg(any( - target_arch = "aarch64", - target_arch = "arm64ec", - target_arch = "x86_64" -))] +#[cfg(target_arch = "x86")] #[derive(Clone, Copy)] pub struct WSADATA { pub wVersion: u16, pub wHighVersion: u16, + pub szDescription: [i8; 257], + pub szSystemStatus: [i8; 129], pub iMaxSockets: u16, pub iMaxUdpDg: u16, pub lpVendorInfo: PSTR, - pub szDescription: [i8; 257], - pub szSystemStatus: [i8; 129], } #[repr(C)] -#[cfg(target_arch = "x86")] +#[cfg(any( + target_arch = "aarch64", + target_arch = "arm64ec", + target_arch = "x86_64" +))] #[derive(Clone, Copy)] pub struct WSADATA { pub wVersion: u16, pub wHighVersion: u16, - pub szDescription: [i8; 257], - pub szSystemStatus: [i8; 129], pub iMaxSockets: u16, pub iMaxUdpDg: u16, pub lpVendorInfo: PSTR, + pub szDescription: [i8; 257], + pub szSystemStatus: [i8; 129], } -pub type PSTR = *mut u8; diff --git a/crates/tests/misc/standalone/src/b_arch_dependencies.rs b/crates/tests/misc/standalone/src/b_arch_dependencies.rs index 25a1182aa2..9779347484 100644 --- a/crates/tests/misc/standalone/src/b_arch_dependencies.rs +++ b/crates/tests/misc/standalone/src/b_arch_dependencies.rs @@ -7,7 +7,6 @@ )] windows_targets::link!("kernel32.dll" "system" fn RtlCaptureContext(contextrecord : *mut CONTEXT)); -pub type CONTEXT_FLAGS = u32; #[repr(C)] #[derive(Clone, Copy)] pub union ARM64_NT_NEON128 { @@ -24,64 +23,34 @@ pub struct ARM64_NT_NEON128_0 { pub High: i64, } #[repr(C)] -#[cfg(target_arch = "aarch64")] +#[cfg(target_arch = "x86")] #[derive(Clone, Copy)] pub struct CONTEXT { pub ContextFlags: CONTEXT_FLAGS, - pub Cpsr: u32, - pub Anonymous: CONTEXT_0, - pub Sp: u64, - pub Pc: u64, - pub V: [ARM64_NT_NEON128; 32], - pub Fpcr: u32, - pub Fpsr: u32, - pub Bcr: [u32; 8], - pub Bvr: [u64; 8], - pub Wcr: [u32; 2], - pub Wvr: [u64; 2], -} -#[repr(C)] -#[cfg(target_arch = "aarch64")] -#[derive(Clone, Copy)] -pub union CONTEXT_0 { - pub Anonymous: CONTEXT_0_0, - pub X: [u64; 31], -} -#[repr(C)] -#[cfg(target_arch = "aarch64")] -#[derive(Clone, Copy)] -pub struct CONTEXT_0_0 { - pub X0: u64, - pub X1: u64, - pub X2: u64, - pub X3: u64, - pub X4: u64, - pub X5: u64, - pub X6: u64, - pub X7: u64, - pub X8: u64, - pub X9: u64, - pub X10: u64, - pub X11: u64, - pub X12: u64, - pub X13: u64, - pub X14: u64, - pub X15: u64, - pub X16: u64, - pub X17: u64, - pub X18: u64, - pub X19: u64, - pub X20: u64, - pub X21: u64, - pub X22: u64, - pub X23: u64, - pub X24: u64, - pub X25: u64, - pub X26: u64, - pub X27: u64, - pub X28: u64, - pub Fp: u64, - pub Lr: u64, + pub Dr0: u32, + pub Dr1: u32, + pub Dr2: u32, + pub Dr3: u32, + pub Dr6: u32, + pub Dr7: u32, + pub FloatSave: FLOATING_SAVE_AREA, + pub SegGs: u32, + pub SegFs: u32, + pub SegEs: u32, + pub SegDs: u32, + pub Edi: u32, + pub Esi: u32, + pub Ebx: u32, + pub Edx: u32, + pub Ecx: u32, + pub Eax: u32, + pub Ebp: u32, + pub Eip: u32, + pub SegCs: u32, + pub EFlags: u32, + pub Esp: u32, + pub SegSs: u32, + pub ExtendedRegisters: [u8; 512], } #[repr(C)] #[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))] @@ -165,41 +134,68 @@ pub struct CONTEXT_0_0 { pub Xmm15: M128A, } #[repr(C)] -#[cfg(target_arch = "x86")] +#[cfg(target_arch = "aarch64")] #[derive(Clone, Copy)] pub struct CONTEXT { pub ContextFlags: CONTEXT_FLAGS, - pub Dr0: u32, - pub Dr1: u32, - pub Dr2: u32, - pub Dr3: u32, - pub Dr6: u32, - pub Dr7: u32, - pub FloatSave: FLOATING_SAVE_AREA, - pub SegGs: u32, - pub SegFs: u32, - pub SegEs: u32, - pub SegDs: u32, - pub Edi: u32, - pub Esi: u32, - pub Ebx: u32, - pub Edx: u32, - pub Ecx: u32, - pub Eax: u32, - pub Ebp: u32, - pub Eip: u32, - pub SegCs: u32, - pub EFlags: u32, - pub Esp: u32, - pub SegSs: u32, - pub ExtendedRegisters: [u8; 512], + pub Cpsr: u32, + pub Anonymous: CONTEXT_0, + pub Sp: u64, + pub Pc: u64, + pub V: [ARM64_NT_NEON128; 32], + pub Fpcr: u32, + pub Fpsr: u32, + pub Bcr: [u32; 8], + pub Bvr: [u64; 8], + pub Wcr: [u32; 2], + pub Wvr: [u64; 2], } #[repr(C)] -#[cfg(any( - target_arch = "aarch64", - target_arch = "arm64ec", - target_arch = "x86_64" -))] +#[cfg(target_arch = "aarch64")] +#[derive(Clone, Copy)] +pub union CONTEXT_0 { + pub Anonymous: CONTEXT_0_0, + pub X: [u64; 31], +} +#[repr(C)] +#[cfg(target_arch = "aarch64")] +#[derive(Clone, Copy)] +pub struct CONTEXT_0_0 { + pub X0: u64, + pub X1: u64, + pub X2: u64, + pub X3: u64, + pub X4: u64, + pub X5: u64, + pub X6: u64, + pub X7: u64, + pub X8: u64, + pub X9: u64, + pub X10: u64, + pub X11: u64, + pub X12: u64, + pub X13: u64, + pub X14: u64, + pub X15: u64, + pub X16: u64, + pub X17: u64, + pub X18: u64, + pub X19: u64, + pub X20: u64, + pub X21: u64, + pub X22: u64, + pub X23: u64, + pub X24: u64, + pub X25: u64, + pub X26: u64, + pub X27: u64, + pub X28: u64, + pub Fp: u64, + pub Lr: u64, +} +pub type CONTEXT_FLAGS = u32; +#[repr(C)] +#[cfg(target_arch = "x86")] #[derive(Clone, Copy)] pub struct FLOATING_SAVE_AREA { pub ControlWord: u32, @@ -210,10 +206,14 @@ pub struct FLOATING_SAVE_AREA { pub DataOffset: u32, pub DataSelector: u32, pub RegisterArea: [u8; 80], - pub Cr0NpxState: u32, + pub Spare0: u32, } #[repr(C)] -#[cfg(target_arch = "x86")] +#[cfg(any( + target_arch = "aarch64", + target_arch = "arm64ec", + target_arch = "x86_64" +))] #[derive(Clone, Copy)] pub struct FLOATING_SAVE_AREA { pub ControlWord: u32, @@ -224,7 +224,7 @@ pub struct FLOATING_SAVE_AREA { pub DataOffset: u32, pub DataSelector: u32, pub RegisterArea: [u8; 80], - pub Spare0: u32, + pub Cr0NpxState: u32, } #[repr(C)] #[derive(Clone, Copy)] @@ -233,11 +233,7 @@ pub struct M128A { pub High: i64, } #[repr(C)] -#[cfg(any( - target_arch = "aarch64", - target_arch = "arm64ec", - target_arch = "x86_64" -))] +#[cfg(target_arch = "x86")] #[derive(Clone, Copy)] pub struct XSAVE_FORMAT { pub ControlWord: u16, @@ -254,11 +250,15 @@ pub struct XSAVE_FORMAT { pub MxCsr: u32, pub MxCsr_Mask: u32, pub FloatRegisters: [M128A; 8], - pub XmmRegisters: [M128A; 16], - pub Reserved4: [u8; 96], + pub XmmRegisters: [M128A; 8], + pub Reserved4: [u8; 224], } #[repr(C)] -#[cfg(target_arch = "x86")] +#[cfg(any( + target_arch = "aarch64", + target_arch = "arm64ec", + target_arch = "x86_64" +))] #[derive(Clone, Copy)] pub struct XSAVE_FORMAT { pub ControlWord: u16, @@ -275,6 +275,6 @@ pub struct XSAVE_FORMAT { pub MxCsr: u32, pub MxCsr_Mask: u32, pub FloatRegisters: [M128A; 8], - pub XmmRegisters: [M128A; 8], - pub Reserved4: [u8; 224], + pub XmmRegisters: [M128A; 16], + pub Reserved4: [u8; 96], } diff --git a/crates/tests/misc/standalone/src/b_bstr.rs b/crates/tests/misc/standalone/src/b_bstr.rs index 64eb8412e7..b7e6a56295 100644 --- a/crates/tests/misc/standalone/src/b_bstr.rs +++ b/crates/tests/misc/standalone/src/b_bstr.rs @@ -7,5 +7,5 @@ )] windows_targets::link!("oleaut32.dll" "system" fn SysAllocString(psz : PCWSTR) -> BSTR); -pub type PCWSTR = *const u16; pub type BSTR = *const u16; +pub type PCWSTR = *const u16; diff --git a/crates/tests/misc/standalone/src/b_constant_types.rs b/crates/tests/misc/standalone/src/b_constant_types.rs index 45e830dc19..fdf49ce94c 100644 --- a/crates/tests/misc/standalone/src/b_constant_types.rs +++ b/crates/tests/misc/standalone/src/b_constant_types.rs @@ -6,11 +6,11 @@ clippy::all )] -pub type NTSTATUS = i32; pub const CMC_ADD_ATTRIBUTES: PCSTR = 63i32 as _; pub const E_ACCESSDENIED: HRESULT = 0x80070005_u32 as _; +pub type HRESULT = i32; pub const IDC_UPARROW: PCWSTR = 32516u16 as _; -pub const STATUS_NOT_FOUND: NTSTATUS = 0xC0000225_u32 as _; +pub type NTSTATUS = i32; pub type PCSTR = *const u8; pub type PCWSTR = *const u16; -pub type HRESULT = i32; +pub const STATUS_NOT_FOUND: NTSTATUS = 0xC0000225_u32 as _; diff --git a/crates/tests/misc/standalone/src/b_depends.rs b/crates/tests/misc/standalone/src/b_depends.rs index 927e89af77..5d254b03b5 100644 --- a/crates/tests/misc/standalone/src/b_depends.rs +++ b/crates/tests/misc/standalone/src/b_depends.rs @@ -6,6 +6,8 @@ clippy::all )] +pub type ADDRESS_FAMILY = u16; +pub type HANDLE = *mut core::ffi::c_void; pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = Option< unsafe extern "system" fn( dwerror: u32, @@ -14,8 +16,6 @@ pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = Option< dwflags: u32, ), >; -pub type ADDRESS_FAMILY = u16; -pub type HANDLE = *mut core::ffi::c_void; #[repr(C)] #[derive(Clone, Copy)] pub struct OVERLAPPED { @@ -36,6 +36,7 @@ pub struct OVERLAPPED_0_0 { pub Offset: u32, pub OffsetHigh: u32, } +pub type PSTR = *mut u8; #[repr(C)] #[derive(Clone, Copy)] pub struct SOCKADDR { @@ -67,4 +68,3 @@ pub struct WSASENDMSG { pub lpOverlapped: *mut OVERLAPPED, pub lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, } -pub type PSTR = *mut u8; diff --git a/crates/tests/misc/standalone/src/b_inspectable.rs b/crates/tests/misc/standalone/src/b_inspectable.rs index 1f54b8516e..eb30527f47 100644 --- a/crates/tests/misc/standalone/src/b_inspectable.rs +++ b/crates/tests/misc/standalone/src/b_inspectable.rs @@ -7,23 +7,6 @@ )] windows_targets::link!("api-ms-win-core-winrt-l1-1-0.dll" "system" fn RoActivateInstance(activatableclassid : HSTRING, instance : *mut * mut core::ffi::c_void) -> HRESULT); -pub type HSTRING = *mut core::ffi::c_void; -pub const IID_IInspectable: GUID = GUID::from_u128(0xaf86e2e0_b12d_4c6a_9c5a_d7aa65101e90); -#[repr(C)] -pub struct IInspectable_Vtbl { - pub base: IUnknown_Vtbl, - pub GetIids: unsafe extern "system" fn( - this: *mut core::ffi::c_void, - count: *mut u32, - values: *mut *mut GUID, - ) -> HRESULT, - pub GetRuntimeClassName: unsafe extern "system" fn( - this: *mut core::ffi::c_void, - value: *mut *mut core::ffi::c_void, - ) -> HRESULT, - pub GetTrustLevel: - unsafe extern "system" fn(this: *mut core::ffi::c_void, value: *mut i32) -> HRESULT, -} #[repr(C)] #[derive(Clone, Copy)] pub struct GUID { @@ -54,3 +37,20 @@ pub struct IUnknown_Vtbl { pub AddRef: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, pub Release: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, } +pub const IID_IInspectable: GUID = GUID::from_u128(0xaf86e2e0_b12d_4c6a_9c5a_d7aa65101e90); +#[repr(C)] +pub struct IInspectable_Vtbl { + pub base: IUnknown_Vtbl, + pub GetIids: unsafe extern "system" fn( + this: *mut core::ffi::c_void, + count: *mut u32, + values: *mut *mut GUID, + ) -> HRESULT, + pub GetRuntimeClassName: unsafe extern "system" fn( + this: *mut core::ffi::c_void, + value: *mut *mut core::ffi::c_void, + ) -> HRESULT, + pub GetTrustLevel: + unsafe extern "system" fn(this: *mut core::ffi::c_void, value: *mut i32) -> HRESULT, +} +pub type HSTRING = *mut core::ffi::c_void; diff --git a/crates/tests/misc/standalone/src/b_nested.rs b/crates/tests/misc/standalone/src/b_nested.rs index e76e4e55d1..d49a04ae0c 100644 --- a/crates/tests/misc/standalone/src/b_nested.rs +++ b/crates/tests/misc/standalone/src/b_nested.rs @@ -6,77 +6,6 @@ clippy::all )] -pub const IID_ISequentialStream: GUID = GUID::from_u128(0x0c733a30_2a1c_11ce_ade5_00aa0044773d); -#[repr(C)] -pub struct ISequentialStream_Vtbl { - pub base__: IUnknown_Vtbl, - pub Read: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut core::ffi::c_void, - u32, - *mut u32, - ) -> HRESULT, - pub Write: unsafe extern "system" fn( - *mut core::ffi::c_void, - *const core::ffi::c_void, - u32, - *mut u32, - ) -> HRESULT, -} -pub const IID_IStorage: GUID = GUID::from_u128(0x0000000b_0000_0000_c000_000000000046); -#[repr(C)] -pub struct IStorage_Vtbl { - pub base__: IUnknown_Vtbl, - CreateStream: usize, - OpenStream: usize, - CreateStorage: usize, - OpenStorage: usize, - pub CopyTo: unsafe extern "system" fn( - *mut core::ffi::c_void, - u32, - *const GUID, - *const *const u16, - *mut core::ffi::c_void, - ) -> HRESULT, - MoveElementTo: usize, - pub Commit: unsafe extern "system" fn(*mut core::ffi::c_void, u32) -> HRESULT, - pub Revert: unsafe extern "system" fn(*mut core::ffi::c_void) -> HRESULT, - EnumElements: usize, - pub DestroyElement: unsafe extern "system" fn(*mut core::ffi::c_void, PCWSTR) -> HRESULT, - pub RenameElement: unsafe extern "system" fn(*mut core::ffi::c_void, PCWSTR, PCWSTR) -> HRESULT, - SetElementTimes: usize, - pub SetClass: unsafe extern "system" fn(*mut core::ffi::c_void, *const GUID) -> HRESULT, - pub SetStateBits: unsafe extern "system" fn(*mut core::ffi::c_void, u32, u32) -> HRESULT, - Stat: usize, -} -pub const IID_IStream: GUID = GUID::from_u128(0x0000000c_0000_0000_c000_000000000046); -#[repr(C)] -pub struct IStream_Vtbl { - pub base__: ISequentialStream_Vtbl, - Seek: usize, - pub SetSize: unsafe extern "system" fn(*mut core::ffi::c_void, u64) -> HRESULT, - pub CopyTo: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut core::ffi::c_void, - u64, - *mut u64, - *mut u64, - ) -> HRESULT, - Commit: usize, - pub Revert: unsafe extern "system" fn(*mut core::ffi::c_void) -> HRESULT, - LockRegion: usize, - pub UnlockRegion: unsafe extern "system" fn(*mut core::ffi::c_void, u64, u64, u32) -> HRESULT, - Stat: usize, - pub Clone: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut *mut core::ffi::c_void) -> HRESULT, -} -pub type DEVMODE_COLLATE = i16; -pub type DEVMODE_COLOR = i16; -pub type DEVMODE_DISPLAY_FIXED_OUTPUT = u32; -pub type DEVMODE_DISPLAY_ORIENTATION = u32; -pub type DEVMODE_DUPLEX = i16; -pub type DEVMODE_FIELD_FLAGS = u32; -pub type DEVMODE_TRUETYPE_OPTION = i16; #[repr(C)] #[derive(Clone, Copy)] pub struct DEVMODEW { @@ -139,36 +68,13 @@ pub union DEVMODEW_1 { pub dmDisplayFlags: u32, pub dmNup: u32, } -pub type HBITMAP = *mut core::ffi::c_void; -pub type HENHMETAFILE = *mut core::ffi::c_void; -pub type HGDIOBJ = *mut core::ffi::c_void; -pub type HGLOBAL = *mut core::ffi::c_void; -#[repr(C)] -#[derive(Clone, Copy)] -pub struct POINTL { - pub x: i32, - pub y: i32, -} -#[repr(C)] -#[derive(Clone, Copy)] -pub struct STGMEDIUM { - pub tymed: u32, - pub u: STGMEDIUM_0, - pub pUnkForRelease: *mut core::ffi::c_void, -} -#[repr(C)] -#[derive(Clone, Copy)] -pub union STGMEDIUM_0 { - pub hBitmap: HBITMAP, - pub hMetaFilePict: *mut core::ffi::c_void, - pub hEnhMetaFile: HENHMETAFILE, - pub hGlobal: HGLOBAL, - pub lpszFileName: PWSTR, - pub pstm: *mut core::ffi::c_void, - pub pstg: *mut core::ffi::c_void, -} -pub type PWSTR = *mut u16; -pub type PCWSTR = *const u16; +pub type DEVMODE_COLLATE = i16; +pub type DEVMODE_COLOR = i16; +pub type DEVMODE_DISPLAY_FIXED_OUTPUT = u32; +pub type DEVMODE_DISPLAY_ORIENTATION = u32; +pub type DEVMODE_DUPLEX = i16; +pub type DEVMODE_FIELD_FLAGS = u32; +pub type DEVMODE_TRUETYPE_OPTION = i16; #[repr(C)] #[derive(Clone, Copy)] pub struct GUID { @@ -187,7 +93,75 @@ impl GUID { } } } +pub type HBITMAP = *mut core::ffi::c_void; +pub type HENHMETAFILE = *mut core::ffi::c_void; +pub type HGDIOBJ = *mut core::ffi::c_void; +pub type HGLOBAL = *mut core::ffi::c_void; pub type HRESULT = i32; +pub const IID_ISequentialStream: GUID = GUID::from_u128(0x0c733a30_2a1c_11ce_ade5_00aa0044773d); +#[repr(C)] +pub struct ISequentialStream_Vtbl { + pub base__: IUnknown_Vtbl, + pub Read: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut core::ffi::c_void, + u32, + *mut u32, + ) -> HRESULT, + pub Write: unsafe extern "system" fn( + *mut core::ffi::c_void, + *const core::ffi::c_void, + u32, + *mut u32, + ) -> HRESULT, +} +pub const IID_IStorage: GUID = GUID::from_u128(0x0000000b_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IStorage_Vtbl { + pub base__: IUnknown_Vtbl, + CreateStream: usize, + OpenStream: usize, + CreateStorage: usize, + OpenStorage: usize, + pub CopyTo: unsafe extern "system" fn( + *mut core::ffi::c_void, + u32, + *const GUID, + *const *const u16, + *mut core::ffi::c_void, + ) -> HRESULT, + MoveElementTo: usize, + pub Commit: unsafe extern "system" fn(*mut core::ffi::c_void, u32) -> HRESULT, + pub Revert: unsafe extern "system" fn(*mut core::ffi::c_void) -> HRESULT, + EnumElements: usize, + pub DestroyElement: unsafe extern "system" fn(*mut core::ffi::c_void, PCWSTR) -> HRESULT, + pub RenameElement: unsafe extern "system" fn(*mut core::ffi::c_void, PCWSTR, PCWSTR) -> HRESULT, + SetElementTimes: usize, + pub SetClass: unsafe extern "system" fn(*mut core::ffi::c_void, *const GUID) -> HRESULT, + pub SetStateBits: unsafe extern "system" fn(*mut core::ffi::c_void, u32, u32) -> HRESULT, + Stat: usize, +} +pub const IID_IStream: GUID = GUID::from_u128(0x0000000c_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IStream_Vtbl { + pub base__: ISequentialStream_Vtbl, + Seek: usize, + pub SetSize: unsafe extern "system" fn(*mut core::ffi::c_void, u64) -> HRESULT, + pub CopyTo: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut core::ffi::c_void, + u64, + *mut u64, + *mut u64, + ) -> HRESULT, + Commit: usize, + pub Revert: unsafe extern "system" fn(*mut core::ffi::c_void) -> HRESULT, + LockRegion: usize, + pub UnlockRegion: unsafe extern "system" fn(*mut core::ffi::c_void, u64, u64, u32) -> HRESULT, + Stat: usize, + pub Clone: + unsafe extern "system" fn(*mut core::ffi::c_void, *mut *mut core::ffi::c_void) -> HRESULT, +} pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); #[repr(C)] pub struct IUnknown_Vtbl { @@ -199,3 +173,29 @@ pub struct IUnknown_Vtbl { pub AddRef: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, pub Release: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, } +pub type PCWSTR = *const u16; +#[repr(C)] +#[derive(Clone, Copy)] +pub struct POINTL { + pub x: i32, + pub y: i32, +} +pub type PWSTR = *mut u16; +#[repr(C)] +#[derive(Clone, Copy)] +pub struct STGMEDIUM { + pub tymed: u32, + pub u: STGMEDIUM_0, + pub pUnkForRelease: *mut core::ffi::c_void, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub union STGMEDIUM_0 { + pub hBitmap: HBITMAP, + pub hMetaFilePict: *mut core::ffi::c_void, + pub hEnhMetaFile: HENHMETAFILE, + pub hGlobal: HGLOBAL, + pub lpszFileName: PWSTR, + pub pstm: *mut core::ffi::c_void, + pub pstg: *mut core::ffi::c_void, +} diff --git a/crates/tests/misc/standalone/src/b_pstr.rs b/crates/tests/misc/standalone/src/b_pstr.rs index 8de2b3502f..cd535fb601 100644 --- a/crates/tests/misc/standalone/src/b_pstr.rs +++ b/crates/tests/misc/standalone/src/b_pstr.rs @@ -7,5 +7,5 @@ )] windows_targets::link!("oleaut32.dll" "system" fn VarI1FromDate(datein : f64, pcout : PSTR) -> HRESULT); -pub type PSTR = *mut u8; pub type HRESULT = i32; +pub type PSTR = *mut u8; diff --git a/crates/tests/misc/standalone/src/b_std.rs b/crates/tests/misc/standalone/src/b_std.rs index 964c35b07e..14387b4773 100644 --- a/crates/tests/misc/standalone/src/b_std.rs +++ b/crates/tests/misc/standalone/src/b_std.rs @@ -11,8 +11,6 @@ windows_targets::link!("kernel32.dll" "system" fn GetLastError() -> WIN32_ERROR) windows_targets::link!("advapi32.dll" "system" "SystemFunction036" fn RtlGenRandom(randombuffer : *mut core::ffi::c_void, randombufferlength : u32) -> BOOLEAN); windows_targets::link!("ws2_32.dll" "system" fn socket(af : i32, r#type : WINSOCK_SOCKET_TYPE, protocol : i32) -> SOCKET); windows_targets::link!("user32.dll" "cdecl" fn wsprintfA(param0 : PSTR, param1 : PCSTR, ...) -> i32); -pub type WIN32_ERROR = u32; -pub type WINSOCK_SOCKET_TYPE = i32; pub type BCRYPT_ALG_HANDLE = *mut core::ffi::c_void; pub type BCRYPT_HANDLE = *mut core::ffi::c_void; pub type BOOL = i32; @@ -20,6 +18,8 @@ pub type BOOLEAN = u8; pub type HANDLE = *mut core::ffi::c_void; pub type HINSTANCE = *mut core::ffi::c_void; pub type HMODULE = *mut core::ffi::c_void; -pub type SOCKET = usize; -pub type PSTR = *mut u8; pub type PCSTR = *const u8; +pub type PSTR = *mut u8; +pub type SOCKET = usize; +pub type WIN32_ERROR = u32; +pub type WINSOCK_SOCKET_TYPE = i32; diff --git a/crates/tests/misc/standalone/src/b_test.rs b/crates/tests/misc/standalone/src/b_test.rs index 4a48fd744f..853133fab2 100644 --- a/crates/tests/misc/standalone/src/b_test.rs +++ b/crates/tests/misc/standalone/src/b_test.rs @@ -12,23 +12,9 @@ windows_targets::link!("kernel32.dll" "system" fn CreateEventW(lpeventattributes windows_targets::link!("kernel32.dll" "system" fn SetEvent(hevent : HANDLE) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn WaitForSingleObject(hhandle : HANDLE, dwmilliseconds : u32) -> WAIT_EVENT); windows_targets::link!("user32.dll" "cdecl" fn wsprintfA(param0 : PSTR, param1 : PCSTR, ...) -> i32); -pub type CLSCTX = u32; -pub type WAIT_EVENT = u32; pub type BOOL = i32; -pub type HANDLE = *mut core::ffi::c_void; -#[repr(C)] -#[derive(Clone, Copy)] -pub struct SECURITY_ATTRIBUTES { - pub nLength: u32, - pub lpSecurityDescriptor: *mut core::ffi::c_void, - pub bInheritHandle: BOOL, -} -pub const UIAnimationManager: GUID = GUID::from_u128(0x4c1fc63a_695c_47e8_a339_1a194be3d0b8); +pub type CLSCTX = u32; pub const CLSCTX_ALL: CLSCTX = 23u32; -pub const STGTY_REPEAT: i32 = 256i32; -pub type PSTR = *mut u8; -pub type PCSTR = *const u8; -pub type PCWSTR = *const u16; #[repr(C)] #[derive(Clone, Copy)] pub struct GUID { @@ -47,6 +33,7 @@ impl GUID { } } } +pub type HANDLE = *mut core::ffi::c_void; pub type HRESULT = i32; pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); #[repr(C)] @@ -59,3 +46,16 @@ pub struct IUnknown_Vtbl { pub AddRef: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, pub Release: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, } +pub type PCSTR = *const u8; +pub type PCWSTR = *const u16; +pub type PSTR = *mut u8; +#[repr(C)] +#[derive(Clone, Copy)] +pub struct SECURITY_ATTRIBUTES { + pub nLength: u32, + pub lpSecurityDescriptor: *mut core::ffi::c_void, + pub bInheritHandle: BOOL, +} +pub const STGTY_REPEAT: i32 = 256i32; +pub const UIAnimationManager: GUID = GUID::from_u128(0x4c1fc63a_695c_47e8_a339_1a194be3d0b8); +pub type WAIT_EVENT = u32; diff --git a/crates/tests/misc/standalone/src/b_uri.rs b/crates/tests/misc/standalone/src/b_uri.rs index 7f9ceda547..0bb53ac6cb 100644 --- a/crates/tests/misc/standalone/src/b_uri.rs +++ b/crates/tests/misc/standalone/src/b_uri.rs @@ -6,6 +6,215 @@ clippy::all )] +windows_core::imp::define_interface!( + IStringable, + IStringable_Vtbl, + 0x96369f54_8eb6_48f0_abce_c1b211e627c3 +); +impl windows_core::RuntimeType for IStringable { + const SIGNATURE: windows_core::imp::ConstBuffer = + windows_core::imp::ConstBuffer::for_interface::(); +} +windows_core::imp::interface_hierarchy!( + IStringable, + windows_core::IUnknown, + windows_core::IInspectable +); +impl IStringable { + pub fn ToString(&self) -> windows_core::Result { + let this = self; + unsafe { + let mut result__ = core::mem::zeroed(); + (windows_core::Interface::vtable(this).ToString)( + windows_core::Interface::as_raw(this), + &mut result__, + ) + .map(|| core::mem::transmute(result__)) + } + } +} +impl windows_core::RuntimeName for IStringable { + const NAME: &'static str = "Windows.Foundation.IStringable"; +} +pub trait IStringable_Impl: windows_core::IUnknownImpl { + fn ToString(&self) -> windows_core::Result; +} +impl IStringable_Vtbl { + pub const fn new() -> Self { + unsafe extern "system" fn ToString( + this: *mut core::ffi::c_void, + result__: *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT { + let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); + match IStringable_Impl::ToString(this) { + Ok(ok__) => { + result__.write(core::mem::transmute_copy(&ok__)); + core::mem::forget(ok__); + windows_core::HRESULT(0) + } + Err(err) => err.into(), + } + } + Self { + base__: windows_core::IInspectable_Vtbl::new::(), + ToString: ToString::, + } + } + pub fn matches(iid: &windows_core::GUID) -> bool { + iid == &::IID + } +} +#[repr(C)] +pub struct IStringable_Vtbl { + pub base__: windows_core::IInspectable_Vtbl, + pub ToString: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, +} +windows_core::imp::define_interface!( + IUriEscapeStatics, + IUriEscapeStatics_Vtbl, + 0xc1d432ba_c824_4452_a7fd_512bc3bbe9a1 +); +impl windows_core::RuntimeType for IUriEscapeStatics { + const SIGNATURE: windows_core::imp::ConstBuffer = + windows_core::imp::ConstBuffer::for_interface::(); +} +#[repr(C)] +pub struct IUriEscapeStatics_Vtbl { + pub base__: windows_core::IInspectable_Vtbl, + pub UnescapeComponent: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub EscapeComponent: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, +} +windows_core::imp::define_interface!( + IUriRuntimeClass, + IUriRuntimeClass_Vtbl, + 0x9e365e57_48b2_4160_956f_c7385120bbfc +); +impl windows_core::RuntimeType for IUriRuntimeClass { + const SIGNATURE: windows_core::imp::ConstBuffer = + windows_core::imp::ConstBuffer::for_interface::(); +} +#[repr(C)] +pub struct IUriRuntimeClass_Vtbl { + pub base__: windows_core::IInspectable_Vtbl, + pub AbsoluteUri: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub DisplayUri: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub Domain: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub Extension: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub Fragment: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub Host: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub Password: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub Path: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub Query: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + get_QueryParsed: usize, + pub RawUri: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub SchemeName: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub UserName: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub Port: unsafe extern "system" fn(*mut core::ffi::c_void, *mut i32) -> windows_core::HRESULT, + pub Suspicious: + unsafe extern "system" fn(*mut core::ffi::c_void, *mut bool) -> windows_core::HRESULT, + pub Equals: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut core::ffi::c_void, + *mut bool, + ) -> windows_core::HRESULT, + pub CombineUri: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, +} +windows_core::imp::define_interface!( + IUriRuntimeClassFactory, + IUriRuntimeClassFactory_Vtbl, + 0x44a9796f_723e_4fdf_a218_033e75b0c084 +); +impl windows_core::RuntimeType for IUriRuntimeClassFactory { + const SIGNATURE: windows_core::imp::ConstBuffer = + windows_core::imp::ConstBuffer::for_interface::(); +} +#[repr(C)] +pub struct IUriRuntimeClassFactory_Vtbl { + pub base__: windows_core::IInspectable_Vtbl, + pub CreateUri: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub CreateWithRelativeUri: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut core::ffi::c_void, + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, +} +windows_core::imp::define_interface!( + IUriRuntimeClassWithAbsoluteCanonicalUri, + IUriRuntimeClassWithAbsoluteCanonicalUri_Vtbl, + 0x758d9661_221c_480f_a339_50656673f46f +); +impl windows_core::RuntimeType for IUriRuntimeClassWithAbsoluteCanonicalUri { + const SIGNATURE: windows_core::imp::ConstBuffer = + windows_core::imp::ConstBuffer::for_interface::(); +} +#[repr(C)] +pub struct IUriRuntimeClassWithAbsoluteCanonicalUri_Vtbl { + pub base__: windows_core::IInspectable_Vtbl, + pub AbsoluteCanonicalUri: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, + pub DisplayIri: unsafe extern "system" fn( + *mut core::ffi::c_void, + *mut *mut core::ffi::c_void, + ) -> windows_core::HRESULT, +} #[repr(transparent)] #[derive(Clone, Debug, Eq, PartialEq)] pub struct Uri(windows_core::IUnknown); @@ -311,212 +520,3 @@ impl windows_core::RuntimeName for Uri { } unsafe impl Send for Uri {} unsafe impl Sync for Uri {} -windows_core::imp::define_interface!( - IStringable, - IStringable_Vtbl, - 0x96369f54_8eb6_48f0_abce_c1b211e627c3 -); -impl windows_core::RuntimeType for IStringable { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::for_interface::(); -} -windows_core::imp::interface_hierarchy!( - IStringable, - windows_core::IUnknown, - windows_core::IInspectable -); -impl IStringable { - pub fn ToString(&self) -> windows_core::Result { - let this = self; - unsafe { - let mut result__ = core::mem::zeroed(); - (windows_core::Interface::vtable(this).ToString)( - windows_core::Interface::as_raw(this), - &mut result__, - ) - .map(|| core::mem::transmute(result__)) - } - } -} -impl windows_core::RuntimeName for IStringable { - const NAME: &'static str = "Windows.Foundation.IStringable"; -} -pub trait IStringable_Impl: windows_core::IUnknownImpl { - fn ToString(&self) -> windows_core::Result; -} -impl IStringable_Vtbl { - pub const fn new() -> Self { - unsafe extern "system" fn ToString( - this: *mut core::ffi::c_void, - result__: *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT { - let this: &Identity = &*((this as *const *const ()).offset(OFFSET) as *const Identity); - match IStringable_Impl::ToString(this) { - Ok(ok__) => { - result__.write(core::mem::transmute_copy(&ok__)); - core::mem::forget(ok__); - windows_core::HRESULT(0) - } - Err(err) => err.into(), - } - } - Self { - base__: windows_core::IInspectable_Vtbl::new::(), - ToString: ToString::, - } - } - pub fn matches(iid: &windows_core::GUID) -> bool { - iid == &::IID - } -} -#[repr(C)] -pub struct IStringable_Vtbl { - pub base__: windows_core::IInspectable_Vtbl, - pub ToString: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, -} -windows_core::imp::define_interface!( - IUriEscapeStatics, - IUriEscapeStatics_Vtbl, - 0xc1d432ba_c824_4452_a7fd_512bc3bbe9a1 -); -impl windows_core::RuntimeType for IUriEscapeStatics { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::for_interface::(); -} -#[repr(C)] -pub struct IUriEscapeStatics_Vtbl { - pub base__: windows_core::IInspectable_Vtbl, - pub UnescapeComponent: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub EscapeComponent: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, -} -windows_core::imp::define_interface!( - IUriRuntimeClass, - IUriRuntimeClass_Vtbl, - 0x9e365e57_48b2_4160_956f_c7385120bbfc -); -impl windows_core::RuntimeType for IUriRuntimeClass { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::for_interface::(); -} -#[repr(C)] -pub struct IUriRuntimeClass_Vtbl { - pub base__: windows_core::IInspectable_Vtbl, - pub AbsoluteUri: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub DisplayUri: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub Domain: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub Extension: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub Fragment: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub Host: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub Password: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub Path: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub Query: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - get_QueryParsed: usize, - pub RawUri: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub SchemeName: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub UserName: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub Port: unsafe extern "system" fn(*mut core::ffi::c_void, *mut i32) -> windows_core::HRESULT, - pub Suspicious: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut bool) -> windows_core::HRESULT, - pub Equals: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut core::ffi::c_void, - *mut bool, - ) -> windows_core::HRESULT, - pub CombineUri: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, -} -windows_core::imp::define_interface!( - IUriRuntimeClassFactory, - IUriRuntimeClassFactory_Vtbl, - 0x44a9796f_723e_4fdf_a218_033e75b0c084 -); -impl windows_core::RuntimeType for IUriRuntimeClassFactory { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::for_interface::(); -} -#[repr(C)] -pub struct IUriRuntimeClassFactory_Vtbl { - pub base__: windows_core::IInspectable_Vtbl, - pub CreateUri: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub CreateWithRelativeUri: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut core::ffi::c_void, - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, -} -windows_core::imp::define_interface!( - IUriRuntimeClassWithAbsoluteCanonicalUri, - IUriRuntimeClassWithAbsoluteCanonicalUri_Vtbl, - 0x758d9661_221c_480f_a339_50656673f46f -); -impl windows_core::RuntimeType for IUriRuntimeClassWithAbsoluteCanonicalUri { - const SIGNATURE: windows_core::imp::ConstBuffer = - windows_core::imp::ConstBuffer::for_interface::(); -} -#[repr(C)] -pub struct IUriRuntimeClassWithAbsoluteCanonicalUri_Vtbl { - pub base__: windows_core::IInspectable_Vtbl, - pub AbsoluteCanonicalUri: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, - pub DisplayIri: unsafe extern "system" fn( - *mut core::ffi::c_void, - *mut *mut core::ffi::c_void, - ) -> windows_core::HRESULT, -} diff --git a/crates/tests/misc/standalone/src/b_variant.rs b/crates/tests/misc/standalone/src/b_variant.rs index 5f8c6c87c6..54f4fcceed 100644 --- a/crates/tests/misc/standalone/src/b_variant.rs +++ b/crates/tests/misc/standalone/src/b_variant.rs @@ -6,6 +6,71 @@ clippy::all )] +pub type ADVANCED_FEATURE_FLAGS = u16; +pub type BSTR = *const u16; +#[repr(C)] +#[derive(Clone, Copy)] +pub union CY { + pub Anonymous: CY_0, + pub int64: i64, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct CY_0 { + pub Lo: u32, + pub Hi: i32, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct DECIMAL { + pub wReserved: u16, + pub Anonymous1: DECIMAL_0, + pub Hi32: u32, + pub Anonymous2: DECIMAL_1, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub union DECIMAL_0 { + pub Anonymous: DECIMAL_0_0, + pub signscale: u16, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct DECIMAL_0_0 { + pub scale: u8, + pub sign: u8, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub union DECIMAL_1 { + pub Anonymous: DECIMAL_1_0, + pub Lo64: u64, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct DECIMAL_1_0 { + pub Lo32: u32, + pub Mid32: u32, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct GUID { + pub data1: u32, + pub data2: u16, + pub data3: u16, + pub data4: [u8; 8], +} +impl GUID { + pub const fn from_u128(uuid: u128) -> Self { + Self { + data1: (uuid >> 96) as u32, + data2: (uuid >> 80 & 0xffff) as u16, + data3: (uuid >> 64 & 0xffff) as u16, + data4: (uuid as u64).to_be_bytes(), + } + } +} +pub type HRESULT = i32; pub const IID_IDispatch: GUID = GUID::from_u128(0x00020400_0000_0000_c000_000000000046); #[repr(C)] pub struct IDispatch_Vtbl { @@ -78,52 +143,19 @@ pub struct IRecordInfo_Vtbl { pub RecordDestroy: unsafe extern "system" fn(*mut core::ffi::c_void, *const core::ffi::c_void) -> HRESULT, } -pub type ADVANCED_FEATURE_FLAGS = u16; -pub type VARENUM = u16; -#[repr(C)] -#[derive(Clone, Copy)] -pub union CY { - pub Anonymous: CY_0, - pub int64: i64, -} -#[repr(C)] -#[derive(Clone, Copy)] -pub struct CY_0 { - pub Lo: u32, - pub Hi: i32, -} -#[repr(C)] -#[derive(Clone, Copy)] -pub struct DECIMAL { - pub wReserved: u16, - pub Anonymous1: DECIMAL_0, - pub Hi32: u32, - pub Anonymous2: DECIMAL_1, -} -#[repr(C)] -#[derive(Clone, Copy)] -pub union DECIMAL_0 { - pub Anonymous: DECIMAL_0_0, - pub signscale: u16, -} -#[repr(C)] -#[derive(Clone, Copy)] -pub struct DECIMAL_0_0 { - pub scale: u8, - pub sign: u8, -} -#[repr(C)] -#[derive(Clone, Copy)] -pub union DECIMAL_1 { - pub Anonymous: DECIMAL_1_0, - pub Lo64: u64, -} +pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); #[repr(C)] -#[derive(Clone, Copy)] -pub struct DECIMAL_1_0 { - pub Lo32: u32, - pub Mid32: u32, +pub struct IUnknown_Vtbl { + pub QueryInterface: unsafe extern "system" fn( + this: *mut core::ffi::c_void, + iid: *const GUID, + interface: *mut *mut core::ffi::c_void, + ) -> HRESULT, + pub AddRef: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, + pub Release: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, } +pub type PCWSTR = *const u16; +pub type PSTR = *mut u8; #[repr(C)] #[derive(Clone, Copy)] pub struct SAFEARRAY { @@ -140,6 +172,7 @@ pub struct SAFEARRAYBOUND { pub cElements: u32, pub lLbound: i32, } +pub type VARENUM = u16; #[repr(C)] #[derive(Clone, Copy)] pub struct VARIANT { @@ -217,36 +250,3 @@ pub struct VARIANT_0_0_0_0 { pub pRecInfo: *mut core::ffi::c_void, } pub type VARIANT_BOOL = i16; -pub type PSTR = *mut u8; -pub type PCWSTR = *const u16; -#[repr(C)] -#[derive(Clone, Copy)] -pub struct GUID { - pub data1: u32, - pub data2: u16, - pub data3: u16, - pub data4: [u8; 8], -} -impl GUID { - pub const fn from_u128(uuid: u128) -> Self { - Self { - data1: (uuid >> 96) as u32, - data2: (uuid >> 80 & 0xffff) as u16, - data3: (uuid >> 64 & 0xffff) as u16, - data4: (uuid as u64).to_be_bytes(), - } - } -} -pub type HRESULT = i32; -pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); -#[repr(C)] -pub struct IUnknown_Vtbl { - pub QueryInterface: unsafe extern "system" fn( - this: *mut core::ffi::c_void, - iid: *const GUID, - interface: *mut *mut core::ffi::c_void, - ) -> HRESULT, - pub AddRef: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, - pub Release: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, -} -pub type BSTR = *const u16; diff --git a/crates/tests/misc/standalone/src/b_vtbl_0.rs b/crates/tests/misc/standalone/src/b_vtbl_0.rs index 7f3b643b99..aa0dde843e 100644 --- a/crates/tests/misc/standalone/src/b_vtbl_0.rs +++ b/crates/tests/misc/standalone/src/b_vtbl_0.rs @@ -6,11 +6,6 @@ clippy::all )] -pub const IID_IAgileObject: GUID = GUID::from_u128(0x94ea2b94_e9cc_49e0_c0ff_ee64ca8f5b90); -#[repr(C)] -pub struct IAgileObject_Vtbl { - pub base__: IUnknown_Vtbl, -} #[repr(C)] #[derive(Clone, Copy)] pub struct GUID { @@ -30,6 +25,11 @@ impl GUID { } } pub type HRESULT = i32; +pub const IID_IAgileObject: GUID = GUID::from_u128(0x94ea2b94_e9cc_49e0_c0ff_ee64ca8f5b90); +#[repr(C)] +pub struct IAgileObject_Vtbl { + pub base__: IUnknown_Vtbl, +} pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); #[repr(C)] pub struct IUnknown_Vtbl { diff --git a/crates/tests/misc/standalone/src/b_vtbl_1.rs b/crates/tests/misc/standalone/src/b_vtbl_1.rs index 266b61e3f1..2e54933400 100644 --- a/crates/tests/misc/standalone/src/b_vtbl_1.rs +++ b/crates/tests/misc/standalone/src/b_vtbl_1.rs @@ -6,23 +6,6 @@ clippy::all )] -pub const IID_IDispatch: GUID = GUID::from_u128(0x00020400_0000_0000_c000_000000000046); -#[repr(C)] -pub struct IDispatch_Vtbl { - pub base__: IUnknown_Vtbl, - pub GetTypeInfoCount: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> HRESULT, - GetTypeInfo: usize, - pub GetIDsOfNames: unsafe extern "system" fn( - *mut core::ffi::c_void, - *const GUID, - *const PCWSTR, - u32, - u32, - *mut i32, - ) -> HRESULT, - Invoke: usize, -} -pub type PCWSTR = *const u16; #[repr(C)] #[derive(Clone, Copy)] pub struct GUID { @@ -42,6 +25,22 @@ impl GUID { } } pub type HRESULT = i32; +pub const IID_IDispatch: GUID = GUID::from_u128(0x00020400_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IDispatch_Vtbl { + pub base__: IUnknown_Vtbl, + pub GetTypeInfoCount: unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> HRESULT, + GetTypeInfo: usize, + pub GetIDsOfNames: unsafe extern "system" fn( + *mut core::ffi::c_void, + *const GUID, + *const PCWSTR, + u32, + u32, + *mut i32, + ) -> HRESULT, + Invoke: usize, +} pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); #[repr(C)] pub struct IUnknown_Vtbl { @@ -53,3 +52,4 @@ pub struct IUnknown_Vtbl { pub AddRef: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, pub Release: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, } +pub type PCWSTR = *const u16; diff --git a/crates/tests/misc/standalone/src/b_vtbl_2.rs b/crates/tests/misc/standalone/src/b_vtbl_2.rs index 10bedc6287..8026dc7d66 100644 --- a/crates/tests/misc/standalone/src/b_vtbl_2.rs +++ b/crates/tests/misc/standalone/src/b_vtbl_2.rs @@ -6,29 +6,6 @@ clippy::all )] -pub const IID_IActivationFactory: GUID = GUID::from_u128(0x00000035_0000_0000_c000_000000000046); -#[repr(C)] -pub struct IActivationFactory_Vtbl { - pub base__: IInspectable_Vtbl, - pub ActivateInstance: - unsafe extern "system" fn(*mut core::ffi::c_void, *mut *mut core::ffi::c_void) -> HRESULT, -} -pub const IID_IInspectable: GUID = GUID::from_u128(0xaf86e2e0_b12d_4c6a_9c5a_d7aa65101e90); -#[repr(C)] -pub struct IInspectable_Vtbl { - pub base: IUnknown_Vtbl, - pub GetIids: unsafe extern "system" fn( - this: *mut core::ffi::c_void, - count: *mut u32, - values: *mut *mut GUID, - ) -> HRESULT, - pub GetRuntimeClassName: unsafe extern "system" fn( - this: *mut core::ffi::c_void, - value: *mut *mut core::ffi::c_void, - ) -> HRESULT, - pub GetTrustLevel: - unsafe extern "system" fn(this: *mut core::ffi::c_void, value: *mut i32) -> HRESULT, -} #[repr(C)] #[derive(Clone, Copy)] pub struct GUID { @@ -48,6 +25,13 @@ impl GUID { } } pub type HRESULT = i32; +pub const IID_IActivationFactory: GUID = GUID::from_u128(0x00000035_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IActivationFactory_Vtbl { + pub base__: IInspectable_Vtbl, + pub ActivateInstance: + unsafe extern "system" fn(*mut core::ffi::c_void, *mut *mut core::ffi::c_void) -> HRESULT, +} pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); #[repr(C)] pub struct IUnknown_Vtbl { @@ -59,3 +43,19 @@ pub struct IUnknown_Vtbl { pub AddRef: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, pub Release: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, } +pub const IID_IInspectable: GUID = GUID::from_u128(0xaf86e2e0_b12d_4c6a_9c5a_d7aa65101e90); +#[repr(C)] +pub struct IInspectable_Vtbl { + pub base: IUnknown_Vtbl, + pub GetIids: unsafe extern "system" fn( + this: *mut core::ffi::c_void, + count: *mut u32, + values: *mut *mut GUID, + ) -> HRESULT, + pub GetRuntimeClassName: unsafe extern "system" fn( + this: *mut core::ffi::c_void, + value: *mut *mut core::ffi::c_void, + ) -> HRESULT, + pub GetTrustLevel: + unsafe extern "system" fn(this: *mut core::ffi::c_void, value: *mut i32) -> HRESULT, +} diff --git a/crates/tests/misc/standalone/src/b_vtbl_3.rs b/crates/tests/misc/standalone/src/b_vtbl_3.rs index f635b30bc1..432621f265 100644 --- a/crates/tests/misc/standalone/src/b_vtbl_3.rs +++ b/crates/tests/misc/standalone/src/b_vtbl_3.rs @@ -6,29 +6,6 @@ clippy::all )] -pub const IID_IStringable: GUID = GUID::from_u128(0x96369f54_8eb6_48f0_abce_c1b211e627c3); -#[repr(C)] -pub struct IStringable_Vtbl { - pub base__: IInspectable_Vtbl, - pub ToString: unsafe extern "system" fn(*mut core::ffi::c_void, *mut HSTRING) -> HRESULT, -} -pub type HSTRING = *mut core::ffi::c_void; -pub const IID_IInspectable: GUID = GUID::from_u128(0xaf86e2e0_b12d_4c6a_9c5a_d7aa65101e90); -#[repr(C)] -pub struct IInspectable_Vtbl { - pub base: IUnknown_Vtbl, - pub GetIids: unsafe extern "system" fn( - this: *mut core::ffi::c_void, - count: *mut u32, - values: *mut *mut GUID, - ) -> HRESULT, - pub GetRuntimeClassName: unsafe extern "system" fn( - this: *mut core::ffi::c_void, - value: *mut *mut core::ffi::c_void, - ) -> HRESULT, - pub GetTrustLevel: - unsafe extern "system" fn(this: *mut core::ffi::c_void, value: *mut i32) -> HRESULT, -} #[repr(C)] #[derive(Clone, Copy)] pub struct GUID { @@ -48,6 +25,12 @@ impl GUID { } } pub type HRESULT = i32; +pub const IID_IStringable: GUID = GUID::from_u128(0x96369f54_8eb6_48f0_abce_c1b211e627c3); +#[repr(C)] +pub struct IStringable_Vtbl { + pub base__: IInspectable_Vtbl, + pub ToString: unsafe extern "system" fn(*mut core::ffi::c_void, *mut HSTRING) -> HRESULT, +} pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); #[repr(C)] pub struct IUnknown_Vtbl { @@ -59,3 +42,20 @@ pub struct IUnknown_Vtbl { pub AddRef: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, pub Release: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, } +pub const IID_IInspectable: GUID = GUID::from_u128(0xaf86e2e0_b12d_4c6a_9c5a_d7aa65101e90); +#[repr(C)] +pub struct IInspectable_Vtbl { + pub base: IUnknown_Vtbl, + pub GetIids: unsafe extern "system" fn( + this: *mut core::ffi::c_void, + count: *mut u32, + values: *mut *mut GUID, + ) -> HRESULT, + pub GetRuntimeClassName: unsafe extern "system" fn( + this: *mut core::ffi::c_void, + value: *mut *mut core::ffi::c_void, + ) -> HRESULT, + pub GetTrustLevel: + unsafe extern "system" fn(this: *mut core::ffi::c_void, value: *mut i32) -> HRESULT, +} +pub type HSTRING = *mut core::ffi::c_void; diff --git a/crates/tests/misc/standalone/src/b_vtbl_4.rs b/crates/tests/misc/standalone/src/b_vtbl_4.rs index ea13ea8591..d0bb59fc81 100644 --- a/crates/tests/misc/standalone/src/b_vtbl_4.rs +++ b/crates/tests/misc/standalone/src/b_vtbl_4.rs @@ -6,24 +6,6 @@ clippy::all )] -pub const IID_IPersist: GUID = GUID::from_u128(0x0000010c_0000_0000_c000_000000000046); -#[repr(C)] -pub struct IPersist_Vtbl { - pub base__: IUnknown_Vtbl, - pub GetClassID: unsafe extern "system" fn(*mut core::ffi::c_void, *mut GUID) -> HRESULT, -} -pub const IID_IPersistFile: GUID = GUID::from_u128(0x0000010b_0000_0000_c000_000000000046); -#[repr(C)] -pub struct IPersistFile_Vtbl { - pub base__: IPersist_Vtbl, - pub IsDirty: unsafe extern "system" fn(*mut core::ffi::c_void) -> HRESULT, - Load: usize, - Save: usize, - pub SaveCompleted: unsafe extern "system" fn(*mut core::ffi::c_void, PCWSTR) -> HRESULT, - pub GetCurFile: unsafe extern "system" fn(*mut core::ffi::c_void, *mut PWSTR) -> HRESULT, -} -pub type PWSTR = *mut u16; -pub type PCWSTR = *const u16; #[repr(C)] #[derive(Clone, Copy)] pub struct GUID { @@ -43,6 +25,22 @@ impl GUID { } } pub type HRESULT = i32; +pub const IID_IPersist: GUID = GUID::from_u128(0x0000010c_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IPersist_Vtbl { + pub base__: IUnknown_Vtbl, + pub GetClassID: unsafe extern "system" fn(*mut core::ffi::c_void, *mut GUID) -> HRESULT, +} +pub const IID_IPersistFile: GUID = GUID::from_u128(0x0000010b_0000_0000_c000_000000000046); +#[repr(C)] +pub struct IPersistFile_Vtbl { + pub base__: IPersist_Vtbl, + pub IsDirty: unsafe extern "system" fn(*mut core::ffi::c_void) -> HRESULT, + Load: usize, + Save: usize, + pub SaveCompleted: unsafe extern "system" fn(*mut core::ffi::c_void, PCWSTR) -> HRESULT, + pub GetCurFile: unsafe extern "system" fn(*mut core::ffi::c_void, *mut PWSTR) -> HRESULT, +} pub const IID_IUnknown: GUID = GUID::from_u128(0x00000000_0000_0000_c000_000000000046); #[repr(C)] pub struct IUnknown_Vtbl { @@ -54,3 +52,5 @@ pub struct IUnknown_Vtbl { pub AddRef: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, pub Release: unsafe extern "system" fn(this: *mut core::ffi::c_void) -> u32, } +pub type PCWSTR = *const u16; +pub type PWSTR = *mut u16;