aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2017-05-05 21:00:58 +0100
committerGitHub <noreply@github.com>2017-05-05 21:00:58 +0100
commitb60b3101211b5eb7410d7b18a031b0dd026f6ab3 (patch)
tree2b4a3dd5b34a1222d1d7434ec79b98b6d9134978
parent51ea59d76a3e0ee72a9a3bb59bd61845dea64e5e (diff)
parentc7f7e562a0d5f00dc2c813d69be3bb326b0787bc (diff)
Merge pull request #61 from ThisDrunkDane/master
Fix constant casing and add several win32 functions, structure and constants
-rw-r--r--core/sys/windows.odin26
1 files changed, 25 insertions, 1 deletions
diff --git a/core/sys/windows.odin b/core/sys/windows.odin
index 53e27252c..82d0d8953 100644
--- a/core/sys/windows.odin
+++ b/core/sys/windows.odin
@@ -129,6 +129,20 @@ File_Attribute_Data :: struct {
file_size_low: u32,
}
+Find_Data :: struct {
+ file_attributes : u32,
+ creation_time : Filetime,
+ last_access_time : Filetime,
+ last_write_time : Filetime,
+ file_size_high : u32,
+ file_size_low : u32,
+ reserved0 : u32,
+ reserved1 : u32,
+ file_name : [MAX_PATH]byte,
+ alternate_file_name : [14]byte,
+}
+
+
GET_FILEEX_INFO_LEVELS :: i32;
GetFileExInfoStandard: GET_FILEEX_INFO_LEVELS : 0;
@@ -137,6 +151,7 @@ GetFileExMaxInfoLevel: GET_FILEEX_INFO_LEVELS : 1;
GetLastError :: proc() -> i32 #foreign kernel32;
ExitProcess :: proc(exit_code: u32) #foreign kernel32;
GetDesktopWindow :: proc() -> Hwnd #foreign user32;
+ShowCursor :: proc(show : Bool) #foreign user32;
GetCursorPos :: proc(p: ^Point) -> i32 #foreign user32;
ScreenToClient :: proc(h: Hwnd, p: ^Point) -> i32 #foreign user32;
GetModuleHandleA :: proc(module_name: ^u8) -> Hinstance #foreign kernel32;
@@ -205,6 +220,7 @@ ReadFile :: proc(h: Handle, buf: rawptr, to_read: u32, bytes_read: ^i32, overla
WriteFile :: proc(h: Handle, buf: rawptr, len: i32, written_result: ^i32, overlapped: rawptr) -> Bool #foreign kernel32;
GetFileSizeEx :: proc(file_handle: Handle, file_size: ^i64) -> Bool #foreign kernel32;
+GetFileAttributesA :: proc(filename : ^byte) -> u32 #foreign kernel32;
GetFileAttributesExA :: proc(filename: ^u8, info_level_id: GET_FILEEX_INFO_LEVELS, file_info: rawptr) -> Bool #foreign kernel32;
GetFileInformationByHandle :: proc(file_handle: Handle, file_info: ^By_Handle_File_Information) -> Bool #foreign kernel32;
@@ -213,6 +229,12 @@ SetFilePointer :: proc(file_handle: Handle, distance_to_move: i32, distance_to_m
SetHandleInformation :: proc(obj: Handle, mask, flags: u32) -> Bool #foreign kernel32;
+FindFirstFileA :: proc(file_name : ^byte, data : ^Find_Data) -> Handle #foreign kernel32;
+FindNextFileA :: proc(file : Handle, data : ^Find_Data) -> Bool #foreign kernel32;
+FindClose :: proc(file : Handle) -> Bool #foreign kernel32;
+
+MAX_PATH :: 0x00000104;
+
HANDLE_FLAG_INHERIT :: 1;
HANDLE_FLAG_PROTECT_FROM_CLOSE :: 2;
@@ -241,10 +263,12 @@ OPEN_EXISTING :: 3;
OPEN_ALWAYS :: 4;
TRUNCATE_EXISTING :: 5;
+INVALID_FILE_ATTRIBUTES :: -1;
+
FILE_ATTRIBUTE_READONLY :: 0x00000001;
FILE_ATTRIBUTE_HIDDEN :: 0x00000002;
FILE_ATTRIBUTE_SYSTEM :: 0x00000004;
-FILE_ATTRIBUTE_DIRectORY :: 0x00000010;
+FILE_ATTRIBUTE_DIRECTORY :: 0x00000010;
FILE_ATTRIBUTE_ARCHIVE :: 0x00000020;
FILE_ATTRIBUTE_DEVICE :: 0x00000040;
FILE_ATTRIBUTE_NORMAL :: 0x00000080;