aboutsummaryrefslogtreecommitdiff
path: root/core/sys
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-07-16 11:56:31 +0100
committergingerBill <bill@gingerbill.org>2024-07-16 11:56:31 +0100
commit169fc4d3be48d16d9d6fdb41a8b7312ce76d0ecd (patch)
treef3a63ba3259b797b69dfd84f4fb63bddbba36605 /core/sys
parentaffe8f7144203c5e4c09c3d5369826a7a5fc144e (diff)
General clean up of the os2/process_windows.odin code
Diffstat (limited to 'core/sys')
-rw-r--r--core/sys/windows/ntdll.odin106
-rw-r--r--core/sys/windows/types.odin6
2 files changed, 109 insertions, 3 deletions
diff --git a/core/sys/windows/ntdll.odin b/core/sys/windows/ntdll.odin
index 56c24f1a2..b75ac695a 100644
--- a/core/sys/windows/ntdll.odin
+++ b/core/sys/windows/ntdll.odin
@@ -6,4 +6,110 @@ foreign import ntdll_lib "system:ntdll.lib"
@(default_calling_convention="system")
foreign ntdll_lib {
RtlGetVersion :: proc(lpVersionInformation: ^OSVERSIONINFOEXW) -> NTSTATUS ---
+
+
+ NtQueryInformationProcess :: proc(
+ ProcessHandle: HANDLE,
+ ProcessInformationClass: PROCESS_INFO_CLASS,
+ ProcessInformation: rawptr,
+ ProcessInformationLength: u32,
+ ReturnLength: ^u32,
+ ) -> u32 ---
+}
+
+
+PROCESS_INFO_CLASS :: enum i32 {
+ ProcessBasicInformation = 0,
+ ProcessDebugPort = 7,
+ ProcessWow64Information = 26,
+ ProcessImageFileName = 27,
+ ProcessBreakOnTermination = 29,
+ ProcessTelemetryIdInformation = 64,
+ ProcessSubsystemInformation = 75,
+}
+
+
+
+PROCESS_BASIC_INFORMATION :: struct {
+ ExitStatus: NTSTATUS,
+ PebBaseAddress: ^PEB,
+ AffinityMask: ULONG_PTR,
+ BasePriority: KPRIORITY,
+ UniqueProcessId: ULONG_PTR,
+ InheritedFromUniqueProcessId: ULONG_PTR,
+}
+
+KPRIORITY :: rawptr
+
+PPS_POST_PROCESS_INIT_ROUTINE :: proc "system" ()
+
+
+PEB :: struct {
+ _: [2]u8,
+ BeingDebugged: u8,
+ _: [1]u8,
+ _: [2]rawptr,
+ Ldr: ^PEB_LDR_DATA,
+ ProcessParameters: ^RTL_USER_PROCESS_PARAMETERS,
+ _: [104]u8,
+ _: [52]rawptr,
+ PostProcessInitRoutine: PPS_POST_PROCESS_INIT_ROUTINE,
+ _: [128]u8,
+ _: [1]rawptr,
+ SessionId: u32,
+}
+
+
+
+
+PEB_LDR_DATA :: struct {
+ _: [8]u8,
+ _: [3]rawptr,
+ InMemoryOrderModuleList: LIST_ENTRY,
+}
+
+RTL_USER_PROCESS_PARAMETERS :: struct {
+ MaximumLength: u32,
+ Length: u32,
+ Flags: u32,
+ DebugFlags: u32,
+ ConsoleHandle: rawptr,
+ ConsoleFlags: u32,
+ StdInputHandle: rawptr,
+ StdOutputHandle: rawptr,
+ StdErrorHandle: rawptr,
+ CurrentDirectoryPath: UNICODE_STRING,
+ CurrentDirectoryHandle: rawptr,
+ DllPath: UNICODE_STRING,
+ ImagePathName: UNICODE_STRING,
+ CommandLine: UNICODE_STRING,
+ Environment: rawptr,
+ StartingPositionLeft: u32,
+ StartingPositionTop: u32,
+ Width: u32,
+ Height: u32,
+ CharWidth: u32,
+ CharHeight: u32,
+ ConsoleTextAttributes: u32,
+ WindowFlags: u32,
+ ShowWindowFlags: u32,
+ WindowTitle: UNICODE_STRING,
+ DesktopName: UNICODE_STRING,
+ ShellInfo: UNICODE_STRING,
+ RuntimeData: UNICODE_STRING,
+ DLCurrentDirectory: [32]RTL_DRIVE_LETTER_CURDIR,
+ EnvironmentSize: u32,
+}
+
+RTL_DRIVE_LETTER_CURDIR :: struct {
+ Flags: u16,
+ Length: u16,
+ TimeStamp: u32,
+ DosPath: UNICODE_STRING,
+}
+
+
+LIST_ENTRY :: struct {
+ Flink: ^LIST_ENTRY,
+ Blink: ^LIST_ENTRY,
} \ No newline at end of file
diff --git a/core/sys/windows/types.odin b/core/sys/windows/types.odin
index 92c6023eb..35f4174eb 100644
--- a/core/sys/windows/types.odin
+++ b/core/sys/windows/types.odin
@@ -2495,9 +2495,9 @@ OBJECT_ATTRIBUTES :: struct {
}
UNICODE_STRING :: struct {
- Length: u16,
- MaximumLength: u16,
- Buffer: ^u16,
+ Length: u16 `fmt:"-"`,
+ MaximumLength: u16 `fmt:"-"`,
+ Buffer: [^]u16 `fmt:"s,Length"`,
}
OVERLAPPED :: struct {