Debian Codegraph @

sys/windows/zsyscall_windows.go

raw symbols SCIP
1 // MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT
2
3 package windows
4
5 import "unsafe"
6 import "syscall"
7
8 var _ unsafe.Pointer
9
10 var (
11 modkernel32 = syscall.NewLazyDLL("kernel32.dll")
12 modpsapi = syscall.NewLazyDLL("psapi.dll")
13 modntdll = syscall.NewLazyDLL("ntdll.dll")
14 modadvapi32 = syscall.NewLazyDLL("advapi32.dll")
15
16 procGlobalMemoryStatusEx = modkernel32.NewProc("GlobalMemoryStatusEx")
17 procGetLogicalDriveStringsW = modkernel32.NewProc("GetLogicalDriveStringsW")
18 procGetProcessMemoryInfo = modpsapi.NewProc("GetProcessMemoryInfo")
19 procGetProcessImageFileNameW = modpsapi.NewProc("GetProcessImageFileNameW")
20 procGetSystemTimes = modkernel32.NewProc("GetSystemTimes")
21 procGetDriveTypeW = modkernel32.NewProc("GetDriveTypeW")
22 procEnumProcesses = modpsapi.NewProc("EnumProcesses")
23 procGetDiskFreeSpaceExW = modkernel32.NewProc("GetDiskFreeSpaceExW")
24 procProcess32FirstW = modkernel32.NewProc("Process32FirstW")
25 procProcess32NextW = modkernel32.NewProc("Process32NextW")
26 procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot")
27 procNtQuerySystemInformation = modntdll.NewProc("NtQuerySystemInformation")
28 procNtQueryInformationProcess = modntdll.NewProc("NtQueryInformationProcess")
29 procLookupPrivilegeNameW = modadvapi32.NewProc("LookupPrivilegeNameW")
30 procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW")
31 procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges")
32 )
33
34 func _GlobalMemoryStatusEx(buffer *MemoryStatusEx) (err error) {
35 r1, _, e1 := syscall.Syscall(procGlobalMemoryStatusEx.Addr(), 1, uintptr(unsafe.Pointer(buffer)), 0, 0)
36 if r1 == 0 {
37 if e1 != 0 {
38 err = error(e1)
39 } else {
40 err = syscall.EINVAL
41 }
42 }
43 return
44 }
45
46 func _GetLogicalDriveStringsW(bufferLength uint32, buffer *uint16) (length uint32, err error) {
47 r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0)
48 length = uint32(r0)
49 if length == 0 {
50 if e1 != 0 {
51 err = error(e1)
52 } else {
53 err = syscall.EINVAL
54 }
55 }
56 return
57 }
58
59 func _GetProcessMemoryInfo(handle syscall.Handle, psmemCounters *ProcessMemoryCountersEx, cb uint32) (err error) {
60 r1, _, e1 := syscall.Syscall(procGetProcessMemoryInfo.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(psmemCounters)), uintptr(cb))
61 if r1 == 0 {
62 if e1 != 0 {
63 err = error(e1)
64 } else {
65 err = syscall.EINVAL
66 }
67 }
68 return
69 }
70
71 func _GetProcessImageFileName(handle syscall.Handle, outImageFileName *uint16, size uint32) (length uint32, err error) {
72 r0, _, e1 := syscall.Syscall(procGetProcessImageFileNameW.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(outImageFileName)), uintptr(size))
73 length = uint32(r0)
74 if length == 0 {
75 if e1 != 0 {
76 err = error(e1)
77 } else {
78 err = syscall.EINVAL
79 }
80 }
81 return
82 }
83
84 func _GetSystemTimes(idleTime *syscall.Filetime, kernelTime *syscall.Filetime, userTime *syscall.Filetime) (err error) {
85 r1, _, e1 := syscall.Syscall(procGetSystemTimes.Addr(), 3, uintptr(unsafe.Pointer(idleTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)))
86 if r1 == 0 {
87 if e1 != 0 {
88 err = error(e1)
89 } else {
90 err = syscall.EINVAL
91 }
92 }
93 return
94 }
95
96 func _GetDriveType(rootPathName *uint16) (dt DriveType, err error) {
97 r0, _, e1 := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0)
98 dt = DriveType(r0)
99 if dt == 0 {
100 if e1 != 0 {
101 err = error(e1)
102 } else {
103 err = syscall.EINVAL
104 }
105 }
106 return
107 }
108
109 func _EnumProcesses(processIds *uint32, sizeBytes uint32, bytesReturned *uint32) (err error) {
110 r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(processIds)), uintptr(sizeBytes), uintptr(unsafe.Pointer(bytesReturned)))
111 if r1 == 0 {
112 if e1 != 0 {
113 err = error(e1)
114 } else {
115 err = syscall.EINVAL
116 }
117 }
118 return
119 }
120
121 func _GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailable *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) {
122 r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailable)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0)
123 if r1 == 0 {
124 if e1 != 0 {
125 err = error(e1)
126 } else {
127 err = syscall.EINVAL
128 }
129 }
130 return
131 }
132
133 func _Process32First(handle syscall.Handle, processEntry32 *ProcessEntry32) (err error) {
134 r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(processEntry32)), 0)
135 if r1 == 0 {
136 if e1 != 0 {
137 err = error(e1)
138 } else {
139 err = syscall.EINVAL
140 }
141 }
142 return
143 }
144
145 func _Process32Next(handle syscall.Handle, processEntry32 *ProcessEntry32) (err error) {
146 r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(processEntry32)), 0)
147 if r1 == 0 {
148 if e1 != 0 {
149 err = error(e1)
150 } else {
151 err = syscall.EINVAL
152 }
153 }
154 return
155 }
156
157 func _CreateToolhelp32Snapshot(flags uint32, processID uint32) (handle syscall.Handle, err error) {
158 r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processID), 0)
159 handle = syscall.Handle(r0)
160 if handle == 0 {
161 if e1 != 0 {
162 err = error(e1)
163 } else {
164 err = syscall.EINVAL
165 }
166 }
167 return
168 }
169
170 func _NtQuerySystemInformation(systemInformationClass uint32, systemInformation *byte, systemInformationLength uint32, returnLength *uint32) (ntstatus uint32, err error) {
171 r0, _, e1 := syscall.Syscall6(procNtQuerySystemInformation.Addr(), 4, uintptr(systemInformationClass), uintptr(unsafe.Pointer(systemInformation)), uintptr(systemInformationLength), uintptr(unsafe.Pointer(returnLength)), 0, 0)
172 ntstatus = uint32(r0)
173 if ntstatus == 0 {
174 if e1 != 0 {
175 err = error(e1)
176 } else {
177 err = syscall.EINVAL
178 }
179 }
180 return
181 }
182
183 func _NtQueryInformationProcess(processHandle syscall.Handle, processInformationClass uint32, processInformation *byte, processInformationLength uint32, returnLength *uint32) (ntstatus uint32, err error) {
184 r0, _, e1 := syscall.Syscall6(procNtQueryInformationProcess.Addr(), 5, uintptr(processHandle), uintptr(processInformationClass), uintptr(unsafe.Pointer(processInformation)), uintptr(processInformationLength), uintptr(unsafe.Pointer(returnLength)), 0)
185 ntstatus = uint32(r0)
186 if ntstatus == 0 {
187 if e1 != 0 {
188 err = error(e1)
189 } else {
190 err = syscall.EINVAL
191 }
192 }
193 return
194 }
195
196 func _LookupPrivilegeName(systemName string, luid *int64, buffer *uint16, size *uint32) (err error) {
197 var _p0 *uint16
198 _p0, err = syscall.UTF16PtrFromString(systemName)
199 if err != nil {
200 return
201 }
202 return __LookupPrivilegeName(_p0, luid, buffer, size)
203 }
204
205 func __LookupPrivilegeName(systemName *uint16, luid *int64, buffer *uint16, size *uint32) (err error) {
206 r1, _, e1 := syscall.Syscall6(procLookupPrivilegeNameW.Addr(), 4, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(luid)), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(size)), 0, 0)
207 if r1 == 0 {
208 if e1 != 0 {
209 err = error(e1)
210 } else {
211 err = syscall.EINVAL
212 }
213 }
214 return
215 }
216
217 func _LookupPrivilegeValue(systemName string, name string, luid *int64) (err error) {
218 var _p0 *uint16
219 _p0, err = syscall.UTF16PtrFromString(systemName)
220 if err != nil {
221 return
222 }
223 var _p1 *uint16
224 _p1, err = syscall.UTF16PtrFromString(name)
225 if err != nil {
226 return
227 }
228 return __LookupPrivilegeValue(_p0, _p1, luid)
229 }
230
231 func __LookupPrivilegeValue(systemName *uint16, name *uint16, luid *int64) (err error) {
232 r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
233 if r1 == 0 {
234 if e1 != 0 {
235 err = error(e1)
236 } else {
237 err = syscall.EINVAL
238 }
239 }
240 return
241 }
242
243 func _AdjustTokenPrivileges(token syscall.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) {
244 var _p0 uint32
245 if releaseAll {
246 _p0 = 1
247 } else {
248 _p0 = 0
249 }
250 r0, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(input)), uintptr(outputSize), uintptr(unsafe.Pointer(output)), uintptr(unsafe.Pointer(requiredSize)))
251 success = r0 != 0
252 if true {
253 if e1 != 0 {
254 err = error(e1)
255 } else {
256 err = syscall.EINVAL
257 }
258 }
259 return
260 }