1 package winapi 2 3 const PROCESS_ALL_ACCESS uint32 = 2097151 4 5 const ( 6 PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE = 0x20016 7 PROC_THREAD_ATTRIBUTE_JOB_LIST = 0x2000D 8 ) 9 10 // ProcessVmCounters corresponds to the _VM_COUNTERS_EX and _VM_COUNTERS_EX2 structures. 11 const ProcessVmCounters = 3 12 13 // __kernel_entry NTSTATUS NtQueryInformationProcess( 14 // [in] HANDLE ProcessHandle, 15 // [in] PROCESSINFOCLASS ProcessInformationClass, 16 // [out] PVOID ProcessInformation, 17 // [in] ULONG ProcessInformationLength, 18 // [out, optional] PULONG ReturnLength 19 // ); 20 // 21 //sys NtQueryInformationProcess(processHandle windows.Handle, processInfoClass uint32, processInfo unsafe.Pointer, processInfoLength uint32, returnLength *uint32) (status uint32) = ntdll.NtQueryInformationProcess 22 23 // typedef struct _VM_COUNTERS_EX { 24 // SIZE_T PeakVirtualSize; 25 // SIZE_T VirtualSize; 26 // ULONG PageFaultCount; 27 // SIZE_T PeakWorkingSetSize; 28 // SIZE_T WorkingSetSize; 29 // SIZE_T QuotaPeakPagedPoolUsage; 30 // SIZE_T QuotaPagedPoolUsage; 31 // SIZE_T QuotaPeakNonPagedPoolUsage; 32 // SIZE_T QuotaNonPagedPoolUsage; 33 // SIZE_T PagefileUsage; 34 // SIZE_T PeakPagefileUsage; 35 // SIZE_T PrivateUsage; 36 // } VM_COUNTERS_EX, *PVM_COUNTERS_EX; 37 type VM_COUNTERS_EX struct { 38 PeakVirtualSize uintptr 39 VirtualSize uintptr 40 PageFaultCount uint32 41 PeakWorkingSetSize uintptr 42 WorkingSetSize uintptr 43 QuotaPeakPagedPoolUsage uintptr 44 QuotaPagedPoolUsage uintptr 45 QuotaPeakNonPagedPoolUsage uintptr 46 QuotaNonPagedPoolUsage uintptr 47 PagefileUsage uintptr 48 PeakPagefileUsage uintptr 49 PrivateUsage uintptr 50 } 51 52 // typedef struct _VM_COUNTERS_EX2 { 53 // VM_COUNTERS_EX CountersEx; 54 // SIZE_T PrivateWorkingSetSize; 55 // SIZE_T SharedCommitUsage; 56 // } VM_COUNTERS_EX2, *PVM_COUNTERS_EX2; 57 type VM_COUNTERS_EX2 struct { 58 CountersEx VM_COUNTERS_EX 59 PrivateWorkingSetSize uintptr 60 SharedCommitUsage uintptr 61 } 62