diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2024-07-06 00:23:47 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-06 00:23:47 +0100 |
| commit | efe5e9e349ff0fff5d7e0526f0e16a06dc93ac67 (patch) | |
| tree | 2daf61f4dbf41b0b2b221f992a00c6f521934fb6 /core | |
| parent | 25904e8f896d95f65c04907021cfe044c4f37e8c (diff) | |
| parent | 41282b5211773553a40eebd0c5c90281b11817ac (diff) | |
Merge pull request #3858 from flysand7/wow64-apiset
Add bindings for WOW64 API set
Diffstat (limited to 'core')
| -rw-r--r-- | core/sys/windows/wow64_apiset.odin | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/core/sys/windows/wow64_apiset.odin b/core/sys/windows/wow64_apiset.odin new file mode 100644 index 000000000..28558e9ca --- /dev/null +++ b/core/sys/windows/wow64_apiset.odin @@ -0,0 +1,85 @@ +//+build windows +package sys_windows + +foreign import kernel32 "system:Kernel32.lib" + +@(default_calling_convention="system") +foreign kernel32 { + GetSystemWow64Directory2W :: proc (lpBuffer: LPWSTR, uSize: UINT, ImageFileMachineTyp: WORD) -> UINT --- + GetSystemWow64DirectoryW :: proc (lpBuffer: LPWSTR, uSize: UINT) -> UINT --- + IsWow64GuestMachineSupported :: proc (WowGuestMachine: USHORT, MachineIsSupported: ^BOOL) -> HRESULT --- + IsWow64Process :: proc (hProcess: HANDLE, Wow64Process: PBOOL) -> BOOL --- + IsWow64Process2 :: proc (hProcess: HANDLE, pProcessMachine: ^USHORT, pNativeMachine: ^USHORT) -> BOOL --- + Wow64EnableWow64FsRedirection :: proc (Wow64FsEnableRedirection: BOOLEAN) -> BOOLEAN --- + Wow64DisableWow64FsRedirection :: proc (OldValue: ^PVOID) -> BOOL --- + Wow64RevertWow64FsRedirection :: proc (OlValue: PVOID) -> BOOL --- + Wow64GetThreadContext :: proc (hThread: HANDLE, lpContext: PWOW64_CONTEXT) -> BOOL --- + Wow64SetThreadContext :: proc(hThread: HANDLE, lpContext: ^WOW64_CONTEXT) -> BOOL --- + Wow64SetThreadDefaultGuestMachine :: proc(Machine: USHORT) -> USHORT --- + Wow64SuspendThread :: proc (hThread: HANDLE) -> DWORD --- +} + +WOW64_CONTEXT_i386 :: 0x00010000 + +WOW64_CONTEXT_CONTROL :: (WOW64_CONTEXT_i386 | 0x00000001) +WOW64_CONTEXT_INTEGER :: (WOW64_CONTEXT_i386 | 0x00000002) +WOW64_CONTEXT_SEGMENTS :: (WOW64_CONTEXT_i386 | 0x00000004) + +WOW64_CONTEXT_FLOATING_POINT :: (WOW64_CONTEXT_i386 | 0x00000008) +WOW64_CONTEXT_DEBUG_REGISTERS :: (WOW64_CONTEXT_i386 | 0x00000010) +WOW64_CONTEXT_EXTENDED_REGISTERS :: (WOW64_CONTEXT_i386 | 0x00000020) +WOW64_CONTEXT_FULL :: (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | WOW64_CONTEXT_SEGMENTS) +WOW64_CONTEXT_ALL :: ( + WOW64_CONTEXT_CONTROL | + WOW64_CONTEXT_INTEGER | + WOW64_CONTEXT_SEGMENTS | + WOW64_CONTEXT_FLOATING_POINT | + WOW64_CONTEXT_DEBUG_REGISTERS | + WOW64_CONTEXT_EXTENDED_REGISTERS) + +WOW64_SIZE_OF_80387_REGISTERS :: 80 +WOW64_MAXIMUM_SUPPORTED_EXTENSION :: 512 + +WOW64_CONTEXT :: struct { + ContextFlags: DWORD, + Dr0: DWORD, + Dr1: DWORD, + Dr2: DWORD, + Dr3: DWORD, + Dr6: DWORD, + Dr7: DWORD, + FloatSave: WOW64_FLOATING_SAVE_AREA, + SegGs: DWORD, + SegFs: DWORD, + SegEs: DWORD, + SegDs: DWORD, + Edi: DWORD, + Esi: DWORD, + Ebx: DWORD, + Edx: DWORD, + Ecx: DWORD, + Eax: DWORD, + Ebp: DWORD, + Eip: DWORD, + SegCs: DWORD, + EFlags: DWORD, + Esp: DWORD, + SegSs: DWORD, + ExtendedRegisters: [WOW64_MAXIMUM_SUPPORTED_EXTENSION]BYTE, +} + +PWOW64_CONTEXT :: ^WOW64_CONTEXT + +WOW64_FLOATING_SAVE_AREA :: struct { + ControlWord: DWORD, + StatusWord: DWORD, + TagWord: DWORD, + ErrorOffset: DWORD, + ErrorSelector: DWORD, + DataOffset: DWORD, + DataSelector: DWORD, + RegisterArea: [WOW64_SIZE_OF_80387_REGISTERS]BYTE, + Cr0NpxState: DWORD, +} + +PWOW64_FLOATING_SAVE_AREA :: ^WOW64_FLOATING_SAVE_AREA
\ No newline at end of file |