aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2022-06-28 13:14:35 +0100
committerGitHub <noreply@github.com>2022-06-28 13:14:35 +0100
commitc0d2359a913c9f62969b0b104ffe48c885c9ba6f (patch)
treee589e46b7ba28ee4e2ae4bea1e01f78785af3b7a
parent51a2f09032ddf602b32f8dc49e309c669dd0115e (diff)
parent50cbb8a1fce5fb25ee2076d85c43845e1fdfacbc (diff)
Merge pull request #1826 from englerj/windows-bindings
Added additional Windows bindings.
-rw-r--r--core/sys/windows/types.odin81
-rw-r--r--core/sys/windows/user32.odin2
2 files changed, 75 insertions, 8 deletions
diff --git a/core/sys/windows/types.odin b/core/sys/windows/types.odin
index 1b5189b13..edf6e593e 100644
--- a/core/sys/windows/types.odin
+++ b/core/sys/windows/types.odin
@@ -196,15 +196,26 @@ OPEN_ALWAYS: DWORD : 4
OPEN_EXISTING: DWORD : 3
TRUNCATE_EXISTING: DWORD : 5
+FILE_READ_DATA : DWORD : 0x00000001
+FILE_LIST_DIRECTORY : DWORD : 0x00000001
+FILE_WRITE_DATA : DWORD : 0x00000002
+FILE_ADD_FILE : DWORD : 0x00000002
+FILE_APPEND_DATA : DWORD : 0x00000004
+FILE_ADD_SUBDIRECTORY : DWORD : 0x00000004
+FILE_CREATE_PIPE_INSTANCE : DWORD : 0x00000004
+FILE_READ_EA : DWORD : 0x00000008
+FILE_WRITE_EA : DWORD : 0x00000010
+FILE_EXECUTE : DWORD : 0x00000020
+FILE_TRAVERSE : DWORD : 0x00000020
+FILE_DELETE_CHILD : DWORD : 0x00000040
+FILE_READ_ATTRIBUTES : DWORD : 0x00000080
+FILE_WRITE_ATTRIBUTES : DWORD : 0x00000100
+
+GENERIC_READ : DWORD : 0x80000000
+GENERIC_WRITE : DWORD : 0x40000000
+GENERIC_EXECUTE : DWORD : 0x20000000
+GENERIC_ALL : DWORD : 0x10000000
-
-FILE_WRITE_DATA: DWORD : 0x00000002
-FILE_APPEND_DATA: DWORD : 0x00000004
-FILE_WRITE_EA: DWORD : 0x00000010
-FILE_WRITE_ATTRIBUTES: DWORD : 0x00000100
-FILE_READ_ATTRIBUTES: DWORD : 0x000000080
-GENERIC_READ: DWORD : 0x80000000
-GENERIC_WRITE: DWORD : 0x40000000
FILE_GENERIC_WRITE: DWORD : STANDARD_RIGHTS_WRITE |
FILE_WRITE_DATA |
FILE_WRITE_ATTRIBUTES |
@@ -250,6 +261,9 @@ DIAGNOSTIC_REASON_SIMPLE_STRING :: 0x00000001
DIAGNOSTIC_REASON_DETAILED_STRING :: 0x00000002
DIAGNOSTIC_REASON_NOT_SPECIFIED :: 0x80000000
+ENUM_CURRENT_SETTINGS : DWORD : 4294967295 // (DWORD)-1
+ENUM_REGISTRY_SETTINGS : DWORD : 4294967294 // (DWORD)-2
+
// Defines for power request APIs
POWER_REQUEST_CONTEXT_VERSION :: DIAGNOSTIC_REASON_VERSION
@@ -813,6 +827,57 @@ CREATESTRUCTW:: struct {
dwExStyle: DWORD,
}
+DEVMODEW :: struct {
+ dmDeviceName: [32]wchar_t,
+ dmSpecVersion: WORD,
+ dmDriverVersion: WORD,
+ dmSize: WORD,
+ dmDriverExtra: WORD,
+ dmFields: DWORD,
+ using _: struct #raw_union {
+ // Printer only fields.
+ using _: struct {
+ dmOrientation: c_short,
+ dmPaperSize: c_short,
+ dmPaperLength: c_short,
+ dmPaperWidth: c_short,
+ dmScale: c_short,
+ dmCopies: c_short,
+ dmDefaultSource: c_short,
+ dmPrintQuality: c_short,
+ },
+ // Display only fields.
+ using _: struct {
+ dmPosition: POINT,
+ dmDisplayOrientation: DWORD,
+ dmDisplayFixedOutput: DWORD,
+ },
+ },
+ dmColor: c_short,
+ dmDuplex: c_short,
+ dmYResolution: c_short,
+ dmTTOption: c_short,
+ dmCollate: c_short,
+ dmFormName: [32]wchar_t,
+ dmLogPixels: WORD,
+ dmBitsPerPel: DWORD,
+ dmPelsWidth: DWORD,
+ dmPelsHeight: DWORD,
+ using _: struct #raw_union {
+ dmDisplayFlags: DWORD,
+ dmNup: DWORD,
+ },
+ dmDisplayFrequency: DWORD,
+ dmICMMethod: DWORD,
+ dmICMIntent: DWORD,
+ dmMediaType: DWORD,
+ dmDitherType: DWORD,
+ dmReserved1: DWORD,
+ dmReserved2: DWORD,
+ dmPanningWidth: DWORD,
+ dmPanningHeight: DWORD,
+}
+
// MessageBox() Flags
MB_OK :: 0x00000000
MB_OKCANCEL :: 0x00000001
diff --git a/core/sys/windows/user32.odin b/core/sys/windows/user32.odin
index 6a4e75b7b..47de354b6 100644
--- a/core/sys/windows/user32.odin
+++ b/core/sys/windows/user32.odin
@@ -135,6 +135,8 @@ foreign user32 {
SetCursorPos :: proc(X: c_int, Y: c_int) -> BOOL ---
SetCursor :: proc(hCursor: HCURSOR) -> HCURSOR ---
+ EnumDisplaySettingsW :: proc(lpszDeviceName: LPCWSTR, iModeNum: DWORD, lpDevMode: ^DEVMODEW) -> BOOL ---
+
BroadcastSystemMessageW :: proc(
flags: DWORD,
lpInfo: LPDWORD,