Browse code

Revendor go-winio to v0.3.7

Signed-off-by: Darren Stahl <darst@microsoft.com>

Darren Stahl authored on 2016/11/22 07:53:43
Showing 12 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 # the following lines are in sorted order, FYI
2 2
 github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62
3 3
 github.com/Microsoft/hcsshim v0.5.9
4
-github.com/Microsoft/go-winio v0.3.6
4
+github.com/Microsoft/go-winio v0.3.7
5 5
 github.com/Sirupsen/logrus f76d643702a30fbffecdfe50831e11881c96ceb3 https://github.com/aaronlehmann/logrus
6 6
 github.com/davecgh/go-spew 6d212800a42e8ab5c146b8ace3490ee17e5225f9
7 7
 github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
... ...
@@ -1,3 +1,5 @@
1
+// +build windows
2
+
1 3
 package winio
2 4
 
3 5
 import (
4 6
new file mode 100644
... ...
@@ -0,0 +1,4 @@
0
+// +build !windows
1
+// This file only exists to allow go get on non-Windows platforms.
2
+
3
+package backuptar
... ...
@@ -1,3 +1,5 @@
1
+// +build windows
2
+
1 3
 package backuptar
2 4
 
3 5
 import (
... ...
@@ -1,3 +1,5 @@
1
+// +build windows
2
+
1 3
 package winio
2 4
 
3 5
 import (
... ...
@@ -1,3 +1,5 @@
1
+// +build windows
2
+
1 3
 package winio
2 4
 
3 5
 import (
... ...
@@ -1,3 +1,5 @@
1
+// +build windows
2
+
1 3
 package winio
2 4
 
3 5
 import (
... ...
@@ -1,3 +1,5 @@
1
+// +build windows
2
+
1 3
 package winio
2 4
 
3 5
 import (
... ...
@@ -1,3 +1,5 @@
1
+// +build windows
2
+
1 3
 package winio
2 4
 
3 5
 import (
... ...
@@ -1,3 +1,3 @@
1 1
 package winio
2 2
 
3
-//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall.go file.go pipe.go sd.go fileinfo.go privilege.go backup.go
3
+//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go file.go pipe.go sd.go fileinfo.go privilege.go backup.go
4 4
deleted file mode 100644
... ...
@@ -1,496 +0,0 @@
1
-// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT
2
-
3
-package winio
4
-
5
-import (
6
-	"syscall"
7
-	"unsafe"
8
-
9
-	"golang.org/x/sys/windows"
10
-)
11
-
12
-var _ unsafe.Pointer
13
-
14
-var (
15
-	modkernel32 = syscall.NewLazyDLL("kernel32.dll")
16
-	modwinmm    = syscall.NewLazyDLL("winmm.dll")
17
-	modadvapi32 = syscall.NewLazyDLL("advapi32.dll")
18
-
19
-	procCancelIoEx                                           = modkernel32.NewProc("CancelIoEx")
20
-	procCreateIoCompletionPort                               = modkernel32.NewProc("CreateIoCompletionPort")
21
-	procGetQueuedCompletionStatus                            = modkernel32.NewProc("GetQueuedCompletionStatus")
22
-	procSetFileCompletionNotificationModes                   = modkernel32.NewProc("SetFileCompletionNotificationModes")
23
-	proctimeBeginPeriod                                      = modwinmm.NewProc("timeBeginPeriod")
24
-	procConnectNamedPipe                                     = modkernel32.NewProc("ConnectNamedPipe")
25
-	procCreateNamedPipeW                                     = modkernel32.NewProc("CreateNamedPipeW")
26
-	procCreateFileW                                          = modkernel32.NewProc("CreateFileW")
27
-	procWaitNamedPipeW                                       = modkernel32.NewProc("WaitNamedPipeW")
28
-	procGetNamedPipeInfo                                     = modkernel32.NewProc("GetNamedPipeInfo")
29
-	procGetNamedPipeHandleStateW                             = modkernel32.NewProc("GetNamedPipeHandleStateW")
30
-	procLookupAccountNameW                                   = modadvapi32.NewProc("LookupAccountNameW")
31
-	procConvertSidToStringSidW                               = modadvapi32.NewProc("ConvertSidToStringSidW")
32
-	procConvertStringSecurityDescriptorToSecurityDescriptorW = modadvapi32.NewProc("ConvertStringSecurityDescriptorToSecurityDescriptorW")
33
-	procConvertSecurityDescriptorToStringSecurityDescriptorW = modadvapi32.NewProc("ConvertSecurityDescriptorToStringSecurityDescriptorW")
34
-	procLocalFree                                            = modkernel32.NewProc("LocalFree")
35
-	procGetSecurityDescriptorLength                          = modadvapi32.NewProc("GetSecurityDescriptorLength")
36
-	procGetFileInformationByHandleEx                         = modkernel32.NewProc("GetFileInformationByHandleEx")
37
-	procSetFileInformationByHandle                           = modkernel32.NewProc("SetFileInformationByHandle")
38
-	procAdjustTokenPrivileges                                = modadvapi32.NewProc("AdjustTokenPrivileges")
39
-	procImpersonateSelf                                      = modadvapi32.NewProc("ImpersonateSelf")
40
-	procRevertToSelf                                         = modadvapi32.NewProc("RevertToSelf")
41
-	procOpenThreadToken                                      = modadvapi32.NewProc("OpenThreadToken")
42
-	procGetCurrentThread                                     = modkernel32.NewProc("GetCurrentThread")
43
-	procLookupPrivilegeValueW                                = modadvapi32.NewProc("LookupPrivilegeValueW")
44
-	procLookupPrivilegeNameW                                 = modadvapi32.NewProc("LookupPrivilegeNameW")
45
-	procLookupPrivilegeDisplayNameW                          = modadvapi32.NewProc("LookupPrivilegeDisplayNameW")
46
-	procBackupRead                                           = modkernel32.NewProc("BackupRead")
47
-	procBackupWrite                                          = modkernel32.NewProc("BackupWrite")
48
-)
49
-
50
-func cancelIoEx(file syscall.Handle, o *syscall.Overlapped) (err error) {
51
-	r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(file), uintptr(unsafe.Pointer(o)), 0)
52
-	if r1 == 0 {
53
-		if e1 != 0 {
54
-			err = error(e1)
55
-		} else {
56
-			err = syscall.EINVAL
57
-		}
58
-	}
59
-	return
60
-}
61
-
62
-func createIoCompletionPort(file syscall.Handle, port syscall.Handle, key uintptr, threadCount uint32) (newport syscall.Handle, err error) {
63
-	r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(file), uintptr(port), uintptr(key), uintptr(threadCount), 0, 0)
64
-	newport = syscall.Handle(r0)
65
-	if newport == 0 {
66
-		if e1 != 0 {
67
-			err = error(e1)
68
-		} else {
69
-			err = syscall.EINVAL
70
-		}
71
-	}
72
-	return
73
-}
74
-
75
-func getQueuedCompletionStatus(port syscall.Handle, bytes *uint32, key *uintptr, o **ioOperation, timeout uint32) (err error) {
76
-	r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(port), uintptr(unsafe.Pointer(bytes)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(o)), uintptr(timeout), 0)
77
-	if r1 == 0 {
78
-		if e1 != 0 {
79
-			err = error(e1)
80
-		} else {
81
-			err = syscall.EINVAL
82
-		}
83
-	}
84
-	return
85
-}
86
-
87
-func setFileCompletionNotificationModes(h syscall.Handle, flags uint8) (err error) {
88
-	r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(h), uintptr(flags), 0)
89
-	if r1 == 0 {
90
-		if e1 != 0 {
91
-			err = error(e1)
92
-		} else {
93
-			err = syscall.EINVAL
94
-		}
95
-	}
96
-	return
97
-}
98
-
99
-func timeBeginPeriod(period uint32) (n int32) {
100
-	r0, _, _ := syscall.Syscall(proctimeBeginPeriod.Addr(), 1, uintptr(period), 0, 0)
101
-	n = int32(r0)
102
-	return
103
-}
104
-
105
-func connectNamedPipe(pipe syscall.Handle, o *syscall.Overlapped) (err error) {
106
-	r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(o)), 0)
107
-	if r1 == 0 {
108
-		if e1 != 0 {
109
-			err = error(e1)
110
-		} else {
111
-			err = syscall.EINVAL
112
-		}
113
-	}
114
-	return
115
-}
116
-
117
-func createNamedPipe(name string, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *securityAttributes) (handle syscall.Handle, err error) {
118
-	var _p0 *uint16
119
-	_p0, err = syscall.UTF16PtrFromString(name)
120
-	if err != nil {
121
-		return
122
-	}
123
-	return _createNamedPipe(_p0, flags, pipeMode, maxInstances, outSize, inSize, defaultTimeout, sa)
124
-}
125
-
126
-func _createNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *securityAttributes) (handle syscall.Handle, err error) {
127
-	r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0)
128
-	handle = syscall.Handle(r0)
129
-	if handle == syscall.InvalidHandle {
130
-		if e1 != 0 {
131
-			err = error(e1)
132
-		} else {
133
-			err = syscall.EINVAL
134
-		}
135
-	}
136
-	return
137
-}
138
-
139
-func createFile(name string, access uint32, mode uint32, sa *securityAttributes, createmode uint32, attrs uint32, templatefile syscall.Handle) (handle syscall.Handle, err error) {
140
-	var _p0 *uint16
141
-	_p0, err = syscall.UTF16PtrFromString(name)
142
-	if err != nil {
143
-		return
144
-	}
145
-	return _createFile(_p0, access, mode, sa, createmode, attrs, templatefile)
146
-}
147
-
148
-func _createFile(name *uint16, access uint32, mode uint32, sa *securityAttributes, createmode uint32, attrs uint32, templatefile syscall.Handle) (handle syscall.Handle, err error) {
149
-	r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0)
150
-	handle = syscall.Handle(r0)
151
-	if handle == syscall.InvalidHandle {
152
-		if e1 != 0 {
153
-			err = error(e1)
154
-		} else {
155
-			err = syscall.EINVAL
156
-		}
157
-	}
158
-	return
159
-}
160
-
161
-func waitNamedPipe(name string, timeout uint32) (err error) {
162
-	var _p0 *uint16
163
-	_p0, err = syscall.UTF16PtrFromString(name)
164
-	if err != nil {
165
-		return
166
-	}
167
-	return _waitNamedPipe(_p0, timeout)
168
-}
169
-
170
-func _waitNamedPipe(name *uint16, timeout uint32) (err error) {
171
-	r1, _, e1 := syscall.Syscall(procWaitNamedPipeW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(timeout), 0)
172
-	if r1 == 0 {
173
-		if e1 != 0 {
174
-			err = error(e1)
175
-		} else {
176
-			err = syscall.EINVAL
177
-		}
178
-	}
179
-	return
180
-}
181
-
182
-func getNamedPipeInfo(pipe syscall.Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) {
183
-	r1, _, e1 := syscall.Syscall6(procGetNamedPipeInfo.Addr(), 5, uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances)), 0)
184
-	if r1 == 0 {
185
-		if e1 != 0 {
186
-			err = error(e1)
187
-		} else {
188
-			err = syscall.EINVAL
189
-		}
190
-	}
191
-	return
192
-}
193
-
194
-func getNamedPipeHandleState(pipe syscall.Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) {
195
-	r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0)
196
-	if r1 == 0 {
197
-		if e1 != 0 {
198
-			err = error(e1)
199
-		} else {
200
-			err = syscall.EINVAL
201
-		}
202
-	}
203
-	return
204
-}
205
-
206
-func lookupAccountName(systemName *uint16, accountName string, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) {
207
-	var _p0 *uint16
208
-	_p0, err = syscall.UTF16PtrFromString(accountName)
209
-	if err != nil {
210
-		return
211
-	}
212
-	return _lookupAccountName(systemName, _p0, sid, sidSize, refDomain, refDomainSize, sidNameUse)
213
-}
214
-
215
-func _lookupAccountName(systemName *uint16, accountName *uint16, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) {
216
-	r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidSize)), uintptr(unsafe.Pointer(refDomain)), uintptr(unsafe.Pointer(refDomainSize)), uintptr(unsafe.Pointer(sidNameUse)), 0, 0)
217
-	if r1 == 0 {
218
-		if e1 != 0 {
219
-			err = error(e1)
220
-		} else {
221
-			err = syscall.EINVAL
222
-		}
223
-	}
224
-	return
225
-}
226
-
227
-func convertSidToStringSid(sid *byte, str **uint16) (err error) {
228
-	r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(str)), 0)
229
-	if r1 == 0 {
230
-		if e1 != 0 {
231
-			err = error(e1)
232
-		} else {
233
-			err = syscall.EINVAL
234
-		}
235
-	}
236
-	return
237
-}
238
-
239
-func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd *uintptr, size *uint32) (err error) {
240
-	var _p0 *uint16
241
-	_p0, err = syscall.UTF16PtrFromString(str)
242
-	if err != nil {
243
-		return
244
-	}
245
-	return _convertStringSecurityDescriptorToSecurityDescriptor(_p0, revision, sd, size)
246
-}
247
-
248
-func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd *uintptr, size *uint32) (err error) {
249
-	r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0)
250
-	if r1 == 0 {
251
-		if e1 != 0 {
252
-			err = error(e1)
253
-		} else {
254
-			err = syscall.EINVAL
255
-		}
256
-	}
257
-	return
258
-}
259
-
260
-func convertSecurityDescriptorToStringSecurityDescriptor(sd *byte, revision uint32, secInfo uint32, sddl **uint16, sddlSize *uint32) (err error) {
261
-	r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(secInfo), uintptr(unsafe.Pointer(sddl)), uintptr(unsafe.Pointer(sddlSize)), 0)
262
-	if r1 == 0 {
263
-		if e1 != 0 {
264
-			err = error(e1)
265
-		} else {
266
-			err = syscall.EINVAL
267
-		}
268
-	}
269
-	return
270
-}
271
-
272
-func localFree(mem uintptr) {
273
-	syscall.Syscall(procLocalFree.Addr(), 1, uintptr(mem), 0, 0)
274
-	return
275
-}
276
-
277
-func getSecurityDescriptorLength(sd uintptr) (len uint32) {
278
-	r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(sd), 0, 0)
279
-	len = uint32(r0)
280
-	return
281
-}
282
-
283
-func getFileInformationByHandleEx(h syscall.Handle, class uint32, buffer *byte, size uint32) (err error) {
284
-	r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(h), uintptr(class), uintptr(unsafe.Pointer(buffer)), uintptr(size), 0, 0)
285
-	if r1 == 0 {
286
-		if e1 != 0 {
287
-			err = error(e1)
288
-		} else {
289
-			err = syscall.EINVAL
290
-		}
291
-	}
292
-	return
293
-}
294
-
295
-func setFileInformationByHandle(h syscall.Handle, class uint32, buffer *byte, size uint32) (err error) {
296
-	r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(h), uintptr(class), uintptr(unsafe.Pointer(buffer)), uintptr(size), 0, 0)
297
-	if r1 == 0 {
298
-		if e1 != 0 {
299
-			err = error(e1)
300
-		} else {
301
-			err = syscall.EINVAL
302
-		}
303
-	}
304
-	return
305
-}
306
-
307
-func adjustTokenPrivileges(token windows.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) {
308
-	var _p0 uint32
309
-	if releaseAll {
310
-		_p0 = 1
311
-	} else {
312
-		_p0 = 0
313
-	}
314
-	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)))
315
-	success = r0 != 0
316
-	if true {
317
-		if e1 != 0 {
318
-			err = error(e1)
319
-		} else {
320
-			err = syscall.EINVAL
321
-		}
322
-	}
323
-	return
324
-}
325
-
326
-func impersonateSelf(level uint32) (err error) {
327
-	r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(level), 0, 0)
328
-	if r1 == 0 {
329
-		if e1 != 0 {
330
-			err = error(e1)
331
-		} else {
332
-			err = syscall.EINVAL
333
-		}
334
-	}
335
-	return
336
-}
337
-
338
-func revertToSelf() (err error) {
339
-	r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0)
340
-	if r1 == 0 {
341
-		if e1 != 0 {
342
-			err = error(e1)
343
-		} else {
344
-			err = syscall.EINVAL
345
-		}
346
-	}
347
-	return
348
-}
349
-
350
-func openThreadToken(thread syscall.Handle, accessMask uint32, openAsSelf bool, token *windows.Token) (err error) {
351
-	var _p0 uint32
352
-	if openAsSelf {
353
-		_p0 = 1
354
-	} else {
355
-		_p0 = 0
356
-	}
357
-	r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(accessMask), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0)
358
-	if r1 == 0 {
359
-		if e1 != 0 {
360
-			err = error(e1)
361
-		} else {
362
-			err = syscall.EINVAL
363
-		}
364
-	}
365
-	return
366
-}
367
-
368
-func getCurrentThread() (h syscall.Handle) {
369
-	r0, _, _ := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0)
370
-	h = syscall.Handle(r0)
371
-	return
372
-}
373
-
374
-func lookupPrivilegeValue(systemName string, name string, luid *uint64) (err error) {
375
-	var _p0 *uint16
376
-	_p0, err = syscall.UTF16PtrFromString(systemName)
377
-	if err != nil {
378
-		return
379
-	}
380
-	var _p1 *uint16
381
-	_p1, err = syscall.UTF16PtrFromString(name)
382
-	if err != nil {
383
-		return
384
-	}
385
-	return _lookupPrivilegeValue(_p0, _p1, luid)
386
-}
387
-
388
-func _lookupPrivilegeValue(systemName *uint16, name *uint16, luid *uint64) (err error) {
389
-	r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
390
-	if r1 == 0 {
391
-		if e1 != 0 {
392
-			err = error(e1)
393
-		} else {
394
-			err = syscall.EINVAL
395
-		}
396
-	}
397
-	return
398
-}
399
-
400
-func lookupPrivilegeName(systemName string, luid *uint64, buffer *uint16, size *uint32) (err error) {
401
-	var _p0 *uint16
402
-	_p0, err = syscall.UTF16PtrFromString(systemName)
403
-	if err != nil {
404
-		return
405
-	}
406
-	return _lookupPrivilegeName(_p0, luid, buffer, size)
407
-}
408
-
409
-func _lookupPrivilegeName(systemName *uint16, luid *uint64, buffer *uint16, size *uint32) (err error) {
410
-	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)
411
-	if r1 == 0 {
412
-		if e1 != 0 {
413
-			err = error(e1)
414
-		} else {
415
-			err = syscall.EINVAL
416
-		}
417
-	}
418
-	return
419
-}
420
-
421
-func lookupPrivilegeDisplayName(systemName string, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) {
422
-	var _p0 *uint16
423
-	_p0, err = syscall.UTF16PtrFromString(systemName)
424
-	if err != nil {
425
-		return
426
-	}
427
-	return _lookupPrivilegeDisplayName(_p0, name, buffer, size, languageId)
428
-}
429
-
430
-func _lookupPrivilegeDisplayName(systemName *uint16, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) {
431
-	r1, _, e1 := syscall.Syscall6(procLookupPrivilegeDisplayNameW.Addr(), 5, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(languageId)), 0)
432
-	if r1 == 0 {
433
-		if e1 != 0 {
434
-			err = error(e1)
435
-		} else {
436
-			err = syscall.EINVAL
437
-		}
438
-	}
439
-	return
440
-}
441
-
442
-func backupRead(h syscall.Handle, b []byte, bytesRead *uint32, abort bool, processSecurity bool, context *uintptr) (err error) {
443
-	var _p0 *byte
444
-	if len(b) > 0 {
445
-		_p0 = &b[0]
446
-	}
447
-	var _p1 uint32
448
-	if abort {
449
-		_p1 = 1
450
-	} else {
451
-		_p1 = 0
452
-	}
453
-	var _p2 uint32
454
-	if processSecurity {
455
-		_p2 = 1
456
-	} else {
457
-		_p2 = 0
458
-	}
459
-	r1, _, e1 := syscall.Syscall9(procBackupRead.Addr(), 7, uintptr(h), uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(unsafe.Pointer(bytesRead)), uintptr(_p1), uintptr(_p2), uintptr(unsafe.Pointer(context)), 0, 0)
460
-	if r1 == 0 {
461
-		if e1 != 0 {
462
-			err = error(e1)
463
-		} else {
464
-			err = syscall.EINVAL
465
-		}
466
-	}
467
-	return
468
-}
469
-
470
-func backupWrite(h syscall.Handle, b []byte, bytesWritten *uint32, abort bool, processSecurity bool, context *uintptr) (err error) {
471
-	var _p0 *byte
472
-	if len(b) > 0 {
473
-		_p0 = &b[0]
474
-	}
475
-	var _p1 uint32
476
-	if abort {
477
-		_p1 = 1
478
-	} else {
479
-		_p1 = 0
480
-	}
481
-	var _p2 uint32
482
-	if processSecurity {
483
-		_p2 = 1
484
-	} else {
485
-		_p2 = 0
486
-	}
487
-	r1, _, e1 := syscall.Syscall9(procBackupWrite.Addr(), 7, uintptr(h), uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(unsafe.Pointer(bytesWritten)), uintptr(_p1), uintptr(_p2), uintptr(unsafe.Pointer(context)), 0, 0)
488
-	if r1 == 0 {
489
-		if e1 != 0 {
490
-			err = error(e1)
491
-		} else {
492
-			err = syscall.EINVAL
493
-		}
494
-	}
495
-	return
496
-}
497 1
new file mode 100644
... ...
@@ -0,0 +1,496 @@
0
+// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT
1
+
2
+package winio
3
+
4
+import (
5
+	"syscall"
6
+	"unsafe"
7
+
8
+	"golang.org/x/sys/windows"
9
+)
10
+
11
+var _ unsafe.Pointer
12
+
13
+var (
14
+	modkernel32 = windows.NewLazySystemDLL("kernel32.dll")
15
+	modwinmm    = windows.NewLazySystemDLL("winmm.dll")
16
+	modadvapi32 = windows.NewLazySystemDLL("advapi32.dll")
17
+
18
+	procCancelIoEx                                           = modkernel32.NewProc("CancelIoEx")
19
+	procCreateIoCompletionPort                               = modkernel32.NewProc("CreateIoCompletionPort")
20
+	procGetQueuedCompletionStatus                            = modkernel32.NewProc("GetQueuedCompletionStatus")
21
+	procSetFileCompletionNotificationModes                   = modkernel32.NewProc("SetFileCompletionNotificationModes")
22
+	proctimeBeginPeriod                                      = modwinmm.NewProc("timeBeginPeriod")
23
+	procConnectNamedPipe                                     = modkernel32.NewProc("ConnectNamedPipe")
24
+	procCreateNamedPipeW                                     = modkernel32.NewProc("CreateNamedPipeW")
25
+	procCreateFileW                                          = modkernel32.NewProc("CreateFileW")
26
+	procWaitNamedPipeW                                       = modkernel32.NewProc("WaitNamedPipeW")
27
+	procGetNamedPipeInfo                                     = modkernel32.NewProc("GetNamedPipeInfo")
28
+	procGetNamedPipeHandleStateW                             = modkernel32.NewProc("GetNamedPipeHandleStateW")
29
+	procLookupAccountNameW                                   = modadvapi32.NewProc("LookupAccountNameW")
30
+	procConvertSidToStringSidW                               = modadvapi32.NewProc("ConvertSidToStringSidW")
31
+	procConvertStringSecurityDescriptorToSecurityDescriptorW = modadvapi32.NewProc("ConvertStringSecurityDescriptorToSecurityDescriptorW")
32
+	procConvertSecurityDescriptorToStringSecurityDescriptorW = modadvapi32.NewProc("ConvertSecurityDescriptorToStringSecurityDescriptorW")
33
+	procLocalFree                                            = modkernel32.NewProc("LocalFree")
34
+	procGetSecurityDescriptorLength                          = modadvapi32.NewProc("GetSecurityDescriptorLength")
35
+	procGetFileInformationByHandleEx                         = modkernel32.NewProc("GetFileInformationByHandleEx")
36
+	procSetFileInformationByHandle                           = modkernel32.NewProc("SetFileInformationByHandle")
37
+	procAdjustTokenPrivileges                                = modadvapi32.NewProc("AdjustTokenPrivileges")
38
+	procImpersonateSelf                                      = modadvapi32.NewProc("ImpersonateSelf")
39
+	procRevertToSelf                                         = modadvapi32.NewProc("RevertToSelf")
40
+	procOpenThreadToken                                      = modadvapi32.NewProc("OpenThreadToken")
41
+	procGetCurrentThread                                     = modkernel32.NewProc("GetCurrentThread")
42
+	procLookupPrivilegeValueW                                = modadvapi32.NewProc("LookupPrivilegeValueW")
43
+	procLookupPrivilegeNameW                                 = modadvapi32.NewProc("LookupPrivilegeNameW")
44
+	procLookupPrivilegeDisplayNameW                          = modadvapi32.NewProc("LookupPrivilegeDisplayNameW")
45
+	procBackupRead                                           = modkernel32.NewProc("BackupRead")
46
+	procBackupWrite                                          = modkernel32.NewProc("BackupWrite")
47
+)
48
+
49
+func cancelIoEx(file syscall.Handle, o *syscall.Overlapped) (err error) {
50
+	r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(file), uintptr(unsafe.Pointer(o)), 0)
51
+	if r1 == 0 {
52
+		if e1 != 0 {
53
+			err = error(e1)
54
+		} else {
55
+			err = syscall.EINVAL
56
+		}
57
+	}
58
+	return
59
+}
60
+
61
+func createIoCompletionPort(file syscall.Handle, port syscall.Handle, key uintptr, threadCount uint32) (newport syscall.Handle, err error) {
62
+	r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(file), uintptr(port), uintptr(key), uintptr(threadCount), 0, 0)
63
+	newport = syscall.Handle(r0)
64
+	if newport == 0 {
65
+		if e1 != 0 {
66
+			err = error(e1)
67
+		} else {
68
+			err = syscall.EINVAL
69
+		}
70
+	}
71
+	return
72
+}
73
+
74
+func getQueuedCompletionStatus(port syscall.Handle, bytes *uint32, key *uintptr, o **ioOperation, timeout uint32) (err error) {
75
+	r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(port), uintptr(unsafe.Pointer(bytes)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(o)), uintptr(timeout), 0)
76
+	if r1 == 0 {
77
+		if e1 != 0 {
78
+			err = error(e1)
79
+		} else {
80
+			err = syscall.EINVAL
81
+		}
82
+	}
83
+	return
84
+}
85
+
86
+func setFileCompletionNotificationModes(h syscall.Handle, flags uint8) (err error) {
87
+	r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(h), uintptr(flags), 0)
88
+	if r1 == 0 {
89
+		if e1 != 0 {
90
+			err = error(e1)
91
+		} else {
92
+			err = syscall.EINVAL
93
+		}
94
+	}
95
+	return
96
+}
97
+
98
+func timeBeginPeriod(period uint32) (n int32) {
99
+	r0, _, _ := syscall.Syscall(proctimeBeginPeriod.Addr(), 1, uintptr(period), 0, 0)
100
+	n = int32(r0)
101
+	return
102
+}
103
+
104
+func connectNamedPipe(pipe syscall.Handle, o *syscall.Overlapped) (err error) {
105
+	r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(o)), 0)
106
+	if r1 == 0 {
107
+		if e1 != 0 {
108
+			err = error(e1)
109
+		} else {
110
+			err = syscall.EINVAL
111
+		}
112
+	}
113
+	return
114
+}
115
+
116
+func createNamedPipe(name string, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *securityAttributes) (handle syscall.Handle, err error) {
117
+	var _p0 *uint16
118
+	_p0, err = syscall.UTF16PtrFromString(name)
119
+	if err != nil {
120
+		return
121
+	}
122
+	return _createNamedPipe(_p0, flags, pipeMode, maxInstances, outSize, inSize, defaultTimeout, sa)
123
+}
124
+
125
+func _createNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *securityAttributes) (handle syscall.Handle, err error) {
126
+	r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0)
127
+	handle = syscall.Handle(r0)
128
+	if handle == syscall.InvalidHandle {
129
+		if e1 != 0 {
130
+			err = error(e1)
131
+		} else {
132
+			err = syscall.EINVAL
133
+		}
134
+	}
135
+	return
136
+}
137
+
138
+func createFile(name string, access uint32, mode uint32, sa *securityAttributes, createmode uint32, attrs uint32, templatefile syscall.Handle) (handle syscall.Handle, err error) {
139
+	var _p0 *uint16
140
+	_p0, err = syscall.UTF16PtrFromString(name)
141
+	if err != nil {
142
+		return
143
+	}
144
+	return _createFile(_p0, access, mode, sa, createmode, attrs, templatefile)
145
+}
146
+
147
+func _createFile(name *uint16, access uint32, mode uint32, sa *securityAttributes, createmode uint32, attrs uint32, templatefile syscall.Handle) (handle syscall.Handle, err error) {
148
+	r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0)
149
+	handle = syscall.Handle(r0)
150
+	if handle == syscall.InvalidHandle {
151
+		if e1 != 0 {
152
+			err = error(e1)
153
+		} else {
154
+			err = syscall.EINVAL
155
+		}
156
+	}
157
+	return
158
+}
159
+
160
+func waitNamedPipe(name string, timeout uint32) (err error) {
161
+	var _p0 *uint16
162
+	_p0, err = syscall.UTF16PtrFromString(name)
163
+	if err != nil {
164
+		return
165
+	}
166
+	return _waitNamedPipe(_p0, timeout)
167
+}
168
+
169
+func _waitNamedPipe(name *uint16, timeout uint32) (err error) {
170
+	r1, _, e1 := syscall.Syscall(procWaitNamedPipeW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(timeout), 0)
171
+	if r1 == 0 {
172
+		if e1 != 0 {
173
+			err = error(e1)
174
+		} else {
175
+			err = syscall.EINVAL
176
+		}
177
+	}
178
+	return
179
+}
180
+
181
+func getNamedPipeInfo(pipe syscall.Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) {
182
+	r1, _, e1 := syscall.Syscall6(procGetNamedPipeInfo.Addr(), 5, uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances)), 0)
183
+	if r1 == 0 {
184
+		if e1 != 0 {
185
+			err = error(e1)
186
+		} else {
187
+			err = syscall.EINVAL
188
+		}
189
+	}
190
+	return
191
+}
192
+
193
+func getNamedPipeHandleState(pipe syscall.Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) {
194
+	r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0)
195
+	if r1 == 0 {
196
+		if e1 != 0 {
197
+			err = error(e1)
198
+		} else {
199
+			err = syscall.EINVAL
200
+		}
201
+	}
202
+	return
203
+}
204
+
205
+func lookupAccountName(systemName *uint16, accountName string, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) {
206
+	var _p0 *uint16
207
+	_p0, err = syscall.UTF16PtrFromString(accountName)
208
+	if err != nil {
209
+		return
210
+	}
211
+	return _lookupAccountName(systemName, _p0, sid, sidSize, refDomain, refDomainSize, sidNameUse)
212
+}
213
+
214
+func _lookupAccountName(systemName *uint16, accountName *uint16, sid *byte, sidSize *uint32, refDomain *uint16, refDomainSize *uint32, sidNameUse *uint32) (err error) {
215
+	r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidSize)), uintptr(unsafe.Pointer(refDomain)), uintptr(unsafe.Pointer(refDomainSize)), uintptr(unsafe.Pointer(sidNameUse)), 0, 0)
216
+	if r1 == 0 {
217
+		if e1 != 0 {
218
+			err = error(e1)
219
+		} else {
220
+			err = syscall.EINVAL
221
+		}
222
+	}
223
+	return
224
+}
225
+
226
+func convertSidToStringSid(sid *byte, str **uint16) (err error) {
227
+	r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(str)), 0)
228
+	if r1 == 0 {
229
+		if e1 != 0 {
230
+			err = error(e1)
231
+		} else {
232
+			err = syscall.EINVAL
233
+		}
234
+	}
235
+	return
236
+}
237
+
238
+func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd *uintptr, size *uint32) (err error) {
239
+	var _p0 *uint16
240
+	_p0, err = syscall.UTF16PtrFromString(str)
241
+	if err != nil {
242
+		return
243
+	}
244
+	return _convertStringSecurityDescriptorToSecurityDescriptor(_p0, revision, sd, size)
245
+}
246
+
247
+func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd *uintptr, size *uint32) (err error) {
248
+	r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0)
249
+	if r1 == 0 {
250
+		if e1 != 0 {
251
+			err = error(e1)
252
+		} else {
253
+			err = syscall.EINVAL
254
+		}
255
+	}
256
+	return
257
+}
258
+
259
+func convertSecurityDescriptorToStringSecurityDescriptor(sd *byte, revision uint32, secInfo uint32, sddl **uint16, sddlSize *uint32) (err error) {
260
+	r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(secInfo), uintptr(unsafe.Pointer(sddl)), uintptr(unsafe.Pointer(sddlSize)), 0)
261
+	if r1 == 0 {
262
+		if e1 != 0 {
263
+			err = error(e1)
264
+		} else {
265
+			err = syscall.EINVAL
266
+		}
267
+	}
268
+	return
269
+}
270
+
271
+func localFree(mem uintptr) {
272
+	syscall.Syscall(procLocalFree.Addr(), 1, uintptr(mem), 0, 0)
273
+	return
274
+}
275
+
276
+func getSecurityDescriptorLength(sd uintptr) (len uint32) {
277
+	r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(sd), 0, 0)
278
+	len = uint32(r0)
279
+	return
280
+}
281
+
282
+func getFileInformationByHandleEx(h syscall.Handle, class uint32, buffer *byte, size uint32) (err error) {
283
+	r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(h), uintptr(class), uintptr(unsafe.Pointer(buffer)), uintptr(size), 0, 0)
284
+	if r1 == 0 {
285
+		if e1 != 0 {
286
+			err = error(e1)
287
+		} else {
288
+			err = syscall.EINVAL
289
+		}
290
+	}
291
+	return
292
+}
293
+
294
+func setFileInformationByHandle(h syscall.Handle, class uint32, buffer *byte, size uint32) (err error) {
295
+	r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(h), uintptr(class), uintptr(unsafe.Pointer(buffer)), uintptr(size), 0, 0)
296
+	if r1 == 0 {
297
+		if e1 != 0 {
298
+			err = error(e1)
299
+		} else {
300
+			err = syscall.EINVAL
301
+		}
302
+	}
303
+	return
304
+}
305
+
306
+func adjustTokenPrivileges(token windows.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) {
307
+	var _p0 uint32
308
+	if releaseAll {
309
+		_p0 = 1
310
+	} else {
311
+		_p0 = 0
312
+	}
313
+	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)))
314
+	success = r0 != 0
315
+	if true {
316
+		if e1 != 0 {
317
+			err = error(e1)
318
+		} else {
319
+			err = syscall.EINVAL
320
+		}
321
+	}
322
+	return
323
+}
324
+
325
+func impersonateSelf(level uint32) (err error) {
326
+	r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(level), 0, 0)
327
+	if r1 == 0 {
328
+		if e1 != 0 {
329
+			err = error(e1)
330
+		} else {
331
+			err = syscall.EINVAL
332
+		}
333
+	}
334
+	return
335
+}
336
+
337
+func revertToSelf() (err error) {
338
+	r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0)
339
+	if r1 == 0 {
340
+		if e1 != 0 {
341
+			err = error(e1)
342
+		} else {
343
+			err = syscall.EINVAL
344
+		}
345
+	}
346
+	return
347
+}
348
+
349
+func openThreadToken(thread syscall.Handle, accessMask uint32, openAsSelf bool, token *windows.Token) (err error) {
350
+	var _p0 uint32
351
+	if openAsSelf {
352
+		_p0 = 1
353
+	} else {
354
+		_p0 = 0
355
+	}
356
+	r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(accessMask), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0)
357
+	if r1 == 0 {
358
+		if e1 != 0 {
359
+			err = error(e1)
360
+		} else {
361
+			err = syscall.EINVAL
362
+		}
363
+	}
364
+	return
365
+}
366
+
367
+func getCurrentThread() (h syscall.Handle) {
368
+	r0, _, _ := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0)
369
+	h = syscall.Handle(r0)
370
+	return
371
+}
372
+
373
+func lookupPrivilegeValue(systemName string, name string, luid *uint64) (err error) {
374
+	var _p0 *uint16
375
+	_p0, err = syscall.UTF16PtrFromString(systemName)
376
+	if err != nil {
377
+		return
378
+	}
379
+	var _p1 *uint16
380
+	_p1, err = syscall.UTF16PtrFromString(name)
381
+	if err != nil {
382
+		return
383
+	}
384
+	return _lookupPrivilegeValue(_p0, _p1, luid)
385
+}
386
+
387
+func _lookupPrivilegeValue(systemName *uint16, name *uint16, luid *uint64) (err error) {
388
+	r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
389
+	if r1 == 0 {
390
+		if e1 != 0 {
391
+			err = error(e1)
392
+		} else {
393
+			err = syscall.EINVAL
394
+		}
395
+	}
396
+	return
397
+}
398
+
399
+func lookupPrivilegeName(systemName string, luid *uint64, buffer *uint16, size *uint32) (err error) {
400
+	var _p0 *uint16
401
+	_p0, err = syscall.UTF16PtrFromString(systemName)
402
+	if err != nil {
403
+		return
404
+	}
405
+	return _lookupPrivilegeName(_p0, luid, buffer, size)
406
+}
407
+
408
+func _lookupPrivilegeName(systemName *uint16, luid *uint64, buffer *uint16, size *uint32) (err error) {
409
+	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)
410
+	if r1 == 0 {
411
+		if e1 != 0 {
412
+			err = error(e1)
413
+		} else {
414
+			err = syscall.EINVAL
415
+		}
416
+	}
417
+	return
418
+}
419
+
420
+func lookupPrivilegeDisplayName(systemName string, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) {
421
+	var _p0 *uint16
422
+	_p0, err = syscall.UTF16PtrFromString(systemName)
423
+	if err != nil {
424
+		return
425
+	}
426
+	return _lookupPrivilegeDisplayName(_p0, name, buffer, size, languageId)
427
+}
428
+
429
+func _lookupPrivilegeDisplayName(systemName *uint16, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) {
430
+	r1, _, e1 := syscall.Syscall6(procLookupPrivilegeDisplayNameW.Addr(), 5, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(languageId)), 0)
431
+	if r1 == 0 {
432
+		if e1 != 0 {
433
+			err = error(e1)
434
+		} else {
435
+			err = syscall.EINVAL
436
+		}
437
+	}
438
+	return
439
+}
440
+
441
+func backupRead(h syscall.Handle, b []byte, bytesRead *uint32, abort bool, processSecurity bool, context *uintptr) (err error) {
442
+	var _p0 *byte
443
+	if len(b) > 0 {
444
+		_p0 = &b[0]
445
+	}
446
+	var _p1 uint32
447
+	if abort {
448
+		_p1 = 1
449
+	} else {
450
+		_p1 = 0
451
+	}
452
+	var _p2 uint32
453
+	if processSecurity {
454
+		_p2 = 1
455
+	} else {
456
+		_p2 = 0
457
+	}
458
+	r1, _, e1 := syscall.Syscall9(procBackupRead.Addr(), 7, uintptr(h), uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(unsafe.Pointer(bytesRead)), uintptr(_p1), uintptr(_p2), uintptr(unsafe.Pointer(context)), 0, 0)
459
+	if r1 == 0 {
460
+		if e1 != 0 {
461
+			err = error(e1)
462
+		} else {
463
+			err = syscall.EINVAL
464
+		}
465
+	}
466
+	return
467
+}
468
+
469
+func backupWrite(h syscall.Handle, b []byte, bytesWritten *uint32, abort bool, processSecurity bool, context *uintptr) (err error) {
470
+	var _p0 *byte
471
+	if len(b) > 0 {
472
+		_p0 = &b[0]
473
+	}
474
+	var _p1 uint32
475
+	if abort {
476
+		_p1 = 1
477
+	} else {
478
+		_p1 = 0
479
+	}
480
+	var _p2 uint32
481
+	if processSecurity {
482
+		_p2 = 1
483
+	} else {
484
+		_p2 = 0
485
+	}
486
+	r1, _, e1 := syscall.Syscall9(procBackupWrite.Addr(), 7, uintptr(h), uintptr(unsafe.Pointer(_p0)), uintptr(len(b)), uintptr(unsafe.Pointer(bytesWritten)), uintptr(_p1), uintptr(_p2), uintptr(unsafe.Pointer(context)), 0, 0)
487
+	if r1 == 0 {
488
+		if e1 != 0 {
489
+			err = error(e1)
490
+		} else {
491
+			err = syscall.EINVAL
492
+		}
493
+	}
494
+	return
495
+}