Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
1c498aa
Trying to setup simple ARM64 CI
hakril Jan 15, 2025
57076b8
[CI] Playing/Testing CI on Windows-ARM64
hakril Jan 16, 2025
533cdda
[CI] Playing/Testing CI on Windows-ARM64 (Fix yml)
hakril Jan 16, 2025
fd00e97
[CI] Playing/Testing CI on Windows-ARM64 (Fix yml2)
hakril Jan 16, 2025
458774f
[CI] more arm64 tests
hakril Jan 16, 2025
b22c5d6
[CI] more arm fun
hakril Jan 16, 2025
6eb31e9
[CI] more arm fun
hakril Jan 16, 2025
e37f87c
Adapt test_syswow.py for arm exploration
hakril Jan 16, 2025
1a9b680
Added some wow64 definition + created functions/syswow64.txt
hakril Jan 16, 2025
1297996
New implem of is_wow_64(handle)
hakril Jan 16, 2025
234844c
Remove breakpoint
hakril Jan 16, 2025
3a3e6bc
improve conftest
hakril Jan 16, 2025
314cd2b
More arm exploration of api responses
hakril Jan 18, 2025
ea6b7b9
arm64: more api tests
hakril Jan 18, 2025
2c9a159
Add system.architecture & process.architecture
hakril Jan 18, 2025
00a2f1a
add utils.image_file_machine_to_processor_architecture()
hakril Jan 18, 2025
646e55c
fix typo
hakril Jan 18, 2025
8151292
Adding ctypes defintion associated with process & architecture
hakril Jan 18, 2025
ce13bf0
First try at WinProcess.architecture
hakril Jan 18, 2025
2cef603
Add some ctypes definition
hakril Jan 18, 2025
720385d
Still playing with process.architecture
hakril Jan 18, 2025
9b5be5f
more arm testing of process.architecture
hakril Jan 18, 2025
4e5325c
Process.architecture now returns flags
hakril Jan 19, 2025
e7679ec
[WIP] simple_arm64 + testsuite
hakril Jan 23, 2025
a7b6dde
Add generated sources
hakril Jan 23, 2025
493fe75
arm64: Ret() encoded \o/ time to tests functions calls
hakril Jan 24, 2025
458a0d0
First implem of arm64.assemble()
hakril Jan 24, 2025
7c96da8
Working on simple_arm64.py
hakril Jan 24, 2025
1bc7818
Still playing with simple_arm64
hakril Jan 24, 2025
1889899
Readd RtlGetCurrentPeb lost in rebase
hakril Feb 2, 2025
bce15d0
simple_arm64.Mov(reg, reg) that redirect to Orr(reg, zero, reg)
hakril Feb 3, 2025
5352013
Fix tests/test_simple_arm64.py error when capstone is not installed
hakril Feb 3, 2025
b1d2d57
Improve range of arm64 testing
hakril Feb 3, 2025
6ade13d
Fix pytest commandline
hakril Feb 3, 2025
2a1217e
Implem current_thread.teb for ARM64 + recognize ARM64 PE in pe_parse
hakril Feb 4, 2025
6a54bca
Fix process.py simple_arm64 import
hakril Feb 4, 2025
013c35b
Improve sample\find_value.py to search in Enums
hakril Feb 5, 2025
d7ff43a
Working on expliciting limitation of x86-on-arm64 NotImplementedError
hakril Feb 5, 2025
e58d80c
More raise NotImplementedError on x86 -> arm64 heaven gate
hakril Feb 5, 2025
017867d
Fox typo
hakril Feb 5, 2025
d094fb8
More limitation identification for x86 on arm64 heaven gate
hakril Feb 5, 2025
54b518c
More x86->arm64 limitation exploration
hakril Feb 5, 2025
5c25e33
Full test suite on arm64 for the lol
hakril Feb 5, 2025
75f1121
more arm64 CI tests
hakril Feb 5, 2025
4113d8a
Reactivate full intel. Check we broke nothing
hakril Feb 6, 2025
13f2993
Fix tests for older python
hakril Feb 6, 2025
26b42a0
Adding ctypes_generation for PROC_THREAD_ATTRIBUTE_X
hakril Feb 6, 2025
b51a6e1
Adding CreateRemoteThreadEx definition
hakril Feb 7, 2025
06b96e6
More NotImplementedError for ARM64
hakril Feb 8, 2025
a93c9b7
Fix typo
hakril Feb 8, 2025
4056162
Improve test_pe fixture stability
hakril Feb 8, 2025
9096693
Improve pipe tests stability / error trigger
hakril Feb 10, 2025
064b22f
Still improving tests for ARM64
hakril Feb 10, 2025
bd52b1a
More tests adaptation for arm64
hakril Feb 10, 2025
fc0c81e
Fix pe parsing for section with 8bytes name
hakril Feb 11, 2025
d4952e2
More arm64 heaven gate NotImplementedError()
hakril Feb 11, 2025
e3c6dee
Fix hang in test_getset_syswow_context on ARM64
hakril Feb 11, 2025
a418035
More test stability
hakril Feb 11, 2025
ebded59
More test stability for ARM64
hakril Feb 11, 2025
16e10af
Testing ARM64 CI continue-on-error
hakril Feb 11, 2025
1ad4560
Improve stubborn stability on Windows 17763
hakril Feb 11, 2025
8a14cc5
Automatic xfail on python injection for ARM64 target process
hakril Feb 12, 2025
be935b0
Improve test marking
hakril Feb 12, 2025
83af73a
Fix tests\test_injection.py
hakril Feb 12, 2025
45b781b
Still playing with xfail identification for arm64 tests
hakril Feb 13, 2025
11665c4
More xfail for ARM64 -> @cross_heaven_gates
hakril Feb 14, 2025
b4c0223
Fix typo in test import
hakril Feb 14, 2025
8eb3384
Change test exe to msiexec.exe + pop_proc64 force machine AMD64 with …
hakril Feb 14, 2025
6c588cf
Improve thread CONTEXT defitions + ARM64_CONTEXT
hakril Mar 6, 2025
520fa86
Disable ARM64 tests until github publish ARM64 github runners
hakril Mar 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,35 @@ jobs:
secondary_rate_limit_wait_seconds: 90
seconds_between_github_writes: 10
seconds_between_github_reads: 1

