system.go 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //go:build windows
  2. package winapi
  3. import "golang.org/x/sys/windows"
  4. const SystemProcessInformation = 5
  5. const STATUS_INFO_LENGTH_MISMATCH = 0xC0000004
  6. // __kernel_entry NTSTATUS NtQuerySystemInformation(
  7. // SYSTEM_INFORMATION_CLASS SystemInformationClass,
  8. // PVOID SystemInformation,
  9. // ULONG SystemInformationLength,
  10. // PULONG ReturnLength
  11. // );
  12. //
  13. //sys NtQuerySystemInformation(systemInfoClass int, systemInformation unsafe.Pointer, systemInfoLength uint32, returnLength *uint32) (status uint32) = ntdll.NtQuerySystemInformation
  14. type SYSTEM_PROCESS_INFORMATION struct {
  15. NextEntryOffset uint32 // ULONG
  16. NumberOfThreads uint32 // ULONG
  17. WorkingSetPrivateSize int64 // LARGE_INTEGER
  18. HardFaultCount uint32 // ULONG
  19. NumberOfThreadsHighWatermark uint32 // ULONG
  20. CycleTime uint64 // ULONGLONG
  21. CreateTime int64 // LARGE_INTEGER
  22. UserTime int64 // LARGE_INTEGER
  23. KernelTime int64 // LARGE_INTEGER
  24. ImageName UnicodeString // UNICODE_STRING
  25. BasePriority int32 // KPRIORITY
  26. UniqueProcessID windows.Handle // HANDLE
  27. InheritedFromUniqueProcessID windows.Handle // HANDLE
  28. HandleCount uint32 // ULONG
  29. SessionID uint32 // ULONG
  30. UniqueProcessKey *uint32 // ULONG_PTR
  31. PeakVirtualSize uintptr // SIZE_T
  32. VirtualSize uintptr // SIZE_T
  33. PageFaultCount uint32 // ULONG
  34. PeakWorkingSetSize uintptr // SIZE_T
  35. WorkingSetSize uintptr // SIZE_T
  36. QuotaPeakPagedPoolUsage uintptr // SIZE_T
  37. QuotaPagedPoolUsage uintptr // SIZE_T
  38. QuotaPeakNonPagedPoolUsage uintptr // SIZE_T
  39. QuotaNonPagedPoolUsage uintptr // SIZE_T
  40. PagefileUsage uintptr // SIZE_T
  41. PeakPagefileUsage uintptr // SIZE_T
  42. PrivatePageCount uintptr // SIZE_T
  43. ReadOperationCount int64 // LARGE_INTEGER
  44. WriteOperationCount int64 // LARGE_INTEGER
  45. OtherOperationCount int64 // LARGE_INTEGER
  46. ReadTransferCount int64 // LARGE_INTEGER
  47. WriteTransferCount int64 // LARGE_INTEGER
  48. OtherTransferCount int64 // LARGE_INTEGER
  49. }