process.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. // SIZE_T PeakVirtualSize;
  20. // SIZE_T VirtualSize;
  21. // ULONG PageFaultCount;
  22. // SIZE_T PeakWorkingSetSize;
  23. // SIZE_T WorkingSetSize;
  24. // SIZE_T QuotaPeakPagedPoolUsage;
  25. // SIZE_T QuotaPagedPoolUsage;
  26. // SIZE_T QuotaPeakNonPagedPoolUsage;
  27. // SIZE_T QuotaNonPagedPoolUsage;
  28. // SIZE_T PagefileUsage;
  29. // SIZE_T PeakPagefileUsage;
  30. // SIZE_T PrivateUsage;
  31. // } VM_COUNTERS_EX, *PVM_COUNTERS_EX;
  32. type VM_COUNTERS_EX struct {
  33. PeakVirtualSize uintptr
  34. VirtualSize uintptr
  35. PageFaultCount uint32
  36. PeakWorkingSetSize uintptr
  37. WorkingSetSize uintptr
  38. QuotaPeakPagedPoolUsage uintptr
  39. QuotaPagedPoolUsage uintptr
  40. QuotaPeakNonPagedPoolUsage uintptr
  41. QuotaNonPagedPoolUsage uintptr
  42. PagefileUsage uintptr
  43. PeakPagefileUsage uintptr
  44. PrivateUsage uintptr
  45. }
  46. // typedef struct _VM_COUNTERS_EX2 {
  47. // VM_COUNTERS_EX CountersEx;
  48. // SIZE_T PrivateWorkingSetSize;
  49. // SIZE_T SharedCommitUsage;
  50. // } VM_COUNTERS_EX2, *PVM_COUNTERS_EX2;
  51. type VM_COUNTERS_EX2 struct {
  52. CountersEx VM_COUNTERS_EX
  53. PrivateWorkingSetSize uintptr
  54. SharedCommitUsage uintptr
  55. }