zsyscall_windows.go 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. //go:build windows
  2. // Code generated by 'go generate' using "github.com/Microsoft/go-winio/tools/mkwinsyscall"; DO NOT EDIT.
  3. package computestorage
  4. import (
  5. "syscall"
  6. "unsafe"
  7. "golang.org/x/sys/windows"
  8. )
  9. var _ unsafe.Pointer
  10. // Do the interface allocations only once for common
  11. // Errno values.
  12. const (
  13. errnoERROR_IO_PENDING = 997
  14. )
  15. var (
  16. errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
  17. errERROR_EINVAL error = syscall.EINVAL
  18. )
  19. // errnoErr returns common boxed Errno values, to prevent
  20. // allocations at runtime.
  21. func errnoErr(e syscall.Errno) error {
  22. switch e {
  23. case 0:
  24. return errERROR_EINVAL
  25. case errnoERROR_IO_PENDING:
  26. return errERROR_IO_PENDING
  27. }
  28. // TODO: add more here, after collecting data on the common
  29. // error values see on Windows. (perhaps when running
  30. // all.bat?)
  31. return e
  32. }
  33. var (
  34. modcomputestorage = windows.NewLazySystemDLL("computestorage.dll")
  35. procHcsAttachLayerStorageFilter = modcomputestorage.NewProc("HcsAttachLayerStorageFilter")
  36. procHcsDestoryLayer = modcomputestorage.NewProc("HcsDestoryLayer")
  37. procHcsDetachLayerStorageFilter = modcomputestorage.NewProc("HcsDetachLayerStorageFilter")
  38. procHcsExportLayer = modcomputestorage.NewProc("HcsExportLayer")
  39. procHcsFormatWritableLayerVhd = modcomputestorage.NewProc("HcsFormatWritableLayerVhd")
  40. procHcsGetLayerVhdMountPath = modcomputestorage.NewProc("HcsGetLayerVhdMountPath")
  41. procHcsImportLayer = modcomputestorage.NewProc("HcsImportLayer")
  42. procHcsInitializeWritableLayer = modcomputestorage.NewProc("HcsInitializeWritableLayer")
  43. procHcsSetupBaseOSLayer = modcomputestorage.NewProc("HcsSetupBaseOSLayer")
  44. procHcsSetupBaseOSVolume = modcomputestorage.NewProc("HcsSetupBaseOSVolume")
  45. )
  46. func hcsAttachLayerStorageFilter(layerPath string, layerData string) (hr error) {
  47. var _p0 *uint16
  48. _p0, hr = syscall.UTF16PtrFromString(layerPath)
  49. if hr != nil {
  50. return
  51. }
  52. var _p1 *uint16
  53. _p1, hr = syscall.UTF16PtrFromString(layerData)
  54. if hr != nil {
  55. return
  56. }
  57. return _hcsAttachLayerStorageFilter(_p0, _p1)
  58. }
  59. func _hcsAttachLayerStorageFilter(layerPath *uint16, layerData *uint16) (hr error) {
  60. hr = procHcsAttachLayerStorageFilter.Find()
  61. if hr != nil {
  62. return
  63. }
  64. r0, _, _ := syscall.Syscall(procHcsAttachLayerStorageFilter.Addr(), 2, uintptr(unsafe.Pointer(layerPath)), uintptr(unsafe.Pointer(layerData)), 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 hcsDestroyLayer(layerPath string) (hr error) {
  74. var _p0 *uint16
  75. _p0, hr = syscall.UTF16PtrFromString(layerPath)
  76. if hr != nil {
  77. return
  78. }
  79. return _hcsDestroyLayer(_p0)
  80. }
  81. func _hcsDestroyLayer(layerPath *uint16) (hr error) {
  82. hr = procHcsDestoryLayer.Find()
  83. if hr != nil {
  84. return
  85. }
  86. r0, _, _ := syscall.Syscall(procHcsDestoryLayer.Addr(), 1, uintptr(unsafe.Pointer(layerPath)), 0, 0)
  87. if int32(r0) < 0 {
  88. if r0&0x1fff0000 == 0x00070000 {
  89. r0 &= 0xffff
  90. }
  91. hr = syscall.Errno(r0)
  92. }
  93. return
  94. }
  95. func hcsDetachLayerStorageFilter(layerPath string) (hr error) {
  96. var _p0 *uint16
  97. _p0, hr = syscall.UTF16PtrFromString(layerPath)
  98. if hr != nil {
  99. return
  100. }
  101. return _hcsDetachLayerStorageFilter(_p0)
  102. }
  103. func _hcsDetachLayerStorageFilter(layerPath *uint16) (hr error) {
  104. hr = procHcsDetachLayerStorageFilter.Find()
  105. if hr != nil {
  106. return
  107. }
  108. r0, _, _ := syscall.Syscall(procHcsDetachLayerStorageFilter.Addr(), 1, uintptr(unsafe.Pointer(layerPath)), 0, 0)
  109. if int32(r0) < 0 {
  110. if r0&0x1fff0000 == 0x00070000 {
  111. r0 &= 0xffff
  112. }
  113. hr = syscall.Errno(r0)
  114. }
  115. return
  116. }
  117. func hcsExportLayer(layerPath string, exportFolderPath string, layerData string, options string) (hr error) {
  118. var _p0 *uint16
  119. _p0, hr = syscall.UTF16PtrFromString(layerPath)
  120. if hr != nil {
  121. return
  122. }
  123. var _p1 *uint16
  124. _p1, hr = syscall.UTF16PtrFromString(exportFolderPath)
  125. if hr != nil {
  126. return
  127. }
  128. var _p2 *uint16
  129. _p2, hr = syscall.UTF16PtrFromString(layerData)
  130. if hr != nil {
  131. return
  132. }
  133. var _p3 *uint16
  134. _p3, hr = syscall.UTF16PtrFromString(options)
  135. if hr != nil {
  136. return
  137. }
  138. return _hcsExportLayer(_p0, _p1, _p2, _p3)
  139. }
  140. func _hcsExportLayer(layerPath *uint16, exportFolderPath *uint16, layerData *uint16, options *uint16) (hr error) {
  141. hr = procHcsExportLayer.Find()
  142. if hr != nil {
  143. return
  144. }
  145. r0, _, _ := syscall.Syscall6(procHcsExportLayer.Addr(), 4, uintptr(unsafe.Pointer(layerPath)), uintptr(unsafe.Pointer(exportFolderPath)), uintptr(unsafe.Pointer(layerData)), uintptr(unsafe.Pointer(options)), 0, 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 hcsFormatWritableLayerVhd(handle windows.Handle) (hr error) {
  155. hr = procHcsFormatWritableLayerVhd.Find()
  156. if hr != nil {
  157. return
  158. }
  159. r0, _, _ := syscall.Syscall(procHcsFormatWritableLayerVhd.Addr(), 1, uintptr(handle), 0, 0)
  160. if int32(r0) < 0 {
  161. if r0&0x1fff0000 == 0x00070000 {
  162. r0 &= 0xffff
  163. }
  164. hr = syscall.Errno(r0)
  165. }
  166. return
  167. }
  168. func hcsGetLayerVhdMountPath(vhdHandle windows.Handle, mountPath **uint16) (hr error) {
  169. hr = procHcsGetLayerVhdMountPath.Find()
  170. if hr != nil {
  171. return
  172. }
  173. r0, _, _ := syscall.Syscall(procHcsGetLayerVhdMountPath.Addr(), 2, uintptr(vhdHandle), uintptr(unsafe.Pointer(mountPath)), 0)
  174. if int32(r0) < 0 {
  175. if r0&0x1fff0000 == 0x00070000 {
  176. r0 &= 0xffff
  177. }
  178. hr = syscall.Errno(r0)
  179. }
  180. return
  181. }
  182. func hcsImportLayer(layerPath string, sourceFolderPath string, layerData string) (hr error) {
  183. var _p0 *uint16
  184. _p0, hr = syscall.UTF16PtrFromString(layerPath)
  185. if hr != nil {
  186. return
  187. }
  188. var _p1 *uint16
  189. _p1, hr = syscall.UTF16PtrFromString(sourceFolderPath)
  190. if hr != nil {
  191. return
  192. }
  193. var _p2 *uint16
  194. _p2, hr = syscall.UTF16PtrFromString(layerData)
  195. if hr != nil {
  196. return
  197. }
  198. return _hcsImportLayer(_p0, _p1, _p2)
  199. }
  200. func _hcsImportLayer(layerPath *uint16, sourceFolderPath *uint16, layerData *uint16) (hr error) {
  201. hr = procHcsImportLayer.Find()
  202. if hr != nil {
  203. return
  204. }
  205. r0, _, _ := syscall.Syscall(procHcsImportLayer.Addr(), 3, uintptr(unsafe.Pointer(layerPath)), uintptr(unsafe.Pointer(sourceFolderPath)), uintptr(unsafe.Pointer(layerData)))
  206. if int32(r0) < 0 {
  207. if r0&0x1fff0000 == 0x00070000 {
  208. r0 &= 0xffff
  209. }
  210. hr = syscall.Errno(r0)
  211. }
  212. return
  213. }
  214. func hcsInitializeWritableLayer(writableLayerPath string, layerData string, options string) (hr error) {
  215. var _p0 *uint16
  216. _p0, hr = syscall.UTF16PtrFromString(writableLayerPath)
  217. if hr != nil {
  218. return
  219. }
  220. var _p1 *uint16
  221. _p1, hr = syscall.UTF16PtrFromString(layerData)
  222. if hr != nil {
  223. return
  224. }
  225. var _p2 *uint16
  226. _p2, hr = syscall.UTF16PtrFromString(options)
  227. if hr != nil {
  228. return
  229. }
  230. return _hcsInitializeWritableLayer(_p0, _p1, _p2)
  231. }
  232. func _hcsInitializeWritableLayer(writableLayerPath *uint16, layerData *uint16, options *uint16) (hr error) {
  233. hr = procHcsInitializeWritableLayer.Find()
  234. if hr != nil {
  235. return
  236. }
  237. r0, _, _ := syscall.Syscall(procHcsInitializeWritableLayer.Addr(), 3, uintptr(unsafe.Pointer(writableLayerPath)), uintptr(unsafe.Pointer(layerData)), uintptr(unsafe.Pointer(options)))
  238. if int32(r0) < 0 {
  239. if r0&0x1fff0000 == 0x00070000 {
  240. r0 &= 0xffff
  241. }
  242. hr = syscall.Errno(r0)
  243. }
  244. return
  245. }
  246. func hcsSetupBaseOSLayer(layerPath string, handle windows.Handle, options string) (hr error) {
  247. var _p0 *uint16
  248. _p0, hr = syscall.UTF16PtrFromString(layerPath)
  249. if hr != nil {
  250. return
  251. }
  252. var _p1 *uint16
  253. _p1, hr = syscall.UTF16PtrFromString(options)
  254. if hr != nil {
  255. return
  256. }
  257. return _hcsSetupBaseOSLayer(_p0, handle, _p1)
  258. }
  259. func _hcsSetupBaseOSLayer(layerPath *uint16, handle windows.Handle, options *uint16) (hr error) {
  260. hr = procHcsSetupBaseOSLayer.Find()
  261. if hr != nil {
  262. return
  263. }
  264. r0, _, _ := syscall.Syscall(procHcsSetupBaseOSLayer.Addr(), 3, uintptr(unsafe.Pointer(layerPath)), uintptr(handle), uintptr(unsafe.Pointer(options)))
  265. if int32(r0) < 0 {
  266. if r0&0x1fff0000 == 0x00070000 {
  267. r0 &= 0xffff
  268. }
  269. hr = syscall.Errno(r0)
  270. }
  271. return
  272. }
  273. func hcsSetupBaseOSVolume(layerPath string, volumePath string, options string) (hr error) {
  274. var _p0 *uint16
  275. _p0, hr = syscall.UTF16PtrFromString(layerPath)
  276. if hr != nil {
  277. return
  278. }
  279. var _p1 *uint16
  280. _p1, hr = syscall.UTF16PtrFromString(volumePath)
  281. if hr != nil {
  282. return
  283. }
  284. var _p2 *uint16
  285. _p2, hr = syscall.UTF16PtrFromString(options)
  286. if hr != nil {
  287. return
  288. }
  289. return _hcsSetupBaseOSVolume(_p0, _p1, _p2)
  290. }
  291. func _hcsSetupBaseOSVolume(layerPath *uint16, volumePath *uint16, options *uint16) (hr error) {
  292. hr = procHcsSetupBaseOSVolume.Find()
  293. if hr != nil {
  294. return
  295. }
  296. r0, _, _ := syscall.Syscall(procHcsSetupBaseOSVolume.Addr(), 3, uintptr(unsafe.Pointer(layerPath)), uintptr(unsafe.Pointer(volumePath)), uintptr(unsafe.Pointer(options)))
  297. if int32(r0) < 0 {
  298. if r0&0x1fff0000 == 0x00070000 {
  299. r0 &= 0xffff
  300. }
  301. hr = syscall.Errno(r0)
  302. }
  303. return
  304. }