# tests_arm64:
# needs: generate_ctypes
# timeout-minutes: 15
# runs-on: windows-ARM64
# continue-on-error: true
#
# strategy:
# fail-fast: false
# matrix:
# python-version: [3.11]
# python-architecture: [x86, x64, arm64]
# include:
# # Translate architecture to bitness for py.exe commandline
# - python-bitness-to-test: 32
# python-architecture: x86
# - python-bitness-to-test: 64
# python-architecture: x64
# - python-bitness-to-test: arm64
# python-architecture: arm64
#
# steps:
# - uses: actions/checkout@v4
#
# - name: Listing python versions availables
# run: py -0
#
# - name: Testing PFW execute
# run: py -${{ matrix.python-version}}-${{ matrix.python-bitness-to-test}} -c "import windows; print(windows)"
#
# - name: Arm64 pytests
# run: py -${{ matrix.python-version}}-${{ matrix.python-bitness-to-test}} -m pytest tests -k "not test_debugger" -v -s -r fEsx
79 changes: 79 additions & 0 deletions ctypes_generation/definitions/defines/proc_thread_attributes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// We have a rare case of defines that depends on an enum
// Which is PROC_THREAD_ATTRIBUTE_NUM
// So i Will just define a copy of those as define here
// Define version copied from: https://github.com/winsiderss/systeminformer/blob/master/phnt/include/ntpsapi.h#L2666
// Thx to them, as always :)

