mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-08 08:38:51 +00:00
Initial support for GetVersionExA
This commit is contained in:
committed by
Mikkel Hjortshøj
parent
db2eff6847
commit
be1a3488a4
@@ -287,4 +287,39 @@ _alloc_command_line_arguments :: proc() -> []string {
|
|||||||
return arg_list;
|
return arg_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_windows_version_ansi :: proc() -> win32.OS_Version_Info_Ex_A {
|
||||||
|
osvi : win32.OS_Version_Info_Ex_A;
|
||||||
|
osvi.os_version_info_size = size_of(win32.OS_Version_Info_Ex_A);
|
||||||
|
win32.get_version(&osvi);
|
||||||
|
return osvi;
|
||||||
|
}
|
||||||
|
|
||||||
|
is_windows_xp :: proc() -> bool {
|
||||||
|
osvi := get_windows_version_ansi();
|
||||||
|
return (osvi.major_version == 5 && osvi.minor_version == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
is_windows_vista :: proc() -> bool {
|
||||||
|
osvi := get_windows_version_ansi();
|
||||||
|
return (osvi.major_version == 6 && osvi.minor_version == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
is_windows_7 :: proc() -> bool {
|
||||||
|
osvi := get_windows_version_ansi();
|
||||||
|
return (osvi.major_version == 6 && osvi.minor_version == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
is_windows_8 :: proc() -> bool {
|
||||||
|
osvi := get_windows_version_ansi();
|
||||||
|
return (osvi.major_version == 6 && osvi.minor_version == 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
is_windows_8_1 :: proc() -> bool {
|
||||||
|
osvi := get_windows_version_ansi();
|
||||||
|
return (osvi.major_version == 6 && osvi.minor_version == 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
is_windows_10 :: proc() -> bool {
|
||||||
|
osvi := get_windows_version_ansi();
|
||||||
|
return (osvi.major_version == 10 && osvi.minor_version == 0);
|
||||||
|
}
|
||||||
@@ -298,6 +298,22 @@ File_Notify_Information :: struct {
|
|||||||
file_name: [1]u16,
|
file_name: [1]u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ns-winnt-_osversioninfoexa
|
||||||
|
OS_Version_Info_Ex_A :: struct {
|
||||||
|
os_version_info_size: u32,
|
||||||
|
major_version: u32,
|
||||||
|
minor_version: u32,
|
||||||
|
build_number: u32,
|
||||||
|
platform_id : u32,
|
||||||
|
service_pack_string: [128]u8,
|
||||||
|
service_pack_major: u16,
|
||||||
|
service_pack_minor: u16,
|
||||||
|
suite_mask: u16,
|
||||||
|
product_type: u8,
|
||||||
|
reserved: u8
|
||||||
|
}
|
||||||
|
|
||||||
MAPVK_VK_TO_VSC :: 0;
|
MAPVK_VK_TO_VSC :: 0;
|
||||||
MAPVK_VSC_TO_VK :: 1;
|
MAPVK_VSC_TO_VK :: 1;
|
||||||
MAPVK_VK_TO_CHAR :: 2;
|
MAPVK_VK_TO_CHAR :: 2;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ foreign kernel32 {
|
|||||||
@(link_name="GetCommandLineA") get_command_line_a :: proc() -> cstring ---;
|
@(link_name="GetCommandLineA") get_command_line_a :: proc() -> cstring ---;
|
||||||
@(link_name="GetCommandLineW") get_command_line_w :: proc() -> Wstring ---;
|
@(link_name="GetCommandLineW") get_command_line_w :: proc() -> Wstring ---;
|
||||||
@(link_name="GetSystemMetrics") get_system_metrics :: proc(index: i32) -> i32 ---;
|
@(link_name="GetSystemMetrics") get_system_metrics :: proc(index: i32) -> i32 ---;
|
||||||
|
@(link_name="GetVersionExA") get_version :: proc(osvi: ^OS_Version_Info_Ex_A) ---;
|
||||||
@(link_name="GetCurrentThreadId") get_current_thread_id :: proc() -> u32 ---;
|
@(link_name="GetCurrentThreadId") get_current_thread_id :: proc() -> u32 ---;
|
||||||
|
|
||||||
@(link_name="GetSystemTimeAsFileTime") get_system_time_as_file_time :: proc(system_time_as_file_time: ^Filetime) ---;
|
@(link_name="GetSystemTimeAsFileTime") get_system_time_as_file_time :: proc(system_time_as_file_time: ^Filetime) ---;
|
||||||
|
|||||||
Reference in New Issue
Block a user