zsyscall_windows.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. // Code generated mksyscall_windows.exe DO NOT EDIT
  2. package wclayer
  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. modvmcompute = windows.NewLazySystemDLL("vmcompute.dll")
  33. procActivateLayer = modvmcompute.NewProc("ActivateLayer")
  34. procCopyLayer = modvmcompute.NewProc("CopyLayer")
  35. procCreateLayer = modvmcompute.NewProc("CreateLayer")
  36. procCreateSandboxLayer = modvmcompute.NewProc("CreateSandboxLayer")
  37. procExpandSandboxSize = modvmcompute.NewProc("ExpandSandboxSize")
  38. procDeactivateLayer = modvmcompute.NewProc("DeactivateLayer")
  39. procDestroyLayer = modvmcompute.NewProc("DestroyLayer")
  40. procExportLayer = modvmcompute.NewProc("ExportLayer")
  41. procGetLayerMountPath = modvmcompute.NewProc("GetLayerMountPath")
  42. procGetBaseImages = modvmcompute.NewProc("GetBaseImages")
  43. procImportLayer = modvmcompute.NewProc("ImportLayer")
  44. procLayerExists = modvmcompute.NewProc("LayerExists")
  45. procNameToGuid = modvmcompute.NewProc("NameToGuid")
  46. procPrepareLayer = modvmcompute.NewProc("PrepareLayer")
  47. procUnprepareLayer = modvmcompute.NewProc("UnprepareLayer")
  48. procProcessBaseImage = modvmcompute.NewProc("ProcessBaseImage")
  49. procProcessUtilityImage = modvmcompute.NewProc("ProcessUtilityImage")
  50. procGrantVmAccess = modvmcompute.NewProc("GrantVmAccess")
  51. )
  52. func activateLayer(info *driverInfo, id string) (hr error) {
  53. var _p0 *uint16
  54. _p0, hr = syscall.UTF16PtrFromString(id)
  55. if hr != nil {
  56. return
  57. }
  58. return _activateLayer(info, _p0)
  59. }
  60. func _activateLayer(info *driverInfo, id *uint16) (hr error) {
  61. if hr = procActivateLayer.Find(); hr != nil {
  62. return
  63. }
  64. r0, _, _ := syscall.Syscall(procActivateLayer.Addr(), 2, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), 0)
  65. if int32(r0) < 0 {
  66. if r0&0x1fff0000 == 0x00070000 {
  67. r0 &= 0xffff
  68. }
  69. hr = syscall.Errno(r0)
  70. }
  71. return
  72. }
  73. func copyLayer(info *driverInfo, srcId string, dstId string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) {
  74. var _p0 *uint16
  75. _p0, hr = syscall.UTF16PtrFromString(srcId)
  76. if hr != nil {
  77. return
  78. }
  79. var _p1 *uint16
  80. _p1, hr = syscall.UTF16PtrFromString(dstId)
  81. if hr != nil {
  82. return
  83. }
  84. return _copyLayer(info, _p0, _p1, descriptors)
  85. }
  86. func _copyLayer(info *driverInfo, srcId *uint16, dstId *uint16, descriptors []WC_LAYER_DESCRIPTOR) (hr error) {
  87. var _p2 *WC_LAYER_DESCRIPTOR
  88. if len(descriptors) > 0 {
  89. _p2 = &descriptors[0]
  90. }
  91. if hr = procCopyLayer.Find(); hr != nil {
  92. return
  93. }
  94. r0, _, _ := syscall.Syscall6(procCopyLayer.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(srcId)), uintptr(unsafe.Pointer(dstId)), uintptr(unsafe.Pointer(_p2)), uintptr(len(descriptors)), 0)
  95. if int32(r0) < 0 {
  96. if r0&0x1fff0000 == 0x00070000 {
  97. r0 &= 0xffff
  98. }
  99. hr = syscall.Errno(r0)
  100. }
  101. return
  102. }
  103. func createLayer(info *driverInfo, id string, parent string) (hr error) {
  104. var _p0 *uint16
  105. _p0, hr = syscall.UTF16PtrFromString(id)
  106. if hr != nil {
  107. return
  108. }
  109. var _p1 *uint16
  110. _p1, hr = syscall.UTF16PtrFromString(parent)
  111. if hr != nil {
  112. return
  113. }
  114. return _createLayer(info, _p0, _p1)
  115. }
  116. func _createLayer(info *driverInfo, id *uint16, parent *uint16) (hr error) {
  117. if hr = procCreateLayer.Find(); hr != nil {
  118. return
  119. }
  120. r0, _, _ := syscall.Syscall(procCreateLayer.Addr(), 3, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(parent)))
  121. if int32(r0) < 0 {
  122. if r0&0x1fff0000 == 0x00070000 {
  123. r0 &= 0xffff
  124. }
  125. hr = syscall.Errno(r0)
  126. }
  127. return
  128. }
  129. func createSandboxLayer(info *driverInfo, id string, parent uintptr, descriptors []WC_LAYER_DESCRIPTOR) (hr error) {
  130. var _p0 *uint16
  131. _p0, hr = syscall.UTF16PtrFromString(id)
  132. if hr != nil {
  133. return
  134. }
  135. return _createSandboxLayer(info, _p0, parent, descriptors)
  136. }
  137. func _createSandboxLayer(info *driverInfo, id *uint16, parent uintptr, descriptors []WC_LAYER_DESCRIPTOR) (hr error) {
  138. var _p1 *WC_LAYER_DESCRIPTOR
  139. if len(descriptors) > 0 {
  140. _p1 = &descriptors[0]
  141. }
  142. if hr = procCreateSandboxLayer.Find(); hr != nil {
  143. return
  144. }
  145. r0, _, _ := syscall.Syscall6(procCreateSandboxLayer.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(parent), uintptr(unsafe.Pointer(_p1)), uintptr(len(descriptors)), 0)
  146. if int32(r0) < 0 {
  147. if r0&0x1fff0000 == 0x00070000 {
  148. r0 &= 0xffff
  149. }
  150. hr = syscall.Errno(r0)
  151. }
  152. return
  153. }
  154. func expandSandboxSize(info *driverInfo, id string, size uint64) (hr error) {
  155. var _p0 *uint16
  156. _p0, hr = syscall.UTF16PtrFromString(id)
  157. if hr != nil {
  158. return
  159. }
  160. return _expandSandboxSize(info, _p0, size)
  161. }
  162. func _expandSandboxSize(info *driverInfo, id *uint16, size uint64) (hr error) {
  163. if hr = procExpandSandboxSize.Find(); hr != nil {
  164. return
  165. }
  166. r0, _, _ := syscall.Syscall(procExpandSandboxSize.Addr(), 3, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(size))
  167. if int32(r0) < 0 {
  168. if r0&0x1fff0000 == 0x00070000 {
  169. r0 &= 0xffff
  170. }
  171. hr = syscall.Errno(r0)
  172. }
  173. return
  174. }
  175. func deactivateLayer(info *driverInfo, id string) (hr error) {
  176. var _p0 *uint16
  177. _p0, hr = syscall.UTF16PtrFromString(id)
  178. if hr != nil {
  179. return
  180. }
  181. return _deactivateLayer(info, _p0)
  182. }
  183. func _deactivateLayer(info *driverInfo, id *uint16) (hr error) {
  184. if hr = procDeactivateLayer.Find(); hr != nil {
  185. return
  186. }
  187. r0, _, _ := syscall.Syscall(procDeactivateLayer.Addr(), 2, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), 0)
  188. if int32(r0) < 0 {
  189. if r0&0x1fff0000 == 0x00070000 {
  190. r0 &= 0xffff
  191. }
  192. hr = syscall.Errno(r0)
  193. }
  194. return
  195. }
  196. func destroyLayer(info *driverInfo, id string) (hr error) {
  197. var _p0 *uint16
  198. _p0, hr = syscall.UTF16PtrFromString(id)
  199. if hr != nil {
  200. return
  201. }
  202. return _destroyLayer(info, _p0)
  203. }
  204. func _destroyLayer(info *driverInfo, id *uint16) (hr error) {
  205. if hr = procDestroyLayer.Find(); hr != nil {
  206. return
  207. }
  208. r0, _, _ := syscall.Syscall(procDestroyLayer.Addr(), 2, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), 0)
  209. if int32(r0) < 0 {
  210. if r0&0x1fff0000 == 0x00070000 {
  211. r0 &= 0xffff
  212. }
  213. hr = syscall.Errno(r0)
  214. }
  215. return
  216. }
  217. func exportLayer(info *driverInfo, id string, path string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) {
  218. var _p0 *uint16
  219. _p0, hr = syscall.UTF16PtrFromString(id)
  220. if hr != nil {
  221. return
  222. }
  223. var _p1 *uint16
  224. _p1, hr = syscall.UTF16PtrFromString(path)
  225. if hr != nil {
  226. return
  227. }
  228. return _exportLayer(info, _p0, _p1, descriptors)
  229. }
  230. func _exportLayer(info *driverInfo, id *uint16, path *uint16, descriptors []WC_LAYER_DESCRIPTOR) (hr error) {
  231. var _p2 *WC_LAYER_DESCRIPTOR
  232. if len(descriptors) > 0 {
  233. _p2 = &descriptors[0]
  234. }
  235. if hr = procExportLayer.Find(); hr != nil {
  236. return
  237. }
  238. r0, _, _ := syscall.Syscall6(procExportLayer.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(_p2)), uintptr(len(descriptors)), 0)
  239. if int32(r0) < 0 {
  240. if r0&0x1fff0000 == 0x00070000 {
  241. r0 &= 0xffff
  242. }
  243. hr = syscall.Errno(r0)
  244. }
  245. return
  246. }
  247. func getLayerMountPath(info *driverInfo, id string, length *uintptr, buffer *uint16) (hr error) {
  248. var _p0 *uint16
  249. _p0, hr = syscall.UTF16PtrFromString(id)
  250. if hr != nil {
  251. return
  252. }
  253. return _getLayerMountPath(info, _p0, length, buffer)
  254. }
  255. func _getLayerMountPath(info *driverInfo, id *uint16, length *uintptr, buffer *uint16) (hr error) {
  256. if hr = procGetLayerMountPath.Find(); hr != nil {
  257. return
  258. }
  259. r0, _, _ := syscall.Syscall6(procGetLayerMountPath.Addr(), 4, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(length)), uintptr(unsafe.Pointer(buffer)), 0, 0)
  260. if int32(r0) < 0 {
  261. if r0&0x1fff0000 == 0x00070000 {
  262. r0 &= 0xffff
  263. }
  264. hr = syscall.Errno(r0)
  265. }
  266. return
  267. }
  268. func getBaseImages(buffer **uint16) (hr error) {
  269. if hr = procGetBaseImages.Find(); hr != nil {
  270. return
  271. }
  272. r0, _, _ := syscall.Syscall(procGetBaseImages.Addr(), 1, uintptr(unsafe.Pointer(buffer)), 0, 0)
  273. if int32(r0) < 0 {
  274. if r0&0x1fff0000 == 0x00070000 {
  275. r0 &= 0xffff
  276. }
  277. hr = syscall.Errno(r0)
  278. }
  279. return
  280. }
  281. func importLayer(info *driverInfo, id string, path string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) {
  282. var _p0 *uint16
  283. _p0, hr = syscall.UTF16PtrFromString(id)
  284. if hr != nil {
  285. return
  286. }
  287. var _p1 *uint16
  288. _p1, hr = syscall.UTF16PtrFromString(path)
  289. if hr != nil {
  290. return
  291. }
  292. return _importLayer(info, _p0, _p1, descriptors)
  293. }
  294. func _importLayer(info *driverInfo, id *uint16, path *uint16, descriptors []WC_LAYER_DESCRIPTOR) (hr error) {
  295. var _p2 *WC_LAYER_DESCRIPTOR
  296. if len(descriptors) > 0 {
  297. _p2 = &descriptors[0]
  298. }
  299. if hr = procImportLayer.Find(); hr != nil {
  300. return
  301. }
  302. r0, _, _ := syscall.Syscall6(procImportLayer.Addr(), 5, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(_p2)), uintptr(len(descriptors)), 0)
  303. if int32(r0) < 0 {
  304. if r0&0x1fff0000 == 0x00070000 {
  305. r0 &= 0xffff
  306. }
  307. hr = syscall.Errno(r0)
  308. }
  309. return
  310. }
  311. func layerExists(info *driverInfo, id string, exists *uint32) (hr error) {
  312. var _p0 *uint16
  313. _p0, hr = syscall.UTF16PtrFromString(id)
  314. if hr != nil {
  315. return
  316. }
  317. return _layerExists(info, _p0, exists)
  318. }
  319. func _layerExists(info *driverInfo, id *uint16, exists *uint32) (hr error) {
  320. if hr = procLayerExists.Find(); hr != nil {
  321. return
  322. }
  323. r0, _, _ := syscall.Syscall(procLayerExists.Addr(), 3, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(exists)))
  324. if int32(r0) < 0 {
  325. if r0&0x1fff0000 == 0x00070000 {
  326. r0 &= 0xffff
  327. }
  328. hr = syscall.Errno(r0)
  329. }
  330. return
  331. }
  332. func nameToGuid(name string, guid *_guid) (hr error) {
  333. var _p0 *uint16
  334. _p0, hr = syscall.UTF16PtrFromString(name)
  335. if hr != nil {
  336. return
  337. }
  338. return _nameToGuid(_p0, guid)
  339. }
  340. func _nameToGuid(name *uint16, guid *_guid) (hr error) {
  341. if hr = procNameToGuid.Find(); hr != nil {
  342. return
  343. }
  344. r0, _, _ := syscall.Syscall(procNameToGuid.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(guid)), 0)
  345. if int32(r0) < 0 {
  346. if r0&0x1fff0000 == 0x00070000 {
  347. r0 &= 0xffff
  348. }
  349. hr = syscall.Errno(r0)
  350. }
  351. return
  352. }
  353. func prepareLayer(info *driverInfo, id string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) {
  354. var _p0 *uint16
  355. _p0, hr = syscall.UTF16PtrFromString(id)
  356. if hr != nil {
  357. return
  358. }
  359. return _prepareLayer(info, _p0, descriptors)
  360. }
  361. func _prepareLayer(info *driverInfo, id *uint16, descriptors []WC_LAYER_DESCRIPTOR) (hr error) {
  362. var _p1 *WC_LAYER_DESCRIPTOR
  363. if len(descriptors) > 0 {
  364. _p1 = &descriptors[0]
  365. }
  366. if hr = procPrepareLayer.Find(); hr != nil {
  367. return
  368. }
  369. r0, _, _ := syscall.Syscall6(procPrepareLayer.Addr(), 4, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(_p1)), uintptr(len(descriptors)), 0, 0)
  370. if int32(r0) < 0 {
  371. if r0&0x1fff0000 == 0x00070000 {
  372. r0 &= 0xffff
  373. }
  374. hr = syscall.Errno(r0)
  375. }
  376. return
  377. }
  378. func unprepareLayer(info *driverInfo, id string) (hr error) {
  379. var _p0 *uint16
  380. _p0, hr = syscall.UTF16PtrFromString(id)
  381. if hr != nil {
  382. return
  383. }
  384. return _unprepareLayer(info, _p0)
  385. }
  386. func _unprepareLayer(info *driverInfo, id *uint16) (hr error) {
  387. if hr = procUnprepareLayer.Find(); hr != nil {
  388. return
  389. }
  390. r0, _, _ := syscall.Syscall(procUnprepareLayer.Addr(), 2, uintptr(unsafe.Pointer(info)), uintptr(unsafe.Pointer(id)), 0)
  391. if int32(r0) < 0 {
  392. if r0&0x1fff0000 == 0x00070000 {
  393. r0 &= 0xffff
  394. }
  395. hr = syscall.Errno(r0)
  396. }
  397. return
  398. }
  399. func processBaseImage(path string) (hr error) {
  400. var _p0 *uint16
  401. _p0, hr = syscall.UTF16PtrFromString(path)
  402. if hr != nil {
  403. return
  404. }
  405. return _processBaseImage(_p0)
  406. }
  407. func _processBaseImage(path *uint16) (hr error) {
  408. if hr = procProcessBaseImage.Find(); hr != nil {
  409. return
  410. }
  411. r0, _, _ := syscall.Syscall(procProcessBaseImage.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
  412. if int32(r0) < 0 {
  413. if r0&0x1fff0000 == 0x00070000 {
  414. r0 &= 0xffff
  415. }
  416. hr = syscall.Errno(r0)
  417. }
  418. return
  419. }
  420. func processUtilityImage(path string) (hr error) {
  421. var _p0 *uint16
  422. _p0, hr = syscall.UTF16PtrFromString(path)
  423. if hr != nil {
  424. return
  425. }
  426. return _processUtilityImage(_p0)
  427. }
  428. func _processUtilityImage(path *uint16) (hr error) {
  429. if hr = procProcessUtilityImage.Find(); hr != nil {
  430. return
  431. }
  432. r0, _, _ := syscall.Syscall(procProcessUtilityImage.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
  433. if int32(r0) < 0 {
  434. if r0&0x1fff0000 == 0x00070000 {
  435. r0 &= 0xffff
  436. }
  437. hr = syscall.Errno(r0)
  438. }
  439. return
  440. }
  441. func grantVmAccess(vmid string, filepath string) (hr error) {
  442. var _p0 *uint16
  443. _p0, hr = syscall.UTF16PtrFromString(vmid)
  444. if hr != nil {
  445. return
  446. }
  447. var _p1 *uint16
  448. _p1, hr = syscall.UTF16PtrFromString(filepath)
  449. if hr != nil {
  450. return
  451. }
  452. return _grantVmAccess(_p0, _p1)
  453. }
  454. func _grantVmAccess(vmid *uint16, filepath *uint16) (hr error) {
  455. if hr = procGrantVmAccess.Find(); hr != nil {
  456. return
  457. }
  458. r0, _, _ := syscall.Syscall(procGrantVmAccess.Addr(), 2, uintptr(unsafe.Pointer(vmid)), uintptr(unsafe.Pointer(filepath)), 0)
  459. if int32(r0) < 0 {
  460. if r0&0x1fff0000 == 0x00070000 {
  461. r0 &= 0xffff
  462. }
  463. hr = syscall.Errno(r0)
  464. }
  465. return
  466. }