#define ProcThreadAttributeParentProcess 0 // in HANDLE
#define ProcThreadAttributeExtendedFlags 1 // in ULONG (EXTENDED_PROCESS_CREATION_FLAG_*)
#define ProcThreadAttributeHandleList 2 // in HANDLE[]
#define ProcThreadAttributeGroupAffinity 3 // in GROUP_AFFINITY // since WIN7
#define ProcThreadAttributePreferredNode 4 // in USHORT
#define ProcThreadAttributeIdealProcessor 5 // in PROCESSOR_NUMBER
#define ProcThreadAttributeUmsThread 6 // in UMS_CREATE_THREAD_ATTRIBUTES
#define ProcThreadAttributeMitigationPolicy 7 // in ULONG, ULONG64, or ULONG64[2]
#define ProcThreadAttributePackageFullName 8 // in WCHAR[] // since WIN8
#define ProcThreadAttributeSecurityCapabilities 9 // in SECURITY_CAPABILITIES
#define ProcThreadAttributeConsoleReference 10 // BaseGetConsoleReference (kernelbase.dll)
#define ProcThreadAttributeProtectionLevel 11 // in ULONG (PROTECTION_LEVEL_*) // since WINBLUE
#define ProcThreadAttributeOsMaxVersionTested 12 // in MAXVERSIONTESTED_INFO // since THRESHOLD // (from exe.manifest)
#define ProcThreadAttributeJobList 13 // in HANDLE[]
#define ProcThreadAttributeChildProcessPolicy 14 // in ULONG (PROCESS_CREATION_CHILD_PROCESS_*) // since THRESHOLD2
#define ProcThreadAttributeAllApplicationPackagesPolicy 15 // in ULONG (PROCESS_CREATION_ALL_APPLICATION_PACKAGES_*) // since REDSTONE
#define ProcThreadAttributeWin32kFilter 16 // in WIN32K_SYSCALL_FILTER
#define ProcThreadAttributeSafeOpenPromptOriginClaim 17 // in SE_SAFE_OPEN_PROMPT_RESULTS
#define ProcThreadAttributeDesktopAppPolicy 18 // in ULONG (PROCESS_CREATION_DESKTOP_APP_*) // since RS2
#define ProcThreadAttributeBnoIsolation 19 // in PROC_THREAD_BNOISOLATION_ATTRIBUTE
#define ProcThreadAttributePseudoConsole 22 // in HANDLE (HPCON) // since RS5
#define ProcThreadAttributeIsolationManifest 23 // in ISOLATION_MANIFEST_PROPERTIES // rev (diversenok) // since 19H2+
#define ProcThreadAttributeMitigationAuditPolicy 24 // in ULONG, ULONG64, or ULONG64[2] // since 21H1
#define ProcThreadAttributeMachineType 25 // in USHORT // since 21H2
#define ProcThreadAttributeComponentFilter 26 // in ULONG
#define ProcThreadAttributeEnableOptionalXStateFeatures 27 // in ULONG64 // since WIN11
#define ProcThreadAttributeCreateStore 28 // ULONG // rev (diversenok)
#define ProcThreadAttributeTrustedApp 29
#define ProcThreadAttributeSveVectorLength 30

// Real definition of value usef by API
// From: https://github.com/microsoft/win32metadata/blob/6af96d8470751e13a4e3f579f84b7b8b3ca398e1/generation/WinSDK/RecompiledIdlHeaders/um/WinBase.h#L3568
// macro ProcThreadAttributeValue is recoded in python in template.py
// I replace TRUE by True && FALSE by False for native python compat :)

#define PROC_THREAD_ATTRIBUTE_NUMBER 0x0000FFFF
#define PROC_THREAD_ATTRIBUTE_THREAD 0x00010000 // Attribute may be used with thread creation
#define PROC_THREAD_ATTRIBUTE_INPUT 0x00020000 // Attribute is input only
#define PROC_THREAD_ATTRIBUTE_ADDITIVE 0x00040000 // Attribute may be "accumulated," e.g. bitmasks,

#define PROC_THREAD_ATTRIBUTE_PARENT_PROCESS \
ProcThreadAttributeValue (ProcThreadAttributeParentProcess, False, True, False)
#define PROC_THREAD_ATTRIBUTE_HANDLE_LIST \
ProcThreadAttributeValue (ProcThreadAttributeHandleList, False, True, False)

#define PROC_THREAD_ATTRIBUTE_GROUP_AFFINITY \
ProcThreadAttributeValue (ProcThreadAttributeGroupAffinity, True, True, False)
#define PROC_THREAD_ATTRIBUTE_PREFERRED_NODE \
ProcThreadAttributeValue (ProcThreadAttributePreferredNode, False, True, False)
#define PROC_THREAD_ATTRIBUTE_IDEAL_PROCESSOR \
ProcThreadAttributeValue (ProcThreadAttributeIdealProcessor, True, True, False)
#define PROC_THREAD_ATTRIBUTE_UMS_THREAD \
ProcThreadAttributeValue (ProcThreadAttributeUmsThread, True, True, False)
#define PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY \
ProcThreadAttributeValue (ProcThreadAttributeMitigationPolicy, False, True, False)

#define PROC_THREAD_ATTRIBUTE_SECURITY_CAPABILITIES \
ProcThreadAttributeValue (ProcThreadAttributeSecurityCapabilities, False, True, False)

#define PROC_THREAD_ATTRIBUTE_PROTECTION_LEVEL \
ProcThreadAttributeValue (ProcThreadAttributeProtectionLevel, False, True, False)

#define PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE \
ProcThreadAttributeValue (ProcThreadAttributePseudoConsole, False, True, False)

#define PROC_THREAD_ATTRIBUTE_MACHINE_TYPE \
ProcThreadAttributeValue (ProcThreadAttributeMachineType, False, True, False)

#define PROC_THREAD_ATTRIBUTE_ENABLE_OPTIONAL_XSTATE_FEATURES \
ProcThreadAttributeValue (ProcThreadAttributeEnableOptionalXStateFeatures, True, True, False)

#define PROC_THREAD_ATTRIBUTE_SVE_VECTOR_LENGTH \
ProcThreadAttributeValue (ProcThreadAttributeSveVectorLength, False, True, False)
38 changes: 38 additions & 0 deletions ctypes_generation/definitions/defines/processor.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#define PROCESSOR_INTEL_386 386
#define PROCESSOR_INTEL_486 486
#define PROCESSOR_INTEL_PENTIUM 586
#define PROCESSOR_INTEL_IA64 2200
#define PROCESSOR_MIPS_R4000 4000 // incl R4101 & R3910 for Windows CE
#define PROCESSOR_ALPHA_21064 21064
#define PROCESSOR_PPC_601 601
#define PROCESSOR_PPC_603 603
#define PROCESSOR_PPC_604 604
#define PROCESSOR_PPC_620 620
#define PROCESSOR_HITACHI_SH3 10003 // Windows CE
#define PROCESSOR_HITACHI_SH3E 10004 // Windows CE
#define PROCESSOR_HITACHI_SH4 10005 // Windows CE
#define PROCESSOR_MOTOROLA_821 821 // Windows CE
#define PROCESSOR_SHx_SH3 103 // Windows CE
#define PROCESSOR_SHx_SH4 104 // Windows CE
#define PROCESSOR_STRONGARM 2577 // Windows CE - 0xA11
#define PROCESSOR_ARM720 1824 // Windows CE - 0x720
#define PROCESSOR_ARM820 2080 // Windows CE - 0x820
#define PROCESSOR_ARM920 2336 // Windows CE - 0x920
#define PROCESSOR_ARM_7TDMI 70001 // Windows CE
#define PROCESSOR_OPTIL 0x494f // MSIL

#define PROCESSOR_ARCHITECTURE_INTEL 0
#define PROCESSOR_ARCHITECTURE_MIPS 1
#define PROCESSOR_ARCHITECTURE_ALPHA 2
#define PROCESSOR_ARCHITECTURE_PPC 3
#define PROCESSOR_ARCHITECTURE_SHX 4
#define PROCESSOR_ARCHITECTURE_ARM 5
#define PROCESSOR_ARCHITECTURE_IA64 6
#define PROCESSOR_ARCHITECTURE_ALPHA64 7
#define PROCESSOR_ARCHITECTURE_MSIL 8
#define PROCESSOR_ARCHITECTURE_AMD64 9
#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
#define PROCESSOR_ARCHITECTURE_NEUTRAL 11
#define PROCESSOR_ARCHITECTURE_ARM64 12
#define PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64 13
#define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
16 changes: 16 additions & 0 deletions ctypes_generation/definitions/defines/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,19 @@ def CTL_CODE(DeviceType, Function, Method, Access):

def HRESULT_FACILITY(hr):
return (((hr) >> 16) & 0x1fff)

# https://github.com/microsoft/win32metadata/blob/6af96d8470751e13a4e3f579f84b7b8b3ca398e1/generation/WinSDK/RecompiledIdlHeaders/um/WinBase.h#L3562
# Original MACRO:

#define ProcThreadAttributeValue(Number, Thread, Input, Additive) \
# (((Number) & PROC_THREAD_ATTRIBUTE_NUMBER) | \
# ((Thread != FALSE) ? PROC_THREAD_ATTRIBUTE_THREAD : 0) | \
# ((Input != FALSE) ? PROC_THREAD_ATTRIBUTE_INPUT : 0) | \
# ((Additive != FALSE) ? PROC_THREAD_ATTRIBUTE_ADDITIVE : 0))

def ProcThreadAttributeValue(Number, Thread, Input, Additive):
return ((Number & PROC_THREAD_ATTRIBUTE_NUMBER) |
(Thread and PROC_THREAD_ATTRIBUTE_THREAD) |
(Input and PROC_THREAD_ATTRIBUTE_INPUT) |
(Additive and PROC_THREAD_ATTRIBUTE_ADDITIVE))

61 changes: 61 additions & 0 deletions ctypes_generation/definitions/defines/thread_context.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Atrget architecture description

#define CONTEXT_I386 0x00010000 // An old PFW error in case ?
#define CONTEXT_AMD64 0x00100000
#define CONTEXT_ARM 0x00200000
#define CONTEXT_ARM64 0x00400000
#define CONTEXT_i386 0x00010000L // this assumes that i386 and
#define CONTEXT_i486 0x00010000L // i486 have identical context records
#define WOW64_CONTEXT_i386 0x00010000 // this assumes that i386 and
#define WOW64_CONTEXT_i486 0x00010000 // i486 have identical context records

// Not perfect, should be explicitly for an architecture

#define CONTEXT_CONTROL 0x00000001L
#define CONTEXT_INTEGER 0x00000002L
#define CONTEXT_SEGMENTS 0x00000004L
#define CONTEXT_FLOATING_POINT 0x00000008L
#define CONTEXT_DEBUG_REGISTERS 0x00000010L
#define CONTEXT_EXTENDED_REGISTERS 0x00000020L
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
#define CONTEXT_ALL (CONTEXT_FULL | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)

#define CONTEXT_XSTATE (CONTEXT_I386 | 0x00000040L)

// WOW64



#define WOW64_CONTEXT_CONTROL (WOW64_CONTEXT_i386 | 0x00000001L) // SS:SP, CS:IP, FLAGS, BP
#define WOW64_CONTEXT_INTEGER (WOW64_CONTEXT_i386 | 0x00000002L) // AX, BX, CX, DX, SI, DI
#define WOW64_CONTEXT_SEGMENTS (WOW64_CONTEXT_i386 | 0x00000004L) // DS, ES, FS, GS
#define WOW64_CONTEXT_FLOATING_POINT (WOW64_CONTEXT_i386 | 0x00000008L) // 387 state
#define WOW64_CONTEXT_DEBUG_REGISTERS (WOW64_CONTEXT_i386 | 0x00000010L) // DB 0-3,6,7
#define WOW64_CONTEXT_EXTENDED_REGISTERS (WOW64_CONTEXT_i386 | 0x00000020L) // cpu specific extensions

#define WOW64_CONTEXT_FULL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | WOW64_CONTEXT_SEGMENTS)

#define WOW64_CONTEXT_ALL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | WOW64_CONTEXT_SEGMENTS | \
WOW64_CONTEXT_FLOATING_POINT | WOW64_CONTEXT_DEBUG_REGISTERS | \
WOW64_CONTEXT_EXTENDED_REGISTERS)

#define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | 0x00000040L)

#define WOW64_CONTEXT_EXCEPTION_ACTIVE 0x08000000
#define WOW64_CONTEXT_SERVICE_ACTIVE 0x10000000
#define WOW64_CONTEXT_EXCEPTION_REQUEST 0x40000000
#define WOW64_CONTEXT_EXCEPTION_REPORTING 0x80000000

// ARM64

#define CONTEXT_ARM64_CONTROL (CONTEXT_ARM64 | 0x1L)
#define CONTEXT_ARM64_INTEGER (CONTEXT_ARM64 | 0x2L)
#define CONTEXT_ARM64_FLOATING_POINT (CONTEXT_ARM64 | 0x4L)
#define CONTEXT_ARM64_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x8L)
#define CONTEXT_ARM64_X18 (CONTEXT_ARM64 | 0x10L)

#define CONTEXT_UNWOUND_TO_CALL 0x20000000
#define CONTEXT_RET_TO_GUEST 0x04000000

#define ARM64_MAX_BREAKPOINTS 8
#define ARM64_MAX_WATCHPOINTS 2
16 changes: 0 additions & 16 deletions ctypes_generation/definitions/defines/windef.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,22 +130,6 @@
#define TH32CS_SNAPALL (TH32CS_SNAPHEAPLIST | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD | TH32CS_SNAPMODULE)
#define TH32CS_INHERIT 0x80000000

#define CONTEXT_I386 0x00010000
#define CONTEXT_AMD64 0x00100000
#define CONTEXT_ARM 0x00200000
#define CONTEXT_ARM64 0x00400000

#define CONTEXT_CONTROL 0x00000001L
#define CONTEXT_INTEGER 0x00000002L
#define CONTEXT_SEGMENTS 0x00000004L
#define CONTEXT_FLOATING_POINT 0x00000008L
#define CONTEXT_DEBUG_REGISTERS 0x00000010L
#define CONTEXT_EXTENDED_REGISTERS 0x00000020L
#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
#define CONTEXT_ALL (CONTEXT_FULL | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)

