Created
March 19, 2023 16:39
-
-
Save spytheman/c96ae087e83207d110561299ddec73e8 to your computer and use it in GitHub Desktop.
Example of declaring C.INPUT that uses an anonymous union inside, by just ignoring it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
[typedef] | |
struct C.MOUSEINPUT { | |
dx i64 | |
dy i64 | |
mouseData u32 | |
dwFlags u32 | |
time u32 | |
dwExtraInfo &u64 = unsafe { nil } | |
} | |
[typedef] | |
struct C.KEYBDINPUT { | |
wVk u16 | |
wScam u16 | |
dwFlags u32 | |
time u32 | |
dwExtraInfo &u64 = unsafe { nil } | |
} | |
[typedef] | |
struct C.HARDWAREINPUT { | |
uMsg u32 | |
wParamL u16 | |
wParamH u16 | |
} | |
[typedef] | |
struct C.INPUT { | |
@type u32 | |
mi C.MOUSEINPUT | |
ki C.KEYBDINPUT | |
hi C.HARDWAREINPUT | |
} | |
fn main() { | |
a := unsafe { C.INPUT{} } | |
unsafe { dump(a.mi.dx) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment