mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
merge upstream/master
This commit is contained in:
@@ -111,6 +111,8 @@ foreign user32 {
|
||||
@(link_name="SetWindowTextW") set_window_text_w :: proc(hwnd: Hwnd, c_string: Wstring) -> Bool ---
|
||||
@(link_name="RegisterClassA") register_class_a :: proc(wc: ^Wnd_Class_A) -> i16 ---
|
||||
@(link_name="RegisterClassW") register_class_w :: proc(wc: ^Wnd_Class_W) -> i16 ---
|
||||
@(link_name="UnregisterClassA") unregister_class_a :: proc(class_name: cstring, instance: Hinstance) -> Bool ---
|
||||
@(link_name="UnregisterClassW") unregister_class_w :: proc(class_name: Wstring, instance: Hinstance) -> Bool ---
|
||||
@(link_name="RegisterClassExA") register_class_ex_a :: proc(wc: ^Wnd_Class_Ex_A) -> i16 ---
|
||||
@(link_name="RegisterClassExW") register_class_ex_w :: proc(wc: ^Wnd_Class_Ex_W) -> i16 ---
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// +build windows
|
||||
package sys_windows
|
||||
|
||||
foreign import dwmapi "system:Dwmapi.lib"
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign dwmapi {
|
||||
DwmFlush :: proc() -> HRESULT ---
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// +build windows
|
||||
package sys_windows
|
||||
|
||||
foreign import gdi32 "system:Gdi32.lib"
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign gdi32 {
|
||||
GetStockObject :: proc(i: c_int) -> HGDIOBJ ---
|
||||
SelectObject :: proc(hdc: HDC, h: HGDIOBJ) -> HGDIOBJ ---
|
||||
|
||||
CreateDIBPatternBrush :: proc(h: HGLOBAL, iUsage: UINT) -> HBRUSH ---
|
||||
|
||||
CreateDIBitmap :: proc(
|
||||
hdc: HDC,
|
||||
pbmih: ^BITMAPINFOHEADER,
|
||||
flInit: DWORD,
|
||||
pjBits: VOID,
|
||||
pbmi: ^BITMAPINFO,
|
||||
iUsage: UINT,
|
||||
) -> HBITMAP ---
|
||||
|
||||
CreateDIBSection :: proc(
|
||||
hdc: HDC,
|
||||
pbmi: ^BITMAPINFO,
|
||||
usage: UINT,
|
||||
ppvBits: VOID,
|
||||
hSection: HANDLE,
|
||||
offset: DWORD,
|
||||
) -> HBITMAP ---
|
||||
|
||||
StretchDIBits :: proc(
|
||||
hdc: HDC,
|
||||
xDest: c_int,
|
||||
yDest: c_int,
|
||||
DestWidth: c_int,
|
||||
DestHeight: c_int,
|
||||
xSrc: c_int,
|
||||
ySrc: c_int,
|
||||
SrcWidth: c_int,
|
||||
SrcHeight: c_int,
|
||||
lpBits: VOID,
|
||||
lpbmi: ^BITMAPINFO,
|
||||
iUsage: UINT,
|
||||
rop: DWORD,
|
||||
) -> c_int ---
|
||||
|
||||
StretchBlt :: proc(
|
||||
hdcDest: HDC,
|
||||
xDest: c_int,
|
||||
yDest: c_int,
|
||||
wDest: c_int,
|
||||
hDest: c_int,
|
||||
hdcSrc: HDC,
|
||||
xSrc: c_int,
|
||||
ySrc: c_int,
|
||||
wSrc: c_int,
|
||||
hSrc: c_int,
|
||||
rop: DWORD,
|
||||
) -> BOOL ---
|
||||
|
||||
SetPixelFormat :: proc(hdc: HDC, format: c_int, ppfd: ^PIXELFORMATDESCRIPTOR) -> BOOL ---
|
||||
ChoosePixelFormat :: proc(hdc: HDC, ppfd: ^PIXELFORMATDESCRIPTOR) -> c_int ---
|
||||
SwapBuffers :: proc(HDC) -> BOOL ---
|
||||
|
||||
PatBlt :: proc(hdc: HDC, x, y, w, h: c_int, rop: DWORD) -> BOOL ---
|
||||
}
|
||||
@@ -342,6 +342,7 @@ MEM_TOP_DOWN :: 0x100000
|
||||
MEM_LARGE_PAGES :: 0x20000000
|
||||
MEM_4MB_PAGES :: 0x80000000
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
VirtualAlloc :: proc(
|
||||
lpAddress: LPVOID,
|
||||
@@ -484,6 +485,7 @@ LowMemoryResourceNotification :: MEMORY_RESOURCE_NOTIFICATION_TYPE.LowMemoryRes
|
||||
HighMemoryResourceNotification :: MEMORY_RESOURCE_NOTIFICATION_TYPE.HighMemoryResourceNotification
|
||||
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
CreateMemoryResourceNotification :: proc(
|
||||
NotificationType: MEMORY_RESOURCE_NOTIFICATION_TYPE,
|
||||
@@ -499,6 +501,7 @@ FILE_CACHE_MAX_HARD_DISABLE :: DWORD(0x00000002)
|
||||
FILE_CACHE_MIN_HARD_ENABLE :: DWORD(0x00000004)
|
||||
FILE_CACHE_MIN_HARD_DISABLE :: DWORD(0x00000008)
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
GetSystemFileCacheSize :: proc(
|
||||
lpMinimumFileCacheSize: PSIZE_T,
|
||||
@@ -528,6 +531,7 @@ WIN32_MEMORY_RANGE_ENTRY :: struct {
|
||||
|
||||
PWIN32_MEMORY_RANGE_ENTRY :: ^WIN32_MEMORY_RANGE_ENTRY
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
PrefetchVirtualMemory :: proc(
|
||||
hProcess: HANDLE,
|
||||
@@ -585,6 +589,7 @@ foreign kernel32 {
|
||||
|
||||
MEHC_PATROL_SCRUBBER_PRESENT :: ULONG(0x1)
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
GetMemoryErrorHandlingCapabilities :: proc(
|
||||
Capabilities: PULONG,
|
||||
@@ -593,6 +598,7 @@ foreign kernel32 {
|
||||
|
||||
PBAD_MEMORY_CALLBACK_ROUTINE :: #type proc "stdcall" ()
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
RegisterBadMemoryNotification :: proc(
|
||||
Callback: PBAD_MEMORY_CALLBACK_ROUTINE,
|
||||
@@ -613,6 +619,7 @@ VmOfferPriorityLow :: OFFER_PRIORITY.VmOfferPriorityLow
|
||||
VmOfferPriorityBelowNormal :: OFFER_PRIORITY.VmOfferPriorityBelowNormal
|
||||
VmOfferPriorityNormal :: OFFER_PRIORITY.VmOfferPriorityNormal
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
OfferVirtualMemory :: proc(
|
||||
VirtualAddress: PVOID,
|
||||
@@ -677,6 +684,7 @@ WIN32_MEMORY_REGION_INFORMATION_u_s_Bitfield :: distinct ULONG
|
||||
Reserved : 32-6,
|
||||
}*/
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
QueryVirtualMemoryInformation :: proc(
|
||||
Process: HANDLE,
|
||||
@@ -701,7 +709,7 @@ foreign kernel32 {
|
||||
|
||||
NUMA_NO_PREFERRED_NODE :: 0xffffffff
|
||||
|
||||
MapViewOfFile2 :: #force_inline proc(
|
||||
MapViewOfFile2 :: #force_inline proc "stdcall" (
|
||||
FileMappingHandle: HANDLE,
|
||||
ProcessHandle: HANDLE,
|
||||
Offset: ULONG64,
|
||||
@@ -722,6 +730,7 @@ MapViewOfFile2 :: #force_inline proc(
|
||||
)
|
||||
}
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
UnmapViewOfFile2 :: proc(
|
||||
ProcessHandle: HANDLE,
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
// +build windows
|
||||
package sys_windows
|
||||
|
||||
// https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
|
||||
// Virtual Keys, Standard Set
|
||||
VK_LBUTTON :: 0x01
|
||||
VK_RBUTTON :: 0x02
|
||||
VK_CANCEL :: 0x03
|
||||
VK_MBUTTON :: 0x04 // NOT contiguous with L & RBUTTON
|
||||
VK_XBUTTON1 :: 0x05 // NOT contiguous with L & RBUTTON
|
||||
VK_XBUTTON2 :: 0x06 // NOT contiguous with L & RBUTTON
|
||||
|
||||
// 0x07 : reserved
|
||||
|
||||
VK_BACK :: 0x08
|
||||
VK_TAB :: 0x09
|
||||
|
||||
// 0x0A - 0x0B : reserved
|
||||
|
||||
VK_CLEAR :: 0x0C
|
||||
VK_RETURN :: 0x0D
|
||||
|
||||
// 0x0E - 0x0F : unassigned
|
||||
|
||||
VK_SHIFT :: 0x10
|
||||
VK_CONTROL :: 0x11
|
||||
VK_MENU :: 0x12
|
||||
VK_PAUSE :: 0x13
|
||||
VK_CAPITAL :: 0x14
|
||||
VK_KANA :: 0x15
|
||||
VK_HANGEUL :: 0x15 // old name - should be here for compatibility
|
||||
VK_HANGUL :: 0x15
|
||||
VK_IME_ON :: 0x16
|
||||
VK_JUNJA :: 0x17
|
||||
VK_FINAL :: 0x18
|
||||
VK_HANJA :: 0x19
|
||||
VK_KANJI :: 0x19
|
||||
VK_IME_OFF :: 0x1A
|
||||
VK_ESCAPE :: 0x1B
|
||||
VK_CONVERT :: 0x1C
|
||||
VK_NONCONVERT :: 0x1D
|
||||
VK_ACCEPT :: 0x1E
|
||||
VK_MODECHANGE :: 0x1F
|
||||
VK_SPACE :: 0x20
|
||||
VK_PRIOR :: 0x21
|
||||
VK_NEXT :: 0x22
|
||||
VK_END :: 0x23
|
||||
VK_HOME :: 0x24
|
||||
VK_LEFT :: 0x25
|
||||
VK_UP :: 0x26
|
||||
VK_RIGHT :: 0x27
|
||||
VK_DOWN :: 0x28
|
||||
VK_SELECT :: 0x29
|
||||
VK_PRINT :: 0x2A
|
||||
VK_EXECUTE :: 0x2B
|
||||
VK_SNAPSHOT :: 0x2C
|
||||
VK_INSERT :: 0x2D
|
||||
VK_DELETE :: 0x2E
|
||||
VK_HELP :: 0x2F
|
||||
|
||||
VK_0 :: '0'
|
||||
VK_1 :: '1'
|
||||
VK_2 :: '2'
|
||||
VK_3 :: '3'
|
||||
VK_4 :: '4'
|
||||
VK_5 :: '5'
|
||||
VK_6 :: '6'
|
||||
VK_7 :: '7'
|
||||
VK_8 :: '8'
|
||||
VK_9 :: '9'
|
||||
|
||||
// 0x3A - 0x40 : unassigned
|
||||
|
||||
VK_A :: 'A'
|
||||
VK_B :: 'B'
|
||||
VK_C :: 'C'
|
||||
VK_D :: 'D'
|
||||
VK_E :: 'E'
|
||||
VK_F :: 'F'
|
||||
VK_G :: 'G'
|
||||
VK_H :: 'H'
|
||||
VK_I :: 'I'
|
||||
VK_J :: 'J'
|
||||
VK_K :: 'K'
|
||||
VK_L :: 'L'
|
||||
VK_M :: 'M'
|
||||
VK_N :: 'N'
|
||||
VK_O :: 'O'
|
||||
VK_P :: 'P'
|
||||
VK_Q :: 'Q'
|
||||
VK_R :: 'R'
|
||||
VK_S :: 'S'
|
||||
VK_T :: 'T'
|
||||
VK_U :: 'U'
|
||||
VK_V :: 'V'
|
||||
VK_W :: 'W'
|
||||
VK_X :: 'X'
|
||||
VK_Y :: 'Y'
|
||||
VK_Z :: 'Z'
|
||||
|
||||
VK_LWIN :: 0x5B
|
||||
VK_RWIN :: 0x5C
|
||||
VK_APPS :: 0x5D
|
||||
|
||||
// 0x5E : reserved
|
||||
|
||||
VK_SLEEP :: 0x5F
|
||||
VK_NUMPAD0 :: 0x60
|
||||
VK_NUMPAD1 :: 0x61
|
||||
VK_NUMPAD2 :: 0x62
|
||||
VK_NUMPAD3 :: 0x63
|
||||
VK_NUMPAD4 :: 0x64
|
||||
VK_NUMPAD5 :: 0x65
|
||||
VK_NUMPAD6 :: 0x66
|
||||
VK_NUMPAD7 :: 0x67
|
||||
VK_NUMPAD8 :: 0x68
|
||||
VK_NUMPAD9 :: 0x69
|
||||
VK_MULTIPLY :: 0x6A
|
||||
VK_ADD :: 0x6B
|
||||
VK_SEPARATOR :: 0x6C
|
||||
VK_SUBTRACT :: 0x6D
|
||||
VK_DECIMAL :: 0x6E
|
||||
VK_DIVIDE :: 0x6F
|
||||
VK_F1 :: 0x70
|
||||
VK_F2 :: 0x71
|
||||
VK_F3 :: 0x72
|
||||
VK_F4 :: 0x73
|
||||
VK_F5 :: 0x74
|
||||
VK_F6 :: 0x75
|
||||
VK_F7 :: 0x76
|
||||
VK_F8 :: 0x77
|
||||
VK_F9 :: 0x78
|
||||
VK_F10 :: 0x79
|
||||
VK_F11 :: 0x7A
|
||||
VK_F12 :: 0x7B
|
||||
VK_F13 :: 0x7C
|
||||
VK_F14 :: 0x7D
|
||||
VK_F15 :: 0x7E
|
||||
VK_F16 :: 0x7F
|
||||
VK_F17 :: 0x80
|
||||
VK_F18 :: 0x81
|
||||
VK_F19 :: 0x82
|
||||
VK_F20 :: 0x83
|
||||
VK_F21 :: 0x84
|
||||
VK_F22 :: 0x85
|
||||
VK_F23 :: 0x86
|
||||
VK_F24 :: 0x87
|
||||
|
||||
// 0x88 - 0x8F : reserved
|
||||
|
||||
VK_NUMLOCK :: 0x90
|
||||
VK_SCROLL :: 0x91
|
||||
|
||||
// NEC PC-9800 kbd definitions
|
||||
VK_OEM_NEC_EQUAL :: 0x92 // '=' key on numpad
|
||||
|
||||
// Fujitsu/OASYS kbd definitions
|
||||
VK_OEM_FJ_JISHO :: 0x92 // 'Dictionary' key
|
||||
VK_OEM_FJ_MASSHOU :: 0x93 // 'Unregister word' key
|
||||
VK_OEM_FJ_TOUROKU :: 0x94 // 'Register word' key
|
||||
VK_OEM_FJ_LOYA :: 0x95 // 'Left OYAYUBI' key
|
||||
VK_OEM_FJ_ROYA :: 0x96 // 'Right OYAYUBI' key
|
||||
|
||||
// 0x97 - 0x9F : unassigned
|
||||
|
||||
// VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
|
||||
// Used only as parameters to GetAsyncKeyState() and GetKeyState().
|
||||
// No other API or message will distinguish left and right keys in this way.
|
||||
VK_LSHIFT :: 0xA0
|
||||
VK_RSHIFT :: 0xA1
|
||||
VK_LCONTROL :: 0xA2
|
||||
VK_RCONTROL :: 0xA3
|
||||
VK_LMENU :: 0xA4
|
||||
VK_RMENU :: 0xA5
|
||||
|
||||
VK_BROWSER_BACK :: 0xA6
|
||||
VK_BROWSER_FORWARD :: 0xA7
|
||||
VK_BROWSER_REFRESH :: 0xA8
|
||||
VK_BROWSER_STOP :: 0xA9
|
||||
VK_BROWSER_SEARCH :: 0xAA
|
||||
VK_BROWSER_FAVORITES :: 0xAB
|
||||
VK_BROWSER_HOME :: 0xAC
|
||||
VK_VOLUME_MUTE :: 0xAD
|
||||
VK_VOLUME_DOWN :: 0xAE
|
||||
VK_VOLUME_UP :: 0xAF
|
||||
VK_MEDIA_NEXT_TRACK :: 0xB0
|
||||
VK_MEDIA_PREV_TRACK :: 0xB1
|
||||
VK_MEDIA_STOP :: 0xB2
|
||||
VK_MEDIA_PLAY_PAUSE :: 0xB3
|
||||
VK_LAUNCH_MAIL :: 0xB4
|
||||
VK_LAUNCH_MEDIA_SELECT :: 0xB5
|
||||
VK_LAUNCH_APP1 :: 0xB6
|
||||
VK_LAUNCH_APP2 :: 0xB7
|
||||
|
||||
// 0xB8 - 0xB9 : reserved
|
||||
|
||||
VK_OEM_1 :: 0xBA // ';:' for US
|
||||
VK_OEM_PLUS :: 0xBB // '+' any country
|
||||
VK_OEM_COMMA :: 0xBC // ',' any country
|
||||
VK_OEM_MINUS :: 0xBD // '-' any country
|
||||
VK_OEM_PERIOD :: 0xBE // '.' any country
|
||||
VK_OEM_2 :: 0xBF // '/?' for US
|
||||
VK_OEM_3 :: 0xC0 // '`~' for US
|
||||
|
||||
// 0xC1 - 0xDA : reserved
|
||||
|
||||
VK_OEM_4 :: 0xDB // '[{' for US
|
||||
VK_OEM_5 :: 0xDC // '\|' for US
|
||||
VK_OEM_6 :: 0xDD // ']}' for US
|
||||
VK_OEM_7 :: 0xDE // ''"' for US
|
||||
VK_OEM_8 :: 0xDF
|
||||
|
||||
// 0xE0 : reserved
|
||||
|
||||
// Various extended or enhanced keyboards
|
||||
VK_OEM_AX :: 0xE1 // 'AX' key on Japanese AX kbd
|
||||
VK_OEM_102 :: 0xE2 // "<>" or "\|" on RT 102-key kbd.
|
||||
VK_ICO_HELP :: 0xE3 // Help key on ICO
|
||||
VK_ICO_00 :: 0xE4 // 00 key on ICO
|
||||
|
||||
VK_PROCESSKEY :: 0xE5
|
||||
VK_ICO_CLEAR :: 0xE6
|
||||
VK_PACKET :: 0xE7
|
||||
|
||||
// 0xE8 : unassigned
|
||||
|
||||
// Nokia/Ericsson definitions
|
||||
VK_OEM_RESET :: 0xE9
|
||||
VK_OEM_JUMP :: 0xEA
|
||||
VK_OEM_PA1 :: 0xEB
|
||||
VK_OEM_PA2 :: 0xEC
|
||||
VK_OEM_PA3 :: 0xED
|
||||
VK_OEM_WSCTRL :: 0xEE
|
||||
VK_OEM_CUSEL :: 0xEF
|
||||
VK_OEM_ATTN :: 0xF0
|
||||
VK_OEM_FINISH :: 0xF1
|
||||
VK_OEM_COPY :: 0xF2
|
||||
VK_OEM_AUTO :: 0xF3
|
||||
VK_OEM_ENLW :: 0xF4
|
||||
VK_OEM_BACKTAB :: 0xF5
|
||||
|
||||
VK_ATTN :: 0xF6
|
||||
VK_CRSEL :: 0xF7
|
||||
VK_EXSEL :: 0xF8
|
||||
VK_EREOF :: 0xF9
|
||||
VK_PLAY :: 0xFA
|
||||
VK_ZOOM :: 0xFB
|
||||
VK_NONAME :: 0xFC
|
||||
VK_PA1 :: 0xFD
|
||||
VK_OEM_CLEAR :: 0xFE
|
||||
|
||||
// 0xFF : reserved
|
||||
+861
-32
@@ -21,7 +21,16 @@ HINSTANCE :: HANDLE
|
||||
HMODULE :: distinct HINSTANCE
|
||||
HRESULT :: distinct LONG
|
||||
HWND :: distinct HANDLE
|
||||
HDC :: distinct HANDLE
|
||||
HMONITOR :: distinct HANDLE
|
||||
HICON :: distinct HANDLE
|
||||
HCURSOR :: distinct HANDLE
|
||||
HMENU :: distinct HANDLE
|
||||
HBRUSH :: distinct HANDLE
|
||||
HGDIOBJ :: distinct HANDLE
|
||||
HBITMAP :: distinct HANDLE
|
||||
HGLOBAL :: distinct HANDLE
|
||||
HHOOK :: distinct HANDLE
|
||||
BOOL :: distinct b32
|
||||
BYTE :: distinct u8
|
||||
BOOLEAN :: distinct b8
|
||||
@@ -42,9 +51,15 @@ PULONG_PTR :: ^ULONG_PTR
|
||||
LPULONG_PTR :: ^ULONG_PTR
|
||||
DWORD_PTR :: ULONG_PTR
|
||||
LONG_PTR :: int
|
||||
UINT_PTR :: uintptr
|
||||
ULONG :: c_ulong
|
||||
UCHAR :: BYTE
|
||||
NTSTATUS :: c.long
|
||||
LPARAM :: LONG_PTR
|
||||
WPARAM :: UINT_PTR
|
||||
LRESULT :: LONG_PTR
|
||||
LPRECT :: ^RECT
|
||||
LPPOINT :: ^POINT
|
||||
|
||||
UINT8 :: u8
|
||||
UINT16 :: u16
|
||||
@@ -71,6 +86,7 @@ PBOOL :: ^BOOL
|
||||
LPBOOL :: ^BOOL
|
||||
LPCSTR :: cstring
|
||||
LPCWSTR :: wstring
|
||||
LPCTSTR :: wstring
|
||||
LPDWORD :: ^DWORD
|
||||
PCSTR :: cstring
|
||||
PCWSTR :: wstring
|
||||
@@ -81,7 +97,9 @@ LPPROCESS_INFORMATION :: ^PROCESS_INFORMATION
|
||||
PSECURITY_ATTRIBUTES :: ^SECURITY_ATTRIBUTES
|
||||
LPSECURITY_ATTRIBUTES :: ^SECURITY_ATTRIBUTES
|
||||
LPSTARTUPINFO :: ^STARTUPINFO
|
||||
PVOID :: rawptr
|
||||
LPTRACKMOUSEEVENT :: ^TRACKMOUSEEVENT
|
||||
VOID :: rawptr
|
||||
PVOID :: rawptr
|
||||
LPVOID :: rawptr
|
||||
PINT :: ^INT
|
||||
LPINT :: ^INT
|
||||
@@ -178,6 +196,109 @@ GetFileExInfoStandard: GET_FILEEX_INFO_LEVELS : 0
|
||||
GetFileExMaxInfoLevel: GET_FILEEX_INFO_LEVELS : 1
|
||||
|
||||
|
||||
TIMERPROC :: #type proc "stdcall" (HWND, UINT, UINT_PTR, DWORD)
|
||||
|
||||
WNDPROC :: #type proc "stdcall" (HWND, UINT, WPARAM, LPARAM) -> LRESULT
|
||||
|
||||
HOOKPROC :: #type proc "stdcall" (code: c_int, wParam: WPARAM, lParam: LPARAM) -> LRESULT
|
||||
|
||||
CWPRETSTRUCT :: struct {
|
||||
lResult: LRESULT,
|
||||
lParam: LPARAM,
|
||||
wParam: WPARAM,
|
||||
message: UINT,
|
||||
hwnd: HWND,
|
||||
}
|
||||
|
||||
KBDLLHOOKSTRUCT :: struct {
|
||||
vkCode: DWORD,
|
||||
scanCode: DWORD,
|
||||
flags: DWORD,
|
||||
time: DWORD,
|
||||
dwExtraInfo: ULONG_PTR,
|
||||
}
|
||||
|
||||
WNDCLASSA :: struct {
|
||||
style: UINT,
|
||||
lpfnWndProc: WNDPROC,
|
||||
cbClsExtra: c_int,
|
||||
cbWndExtra: c_int,
|
||||
hInstance: HINSTANCE,
|
||||
hIcon: HICON,
|
||||
hCursor: HCURSOR,
|
||||
hbrBackground: HBRUSH,
|
||||
lpszMenuName: LPCSTR,
|
||||
lpszClassName: LPCSTR,
|
||||
}
|
||||
|
||||
WNDCLASSW :: struct {
|
||||
style: UINT,
|
||||
lpfnWndProc: WNDPROC,
|
||||
cbClsExtra: c_int,
|
||||
cbWndExtra: c_int,
|
||||
hInstance: HINSTANCE,
|
||||
hIcon: HICON,
|
||||
hCursor: HCURSOR,
|
||||
hbrBackground: HBRUSH,
|
||||
lpszMenuName: LPCWSTR,
|
||||
lpszClassName: LPCWSTR,
|
||||
}
|
||||
|
||||
WNDCLASSEXA :: struct {
|
||||
cbSize: UINT,
|
||||
style: UINT,
|
||||
lpfnWndProc: WNDPROC,
|
||||
cbClsExtra: c_int,
|
||||
cbWndExtra: c_int,
|
||||
hInstance: HINSTANCE,
|
||||
hIcon: HICON,
|
||||
hCursor: HCURSOR,
|
||||
hbrBackground: HBRUSH,
|
||||
lpszMenuName: LPCSTR,
|
||||
lpszClassName: LPCSTR,
|
||||
hIconSm: HICON,
|
||||
}
|
||||
|
||||
WNDCLASSEXW :: struct {
|
||||
cbSize: UINT,
|
||||
style: UINT,
|
||||
lpfnWndProc: WNDPROC,
|
||||
cbClsExtra: c_int,
|
||||
cbWndExtra: c_int,
|
||||
hInstance: HINSTANCE,
|
||||
hIcon: HICON,
|
||||
hCursor: HCURSOR,
|
||||
hbrBackground: HBRUSH,
|
||||
lpszMenuName: LPCWSTR,
|
||||
lpszClassName: LPCWSTR,
|
||||
hIconSm: HICON,
|
||||
}
|
||||
|
||||
MSG :: struct {
|
||||
hwnd: HWND,
|
||||
message: UINT,
|
||||
wParam: WPARAM,
|
||||
lParam: LPARAM,
|
||||
time: DWORD,
|
||||
pt: POINT,
|
||||
}
|
||||
|
||||
PAINTSTRUCT :: struct {
|
||||
hdc: HDC,
|
||||
fErase: BOOL,
|
||||
rcPaint: RECT,
|
||||
fRestore: BOOL,
|
||||
fIncUpdate: BOOL,
|
||||
rgbReserved: [32]BYTE,
|
||||
}
|
||||
|
||||
TRACKMOUSEEVENT :: struct {
|
||||
cbSize: DWORD,
|
||||
dwFlags: DWORD,
|
||||
hwndTrack: HWND,
|
||||
dwHoverTime: DWORD,
|
||||
}
|
||||
|
||||
WIN32_FIND_DATAW :: struct {
|
||||
dwFileAttributes: DWORD,
|
||||
ftCreationTime: FILETIME,
|
||||
@@ -191,6 +312,705 @@ WIN32_FIND_DATAW :: struct {
|
||||
cAlternateFileName: [14]wchar_t,
|
||||
}
|
||||
|
||||
CREATESTRUCTA :: struct {
|
||||
lpCreateParams: LPVOID,
|
||||
hInstance: HINSTANCE,
|
||||
hMenu: HMENU,
|
||||
hwndParent: HWND,
|
||||
cy: c_int,
|
||||
cx: c_int,
|
||||
y: c_int,
|
||||
x: c_int,
|
||||
style: LONG,
|
||||
lpszName: LPCSTR,
|
||||
lpszClass: LPCSTR,
|
||||
dwExStyle: DWORD,
|
||||
}
|
||||
|
||||
CREATESTRUCTW:: struct {
|
||||
lpCreateParams: LPVOID,
|
||||
hInstance: HINSTANCE,
|
||||
hMenu: HMENU,
|
||||
hwndParent: HWND,
|
||||
cy: c_int,
|
||||
cx: c_int,
|
||||
y: c_int,
|
||||
x: c_int,
|
||||
style: LONG,
|
||||
lpszName: LPCWSTR,
|
||||
lpszClass: LPCWSTR,
|
||||
dwExStyle: DWORD,
|
||||
}
|
||||
|
||||
// MessageBox() Flags
|
||||
MB_OK :: 0x00000000
|
||||
MB_OKCANCEL :: 0x00000001
|
||||
MB_ABORTRETRYIGNORE :: 0x00000002
|
||||
MB_YESNOCANCEL :: 0x00000003
|
||||
MB_YESNO :: 0x00000004
|
||||
MB_RETRYCANCEL :: 0x00000005
|
||||
MB_CANCELTRYCONTINUE :: 0x00000006
|
||||
|
||||
MB_ICONHAND :: 0x00000010
|
||||
MB_ICONQUESTION :: 0x00000020
|
||||
MB_ICONEXCLAMATION :: 0x00000030
|
||||
MB_ICONASTERISK :: 0x00000040
|
||||
MB_USERICON :: 0x00000080
|
||||
MB_ICONWARNING :: MB_ICONEXCLAMATION
|
||||
MB_ICONERROR :: MB_ICONHAND
|
||||
MB_ICONINFORMATION :: MB_ICONASTERISK
|
||||
MB_ICONSTOP :: MB_ICONHAND
|
||||
|
||||
MB_DEFBUTTON1 :: 0x00000000
|
||||
MB_DEFBUTTON2 :: 0x00000100
|
||||
MB_DEFBUTTON3 :: 0x00000200
|
||||
MB_DEFBUTTON4 :: 0x00000300
|
||||
|
||||
MB_APPLMODAL :: 0x00000000
|
||||
MB_SYSTEMMODAL :: 0x00001000
|
||||
MB_TASKMODAL :: 0x00002000
|
||||
MB_HELP :: 0x00004000 // Help Button
|
||||
|
||||
MB_NOFOCUS :: 0x00008000
|
||||
MB_SETFOREGROUND :: 0x00010000
|
||||
MB_DEFAULT_DESKTOP_ONLY :: 0x00020000
|
||||
MB_TOPMOST :: 0x00040000
|
||||
MB_RIGHT :: 0x00080000
|
||||
MB_RTLREADING :: 0x00100000
|
||||
|
||||
MB_SERVICE_NOTIFICATION :: 0x00200000
|
||||
MB_SERVICE_NOTIFICATION_NT3X :: 0x00040000
|
||||
|
||||
MB_TYPEMASK :: 0x0000000F
|
||||
MB_ICONMASK :: 0x000000F0
|
||||
MB_DEFMASK :: 0x00000F00
|
||||
MB_MODEMASK :: 0x00003000
|
||||
MB_MISCMASK :: 0x0000C000
|
||||
|
||||
// Dialog Box Command IDs
|
||||
IDOK :: 1
|
||||
IDCANCEL :: 2
|
||||
IDABORT :: 3
|
||||
IDRETRY :: 4
|
||||
IDIGNORE :: 5
|
||||
IDYES :: 6
|
||||
IDNO :: 7
|
||||
IDCLOSE :: 8
|
||||
IDHELP :: 9
|
||||
IDTRYAGAIN :: 10
|
||||
IDCONTINUE :: 11
|
||||
IDTIMEOUT :: 32000
|
||||
|
||||
CS_VREDRAW : UINT : 0x0001
|
||||
CS_HREDRAW : UINT : 0x0002
|
||||
CS_DBLCLKS : UINT : 0x0008
|
||||
CS_OWNDC : UINT : 0x0020
|
||||
CS_CLASSDC : UINT : 0x0040
|
||||
CS_PARENTDC : UINT : 0x0080
|
||||
CS_NOCLOSE : UINT : 0x0200
|
||||
CS_SAVEBITS : UINT : 0x0800
|
||||
CS_BYTEALIGNCLIENT : UINT : 0x1000
|
||||
CS_BYTEALIGNWINDOW : UINT : 0x2000
|
||||
CS_GLOBALCLASS : UINT : 0x4000
|
||||
CS_DROPSHADOW : UINT : 0x0002_0000
|
||||
|
||||
WS_BORDER : UINT : 0x0080_0000
|
||||
WS_CAPTION : UINT : 0x00C0_0000
|
||||
WS_CHILD : UINT : 0x4000_0000
|
||||
WS_CHILDWINDOW : UINT : WS_CHILD
|
||||
WS_CLIPCHILDREN : UINT : 0x0200_0000
|
||||
WS_CLIPSIBLINGS : UINT : 0x0400_0000
|
||||
WS_DISABLED : UINT : 0x0800_0000
|
||||
WS_DLGFRAME : UINT : 0x0040_0000
|
||||
WS_GROUP : UINT : 0x0002_0000
|
||||
WS_HSCROLL : UINT : 0x0010_0000
|
||||
WS_ICONIC : UINT : 0x2000_0000
|
||||
WS_MAXIMIZE : UINT : 0x0100_0000
|
||||
WS_MAXIMIZEBOX : UINT : 0x0001_0000
|
||||
WS_MINIMIZE : UINT : 0x2000_0000
|
||||
WS_MINIMIZEBOX : UINT : 0x0002_0000
|
||||
WS_OVERLAPPED : UINT : 0x0000_0000
|
||||
WS_OVERLAPPEDWINDOW : UINT : WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
|
||||
WS_POPUP : UINT : 0x8000_0000
|
||||
WS_POPUPWINDOW : UINT : WS_POPUP | WS_BORDER | WS_SYSMENU
|
||||
WS_SIZEBOX : UINT : 0x0004_0000
|
||||
WS_SYSMENU : UINT : 0x0008_0000
|
||||
WS_TABSTOP : UINT : 0x0001_0000
|
||||
WS_THICKFRAME : UINT : 0x0004_0000
|
||||
WS_TILED : UINT : 0x0000_0000
|
||||
WS_TILEDWINDOW : UINT : WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE
|
||||
WS_VISIBLE : UINT : 0x1000_0000
|
||||
WS_VSCROLL : UINT : 0x0020_0000
|
||||
|
||||
QS_ALLEVENTS : UINT : QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY
|
||||
QS_ALLINPUT : UINT : QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY | QS_SENDMESSAGE
|
||||
QS_ALLPOSTMESSAGE : UINT : 0x0100
|
||||
QS_HOTKEY : UINT : 0x0080
|
||||
QS_INPUT : UINT : QS_MOUSE | QS_KEY | QS_RAWINPUT
|
||||
QS_KEY : UINT : 0x0001
|
||||
QS_MOUSE : UINT : QS_MOUSEMOVE | QS_MOUSEBUTTON
|
||||
QS_MOUSEBUTTON : UINT : 0x0004
|
||||
QS_MOUSEMOVE : UINT : 0x0002
|
||||
QS_PAINT : UINT : 0x0020
|
||||
QS_POSTMESSAGE : UINT : 0x0008
|
||||
QS_RAWINPUT : UINT : 0x0400
|
||||
QS_SENDMESSAGE : UINT : 0x0040
|
||||
QS_TIMER : UINT : 0x0010
|
||||
|
||||
PM_NOREMOVE : UINT : 0x0000
|
||||
PM_REMOVE : UINT : 0x0001
|
||||
PM_NOYIELD : UINT : 0x0002
|
||||
|
||||
PM_QS_INPUT : UINT : QS_INPUT << 16
|
||||
PM_QS_PAINT : UINT : QS_PAINT << 16
|
||||
PM_QS_POSTMESSAGE : UINT : (QS_POSTMESSAGE | QS_HOTKEY | QS_TIMER) << 16
|
||||
PM_QS_SENDMESSAGE : UINT : QS_SENDMESSAGE << 16
|
||||
|
||||
SW_HIDE : c_int : 0
|
||||
SW_SHOWNORMAL : c_int : SW_NORMAL
|
||||
SW_NORMAL : c_int : 1
|
||||
SW_SHOWMINIMIZED : c_int : 2
|
||||
SW_SHOWMAXIMIZED : c_int : SW_MAXIMIZE
|
||||
SW_MAXIMIZE : c_int : 3
|
||||
SW_SHOWNOACTIVATE : c_int : 4
|
||||
SW_SHOW : c_int : 5
|
||||
SW_MINIMIZE : c_int : 6
|
||||
SW_SHOWMINNOACTIVE : c_int : 7
|
||||
SW_SHOWNA : c_int : 8
|
||||
SW_RESTORE : c_int : 9
|
||||
SW_SHOWDEFAULT : c_int : 10
|
||||
SW_FORCEMINIMIZE : c_int : 11
|
||||
|
||||
// SetWindowPos Flags
|
||||
SWP_NOSIZE :: 0x0001
|
||||
SWP_NOMOVE :: 0x0002
|
||||
SWP_NOZORDER :: 0x0004
|
||||
SWP_NOREDRAW :: 0x0008
|
||||
SWP_NOACTIVATE :: 0x0010
|
||||
SWP_FRAMECHANGED :: 0x0020 // The frame changed: send WM_NCCALCSIZE
|
||||
SWP_SHOWWINDOW :: 0x0040
|
||||
SWP_HIDEWINDOW :: 0x0080
|
||||
SWP_NOCOPYBITS :: 0x0100
|
||||
SWP_NOOWNERZORDER :: 0x0200 // Don't do owner Z ordering
|
||||
SWP_NOSENDCHANGING :: 0x0400 // Don't send WM_WINDOWPOSCHANGING
|
||||
|
||||
SWP_DRAWFRAME :: SWP_FRAMECHANGED
|
||||
SWP_NOREPOSITION :: SWP_NOOWNERZORDER
|
||||
|
||||
SWP_DEFERERASE :: 0x2000 // same as SWP_DEFERDRAWING
|
||||
SWP_ASYNCWINDOWPOS :: 0x4000 // same as SWP_CREATESPB
|
||||
|
||||
HWND_TOP :: HWND( uintptr(0)) // 0
|
||||
HWND_BOTTOM :: HWND( uintptr(1)) // 1
|
||||
HWND_TOPMOST :: HWND(~uintptr(0)) // -1
|
||||
HWND_NOTOPMOST :: HWND(~uintptr(0) - 1) // -2
|
||||
|
||||
// Window field offsets for GetWindowLong()
|
||||
GWL_STYLE :: -16
|
||||
GWL_EXSTYLE :: -20
|
||||
GWL_ID :: -12
|
||||
|
||||
when ODIN_ARCH == .i386 {
|
||||
GWL_WNDPROC :: -4
|
||||
GWL_HINSTANCE :: -6
|
||||
GWL_HWNDPARENT :: -8
|
||||
GWL_USERDATA :: -21
|
||||
}
|
||||
|
||||
GWLP_WNDPROC :: -4
|
||||
GWLP_HINSTANCE :: -6
|
||||
GWLP_HWNDPARENT :: -8
|
||||
GWLP_USERDATA :: -21
|
||||
GWLP_ID :: -12
|
||||
|
||||
// Class field offsets for GetClassLong()
|
||||
GCL_CBWNDEXTRA :: -18
|
||||
GCL_CBCLSEXTRA :: -20
|
||||
GCL_STYLE :: -26
|
||||
GCW_ATOM :: -32
|
||||
|
||||
when ODIN_ARCH == .i386 {
|
||||
GCL_MENUNAME :: -8
|
||||
GCL_HBRBACKGROUND :: -10
|
||||
GCL_HCURSOR :: -12
|
||||
GCL_HICON :: -14
|
||||
GCL_HMODULE :: -16
|
||||
GCL_WNDPROC :: -24
|
||||
GCL_HICONSM :: -34
|
||||
}
|
||||
|
||||
GCLP_MENUNAME :: -8
|
||||
GCLP_HBRBACKGROUND :: -10
|
||||
GCLP_HCURSOR :: -12
|
||||
GCLP_HICON :: -14
|
||||
GCLP_HMODULE :: -16
|
||||
GCLP_WNDPROC :: -24
|
||||
GCLP_HICONSM :: -34
|
||||
|
||||
// GetSystemMetrics() codes
|
||||
SM_CXSCREEN :: 0
|
||||
SM_CYSCREEN :: 1
|
||||
SM_CXVSCROLL :: 2
|
||||
SM_CYHSCROLL :: 3
|
||||
SM_CYCAPTION :: 4
|
||||
SM_CXBORDER :: 5
|
||||
SM_CYBORDER :: 6
|
||||
SM_CXDLGFRAME :: 7
|
||||
SM_CYDLGFRAME :: 8
|
||||
SM_CYVTHUMB :: 9
|
||||
SM_CXHTHUMB :: 10
|
||||
SM_CXICON :: 11
|
||||
SM_CYICON :: 12
|
||||
SM_CXCURSOR :: 13
|
||||
SM_CYCURSOR :: 14
|
||||
SM_CYMENU :: 15
|
||||
SM_CXFULLSCREEN :: 16
|
||||
SM_CYFULLSCREEN :: 17
|
||||
SM_CYKANJIWINDOW :: 18
|
||||
SM_MOUSEPRESENT :: 19
|
||||
SM_CYVSCROLL :: 20
|
||||
SM_CXHSCROLL :: 21
|
||||
SM_DEBUG :: 22
|
||||
SM_SWAPBUTTON :: 23
|
||||
SM_RESERVED1 :: 24
|
||||
SM_RESERVED2 :: 25
|
||||
SM_RESERVED3 :: 26
|
||||
SM_RESERVED4 :: 27
|
||||
SM_CXMIN :: 28
|
||||
SM_CYMIN :: 29
|
||||
SM_CXSIZE :: 30
|
||||
SM_CYSIZE :: 31
|
||||
SM_CXFRAME :: 32
|
||||
SM_CYFRAME :: 33
|
||||
SM_CXMINTRACK :: 34
|
||||
SM_CYMINTRACK :: 35
|
||||
SM_CXDOUBLECLK :: 36
|
||||
SM_CYDOUBLECLK :: 37
|
||||
SM_CXICONSPACING :: 38
|
||||
SM_CYICONSPACING :: 39
|
||||
SM_MENUDROPALIGNMENT :: 40
|
||||
SM_PENWINDOWS :: 41
|
||||
SM_DBCSENABLED :: 42
|
||||
SM_CMOUSEBUTTONS :: 43
|
||||
|
||||
SM_CXFIXEDFRAME :: SM_CXDLGFRAME // ;win40 name change
|
||||
SM_CYFIXEDFRAME :: SM_CYDLGFRAME // ;win40 name change
|
||||
SM_CXSIZEFRAME :: SM_CXFRAME // ;win40 name change
|
||||
SM_CYSIZEFRAME :: SM_CYFRAME // ;win40 name change
|
||||
|
||||
SM_SECURE :: 44
|
||||
SM_CXEDGE :: 45
|
||||
SM_CYEDGE :: 46
|
||||
SM_CXMINSPACING :: 47
|
||||
SM_CYMINSPACING :: 48
|
||||
SM_CXSMICON :: 49
|
||||
SM_CYSMICON :: 50
|
||||
SM_CYSMCAPTION :: 51
|
||||
SM_CXSMSIZE :: 52
|
||||
SM_CYSMSIZE :: 53
|
||||
SM_CXMENUSIZE :: 54
|
||||
SM_CYMENUSIZE :: 55
|
||||
SM_ARRANGE :: 56
|
||||
SM_CXMINIMIZED :: 57
|
||||
SM_CYMINIMIZED :: 58
|
||||
SM_CXMAXTRACK :: 59
|
||||
SM_CYMAXTRACK :: 60
|
||||
SM_CXMAXIMIZED :: 61
|
||||
SM_CYMAXIMIZED :: 62
|
||||
SM_NETWORK :: 63
|
||||
SM_CLEANBOOT :: 67
|
||||
SM_CXDRAG :: 68
|
||||
SM_CYDRAG :: 69
|
||||
|
||||
SM_SHOWSOUNDS :: 70
|
||||
SM_CXMENUCHECK :: 71 // Use instead of GetMenuCheckMarkDimensions()!
|
||||
SM_CYMENUCHECK :: 72
|
||||
SM_SLOWMACHINE :: 73
|
||||
SM_MIDEASTENABLED :: 74
|
||||
SM_MOUSEWHEELPRESENT :: 75
|
||||
SM_XVIRTUALSCREEN :: 76
|
||||
SM_YVIRTUALSCREEN :: 77
|
||||
SM_CXVIRTUALSCREEN :: 78
|
||||
SM_CYVIRTUALSCREEN :: 79
|
||||
SM_CMONITORS :: 80
|
||||
SM_SAMEDISPLAYFORMAT :: 81
|
||||
SM_IMMENABLED :: 82
|
||||
SM_CXFOCUSBORDER :: 83
|
||||
SM_CYFOCUSBORDER :: 84
|
||||
SM_TABLETPC :: 86
|
||||
SM_MEDIACENTER :: 87
|
||||
SM_STARTER :: 88
|
||||
SM_SERVERR2 :: 89
|
||||
|
||||
SM_MOUSEHORIZONTALWHEELPRESENT :: 91
|
||||
|
||||
SM_CXPADDEDBORDER :: 92
|
||||
SM_DIGITIZER :: 94
|
||||
SM_MAXIMUMTOUCHES :: 95
|
||||
SM_CMETRICS :: 97
|
||||
|
||||
SM_REMOTESESSION :: 0x1000
|
||||
SM_SHUTTINGDOWN :: 0x2000
|
||||
SM_REMOTECONTROL :: 0x2001
|
||||
SM_CARETBLINKINGENABLED :: 0x2002
|
||||
SM_CONVERTIBLESLATEMODE :: 0x2003
|
||||
SM_SYSTEMDOCKED :: 0x2004
|
||||
|
||||
// System Menu Command Values
|
||||
SC_SIZE :: 0xF000
|
||||
SC_MOVE :: 0xF010
|
||||
SC_MINIMIZE :: 0xF020
|
||||
SC_MAXIMIZE :: 0xF030
|
||||
SC_NEXTWINDOW :: 0xF040
|
||||
SC_PREVWINDOW :: 0xF050
|
||||
SC_CLOSE :: 0xF060
|
||||
SC_VSCROLL :: 0xF070
|
||||
SC_HSCROLL :: 0xF080
|
||||
SC_MOUSEMENU :: 0xF090
|
||||
SC_KEYMENU :: 0xF100
|
||||
SC_ARRANGE :: 0xF110
|
||||
SC_RESTORE :: 0xF120
|
||||
SC_TASKLIST :: 0xF130
|
||||
SC_SCREENSAVE :: 0xF140
|
||||
SC_HOTKEY :: 0xF150
|
||||
SC_DEFAULT :: 0xF160
|
||||
SC_MONITORPOWER :: 0xF170
|
||||
SC_CONTEXTHELP :: 0xF180
|
||||
SC_SEPARATOR :: 0xF00F
|
||||
SCF_ISSECURE :: 0x00000001
|
||||
SC_ICON :: SC_MINIMIZE
|
||||
SC_ZOOM :: SC_MAXIMIZE
|
||||
|
||||
CW_USEDEFAULT : c_int : -2147483648
|
||||
|
||||
SIZE_RESTORED :: 0
|
||||
SIZE_MINIMIZED :: 1
|
||||
SIZE_MAXIMIZED :: 2
|
||||
SIZE_MAXSHOW :: 3
|
||||
SIZE_MAXHIDE :: 4
|
||||
|
||||
WMSZ_LEFT :: 1
|
||||
WMSZ_RIGHT :: 2
|
||||
WMSZ_TOP :: 3
|
||||
WMSZ_TOPLEFT :: 4
|
||||
WMSZ_TOPRIGHT :: 5
|
||||
WMSZ_BOTTOM :: 6
|
||||
WMSZ_BOTTOMLEFT :: 7
|
||||
WMSZ_BOTTOMRIGHT :: 8
|
||||
|
||||
// Key State Masks for Mouse Messages
|
||||
MK_LBUTTON :: 0x0001
|
||||
MK_RBUTTON :: 0x0002
|
||||
MK_SHIFT :: 0x0004
|
||||
MK_CONTROL :: 0x0008
|
||||
MK_MBUTTON :: 0x0010
|
||||
MK_XBUTTON1 :: 0x0020
|
||||
MK_XBUTTON2 :: 0x0040
|
||||
|
||||
// Value for rolling one detent
|
||||
WHEEL_DELTA :: 120
|
||||
|
||||
// Setting to scroll one page for SPI_GET/SETWHEELSCROLLLINES
|
||||
WHEEL_PAGESCROLL :: max(UINT)
|
||||
|
||||
// XButton values are WORD flags
|
||||
XBUTTON1 :: 0x0001
|
||||
XBUTTON2 :: 0x0002
|
||||
// Were there to be an XBUTTON3, its value would be 0x0004
|
||||
|
||||
MAPVK_VK_TO_VSC :: 0
|
||||
MAPVK_VSC_TO_VK :: 1
|
||||
MAPVK_VK_TO_CHAR :: 2
|
||||
MAPVK_VSC_TO_VK_EX :: 3
|
||||
MAPVK_VK_TO_VSC_EX :: 4
|
||||
|
||||
TME_HOVER :: 0x00000001
|
||||
TME_LEAVE :: 0x00000002
|
||||
TME_NONCLIENT :: 0x00000010
|
||||
TME_QUERY :: 0x40000000
|
||||
TME_CANCEL :: 0x80000000
|
||||
HOVER_DEFAULT :: 0xFFFFFFFF
|
||||
|
||||
USER_TIMER_MAXIMUM :: 0x7FFFFFFF
|
||||
USER_TIMER_MINIMUM :: 0x0000000A
|
||||
|
||||
|
||||
// SetWindowsHook() codes
|
||||
WH_MIN :: -1
|
||||
WH_MSGFILTER :: -1
|
||||
WH_JOURNALRECORD :: 0
|
||||
WH_JOURNALPLAYBACK :: 1
|
||||
WH_KEYBOARD :: 2
|
||||
WH_GETMESSAGE :: 3
|
||||
WH_CALLWNDPROC :: 4
|
||||
WH_CBT :: 5
|
||||
WH_SYSMSGFILTER :: 6
|
||||
WH_MOUSE :: 7
|
||||
WH_HARDWARE :: 8
|
||||
WH_DEBUG :: 9
|
||||
WH_SHELL :: 10
|
||||
WH_FOREGROUNDIDLE :: 11
|
||||
WH_CALLWNDPROCRET :: 12
|
||||
WH_KEYBOARD_LL :: 13
|
||||
WH_MOUSE_LL :: 14
|
||||
WH_MAX :: 14
|
||||
WH_MINHOOK :: WH_MIN
|
||||
WH_MAXHOOK :: WH_MAX
|
||||
|
||||
// Hook Codes
|
||||
HC_ACTION :: 0
|
||||
HC_GETNEXT :: 1
|
||||
HC_SKIP :: 2
|
||||
HC_NOREMOVE :: 3
|
||||
HC_NOREM :: HC_NOREMOVE
|
||||
HC_SYSMODALON :: 4
|
||||
HC_SYSMODALOFF :: 5
|
||||
|
||||
// CBT Hook Codes
|
||||
HCBT_MOVESIZE :: 0
|
||||
HCBT_MINMAX :: 1
|
||||
HCBT_QS :: 2
|
||||
HCBT_CREATEWND :: 3
|
||||
HCBT_DESTROYWND :: 4
|
||||
HCBT_ACTIVATE :: 5
|
||||
HCBT_CLICKSKIPPED :: 6
|
||||
HCBT_KEYSKIPPED :: 7
|
||||
HCBT_SYSCOMMAND :: 8
|
||||
HCBT_SETFOCUS :: 9
|
||||
|
||||
_IDC_APPSTARTING := rawptr(uintptr(32650))
|
||||
_IDC_ARROW := rawptr(uintptr(32512))
|
||||
_IDC_CROSS := rawptr(uintptr(32515))
|
||||
_IDC_HAND := rawptr(uintptr(32649))
|
||||
_IDC_HELP := rawptr(uintptr(32651))
|
||||
_IDC_IBEAM := rawptr(uintptr(32513))
|
||||
_IDC_ICON := rawptr(uintptr(32641))
|
||||
_IDC_NO := rawptr(uintptr(32648))
|
||||
_IDC_SIZE := rawptr(uintptr(32640))
|
||||
_IDC_SIZEALL := rawptr(uintptr(32646))
|
||||
_IDC_SIZENESW := rawptr(uintptr(32643))
|
||||
_IDC_SIZENS := rawptr(uintptr(32645))
|
||||
_IDC_SIZENWSE := rawptr(uintptr(32642))
|
||||
_IDC_SIZEWE := rawptr(uintptr(32644))
|
||||
_IDC_UPARROW := rawptr(uintptr(32516))
|
||||
_IDC_WAIT := rawptr(uintptr(32514))
|
||||
|
||||
IDC_APPSTARTING := cstring(_IDC_APPSTARTING)
|
||||
IDC_ARROW := cstring(_IDC_ARROW)
|
||||
IDC_CROSS := cstring(_IDC_CROSS)
|
||||
IDC_HAND := cstring(_IDC_HAND)
|
||||
IDC_HELP := cstring(_IDC_HELP)
|
||||
IDC_IBEAM := cstring(_IDC_IBEAM)
|
||||
IDC_ICON := cstring(_IDC_ICON)
|
||||
IDC_NO := cstring(_IDC_NO)
|
||||
IDC_SIZE := cstring(_IDC_SIZE)
|
||||
IDC_SIZEALL := cstring(_IDC_SIZEALL)
|
||||
IDC_SIZENESW := cstring(_IDC_SIZENESW)
|
||||
IDC_SIZENS := cstring(_IDC_SIZENS)
|
||||
IDC_SIZENWSE := cstring(_IDC_SIZENWSE)
|
||||
IDC_SIZEWE := cstring(_IDC_SIZEWE)
|
||||
IDC_UPARROW := cstring(_IDC_UPARROW)
|
||||
IDC_WAIT := cstring(_IDC_WAIT)
|
||||
|
||||
|
||||
_IDI_APPLICATION := rawptr(uintptr(32512))
|
||||
_IDI_HAND := rawptr(uintptr(32513))
|
||||
_IDI_QUESTION := rawptr(uintptr(32514))
|
||||
_IDI_EXCLAMATION := rawptr(uintptr(32515))
|
||||
_IDI_ASTERISK := rawptr(uintptr(32516))
|
||||
_IDI_WINLOGO := rawptr(uintptr(32517))
|
||||
_IDI_SHIELD := rawptr(uintptr(32518))
|
||||
IDI_APPLICATION := cstring(_IDI_APPLICATION)
|
||||
IDI_HAND := cstring(_IDI_HAND)
|
||||
IDI_QUESTION := cstring(_IDI_QUESTION)
|
||||
IDI_EXCLAMATION := cstring(_IDI_EXCLAMATION)
|
||||
IDI_ASTERISK := cstring(_IDI_ASTERISK)
|
||||
IDI_WINLOGO := cstring(_IDI_WINLOGO)
|
||||
IDI_SHIELD := cstring(_IDI_SHIELD)
|
||||
IDI_WARNING := IDI_EXCLAMATION
|
||||
IDI_ERROR := IDI_HAND
|
||||
IDI_INFORMATION := IDI_ASTERISK
|
||||
|
||||
|
||||
// DIB color table identifiers
|
||||
DIB_RGB_COLORS :: 0
|
||||
DIB_PAL_COLORS :: 1
|
||||
|
||||
// constants for CreateDIBitmap
|
||||
CBM_INIT :: 0x04 // initialize bitmap
|
||||
|
||||
// Region Flags
|
||||
ERROR :: 0
|
||||
NULLREGION :: 1
|
||||
SIMPLEREGION :: 2
|
||||
COMPLEXREGION :: 3
|
||||
RGN_ERROR :: ERROR
|
||||
|
||||
// StretchBlt() Modes
|
||||
BLACKONWHITE :: 1
|
||||
WHITEONBLACK :: 2
|
||||
COLORONCOLOR :: 3
|
||||
HALFTONE :: 4
|
||||
MAXSTRETCHBLTMODE :: 4
|
||||
|
||||
// Binary raster ops
|
||||
R2_BLACK :: 1 // 0
|
||||
R2_NOTMERGEPEN :: 2 // DPon
|
||||
R2_MASKNOTPEN :: 3 // DPna
|
||||
R2_NOTCOPYPEN :: 4 // PN
|
||||
R2_MASKPENNOT :: 5 // PDna
|
||||
R2_NOT :: 6 // Dn
|
||||
R2_XORPEN :: 7 // DPx
|
||||
R2_NOTMASKPEN :: 8 // DPan
|
||||
R2_MASKPEN :: 9 // DPa
|
||||
R2_NOTXORPEN :: 10 // DPxn
|
||||
R2_NOP :: 11 // D
|
||||
R2_MERGENOTPEN :: 12 // DPno
|
||||
R2_COPYPEN :: 13 // P
|
||||
R2_MERGEPENNOT :: 14 // PDno
|
||||
R2_MERGEPEN :: 15 // DPo
|
||||
R2_WHITE :: 16 // 1
|
||||
R2_LAST :: 16
|
||||
|
||||
// Ternary raster operations
|
||||
SRCCOPY : DWORD : 0x00CC0020 // dest = source
|
||||
SRCPAINT : DWORD : 0x00EE0086 // dest = source OR dest
|
||||
SRCAND : DWORD : 0x008800C6 // dest = source AND dest
|
||||
SRCINVERT : DWORD : 0x00660046 // dest = source XOR dest
|
||||
SRCERASE : DWORD : 0x00440328 // dest = source AND (NOT dest)
|
||||
NOTSRCCOPY : DWORD : 0x00330008 // dest = (NOT source)
|
||||
NOTSRCERASE : DWORD : 0x001100A6 // dest = (NOT src) AND (NOT dest)
|
||||
MERGECOPY : DWORD : 0x00C000CA // dest = (source AND pattern
|
||||
MERGEPAINT : DWORD : 0x00BB0226 // dest = (NOT source) OR dest
|
||||
PATCOPY : DWORD : 0x00F00021 // dest = pattern
|
||||
PATPAINT : DWORD : 0x00FB0A09 // dest = DPSnoo
|
||||
PATINVERT : DWORD : 0x005A0049 // dest = pattern XOR dest
|
||||
DSTINVERT : DWORD : 0x00550009 // dest = (NOT dest)
|
||||
BLACKNESS : DWORD : 0x00000042 // dest = BLACK
|
||||
WHITENESS : DWORD : 0x00FF0062 // dest = WHITE
|
||||
NOMIRRORBITMAP : DWORD : 0x80000000 // Do not Mirror the bitmap in this call
|
||||
CAPTUREBLT : DWORD : 0x40000000 // Include layered windows
|
||||
|
||||
// Stock Logical Objects
|
||||
WHITE_BRUSH :: 0
|
||||
LTGRAY_BRUSH :: 1
|
||||
GRAY_BRUSH :: 2
|
||||
DKGRAY_BRUSH :: 3
|
||||
BLACK_BRUSH :: 4
|
||||
NULL_BRUSH :: 5
|
||||
HOLLOW_BRUSH :: NULL_BRUSH
|
||||
WHITE_PEN :: 6
|
||||
BLACK_PEN :: 7
|
||||
NULL_PEN :: 8
|
||||
OEM_FIXED_FONT :: 10
|
||||
ANSI_FIXED_FONT :: 11
|
||||
ANSI_VAR_FONT :: 12
|
||||
SYSTEM_FONT :: 13
|
||||
DEVICE_DEFAULT_FONT :: 14
|
||||
DEFAULT_PALETTE :: 15
|
||||
SYSTEM_FIXED_FONT :: 16
|
||||
DEFAULT_GUI_FONT :: 17
|
||||
DC_BRUSH :: 18
|
||||
DC_PEN :: 19
|
||||
STOCK_LAST :: 19
|
||||
|
||||
CLR_INVALID :: 0xFFFFFFFF
|
||||
|
||||
RGBQUAD :: struct {
|
||||
rgbBlue: BYTE,
|
||||
rgbGreen: BYTE,
|
||||
rgbRed: BYTE,
|
||||
rgbReserved: BYTE,
|
||||
}
|
||||
|
||||
PIXELFORMATDESCRIPTOR :: struct {
|
||||
nSize: WORD,
|
||||
nVersion: WORD,
|
||||
dwFlags: DWORD,
|
||||
iPixelType: BYTE,
|
||||
cColorBits: BYTE,
|
||||
cRedBits: BYTE,
|
||||
cRedShift: BYTE,
|
||||
cGreenBits: BYTE,
|
||||
cGreenShift: BYTE,
|
||||
cBlueBits: BYTE,
|
||||
cBlueShift: BYTE,
|
||||
cAlphaBits: BYTE,
|
||||
cAlphaShift: BYTE,
|
||||
cAccumBits: BYTE,
|
||||
cAccumRedBits: BYTE,
|
||||
cAccumGreenBits: BYTE,
|
||||
cAccumBlueBits: BYTE,
|
||||
cAccumAlphaBits: BYTE,
|
||||
cDepthBits: BYTE,
|
||||
cStencilBits: BYTE,
|
||||
cAuxBuffers: BYTE,
|
||||
iLayerType: BYTE,
|
||||
bReserved: BYTE,
|
||||
dwLayerMask: DWORD,
|
||||
dwVisibleMask: DWORD,
|
||||
dwDamageMask: DWORD,
|
||||
}
|
||||
|
||||
BITMAPINFOHEADER :: struct {
|
||||
biSize: DWORD,
|
||||
biWidth: LONG,
|
||||
biHeight: LONG,
|
||||
biPlanes: WORD,
|
||||
biBitCount: WORD,
|
||||
biCompression: DWORD,
|
||||
biSizeImage: DWORD,
|
||||
biXPelsPerMeter: LONG,
|
||||
biYPelsPerMeter: LONG,
|
||||
biClrUsed: DWORD,
|
||||
biClrImportant: DWORD,
|
||||
}
|
||||
|
||||
BITMAPINFO :: struct {
|
||||
bmiHeader: BITMAPINFOHEADER,
|
||||
bmiColors: [1]RGBQUAD,
|
||||
}
|
||||
|
||||
// pixel types
|
||||
PFD_TYPE_RGBA :: 0
|
||||
PFD_TYPE_COLORINDEX :: 1
|
||||
|
||||
// layer types
|
||||
PFD_MAIN_PLANE :: 0
|
||||
PFD_OVERLAY_PLANE :: 1
|
||||
PFD_UNDERLAY_PLANE :: -1
|
||||
|
||||
// PIXELFORMATDESCRIPTOR flags
|
||||
PFD_DOUBLEBUFFER :: 0x00000001
|
||||
PFD_STEREO :: 0x00000002
|
||||
PFD_DRAW_TO_WINDOW :: 0x00000004
|
||||
PFD_DRAW_TO_BITMAP :: 0x00000008
|
||||
PFD_SUPPORT_GDI :: 0x00000010
|
||||
PFD_SUPPORT_OPENGL :: 0x00000020
|
||||
PFD_GENERIC_FORMAT :: 0x00000040
|
||||
PFD_NEED_PALETTE :: 0x00000080
|
||||
PFD_NEED_SYSTEM_PALETTE :: 0x00000100
|
||||
PFD_SWAP_EXCHANGE :: 0x00000200
|
||||
PFD_SWAP_COPY :: 0x00000400
|
||||
PFD_SWAP_LAYER_BUFFERS :: 0x00000800
|
||||
PFD_GENERIC_ACCELERATED :: 0x00001000
|
||||
PFD_SUPPORT_DIRECTDRAW :: 0x00002000
|
||||
PFD_DIRECT3D_ACCELERATED :: 0x00004000
|
||||
PFD_SUPPORT_COMPOSITION :: 0x00008000
|
||||
|
||||
// PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only
|
||||
PFD_DEPTH_DONTCARE :: 0x20000000
|
||||
PFD_DOUBLEBUFFER_DONTCARE :: 0x40000000
|
||||
PFD_STEREO_DONTCARE :: 0x80000000
|
||||
|
||||
// constants for the biCompression field
|
||||
BI_RGB :: 0
|
||||
BI_RLE8 :: 1
|
||||
BI_RLE4 :: 2
|
||||
BI_BITFIELDS :: 3
|
||||
BI_JPEG :: 4
|
||||
BI_PNG :: 5
|
||||
|
||||
WSA_FLAG_OVERLAPPED: DWORD : 0x01
|
||||
WSA_FLAG_NO_HANDLE_INHERIT: DWORD : 0x80
|
||||
|
||||
@@ -379,6 +1199,15 @@ FILE_TYPE_PIPE :: 0x0003
|
||||
RECT :: struct {left, top, right, bottom: LONG}
|
||||
POINT :: struct {x, y: LONG}
|
||||
|
||||
WINDOWPOS :: struct {
|
||||
hwnd: HWND,
|
||||
hwndInsertAfter: HWND,
|
||||
x: c_int,
|
||||
y: c_int,
|
||||
cx: c_int,
|
||||
cy: c_int,
|
||||
flags: UINT,
|
||||
}
|
||||
|
||||
when size_of(uintptr) == 4 {
|
||||
WSADATA :: struct {
|
||||
@@ -578,7 +1407,7 @@ PROCESS_INFORMATION :: struct {
|
||||
}
|
||||
|
||||
// FYI: This is STARTUPINFOW, not STARTUPINFOA
|
||||
STARTUPINFO :: struct #packed {
|
||||
STARTUPINFO :: struct {
|
||||
cb: DWORD,
|
||||
lpReserved: LPWSTR,
|
||||
lpDesktop: LPWSTR,
|
||||
@@ -784,17 +1613,17 @@ SYSTEM_INFO :: struct {
|
||||
|
||||
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_osversioninfoexw
|
||||
OSVERSIONINFOEXW :: struct {
|
||||
dwOSVersionInfoSize: ULONG,
|
||||
dwMajorVersion: ULONG,
|
||||
dwMinorVersion: ULONG,
|
||||
dwBuildNumber: ULONG,
|
||||
dwPlatformId: ULONG,
|
||||
szCSDVersion: [128]WCHAR,
|
||||
wServicePackMajor: USHORT,
|
||||
wServicePackMinor: USHORT,
|
||||
wSuiteMask: USHORT,
|
||||
wProductType: UCHAR,
|
||||
wReserved: UCHAR,
|
||||
dwOSVersionInfoSize: ULONG,
|
||||
dwMajorVersion: ULONG,
|
||||
dwMinorVersion: ULONG,
|
||||
dwBuildNumber: ULONG,
|
||||
dwPlatformId: ULONG,
|
||||
szCSDVersion: [128]WCHAR,
|
||||
wServicePackMajor: USHORT,
|
||||
wServicePackMinor: USHORT,
|
||||
wSuiteMask: USHORT,
|
||||
wProductType: UCHAR,
|
||||
wReserved: UCHAR,
|
||||
}
|
||||
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-quota_limits
|
||||
@@ -837,24 +1666,24 @@ PROFILEINFOW :: struct {
|
||||
lpDefaultPath: LPWSTR,
|
||||
lpServerName: LPWSTR,
|
||||
lpPolicyPath: LPWSTR,
|
||||
hProfile: HANDLE,
|
||||
hProfile: HANDLE,
|
||||
}
|
||||
|
||||
// Used in LookupAccountNameW
|
||||
SID_NAME_USE :: distinct DWORD
|
||||
|
||||
SID_TYPE :: enum SID_NAME_USE {
|
||||
User = 1,
|
||||
Group,
|
||||
Domain,
|
||||
Alias,
|
||||
WellKnownGroup,
|
||||
DeletedAccount,
|
||||
Invalid,
|
||||
Unknown,
|
||||
Computer,
|
||||
Label,
|
||||
LogonSession,
|
||||
User = 1,
|
||||
Group,
|
||||
Domain,
|
||||
Alias,
|
||||
WellKnownGroup,
|
||||
DeletedAccount,
|
||||
Invalid,
|
||||
Unknown,
|
||||
Computer,
|
||||
Label,
|
||||
LogonSession,
|
||||
}
|
||||
|
||||
SECURITY_MAX_SID_SIZE :: 68
|
||||
@@ -869,7 +1698,7 @@ SID :: struct #packed {
|
||||
#assert(size_of(SID) == SECURITY_MAX_SID_SIZE)
|
||||
|
||||
SID_IDENTIFIER_AUTHORITY :: struct #packed {
|
||||
Value: [6]u8,
|
||||
Value: [6]u8,
|
||||
}
|
||||
|
||||
// For NetAPI32
|
||||
@@ -901,11 +1730,11 @@ USER_INFO_FLAG :: enum DWORD {
|
||||
Passwd_Cant_Change = 6, // 1 << 6: 0x0040,
|
||||
Encrypted_Text_Password_Allowed = 7, // 1 << 7: 0x0080,
|
||||
|
||||
Temp_Duplicate_Account = 8, // 1 << 8: 0x0100,
|
||||
Normal_Account = 9, // 1 << 9: 0x0200,
|
||||
InterDomain_Trust_Account = 11, // 1 << 11: 0x0800,
|
||||
Workstation_Trust_Account = 12, // 1 << 12: 0x1000,
|
||||
Server_Trust_Account = 13, // 1 << 13: 0x2000,
|
||||
Temp_Duplicate_Account = 8, // 1 << 8: 0x0100,
|
||||
Normal_Account = 9, // 1 << 9: 0x0200,
|
||||
InterDomain_Trust_Account = 11, // 1 << 11: 0x0800,
|
||||
Workstation_Trust_Account = 12, // 1 << 12: 0x1000,
|
||||
Server_Trust_Account = 13, // 1 << 13: 0x2000,
|
||||
}
|
||||
USER_INFO_FLAGS :: distinct bit_set[USER_INFO_FLAG]
|
||||
|
||||
@@ -1252,4 +2081,4 @@ SYSTEMTIME :: struct {
|
||||
minute: WORD,
|
||||
second: WORD,
|
||||
milliseconds: WORD,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
// +build windows
|
||||
package sys_windows
|
||||
|
||||
foreign import user32 "system:User32.lib"
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign user32 {
|
||||
GetClassInfoA :: proc(hInstance: HINSTANCE, lpClassNAme: LPCSTR, lpWndClass: ^WNDCLASSA) -> BOOL ---
|
||||
GetClassInfoW :: proc(hInstance: HINSTANCE, lpClassNAme: LPCWSTR, lpWndClass: ^WNDCLASSW) -> BOOL ---
|
||||
GetClassInfoExA :: proc(hInsatnce: HINSTANCE, lpszClass: LPCSTR, lpwcx: ^WNDCLASSEXA) -> BOOL ---
|
||||
GetClassInfoExW :: proc(hInsatnce: HINSTANCE, lpszClass: LPCWSTR, lpwcx: ^WNDCLASSEXW) -> BOOL ---
|
||||
|
||||
GetClassLongA :: proc(hWnd: HWND, nIndex: c_int) -> DWORD ---
|
||||
GetClassLongW :: proc(hWnd: HWND, nIndex: c_int) -> DWORD ---
|
||||
SetClassLongA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> DWORD ---
|
||||
SetClassLongW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> DWORD ---
|
||||
|
||||
GetWindowLongA :: proc(hWnd: HWND, nIndex: c_int) -> LONG ---
|
||||
GetWindowLongW :: proc(hWnd: HWND, nIndex: c_int) -> LONG ---
|
||||
SetWindowLongA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> LONG ---
|
||||
SetWindowLongW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> LONG ---
|
||||
|
||||
GetClassNameA :: proc(hWnd: HWND, lpClassName: LPSTR, nMaxCount: c_int) -> c_int ---
|
||||
GetClassNameW :: proc(hWnd: HWND, lpClassName: LPWSTR, nMaxCount: c_int) -> c_int ---
|
||||
|
||||
RegisterClassA :: proc(lpWndClass: ^WNDCLASSA) -> ATOM ---
|
||||
RegisterClassW :: proc(lpWndClass: ^WNDCLASSW) -> ATOM ---
|
||||
RegisterClassExA :: proc(^WNDCLASSEXA) -> ATOM ---
|
||||
RegisterClassExW :: proc(^WNDCLASSEXW) -> ATOM ---
|
||||
|
||||
CreateWindowExA :: proc(
|
||||
dwExStyle: DWORD,
|
||||
lpClassName: LPCSTR,
|
||||
lpWindowName: LPCSTR,
|
||||
dwStyle: DWORD,
|
||||
X: c_int,
|
||||
Y: c_int,
|
||||
nWidth: c_int,
|
||||
nHeight: c_int,
|
||||
hWndParent: HWND,
|
||||
hMenu: HMENU,
|
||||
hInstance: HINSTANCE,
|
||||
lpParam: LPVOID,
|
||||
) -> HWND ---
|
||||
CreateWindowExW :: proc(
|
||||
dwExStyle: DWORD,
|
||||
lpClassName: LPCWSTR,
|
||||
lpWindowName: LPCWSTR,
|
||||
dwStyle: DWORD,
|
||||
X: c_int,
|
||||
Y: c_int,
|
||||
nWidth: c_int,
|
||||
nHeight: c_int,
|
||||
hWndParent: HWND,
|
||||
hMenu: HMENU,
|
||||
hInstance: HINSTANCE,
|
||||
lpParam: LPVOID,
|
||||
) -> HWND ---
|
||||
|
||||
DestroyWindow :: proc(hWnd: HWND) -> BOOL ---
|
||||
|
||||
ShowWindow :: proc(hWnd: HWND, nCmdShow: c_int) -> BOOL ---
|
||||
|
||||
GetMessageA :: proc(lpMsg: ^MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) -> BOOL ---
|
||||
GetMessageW :: proc(lpMsg: ^MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) -> BOOL ---
|
||||
|
||||
TranslateMessage :: proc(lpMsg: ^MSG) -> BOOL ---
|
||||
DispatchMessageA :: proc(lpMsg: ^MSG) -> LRESULT ---
|
||||
DispatchMessageW :: proc(lpMsg: ^MSG) -> LRESULT ---
|
||||
|
||||
PeekMessageA :: proc(lpMsg: ^MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) -> BOOL ---
|
||||
PeekMessageW :: proc(lpMsg: ^MSG, hWnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) -> BOOL ---
|
||||
|
||||
PostMessageA :: proc(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL ---
|
||||
PostMessageW :: proc(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL ---
|
||||
SendMessageA :: proc(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT ---
|
||||
SendMessageW :: proc(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT ---
|
||||
|
||||
PostThreadMessageA :: proc(idThread: DWORD, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL ---
|
||||
PostThreadMessageW :: proc(idThread: DWORD, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> BOOL ---
|
||||
|
||||
PostQuitMessage :: proc(nExitCode: c_int) ---
|
||||
|
||||
GetQueueStatus :: proc(flags: UINT) -> DWORD ---
|
||||
|
||||
DefWindowProcA :: proc(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT ---
|
||||
DefWindowProcW :: proc(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) -> LRESULT ---
|
||||
|
||||
FindWindowA :: proc(lpClassName: LPCSTR, lpWindowName: LPCSTR) -> HWND ---
|
||||
FindWindowW :: proc(lpClassName: LPCWSTR, lpWindowName: LPCWSTR) -> HWND ---
|
||||
FindWindowExA :: proc(hWndParent: HWND, hWndChildAfter: HWND, lpszClass: LPCSTR, lpszWindow: LPCSTR) -> HWND ---
|
||||
FindWindowExW :: proc(hWndParent: HWND, hWndChildAfter: HWND, lpszClass: LPCWSTR, lpszWindow: LPCWSTR) -> HWND ---
|
||||
|
||||
LoadIconA :: proc(hInstance: HINSTANCE, lpIconName: LPCSTR) -> HICON ---
|
||||
LoadIconW :: proc(hInstance: HINSTANCE, lpIconName: LPCWSTR) -> HICON ---
|
||||
LoadCursorA :: proc(hInstance: HINSTANCE, lpCursorName: LPCSTR) -> HCURSOR ---
|
||||
LoadCursorW :: proc(hInstance: HINSTANCE, lpCursorName: LPCWSTR) -> HCURSOR ---
|
||||
|
||||
GetWindowRect :: proc(hWnd: HWND, lpRect: LPRECT) -> BOOL ---
|
||||
GetClientRect :: proc(hWnd: HWND, lpRect: LPRECT) -> BOOL ---
|
||||
ClientToScreen :: proc(hWnd: HWND, lpPoint: LPPOINT) -> BOOL ---
|
||||
SetWindowPos :: proc(
|
||||
hWnd: HWND,
|
||||
hWndInsertAfter: HWND,
|
||||
X: c_int,
|
||||
Y: c_int,
|
||||
cx: c_int,
|
||||
cy: c_int,
|
||||
uFlags: UINT,
|
||||
) -> BOOL ---
|
||||
GetSystemMetrics :: proc(nIndex: c_int) -> c_int ---
|
||||
AdjustWindowRect :: proc(lpRect: LPRECT, dwStyle: DWORD, bMenu: BOOL) -> BOOL ---
|
||||
AdjustWindowRectEx :: proc(lpRect: LPRECT, dwStyle: DWORD, bMenu: BOOL, dwExStyle: DWORD) -> BOOL ---
|
||||
|
||||
GetWindowDC :: proc(hWnd: HWND) -> HDC ---
|
||||
GetDC :: proc(hWnd: HWND) -> HDC ---
|
||||
ReleaseDC :: proc(hWnd: HWND, hDC: HDC) -> c_int ---
|
||||
|
||||
GetUpdateRect :: proc(hWnd: HWND, lpRect: LPRECT, bErase: BOOL) -> BOOL ---
|
||||
ValidateRect :: proc(hWnd: HWND, lpRect: ^RECT) -> BOOL ---
|
||||
InvalidateRect :: proc(hWnd: HWND, lpRect: ^RECT, bErase: BOOL) -> BOOL ---
|
||||
|
||||
BeginPaint :: proc(hWnd: HWND, lpPaint: ^PAINTSTRUCT) -> HDC ---
|
||||
EndPaint :: proc(hWnd: HWND, lpPaint: ^PAINTSTRUCT) -> BOOL ---
|
||||
|
||||
GetCapture :: proc() -> HWND ---
|
||||
SetCapture :: proc(hWnd: HWND) -> HWND ---
|
||||
ReleaseCapture :: proc() -> BOOL ---
|
||||
TrackMouseEvent :: proc(lpEventTrack: LPTRACKMOUSEEVENT) -> BOOL ---
|
||||
|
||||
GetKeyState :: proc(nVirtKey: c_int) -> SHORT ---
|
||||
GetAsyncKeyState :: proc(vKey: c_int) -> SHORT ---
|
||||
|
||||
MapVirtualKeyA :: proc(uCode: UINT, uMapType: UINT) -> UINT ---
|
||||
MapVirtualKeyW :: proc(uCode: UINT, uMapType: UINT) -> UINT ---
|
||||
|
||||
SetWindowsHookExA :: proc(idHook: c_int, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD) -> HHOOK ---
|
||||
SetWindowsHookExW :: proc(idHook: c_int, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD) -> HHOOK ---
|
||||
UnhookWindowsHookEx :: proc(hhk: HHOOK) -> BOOL ---
|
||||
CallNextHookEx :: proc(hhk: HHOOK, nCode: c_int, wParam: WPARAM, lParam: LPARAM) -> LRESULT ---
|
||||
|
||||
SetTimer :: proc(hWnd: HWND, nIDEvent: UINT_PTR, uElapse: UINT, lpTimerFunc: TIMERPROC) -> UINT_PTR ---
|
||||
KillTimer :: proc(hWnd: HWND, uIDEvent: UINT_PTR) -> BOOL ---
|
||||
|
||||
MessageBoxA :: proc(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT) -> c_int ---
|
||||
MessageBoxW :: proc(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT) -> c_int ---
|
||||
MessageBoxExA :: proc(hWnd: HWND, lpText: LPCSTR, lpCaption: LPCSTR, uType: UINT, wLanguageId: WORD) -> c_int ---
|
||||
MessageBoxExW :: proc(hWnd: HWND, lpText: LPCWSTR, lpCaption: LPCWSTR, uType: UINT, wLanguageId: WORD) -> c_int ---
|
||||
}
|
||||
|
||||
CreateWindowA :: #force_inline proc "stdcall" (
|
||||
lpClassName: LPCSTR,
|
||||
lpWindowName: LPCSTR,
|
||||
dwStyle: DWORD,
|
||||
X: c_int,
|
||||
Y: c_int,
|
||||
nWidth: c_int,
|
||||
nHeight: c_int,
|
||||
hWndParent: HWND,
|
||||
hMenu: HMENU,
|
||||
hInstance: HINSTANCE,
|
||||
lpParam: LPVOID,
|
||||
) -> HWND {
|
||||
return CreateWindowExA(
|
||||
0,
|
||||
lpClassName,
|
||||
lpWindowName,
|
||||
dwStyle,
|
||||
X,
|
||||
Y,
|
||||
nWidth,
|
||||
nHeight,
|
||||
hWndParent,
|
||||
hMenu,
|
||||
hInstance,
|
||||
lpParam,
|
||||
)
|
||||
}
|
||||
|
||||
CreateWindowW :: #force_inline proc "stdcall" (
|
||||
lpClassName: LPCTSTR,
|
||||
lpWindowName: LPCTSTR,
|
||||
dwStyle: DWORD,
|
||||
X: c_int,
|
||||
Y: c_int,
|
||||
nWidth: c_int,
|
||||
nHeight: c_int,
|
||||
hWndParent: HWND,
|
||||
hMenu: HMENU,
|
||||
hInstance: HINSTANCE,
|
||||
lpParam: LPVOID,
|
||||
) -> HWND {
|
||||
return CreateWindowExW(
|
||||
0,
|
||||
lpClassName,
|
||||
lpWindowName,
|
||||
dwStyle,
|
||||
X,
|
||||
Y,
|
||||
nWidth,
|
||||
nHeight,
|
||||
hWndParent,
|
||||
hMenu,
|
||||
hInstance,
|
||||
lpParam,
|
||||
)
|
||||
}
|
||||
|
||||
when ODIN_ARCH == .amd64 {
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign user32 {
|
||||
GetClassLongPtrA :: proc(hWnd: HWND, nIndex: c_int) -> ULONG_PTR ---
|
||||
GetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> ULONG_PTR ---
|
||||
SetClassLongPtrA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR ---
|
||||
SetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR ---
|
||||
|
||||
GetWindowLongPtrA :: proc(hWnd: HWND, nIndex: c_int) -> LONG_PTR ---
|
||||
GetWindowLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> LONG_PTR ---
|
||||
SetWindowLongPtrA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> LONG_PTR ---
|
||||
SetWindowLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> LONG_PTR ---
|
||||
}
|
||||
} else when ODIN_ARCH == .i386 {
|
||||
GetClassLongPtrA :: GetClassLongA
|
||||
GetClassLongPtrW :: GetClassLongW
|
||||
SetClassLongPtrA :: SetClassLongA
|
||||
SetClassLongPtrW :: SetClassLongW
|
||||
|
||||
GetWindowLongPtrA :: GetWindowLongA
|
||||
GetWindowLongPtrW :: GetWindowLongW
|
||||
SetWindowLongPtrA :: GetWindowLongA
|
||||
SetWindowLongPtrW :: GetWindowLongW
|
||||
}
|
||||
|
||||
GET_SC_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_int {
|
||||
return c_int(wParam) & 0xFFF0
|
||||
}
|
||||
|
||||
GET_WHEEL_DELTA_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_short {
|
||||
return cast(c_short)HIWORD(cast(DWORD)wParam)
|
||||
}
|
||||
|
||||
GET_KEYSTATE_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> WORD {
|
||||
return LOWORD(cast(DWORD)wParam)
|
||||
}
|
||||
|
||||
GET_NCHITTEST_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_short {
|
||||
return cast(c_short)LOWORD(cast(DWORD)wParam)
|
||||
}
|
||||
|
||||
GET_XBUTTON_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> WORD {
|
||||
return HIWORD(cast(DWORD)wParam)
|
||||
}
|
||||
@@ -3,6 +3,9 @@ package sys_windows
|
||||
|
||||
import "core:strings"
|
||||
import "core:sys/win32"
|
||||
import "core:intrinsics"
|
||||
|
||||
L :: intrinsics.constant_utf16_cstring
|
||||
|
||||
LOWORD :: #force_inline proc "contextless" (x: DWORD) -> WORD {
|
||||
return WORD(x & 0xffff)
|
||||
@@ -45,7 +48,9 @@ utf8_to_wstring :: proc(s: string, allocator := context.temp_allocator) -> wstri
|
||||
return nil
|
||||
}
|
||||
|
||||
wstring_to_utf8 :: proc(s: wstring, N: int, allocator := context.temp_allocator) -> string {
|
||||
wstring_to_utf8 :: proc(s: wstring, N: int, allocator := context.temp_allocator) -> (res: string) {
|
||||
context.allocator = allocator
|
||||
|
||||
if N <= 0 {
|
||||
return ""
|
||||
}
|
||||
@@ -60,7 +65,7 @@ wstring_to_utf8 :: proc(s: wstring, N: int, allocator := context.temp_allocator)
|
||||
// also null terminated.
|
||||
// If N != -1 it assumes the wide string is not null terminated and the resulting string
|
||||
// will not be null terminated, we therefore have to force it to be null terminated manually.
|
||||
text := make([]byte, n+1 if N != -1 else n, allocator)
|
||||
text := make([]byte, n+1 if N != -1 else n)
|
||||
|
||||
n1 := WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, s, i32(N), raw_data(text), n, nil, nil)
|
||||
if n1 == 0 {
|
||||
@@ -74,7 +79,6 @@ wstring_to_utf8 :: proc(s: wstring, N: int, allocator := context.temp_allocator)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return string(text[:n])
|
||||
}
|
||||
|
||||
@@ -455,4 +459,4 @@ run_as_user :: proc(username, password, application, commandline: string, pi: ^P
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user