#define CONTEXT_XSTATE (CONTEXT_I386 | 0x00000040L)


#define PAGE_NOACCESS 0x01
#define PAGE_READONLY 0x02
Expand Down
4 changes: 3 additions & 1 deletion ctypes_generation/definitions/defines/windef_pe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,6 @@
#define IMAGE_FILE_MACHINE_AMD64 0x8664
#define IMAGE_FILE_MACHINE_M32R 0x9041
#define IMAGE_FILE_MACHINE_CEE 0xC0EE
#define IMAGE_FILE_MACHINE_ARM64 0xAA64
#define IMAGE_FILE_MACHINE_ARM64 0xAA64

#define IMAGE_FILE_MACHINE_TARGET_HOST 0x0001 // Useful for indicating we want to interact with the host and not a WoW guest.
13 changes: 13 additions & 0 deletions ctypes_generation/definitions/functions/process.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ BOOL FreeLibrary(
HMODULE hLibModule
);

BOOL GetProcessInformation(
[in] HANDLE hProcess,
[in] PROCESS_INFORMATION_CLASS ProcessInformationClass,
LPVOID ProcessInformation,
[in] DWORD ProcessInformationSize
);

BOOL SetProcessInformation(
[in] HANDLE hProcess,
[in] PROCESS_INFORMATION_CLASS ProcessInformationClass,
LPVOID ProcessInformation,
[in] DWORD ProcessInformationSize
);

/* Not documented by seems present since dawn of time (WRK)
I Prefere PVOID as a return value to allow simple cast to PEB subclass in process.py*/
Expand Down
8 changes: 8 additions & 0 deletions ctypes_generation/definitions/functions/sysinfo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,12 @@ BOOL LookupAccountNameW(
LPWSTR ReferencedDomainName,
LPDWORD cchReferencedDomainName,
PSID_NAME_USE peUse
);

PVOID GetNativeSystemInfo(
[out] LPSYSTEM_INFO lpSystemInfo
);

PVOID GetSystemInfo(
[out] LPSYSTEM_INFO lpSystemInfo
);
83 changes: 83 additions & 0 deletions ctypes_generation/definitions/functions/syswow64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
BOOL IsWow64Process(
[in] HANDLE hProcess,
[out] PBOOL Wow64Process
);

BOOL IsWow64Process2(
[in] HANDLE hProcess,
[out] USHORT *pProcessMachine,
[out, optional] USHORT *pNativeMachine
);

HRESULT IsWow64GuestMachineSupported(
[in] USHORT WowGuestMachine,
[out] BOOL *MachineIsSupported
);

UINT GetSystemWow64DirectoryA(
[out] LPSTR lpBuffer,
[in] UINT uSize
);

UINT GetSystemWow64DirectoryW(
[out] LPWSTR lpBuffer,
[in] UINT uSize
);

UINT GetSystemWow64Directory2A(
[out] LPSTR lpBuffer,
[in] UINT uSize,
[in] WORD ImageFileMachineType
);

UINT GetSystemWow64Directory2W(
[out] LPWSTR lpBuffer,
[in] UINT uSize,
[in] WORD ImageFileMachineType
);

BOOL Wow64DisableWow64FsRedirection(
[out] PVOID *OldValue
);

BOOLEAN Wow64EnableWow64FsRedirection(
BOOLEAN Wow64FsEnableRedirection
);

BOOL Wow64RevertWow64FsRedirection(
[in] PVOID OlValue
);

BOOL Wow64GetThreadContext(
HANDLE hThread,
PWOW64_CONTEXT lpContext
);

BOOL Wow64SetThreadContext(
HANDLE hThread,
WOW64_CONTEXT *lpContext
);

USHORT Wow64SetThreadDefaultGuestMachine(
USHORT Machine
);

DWORD Wow64SuspendThread(
HANDLE hThread
);

NTSTATUS WINAPI NtWow64ReadVirtualMemory64(
_In_ HANDLE hProcess,
_In_ ULONG64 lpBaseAddress,
_Out_ LPVOID lpBuffer,
_In_ ULONG64 nSize,
_Out_ PULONG64 lpNumberOfBytesRead
);

NTSTATUS WINAPI NtWow64WriteVirtualMemory64(
_In_ HANDLE hProcess,
_In_ ULONG64 lpBaseAddress,
_Out_ LPVOID lpBuffer,
_In_ ULONG64 nSize,
_Out_ PULONG64 lpNumberOfBytesWritten
);
Loading