-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtypes_windows.go
144 lines (134 loc) · 4.21 KB
/
types_windows.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
// +build windows
package main
import (
"syscall"
)
type (
dword uint32
dwordLong uint64
memorystatusex struct {
dwLength dword
dwMemoryLoad dword
ullTotalPhys dwordLong
ullAvailPhys dwordLong
ullTotalPageFile dwordLong
ullAvailPageFile dwordLong
ullTotalVirtual dwordLong
ullAvailVirtual dwordLong
ullAvailExtendedVirtual dwordLong
}
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION struct {
IdleTime uint64
KernelTime uint64
UserTime uint64
DpcTime uint64
InterruptTime uint64
InterruptCount uint32
}
SYSTEM_PERFORMANCE_INFORMATION struct {
IdleProcessTime uint64
IoReadTransferCount uint64
IoWriteTransferCount uint64
IoOtherTransferCount uint64
IoReadOperationCount uint32
IoWriteOperationCount uint32
IoOtherOperationCount uint32
AvailablePages uint32
CommittedPages uint32
CommitLimit uint32
PeakCommitment uint32
PageFaultCount uint32
CopyOnWriteCount uint32
TransitionCount uint32
CacheTransitionCount uint32
DemandZeroCount uint32
PageReadCount uint32
PageReadIoCount uint32
CacheReadCount uint32
CacheIoCount uint32
DirtyPagesWriteCount uint32
DirtyWriteIoCount uint32
MappedPagesWriteCount uint32
MappedWriteIoCount uint32
PagedPoolPages uint32
NonPagedPoolPages uint32
PagedPoolAllocs uint32
PagedPoolFrees uint32
NonPagedPoolAllocs uint32
NonPagedPoolFrees uint32
FreeSystemPtes uint32
ResidentSystemCodePage uint32
TotalSystemDriverPages uint32
TotalSystemCodePages uint32
NonPagedPoolLookasideHit uint32
PagedPoolLookasideHits uint32
AvailablePagedPoolPages uint32
ResidentSystemCachePage uint32
ResidentPagedPoolPage uint32
ResidentSystemDriverPage uint32
CcFastReadNoWait uint32
CcFastReadWait uint32
CcFastReadResourceMiss uint32
CcFastReadNotPossible uint32
CcFastMdlReadNoWait uint32
CcFastMdlReadWait uint32
CcFastMdlReadResourceMis uint32
CcFastMdlReadNotPossible uint32
CcMapDataNoWait uint32
CcMapDataWait uint32
CcMapDataNoWaitMiss uint32
CcMapDataWaitMiss uint32
CcPinMappedDataCount uint32
CcPinReadNoWait uint32
CcPinReadWait uint32
CcPinReadNoWaitMiss uint32
CcPinReadWaitMiss uint32
CcCopyReadNoWait uint32
CcCopyReadWait uint32
CcCopyReadNoWaitMiss uint32
CcCopyReadWaitMiss uint32
CcMdlReadNoWait uint32
CcMdlReadWait uint32
CcMdlReadNoWaitMiss uint32
CcMdlReadWaitMiss uint32
CcReadAheadIos uint32
CcLazyWriteIos uint32
CcLazyWritePages uint32
CcDataFlushes uint32
CcDataPages uint32
ContextSwitches uint32
FirstLevelTbFills uint32
SecondLevelTbFills uint32
SystemCalls uint32
CcTotalDirtyPages uint64
CcDirtyPageThreshold uint64
ResidentAvailablePages int64
}
SYSTEM_TIMEOFDAY_INFORMATION struct {
BootTime uint64
CurrentTime uint64
TimeZoneBias uint64
CurrentTimeZoneId uint64
Reserved1 uint64
}
)
const (
SystemBasicInformation = 0
SystemPerformanceInformation = 2
SystemTimeOfDayInformation = 3
SystemProcessInformation = 5
SystemProcessorPerformanceInformation = 8
SystemInterruptInformation = 23
SystemExceptionInformation = 33
SystemRegistryQuotaInformation = 37
SystemLookasideInformation = 45
SystemPolicyInformation = 134
)
var kernel32 = syscall.NewLazyDLL("kernel32.dll")
var ntDll = syscall.NewLazyDLL("Ntdll.dll")
var (
_globalMemoryStatusEx = kernel32.NewProc("GlobalMemoryStatusEx")
_getDiskFreeSpaceEx = kernel32.NewProc("GetDiskFreeSpaceExW")
_getLogicalDrives = kernel32.NewProc("GetLogicalDrives")
_ntQuerySystemInformation = ntDll.NewProc("NtQuerySystemInformation")
)