1// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT 2 3package hcs 4 5import ( 6 "syscall" 7 "unsafe" 8 9 "github.com/Microsoft/hcsshim/internal/interop" 10 "golang.org/x/sys/windows" 11) 12 13var _ unsafe.Pointer 14 15// Do the interface allocations only once for common 16// Errno values. 17const ( 18 errnoERROR_IO_PENDING = 997 19) 20 21var ( 22 errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) 23) 24 25// errnoErr returns common boxed Errno values, to prevent 26// allocations at runtime. 27func errnoErr(e syscall.Errno) error { 28 switch e { 29 case 0: 30 return nil 31 case errnoERROR_IO_PENDING: 32 return errERROR_IO_PENDING 33 } 34 // TODO: add more here, after collecting data on the common 35 // error values see on Windows. (perhaps when running 36 // all.bat?) 37 return e 38} 39 40var ( 41 modvmcompute = windows.NewLazySystemDLL("vmcompute.dll") 42 43 procHcsEnumerateComputeSystems = modvmcompute.NewProc("HcsEnumerateComputeSystems") 44 procHcsCreateComputeSystem = modvmcompute.NewProc("HcsCreateComputeSystem") 45 procHcsOpenComputeSystem = modvmcompute.NewProc("HcsOpenComputeSystem") 46 procHcsCloseComputeSystem = modvmcompute.NewProc("HcsCloseComputeSystem") 47 procHcsStartComputeSystem = modvmcompute.NewProc("HcsStartComputeSystem") 48 procHcsShutdownComputeSystem = modvmcompute.NewProc("HcsShutdownComputeSystem") 49 procHcsTerminateComputeSystem = modvmcompute.NewProc("HcsTerminateComputeSystem") 50 procHcsPauseComputeSystem = modvmcompute.NewProc("HcsPauseComputeSystem") 51 procHcsResumeComputeSystem = modvmcompute.NewProc("HcsResumeComputeSystem") 52 procHcsGetComputeSystemProperties = modvmcompute.NewProc("HcsGetComputeSystemProperties") 53 procHcsModifyComputeSystem = modvmcompute.NewProc("HcsModifyComputeSystem") 54 procHcsRegisterComputeSystemCallback = modvmcompute.NewProc("HcsRegisterComputeSystemCallback") 55 procHcsUnregisterComputeSystemCallback = modvmcompute.NewProc("HcsUnregisterComputeSystemCallback") 56 procHcsCreateProcess = modvmcompute.NewProc("HcsCreateProcess") 57 procHcsOpenProcess = modvmcompute.NewProc("HcsOpenProcess") 58 procHcsCloseProcess = modvmcompute.NewProc("HcsCloseProcess") 59 procHcsTerminateProcess = modvmcompute.NewProc("HcsTerminateProcess") 60 procHcsGetProcessInfo = modvmcompute.NewProc("HcsGetProcessInfo") 61 procHcsGetProcessProperties = modvmcompute.NewProc("HcsGetProcessProperties") 62 procHcsModifyProcess = modvmcompute.NewProc("HcsModifyProcess") 63 procHcsGetServiceProperties = modvmcompute.NewProc("HcsGetServiceProperties") 64 procHcsRegisterProcessCallback = modvmcompute.NewProc("HcsRegisterProcessCallback") 65 procHcsUnregisterProcessCallback = modvmcompute.NewProc("HcsUnregisterProcessCallback") 66) 67 68func hcsEnumerateComputeSystems(query string, computeSystems **uint16, result **uint16) (hr error) { 69 var _p0 *uint16 70 _p0, hr = syscall.UTF16PtrFromString(query) 71 if hr != nil { 72 return 73 } 74 return _hcsEnumerateComputeSystems(_p0, computeSystems, result) 75} 76 77func _hcsEnumerateComputeSystems(query *uint16, computeSystems **uint16, result **uint16) (hr error) { 78 if hr = procHcsEnumerateComputeSystems.Find(); hr != nil { 79 return 80 } 81 r0, _, _ := syscall.Syscall(procHcsEnumerateComputeSystems.Addr(), 3, uintptr(unsafe.Pointer(query)), uintptr(unsafe.Pointer(computeSystems)), uintptr(unsafe.Pointer(result))) 82 if int32(r0) < 0 { 83 hr = interop.Win32FromHresult(r0) 84 } 85 return 86} 87 88func hcsCreateComputeSystem(id string, configuration string, identity syscall.Handle, computeSystem *hcsSystem, result **uint16) (hr error) { 89 var _p0 *uint16 90 _p0, hr = syscall.UTF16PtrFromString(id) 91 if hr != nil { 92 return 93 } 94 var _p1 *uint16 95 _p1, hr = syscall.UTF16PtrFromString(configuration) 96 if hr != nil { 97 return 98 } 99 return _hcsCreateComputeSystem(_p0, _p1, identity, computeSystem, result) 100} 101 102func _hcsCreateComputeSystem(id *uint16, configuration *uint16, identity syscall.Handle, computeSystem *hcsSystem, result **uint16) (hr error) { 103 if hr = procHcsCreateComputeSystem.Find(); hr != nil { 104 return 105 } 106 r0, _, _ := syscall.Syscall6(procHcsCreateComputeSystem.Addr(), 5, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(configuration)), uintptr(identity), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result)), 0) 107 if int32(r0) < 0 { 108 hr = interop.Win32FromHresult(r0) 109 } 110 return 111} 112 113func hcsOpenComputeSystem(id string, computeSystem *hcsSystem, result **uint16) (hr error) { 114 var _p0 *uint16 115 _p0, hr = syscall.UTF16PtrFromString(id) 116 if hr != nil { 117 return 118 } 119 return _hcsOpenComputeSystem(_p0, computeSystem, result) 120} 121 122func _hcsOpenComputeSystem(id *uint16, computeSystem *hcsSystem, result **uint16) (hr error) { 123 if hr = procHcsOpenComputeSystem.Find(); hr != nil { 124 return 125 } 126 r0, _, _ := syscall.Syscall(procHcsOpenComputeSystem.Addr(), 3, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result))) 127 if int32(r0) < 0 { 128 hr = interop.Win32FromHresult(r0) 129 } 130 return 131} 132 133func hcsCloseComputeSystem(computeSystem hcsSystem) (hr error) { 134 if hr = procHcsCloseComputeSystem.Find(); hr != nil { 135 return 136 } 137 r0, _, _ := syscall.Syscall(procHcsCloseComputeSystem.Addr(), 1, uintptr(computeSystem), 0, 0) 138 if int32(r0) < 0 { 139 hr = interop.Win32FromHresult(r0) 140 } 141 return 142} 143 144func hcsStartComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) { 145 var _p0 *uint16 146 _p0, hr = syscall.UTF16PtrFromString(options) 147 if hr != nil { 148 return 149 } 150 return _hcsStartComputeSystem(computeSystem, _p0, result) 151} 152 153func _hcsStartComputeSystem(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) { 154 if hr = procHcsStartComputeSystem.Find(); hr != nil { 155 return 156 } 157 r0, _, _ := syscall.Syscall(procHcsStartComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) 158 if int32(r0) < 0 { 159 hr = interop.Win32FromHresult(r0) 160 } 161 return 162} 163 164func hcsShutdownComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) { 165 var _p0 *uint16 166 _p0, hr = syscall.UTF16PtrFromString(options) 167 if hr != nil { 168 return 169 } 170 return _hcsShutdownComputeSystem(computeSystem, _p0, result) 171} 172 173func _hcsShutdownComputeSystem(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) { 174 if hr = procHcsShutdownComputeSystem.Find(); hr != nil { 175 return 176 } 177 r0, _, _ := syscall.Syscall(procHcsShutdownComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) 178 if int32(r0) < 0 { 179 hr = interop.Win32FromHresult(r0) 180 } 181 return 182} 183 184func hcsTerminateComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) { 185 var _p0 *uint16 186 _p0, hr = syscall.UTF16PtrFromString(options) 187 if hr != nil { 188 return 189 } 190 return _hcsTerminateComputeSystem(computeSystem, _p0, result) 191} 192 193func _hcsTerminateComputeSystem(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) { 194 if hr = procHcsTerminateComputeSystem.Find(); hr != nil { 195 return 196 } 197 r0, _, _ := syscall.Syscall(procHcsTerminateComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) 198 if int32(r0) < 0 { 199 hr = interop.Win32FromHresult(r0) 200 } 201 return 202} 203 204func hcsPauseComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) { 205 var _p0 *uint16 206 _p0, hr = syscall.UTF16PtrFromString(options) 207 if hr != nil { 208 return 209 } 210 return _hcsPauseComputeSystem(computeSystem, _p0, result) 211} 212 213func _hcsPauseComputeSystem(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) { 214 if hr = procHcsPauseComputeSystem.Find(); hr != nil { 215 return 216 } 217 r0, _, _ := syscall.Syscall(procHcsPauseComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) 218 if int32(r0) < 0 { 219 hr = interop.Win32FromHresult(r0) 220 } 221 return 222} 223 224func hcsResumeComputeSystem(computeSystem hcsSystem, options string, result **uint16) (hr error) { 225 var _p0 *uint16 226 _p0, hr = syscall.UTF16PtrFromString(options) 227 if hr != nil { 228 return 229 } 230 return _hcsResumeComputeSystem(computeSystem, _p0, result) 231} 232 233func _hcsResumeComputeSystem(computeSystem hcsSystem, options *uint16, result **uint16) (hr error) { 234 if hr = procHcsResumeComputeSystem.Find(); hr != nil { 235 return 236 } 237 r0, _, _ := syscall.Syscall(procHcsResumeComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result))) 238 if int32(r0) < 0 { 239 hr = interop.Win32FromHresult(r0) 240 } 241 return 242} 243 244func hcsGetComputeSystemProperties(computeSystem hcsSystem, propertyQuery string, properties **uint16, result **uint16) (hr error) { 245 var _p0 *uint16 246 _p0, hr = syscall.UTF16PtrFromString(propertyQuery) 247 if hr != nil { 248 return 249 } 250 return _hcsGetComputeSystemProperties(computeSystem, _p0, properties, result) 251} 252 253func _hcsGetComputeSystemProperties(computeSystem hcsSystem, propertyQuery *uint16, properties **uint16, result **uint16) (hr error) { 254 if hr = procHcsGetComputeSystemProperties.Find(); hr != nil { 255 return 256 } 257 r0, _, _ := syscall.Syscall6(procHcsGetComputeSystemProperties.Addr(), 4, uintptr(computeSystem), uintptr(unsafe.Pointer(propertyQuery)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result)), 0, 0) 258 if int32(r0) < 0 { 259 hr = interop.Win32FromHresult(r0) 260 } 261 return 262} 263 264func hcsModifyComputeSystem(computeSystem hcsSystem, configuration string, result **uint16) (hr error) { 265 var _p0 *uint16 266 _p0, hr = syscall.UTF16PtrFromString(configuration) 267 if hr != nil { 268 return 269 } 270 return _hcsModifyComputeSystem(computeSystem, _p0, result) 271} 272 273func _hcsModifyComputeSystem(computeSystem hcsSystem, configuration *uint16, result **uint16) (hr error) { 274 if hr = procHcsModifyComputeSystem.Find(); hr != nil { 275 return 276 } 277 r0, _, _ := syscall.Syscall(procHcsModifyComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(configuration)), uintptr(unsafe.Pointer(result))) 278 if int32(r0) < 0 { 279 hr = interop.Win32FromHresult(r0) 280 } 281 return 282} 283 284func hcsRegisterComputeSystemCallback(computeSystem hcsSystem, callback uintptr, context uintptr, callbackHandle *hcsCallback) (hr error) { 285 if hr = procHcsRegisterComputeSystemCallback.Find(); hr != nil { 286 return 287 } 288 r0, _, _ := syscall.Syscall6(procHcsRegisterComputeSystemCallback.Addr(), 4, uintptr(computeSystem), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0) 289 if int32(r0) < 0 { 290 hr = interop.Win32FromHresult(r0) 291 } 292 return 293} 294 295func hcsUnregisterComputeSystemCallback(callbackHandle hcsCallback) (hr error) { 296 if hr = procHcsUnregisterComputeSystemCallback.Find(); hr != nil { 297 return 298 } 299 r0, _, _ := syscall.Syscall(procHcsUnregisterComputeSystemCallback.Addr(), 1, uintptr(callbackHandle), 0, 0) 300 if int32(r0) < 0 { 301 hr = interop.Win32FromHresult(r0) 302 } 303 return 304} 305 306func hcsCreateProcess(computeSystem hcsSystem, processParameters string, processInformation *hcsProcessInformation, process *hcsProcess, result **uint16) (hr error) { 307 var _p0 *uint16 308 _p0, hr = syscall.UTF16PtrFromString(processParameters) 309 if hr != nil { 310 return 311 } 312 return _hcsCreateProcess(computeSystem, _p0, processInformation, process, result) 313} 314 315func _hcsCreateProcess(computeSystem hcsSystem, processParameters *uint16, processInformation *hcsProcessInformation, process *hcsProcess, result **uint16) (hr error) { 316 if hr = procHcsCreateProcess.Find(); hr != nil { 317 return 318 } 319 r0, _, _ := syscall.Syscall6(procHcsCreateProcess.Addr(), 5, uintptr(computeSystem), uintptr(unsafe.Pointer(processParameters)), uintptr(unsafe.Pointer(processInformation)), uintptr(unsafe.Pointer(process)), uintptr(unsafe.Pointer(result)), 0) 320 if int32(r0) < 0 { 321 hr = interop.Win32FromHresult(r0) 322 } 323 return 324} 325 326func hcsOpenProcess(computeSystem hcsSystem, pid uint32, process *hcsProcess, result **uint16) (hr error) { 327 if hr = procHcsOpenProcess.Find(); hr != nil { 328 return 329 } 330 r0, _, _ := syscall.Syscall6(procHcsOpenProcess.Addr(), 4, uintptr(computeSystem), uintptr(pid), uintptr(unsafe.Pointer(process)), uintptr(unsafe.Pointer(result)), 0, 0) 331 if int32(r0) < 0 { 332 hr = interop.Win32FromHresult(r0) 333 } 334 return 335} 336 337func hcsCloseProcess(process hcsProcess) (hr error) { 338 if hr = procHcsCloseProcess.Find(); hr != nil { 339 return 340 } 341 r0, _, _ := syscall.Syscall(procHcsCloseProcess.Addr(), 1, uintptr(process), 0, 0) 342 if int32(r0) < 0 { 343 hr = interop.Win32FromHresult(r0) 344 } 345 return 346} 347 348func hcsTerminateProcess(process hcsProcess, result **uint16) (hr error) { 349 if hr = procHcsTerminateProcess.Find(); hr != nil { 350 return 351 } 352 r0, _, _ := syscall.Syscall(procHcsTerminateProcess.Addr(), 2, uintptr(process), uintptr(unsafe.Pointer(result)), 0) 353 if int32(r0) < 0 { 354 hr = interop.Win32FromHresult(r0) 355 } 356 return 357} 358 359func hcsGetProcessInfo(process hcsProcess, processInformation *hcsProcessInformation, result **uint16) (hr error) { 360 if hr = procHcsGetProcessInfo.Find(); hr != nil { 361 return 362 } 363 r0, _, _ := syscall.Syscall(procHcsGetProcessInfo.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(processInformation)), uintptr(unsafe.Pointer(result))) 364 if int32(r0) < 0 { 365 hr = interop.Win32FromHresult(r0) 366 } 367 return 368} 369 370func hcsGetProcessProperties(process hcsProcess, processProperties **uint16, result **uint16) (hr error) { 371 if hr = procHcsGetProcessProperties.Find(); hr != nil { 372 return 373 } 374 r0, _, _ := syscall.Syscall(procHcsGetProcessProperties.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(processProperties)), uintptr(unsafe.Pointer(result))) 375 if int32(r0) < 0 { 376 hr = interop.Win32FromHresult(r0) 377 } 378 return 379} 380 381func hcsModifyProcess(process hcsProcess, settings string, result **uint16) (hr error) { 382 var _p0 *uint16 383 _p0, hr = syscall.UTF16PtrFromString(settings) 384 if hr != nil { 385 return 386 } 387 return _hcsModifyProcess(process, _p0, result) 388} 389 390func _hcsModifyProcess(process hcsProcess, settings *uint16, result **uint16) (hr error) { 391 if hr = procHcsModifyProcess.Find(); hr != nil { 392 return 393 } 394 r0, _, _ := syscall.Syscall(procHcsModifyProcess.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(settings)), uintptr(unsafe.Pointer(result))) 395 if int32(r0) < 0 { 396 hr = interop.Win32FromHresult(r0) 397 } 398 return 399} 400 401func hcsGetServiceProperties(propertyQuery string, properties **uint16, result **uint16) (hr error) { 402 var _p0 *uint16 403 _p0, hr = syscall.UTF16PtrFromString(propertyQuery) 404 if hr != nil { 405 return 406 } 407 return _hcsGetServiceProperties(_p0, properties, result) 408} 409 410func _hcsGetServiceProperties(propertyQuery *uint16, properties **uint16, result **uint16) (hr error) { 411 if hr = procHcsGetServiceProperties.Find(); hr != nil { 412 return 413 } 414 r0, _, _ := syscall.Syscall(procHcsGetServiceProperties.Addr(), 3, uintptr(unsafe.Pointer(propertyQuery)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result))) 415 if int32(r0) < 0 { 416 hr = interop.Win32FromHresult(r0) 417 } 418 return 419} 420 421func hcsRegisterProcessCallback(process hcsProcess, callback uintptr, context uintptr, callbackHandle *hcsCallback) (hr error) { 422 if hr = procHcsRegisterProcessCallback.Find(); hr != nil { 423 return 424 } 425 r0, _, _ := syscall.Syscall6(procHcsRegisterProcessCallback.Addr(), 4, uintptr(process), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0) 426 if int32(r0) < 0 { 427 hr = interop.Win32FromHresult(r0) 428 } 429 return 430} 431 432func hcsUnregisterProcessCallback(callbackHandle hcsCallback) (hr error) { 433 if hr = procHcsUnregisterProcessCallback.Find(); hr != nil { 434 return 435 } 436 r0, _, _ := syscall.Syscall(procHcsUnregisterProcessCallback.Addr(), 1, uintptr(callbackHandle), 0, 0) 437 if int32(r0) < 0 { 438 hr = interop.Win32FromHresult(r0) 439 } 440 return 441} 442