process.go 2.0 KB

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