mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-31 10:22:08 +00:00
sys/windows: fixed calling conventions, added several bindings
This commit is contained in:
@@ -341,6 +341,7 @@ MEM_TOP_DOWN :: 0x100000
|
||||
MEM_LARGE_PAGES :: 0x20000000
|
||||
MEM_4MB_PAGES :: 0x80000000
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
VirtualAlloc :: proc(
|
||||
lpAddress: LPVOID,
|
||||
@@ -483,6 +484,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,
|
||||
@@ -498,6 +500,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,
|
||||
@@ -527,6 +530,7 @@ WIN32_MEMORY_RANGE_ENTRY :: struct {
|
||||
|
||||
PWIN32_MEMORY_RANGE_ENTRY :: ^WIN32_MEMORY_RANGE_ENTRY
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
PrefetchVirtualMemory :: proc(
|
||||
hProcess: HANDLE,
|
||||
@@ -584,6 +588,7 @@ foreign kernel32 {
|
||||
|
||||
MEHC_PATROL_SCRUBBER_PRESENT :: ULONG(0x1)
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
GetMemoryErrorHandlingCapabilities :: proc(
|
||||
Capabilities: PULONG,
|
||||
@@ -592,6 +597,7 @@ foreign kernel32 {
|
||||
|
||||
PBAD_MEMORY_CALLBACK_ROUTINE :: #type proc "stdcall" ()
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
RegisterBadMemoryNotification :: proc(
|
||||
Callback: PBAD_MEMORY_CALLBACK_ROUTINE,
|
||||
@@ -612,6 +618,7 @@ VmOfferPriorityLow :: OFFER_PRIORITY.VmOfferPriorityLow
|
||||
VmOfferPriorityBelowNormal :: OFFER_PRIORITY.VmOfferPriorityBelowNormal
|
||||
VmOfferPriorityNormal :: OFFER_PRIORITY.VmOfferPriorityNormal
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
OfferVirtualMemory :: proc(
|
||||
VirtualAddress: PVOID,
|
||||
@@ -676,6 +683,7 @@ WIN32_MEMORY_REGION_INFORMATION_u_s_Bitfield :: distinct ULONG
|
||||
Reserved : 32-6,
|
||||
}*/
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
QueryVirtualMemoryInformation :: proc(
|
||||
Process: HANDLE,
|
||||
@@ -700,7 +708,7 @@ foreign kernel32 {
|
||||
|
||||
NUMA_NO_PREFERRED_NODE :: 0xffffffff
|
||||
|
||||
MapViewOfFile2 :: #force_inline proc(
|
||||
MapViewOfFile2 :: #force_inline proc "stdcall" (
|
||||
FileMappingHandle: HANDLE,
|
||||
ProcessHandle: HANDLE,
|
||||
Offset: ULONG64,
|
||||
@@ -721,6 +729,7 @@ MapViewOfFile2 :: #force_inline proc(
|
||||
)
|
||||
}
|
||||
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign kernel32 {
|
||||
UnmapViewOfFile2 :: proc(
|
||||
ProcessHandle: HANDLE,
|
||||
|
||||
@@ -54,6 +54,7 @@ NTSTATUS :: c.long
|
||||
LPARAM :: LONG_PTR
|
||||
WPARAM :: UINT_PTR
|
||||
LRESULT :: LONG_PTR
|
||||
LPRECT :: ^RECT
|
||||
|
||||
UINT8 :: u8
|
||||
UINT16 :: u16
|
||||
@@ -80,6 +81,7 @@ PBOOL :: ^BOOL
|
||||
LPBOOL :: ^BOOL
|
||||
LPCSTR :: cstring
|
||||
LPCWSTR :: wstring
|
||||
LPCTSTR :: wstring
|
||||
LPDWORD :: ^DWORD
|
||||
PCSTR :: cstring
|
||||
PCWSTR :: wstring
|
||||
@@ -438,21 +440,16 @@ _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)
|
||||
|
||||
// if WINVER >= _WIN32_WINNT_NT4
|
||||
IDI_WINLOGO := cstring(_IDI_WINLOGO)
|
||||
IDI_WARNING := IDI_EXCLAMATION
|
||||
IDI_ERROR := IDI_HAND
|
||||
IDI_INFORMATION := IDI_ASTERISK
|
||||
|
||||
// if WINVER >= _WIN32_WINNT_VISTA
|
||||
IDI_SHIELD := cstring(_IDI_SHIELD)
|
||||
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
|
||||
|
||||
|
||||
WSA_FLAG_OVERLAPPED: DWORD : 0x01
|
||||
|
||||
@@ -28,30 +28,6 @@ foreign user32 {
|
||||
RegisterClassExA :: proc(^WNDCLASSEXA) -> ATOM ---
|
||||
RegisterClassExW :: proc(^WNDCLASSEXW) -> ATOM ---
|
||||
|
||||
CreateWindowA :: proc(
|
||||
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: LPARAM) -> HWND ---
|
||||
CreateWindowW :: proc(
|
||||
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: LPARAM) -> HWND ---
|
||||
CreateWindowExA :: proc(
|
||||
dwExStyle: DWORD,
|
||||
lpClassName: LPCSTR,
|
||||
@@ -110,6 +86,8 @@ foreign user32 {
|
||||
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 ---
|
||||
|
||||
@@ -124,6 +102,68 @@ foreign user32 {
|
||||
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 ---
|
||||
}
|
||||
|
||||
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,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user