Skip to content

Commit 0c84188

Browse files
committed
Adding ctypes defintion associated with process & architecture
1 parent ac7ffba commit 0c84188

File tree

6 files changed

+198
-223
lines changed

6 files changed

+198
-223
lines changed

ctypes_generation/definitions/functions/process.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,18 @@ HMODULE LoadLibraryExW(
6363

6464
BOOL FreeLibrary(
6565
HMODULE hLibModule
66+
);
67+
68+
BOOL GetProcessInformation(
69+
[in] HANDLE hProcess,
70+
[in] PROCESS_INFORMATION_CLASS ProcessInformationClass,
71+
LPVOID ProcessInformation,
72+
[in] DWORD ProcessInformationSize
73+
);
74+
75+
BOOL SetProcessInformation(
76+
[in] HANDLE hProcess,
77+
[in] PROCESS_INFORMATION_CLASS ProcessInformationClass,
78+
LPVOID ProcessInformation,
79+
[in] DWORD ProcessInformationSize
6680
);

ctypes_generation/definitions/structures/winstruct.txt

Lines changed: 1 addition & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -565,112 +565,7 @@ typedef enum _SECTION_INHERIT {
565565
ViewUnmap = 2
566566
} SECTION_INHERIT;
567567

568-
typedef enum _PROCESSINFOCLASS {
569-
ProcessBasicInformation = 0,
570-
ProcessQuotaLimits = 1,
571-
ProcessIoCounters = 2,
572-
ProcessVmCounters = 3,
573-
ProcessTimes = 4,
574-
ProcessBasePriority = 5,
575-
ProcessRaisePriority = 6,
576-
ProcessDebugPort = 7,
577-
ProcessExceptionPort = 8,
578-
ProcessAccessToken = 9,
579-
ProcessLdtInformation = 10,
580-
ProcessLdtSize = 11,
581-
ProcessDefaultHardErrorMode = 12,
582-
ProcessIoPortHandlers = 13, // Note: this is kernel mode only
583-
ProcessPooledUsageAndLimits = 14,
584-
ProcessWorkingSetWatch = 15,
585-
ProcessUserModeIOPL = 16,
586-
ProcessEnableAlignmentFaultFixup = 17,
587-
ProcessPriorityClass = 18,
588-
ProcessWx86Information = 19,
589-
ProcessHandleCount = 20,
590-
ProcessAffinityMask = 21,
591-
ProcessPriorityBoost = 22,
592-
ProcessDeviceMap = 23,
593-
ProcessSessionInformation = 24,
594-
ProcessForegroundInformation = 25,
595-
ProcessWow64Information = 26,
596-
ProcessImageFileName = 27,
597-
ProcessLUIDDeviceMapsEnabled = 28,
598-
ProcessBreakOnTermination = 29,
599-
ProcessDebugObjectHandle = 30,
600-
ProcessDebugFlags = 31,
601-
ProcessHandleTracing = 32,
602-
ProcessIoPriority = 33,
603-
ProcessExecuteFlags = 34,
604-
ProcessTlsInformation = 35,
605-
ProcessCookie = 36,
606-
ProcessImageInformation = 37,
607-
ProcessCycleTime = 38,
608-
ProcessPagePriority = 39,
609-
ProcessInstrumentationCallback = 40,
610-
ProcessThreadStackAllocation = 41,
611-
ProcessWorkingSetWatchEx = 42,
612-
ProcessImageFileNameWin32 = 43,
613-
ProcessImageFileMapping = 44,
614-
ProcessAffinityUpdateMode = 45,
615-
ProcessMemoryAllocationMode = 46,
616-
ProcessGroupInformation = 47,
617-
ProcessTokenVirtualizationEnabled = 48,
618-
ProcessOwnerInformation = 49,
619-
ProcessWindowInformation = 50,
620-
ProcessHandleInformation = 51,
621-
ProcessMitigationPolicy = 52,
622-
ProcessDynamicFunctionTableInformation = 53,
623-
ProcessHandleCheckingMode = 54,
624-
ProcessKeepAliveCount = 55,
625-
ProcessRevokeFileHandles = 56,
626-
ProcessWorkingSetControl = 57,
627-
ProcessHandleTable = 58,
628-
ProcessCheckStackExtentsMode = 59,
629-
ProcessCommandLineInformation = 60,
630-
ProcessProtectionInformation = 61,
631-
ProcessMemoryExhaustion = 62,
632-
ProcessFaultInformation = 63,
633-
ProcessTelemetryIdInformation = 64,
634-
ProcessCommitReleaseInformation = 65,
635-
ProcessReserved1Information = 66,
636-
ProcessReserved2Information = 67,
637-
ProcessSubsystemProcess = 68,
638-
ProcessInPrivate = 70,
639-
ProcessRaiseUMExceptionOnInvalidHandleClose = 71,
640-
ProcessSubsystemInformation = 75,
641-
ProcessWin32kSyscallFilterInformation = 79,
642-
ProcessEnergyTrackingState = 82,
643-
MaxProcessInfoClass // MaxProcessInfoClass should always be the last enum
644-
} PROCESSINFOCLASS;
645-
646-
typedef enum _MEMORY_INFORMATION_CLASS {
647-
MemoryBasicInformation,
648-
MemoryWorkingSetList,
649-
MemorySectionName,
650-
MemoryBasicVlmInformation,
651-
MemoryWorkingSetListEx
652-
} MEMORY_INFORMATION_CLASS;
653-
654-
typedef enum _THREAD_INFORMATION_CLASS {
655-
ThreadBasicInformation,
656-
ThreadTimes,
657-
ThreadPriority,
658-
ThreadBasePriority,
659-
ThreadAffinityMask,
660-
ThreadImpersonationToken,
661-
ThreadDescriptorTableEntry,
662-
ThreadEnableAlignmentFaultFixup,
663-
ThreadEventPair,
664-
ThreadQuerySetWin32StartAddress,
665-
ThreadZeroTlsCell,
666-
ThreadPerformanceCount,
667-
ThreadAmILastThread,
668-
ThreadIdealProcessor,
669-
ThreadPriorityBoost,
670-
ThreadSetTlsArrayAddress,
671-
ThreadIsIoPending,
672-
ThreadHideFromDebugger
673-
} THREAD_INFORMATION_CLASS, *PTHREAD_INFORMATION_CLASS;
568+
674569

675570

676571

windows/generated_def/meta.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13276,6 +13276,7 @@
1327613276
'PROCESS_BASIC_INFORMATION',
1327713277
'PROCESS_INFORMATION',
1327813278
'PROCESS_INSTRUMENTATION_CALLBACK_INFORMATION',
13279+
'PROCESS_MACHINE_INFORMATION',
1327913280
'PROCESS_MEMORY_COUNTERS',
1328013281
'PROCESS_MEMORY_COUNTERS_EX',
1328113282
'PROCESS_MITIGATION_ASLR_POLICY',
@@ -13994,6 +13995,7 @@
1399413995
'_PROCESS_BASIC_INFORMATION',
1399513996
'_PROCESS_INFORMATION',
1399613997
'_PROCESS_INSTRUMENTATION_CALLBACK_INFORMATION',
13998+
'_PROCESS_MACHINE_INFORMATION',
1399713999
'_PROCESS_MEMORY_COUNTERS',
1399814000
'_PROCESS_MEMORY_COUNTERS_EX',
1399914001
'_PROCESS_MITIGATION_ASLR_POLICY',
@@ -14297,6 +14299,7 @@
1429714299
'KEY_INFORMATION_CLASS',
1429814300
'KEY_VALUE_INFORMATION_CLASS',
1429914301
'LocalServerType',
14302+
'MACHINE_ATTRIBUTES',
1430014303
'MEMORY_INFORMATION_CLASS',
1430114304
'MEM_EXTENDED_PARAMETER_TYPE',
1430214305
'MIB_TCP_STATE',
@@ -14331,6 +14334,7 @@
1433114334
'PPROCESS_MITIGATION_POLICY',
1433214335
'PREAD_DIRECTORY_NOTIFY_INFORMATION_CLASS',
1433314336
'PROCESSINFOCLASS',
14337+
'PROCESS_INFORMATION_CLASS',
1433414338
'PROCESS_MITIGATION_POLICY',
1433514339
'PSECURITY_IMPERSONATION_LEVEL',
1433614340
'PSID_NAME_USE',
@@ -14430,6 +14434,7 @@
1443014434
'_IO_PRIORITY_HINT',
1443114435
'_KEY_INFORMATION_CLASS',
1443214436
'_KEY_VALUE_INFORMATION_CLASS',
14437+
'_MACHINE_ATTRIBUTES',
1443314438
'_MEMORY_INFORMATION_CLASS',
1443414439
'_MIB_TCP_STATE',
1443514440
'_MULTIPLE_TRUSTEE_OPERATION',
@@ -14440,6 +14445,7 @@
1444014445
'_POLICY_INFORMATION_CLASS',
1444114446
'_POLICY_LSA_SERVER_ROLE',
1444214447
'_PROCESSINFOCLASS',
14448+
'_PROCESS_INFORMATION_CLASS',
1444314449
'_PROCESS_MITIGATION_POLICY',
1444414450
'_READ_DIRECTORY_NOTIFY_INFORMATION_CLASS',
1444514451
'_RTL_PATH_TYPE',
@@ -14850,6 +14856,7 @@
1485014856
'GetProcessId',
1485114857
'GetProcessImageFileNameA',
1485214858
'GetProcessImageFileNameW',
14859+
'GetProcessInformation',
1485314860
'GetProcessMemoryInfo',
1485414861
'GetProcessMitigationPolicy',
1485514862
'GetProcessTimes',
@@ -15194,6 +15201,7 @@
1519415201
'SetNamedSecurityInfoA',
1519515202
'SetNamedSecurityInfoW',
1519615203
'SetPriorityClass',
15204+
'SetProcessInformation',
1519715205
'SetProcessMitigationPolicy',
1519815206
'SetSecurityDescriptorDacl',
1519915207
'SetSecurityDescriptorOwner',

windows/generated_def/winfuncs.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,6 +1735,16 @@
17351735
FreeLibraryPrototype = WINFUNCTYPE(BOOL, HMODULE)
17361736
FreeLibraryParams = ((1, 'hLibModule'),)
17371737

1738+
#def GetProcessInformation(hProcess, ProcessInformationClass, ProcessInformation, ProcessInformationSize):
1739+
# return GetProcessInformation.ctypes_function(hProcess, ProcessInformationClass, ProcessInformation, ProcessInformationSize)
1740+
GetProcessInformationPrototype = WINFUNCTYPE(BOOL, HANDLE, PROCESS_INFORMATION_CLASS, LPVOID, DWORD)
1741+
GetProcessInformationParams = ((1, 'hProcess'), (1, 'ProcessInformationClass'), (1, 'ProcessInformation'), (1, 'ProcessInformationSize'))
1742+
1743+
#def SetProcessInformation(hProcess, ProcessInformationClass, ProcessInformation, ProcessInformationSize):
1744+
# return SetProcessInformation.ctypes_function(hProcess, ProcessInformationClass, ProcessInformation, ProcessInformationSize)
1745+
SetProcessInformationPrototype = WINFUNCTYPE(BOOL, HANDLE, PROCESS_INFORMATION_CLASS, LPVOID, DWORD)
1746+
SetProcessInformationParams = ((1, 'hProcess'), (1, 'ProcessInformationClass'), (1, 'ProcessInformation'), (1, 'ProcessInformationSize'))
1747+
17381748
#def RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData):
17391749
# return RegQueryValueExA.ctypes_function(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData)
17401750
RegQueryValueExAPrototype = WINFUNCTYPE(LSTATUS, HKEY, LPCSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD)

0 commit comments

Comments
 (0)