zsyscall_windows.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. // MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT
  2. package winio
  3. import (
  4. "syscall"
  5. "unsafe"
  6. "golang.org/x/sys/windows"
  7. )
  8. var _ unsafe.Pointer
  9. // Do the interface allocations only once for common
  10. // Errno values.
  11. const (
  12. errnoERROR_IO_PENDING = 997
  13. )
  14. var (
  15. errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
  16. )
  17. // errnoErr returns common boxed Errno values, to prevent
  18. // allocations at runtime.
  19. func errnoErr(e syscall.Errno) error {
  20. switch e {
  21. case 0:
  22. return nil
  23. case errnoERROR_IO_PENDING:
  24. return errERROR_IO_PENDING
  25. }
  26. // TODO: add more here, after collecting data on the common
  27. // error values see on Windows. (perhaps when running
  28. // all.bat?)
  29. return e
  30. }
  31. var (
  32. modkernel32 = windows.NewLazySystemDLL("kernel32.dll")
  33. modadvapi32 = windows.NewLazySystemDLL("advapi32.dll")
  34. procCancelIoEx = modkernel32.NewProc("CancelIoEx")
  35. procCreateIoCompletionPort = modkernel32.NewProc("CreateIoCompletionPort")
  36. procGetQueuedCompletionStatus = modkernel32.NewProc("GetQueuedCompletionStatus")
  37. procSetFileCompletionNotificationModes = modkernel32.NewProc("SetFileCompletionNotificationModes")
  38. procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe")
  39. procCreateNamedPipeW = modkernel32.NewProc("CreateNamedPipeW")
  40. procCreateFileW = modkernel32.NewProc("CreateFileW")
  41. procWaitNamedPipeW = modkernel32.NewProc("WaitNamedPipeW")
  42. procGetNamedPipeInfo = modkernel32.NewProc("GetNamedPipeInfo")
  43. procGetNamedPipeHandleStateW = modkernel32.NewProc("GetNamedPipeHandleStateW")
  44. procLocalAlloc = modkernel32.NewProc("LocalAlloc")
  45. procLookupAccountNameW = modadvapi32.NewProc("LookupAccountNameW")
  46. procConvertSidToStringSidW = modadvapi32.NewProc("ConvertSidToStringSidW")
  47. procConvertStringSecurityDescriptorToSecurityDescriptorW = modadvapi32.NewProc("ConvertStringSecurityDescriptorToSecurityDescriptorW")
  48. procConvertSecurityDescriptorToStringSecurityDescriptorW = modadvapi32.NewProc("ConvertSecurityDescriptorToStringSecurityDescriptorW")
  49. procLocalFree = modkernel32.NewProc("LocalFree")
  50. procGetSecurityDescriptorLength = modadvapi32.NewProc("GetSecurityDescriptorLength")
  51. procGetFileInformationByHandleEx = modkernel32.NewProc("GetFileInformationByHandleEx")
  52. procSetFileInformationByHandle = modkernel32.NewProc("SetFileInformationByHandle")
  53. procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges")
  54. procImpersonateSelf = modadvapi32.NewProc("ImpersonateSelf")
  55. procRevertToSelf = modadvapi32.NewProc("RevertToSelf")
  56. procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken")
  57. procGetCurrentThread = modkernel32.NewProc("GetCurrentThread")
  58. procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW")
  59. procLookupPrivilegeNameW = modadvapi32.NewProc("LookupPrivilegeNameW")
  60. procLookupPrivilegeDisplayNameW = modadvapi32.NewProc("LookupPrivilegeDisplayNameW")
  61. procBackupRead = modkernel32.NewProc("BackupRead")
  62. procBackupWrite = modkernel32.NewProc("BackupWrite")
  63. )
  64. func cancelIoEx(file syscall.Handle, o *syscall.Overlapped) (err error) {
  65. r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(file), uintptr(unsafe.Pointer(o)), 0)
  66. if r1 == 0 {
  67. if e1 != 0 {
  68. err = errnoErr(e1)
  69. } else {
  70. err = syscall.EINVAL
  71. }
  72. }
  73. return
  74. }
  75. func createIoCompletionPort(file syscall.Handle, port syscall.Handle, key uintptr, threadCount uint32) (newport syscall.Handle, err error) {
  76. r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(file), uintptr(port), uintptr(key), uintptr(threadCount), 0, 0)
  77. newport = syscall.Handle(r0)
  78. if newport == 0 {
  79. if e1 != 0 {
  80. err = errnoErr(e1)
  81. } else {
  82. err = syscall.EINVAL
  83. }
  84. }
  85. return
  86. }
  87. func getQueuedCompletionStatus(port syscall.Handle, bytes *uint32, key *uintptr, o **ioOperation, timeout uint32) (err error) {
  88. r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(port), uintptr(unsafe.Pointer(bytes)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(o)), uintptr(timeout), 0)
  89. if r1 == 0 {
  90. if e1 != 0 {
  91. err = errnoErr(e1)
  92. } else {
  93. err = syscall.EINVAL
  94. }
  95. }
  96. return
  97. }
  98. func setFileCompletionNotificationModes(h syscall.Handle, flags uint8) (err error) {
  99. r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(h), uintptr(flags), 0)
  100. if r1 == 0 {
  101. if e1 != 0 {
  102. err = errnoErr(e1)
  103. } else {
  104. err = syscall.EINVAL
  105. }
  106. }
  107. return
  108. }
  109. func connectNamedPipe(pipe syscall.Handle, o *syscall.Overlapped) (err error) {
  110. r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(o)), 0)
  111. if r1 == 0 {
  112. if e1 != 0 {
  113. err = errnoErr(e1)
  114. } else {
  115. err = syscall.EINVAL
  116. }
  117. }
  118. return
  119. }
  120. func createNamedPipe(name string, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *syscall.SecurityAttributes) (handle syscall.Handle, err error) {
  121. var _p0 *uint16
  122. _p0, err = syscall.UTF16PtrFromString(name)
  123. if err != nil {
  124. return
  125. }
  126. return _createNamedPipe(_p0, flags, pipeMode, maxInstances, outSize, inSize, defaultTimeout, sa)
  127. }
  128. func _createNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *syscall.SecurityAttributes) (handle syscall.Handle, err error) {
  129. 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)
  130. handle = syscall.Handle(r0)
  131. if handle == syscall.InvalidHandle {
  132. if e1 != 0 {
  133. err = errnoErr(e1)
  134. } else {
  135. err = syscall.EINVAL
  136. }
  137. }
  138. return
  139. }
  140. func createFile(name string, access uint32, mode uint32, sa *syscall.SecurityAttributes, createmode uint32, attrs uint32, templatefile syscall.Handle) (handle syscall.Handle, err error) {
  141. var _p0 *uint16
  142. _p0, err = syscall.UTF16PtrFromString(name)
  143. if err != nil {
  144. return
  145. }
  146. return _createFile(_p0, access, mode, sa, createmode, attrs, templatefile)
  147. }
  148. func _createFile(name *uint16, access uint32, mode uint32, sa *syscall.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 = errnoErr(e1)
  154. } else {
  155. err = syscall.EINVAL
  156. }
  157. }
  158. return
  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. func _waitNamedPipe(name *uint16, timeout uint32) (err error) {
  169. r1, _, e1 := syscall.Syscall(procWaitNamedPipeW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(timeout), 0)
  170. if r1 == 0 {
  171. if e1 != 0 {
  172. err = errnoErr(e1)
  173. } else {
  174. err = syscall.EINVAL
  175. }
  176. }
  177. return
  178. }
  179. func getNamedPipeInfo(pipe syscall.Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) {
  180. 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)
  181. if r1 == 0 {
  182. if e1 != 0 {
  183. err = errnoErr(e1)
  184. } else {
  185. err = syscall.EINVAL
  186. }
  187. }
  188. return
  189. }
  190. func getNamedPipeHandleState(pipe syscall.Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) {
  191. 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)
  192. if r1 == 0 {
  193. if e1 != 0 {
  194. err = errnoErr(e1)
  195. } else {
  196. err = syscall.EINVAL
  197. }
  198. }
  199. return
  200. }
  201. func localAlloc(uFlags uint32, length uint32) (ptr uintptr) {
  202. r0, _, _ := syscall.Syscall(procLocalAlloc.Addr(), 2, uintptr(uFlags), uintptr(length), 0)
  203. ptr = uintptr(r0)
  204. return
  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. 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 = errnoErr(e1)
  219. } else {
  220. err = syscall.EINVAL
  221. }
  222. }
  223. return
  224. }
  225. func convertSidToStringSid(sid *byte, str **uint16) (err error) {
  226. r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(str)), 0)
  227. if r1 == 0 {
  228. if e1 != 0 {
  229. err = errnoErr(e1)
  230. } else {
  231. err = syscall.EINVAL
  232. }
  233. }
  234. return
  235. }
  236. func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd *uintptr, size *uint32) (err error) {
  237. var _p0 *uint16
  238. _p0, err = syscall.UTF16PtrFromString(str)
  239. if err != nil {
  240. return
  241. }
  242. return _convertStringSecurityDescriptorToSecurityDescriptor(_p0, revision, sd, size)
  243. }
  244. func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd *uintptr, size *uint32) (err error) {
  245. r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0)
  246. if r1 == 0 {
  247. if e1 != 0 {
  248. err = errnoErr(e1)
  249. } else {
  250. err = syscall.EINVAL
  251. }
  252. }
  253. return
  254. }
  255. func convertSecurityDescriptorToStringSecurityDescriptor(sd *byte, revision uint32, secInfo uint32, sddl **uint16, sddlSize *uint32) (err error) {
  256. r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(secInfo), uintptr(unsafe.Pointer(sddl)), uintptr(unsafe.Pointer(sddlSize)), 0)
  257. if r1 == 0 {
  258. if e1 != 0 {
  259. err = errnoErr(e1)
  260. } else {
  261. err = syscall.EINVAL
  262. }
  263. }
  264. return
  265. }
  266. func localFree(mem uintptr) {
  267. syscall.Syscall(procLocalFree.Addr(), 1, uintptr(mem), 0, 0)
  268. return
  269. }
  270. func getSecurityDescriptorLength(sd uintptr) (len uint32) {
  271. r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(sd), 0, 0)
  272. len = uint32(r0)
  273. return
  274. }
  275. func getFileInformationByHandleEx(h syscall.Handle, class uint32, buffer *byte, size uint32) (err error) {
  276. r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(h), uintptr(class), uintptr(unsafe.Pointer(buffer)), uintptr(size), 0, 0)
  277. if r1 == 0 {
  278. if e1 != 0 {
  279. err = errnoErr(e1)
  280. } else {
  281. err = syscall.EINVAL
  282. }
  283. }
  284. return
  285. }
  286. func setFileInformationByHandle(h syscall.Handle, class uint32, buffer *byte, size uint32) (err error) {
  287. r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(h), uintptr(class), uintptr(unsafe.Pointer(buffer)), uintptr(size), 0, 0)
  288. if r1 == 0 {
  289. if e1 != 0 {
  290. err = errnoErr(e1)
  291. } else {
  292. err = syscall.EINVAL
  293. }
  294. }
  295. return
  296. }
  297. func adjustTokenPrivileges(token windows.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) {
  298. var _p0 uint32
  299. if releaseAll {
  300. _p0 = 1
  301. } else {
  302. _p0 = 0
  303. }
  304. 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)))
  305. success = r0 != 0
  306. if true {
  307. if e1 != 0 {
  308. err = errnoErr(e1)
  309. } else {
  310. err = syscall.EINVAL
  311. }
  312. }
  313. return
  314. }
  315. func impersonateSelf(level uint32) (err error) {
  316. r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(level), 0, 0)
  317. if r1 == 0 {
  318. if e1 != 0 {
  319. err = errnoErr(e1)
  320. } else {
  321. err = syscall.EINVAL
  322. }
  323. }
  324. return
  325. }
  326. func revertToSelf() (err error) {
  327. r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0)
  328. if r1 == 0 {
  329. if e1 != 0 {
  330. err = errnoErr(e1)
  331. } else {
  332. err = syscall.EINVAL
  333. }
  334. }
  335. return
  336. }
  337. func openThreadToken(thread syscall.Handle, accessMask uint32, openAsSelf bool, token *windows.Token) (err error) {
  338. var _p0 uint32
  339. if openAsSelf {
  340. _p0 = 1
  341. } else {
  342. _p0 = 0
  343. }
  344. r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(accessMask), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0)
  345. if r1 == 0 {
  346. if e1 != 0 {
  347. err = errnoErr(e1)
  348. } else {
  349. err = syscall.EINVAL
  350. }
  351. }
  352. return
  353. }
  354. func getCurrentThread() (h syscall.Handle) {
  355. r0, _, _ := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0)
  356. h = syscall.Handle(r0)
  357. return
  358. }
  359. func lookupPrivilegeValue(systemName string, name string, luid *uint64) (err error) {
  360. var _p0 *uint16
  361. _p0, err = syscall.UTF16PtrFromString(systemName)
  362. if err != nil {
  363. return
  364. }
  365. var _p1 *uint16
  366. _p1, err = syscall.UTF16PtrFromString(name)
  367. if err != nil {
  368. return
  369. }
  370. return _lookupPrivilegeValue(_p0, _p1, luid)
  371. }
  372. func _lookupPrivilegeValue(systemName *uint16, name *uint16, luid *uint64) (err error) {
  373. r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
  374. if r1 == 0 {
  375. if e1 != 0 {
  376. err = errnoErr(e1)
  377. } else {
  378. err = syscall.EINVAL
  379. }
  380. }
  381. return
  382. }
  383. func lookupPrivilegeName(systemName string, luid *uint64, buffer *uint16, size *uint32) (err error) {
  384. var _p0 *uint16
  385. _p0, err = syscall.UTF16PtrFromString(systemName)
  386. if err != nil {
  387. return
  388. }
  389. return _lookupPrivilegeName(_p0, luid, buffer, size)
  390. }
  391. func _lookupPrivilegeName(systemName *uint16, luid *uint64, buffer *uint16, size *uint32) (err error) {
  392. 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)
  393. if r1 == 0 {
  394. if e1 != 0 {
  395. err = errnoErr(e1)
  396. } else {
  397. err = syscall.EINVAL
  398. }
  399. }
  400. return
  401. }
  402. func lookupPrivilegeDisplayName(systemName string, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) {
  403. var _p0 *uint16
  404. _p0, err = syscall.UTF16PtrFromString(systemName)
  405. if err != nil {
  406. return
  407. }
  408. return _lookupPrivilegeDisplayName(_p0, name, buffer, size, languageId)
  409. }
  410. func _lookupPrivilegeDisplayName(systemName *uint16, name *uint16, buffer *uint16, size *uint32, languageId *uint32) (err error) {
  411. 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)
  412. if r1 == 0 {
  413. if e1 != 0 {
  414. err = errnoErr(e1)
  415. } else {
  416. err = syscall.EINVAL
  417. }
  418. }
  419. return
  420. }
  421. func backupRead(h syscall.Handle, b []byte, bytesRead *uint32, abort bool, processSecurity bool, context *uintptr) (err error) {
  422. var _p0 *byte
  423. if len(b) > 0 {
  424. _p0 = &b[0]
  425. }
  426. var _p1 uint32
  427. if abort {
  428. _p1 = 1
  429. } else {
  430. _p1 = 0
  431. }
  432. var _p2 uint32
  433. if processSecurity {
  434. _p2 = 1
  435. } else {
  436. _p2 = 0
  437. }
  438. 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)
  439. if r1 == 0 {
  440. if e1 != 0 {
  441. err = errnoErr(e1)
  442. } else {
  443. err = syscall.EINVAL
  444. }
  445. }
  446. return
  447. }
  448. func backupWrite(h syscall.Handle, b []byte, bytesWritten *uint32, abort bool, processSecurity bool, context *uintptr) (err error) {
  449. var _p0 *byte
  450. if len(b) > 0 {
  451. _p0 = &b[0]
  452. }
  453. var _p1 uint32
  454. if abort {
  455. _p1 = 1
  456. } else {
  457. _p1 = 0
  458. }
  459. var _p2 uint32
  460. if processSecurity {
  461. _p2 = 1
  462. } else {
  463. _p2 = 0
  464. }
  465. 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)
  466. if r1 == 0 {
  467. if e1 != 0 {
  468. err = errnoErr(e1)
  469. } else {
  470. err = syscall.EINVAL
  471. }
  472. }
  473. return
  474. }