zsyscall_windows.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //go:build windows
  2. // Code generated by 'go generate' using "github.com/Microsoft/go-winio/tools/mkwinsyscall"; DO NOT EDIT.
  3. package hns
  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. modvmcompute = windows.NewLazySystemDLL("vmcompute.dll")
  35. procHNSCall = modvmcompute.NewProc("HNSCall")
  36. )
  37. func _hnsCall(method string, path string, object string, response **uint16) (hr error) {
  38. var _p0 *uint16
  39. _p0, hr = syscall.UTF16PtrFromString(method)
  40. if hr != nil {
  41. return
  42. }
  43. var _p1 *uint16
  44. _p1, hr = syscall.UTF16PtrFromString(path)
  45. if hr != nil {
  46. return
  47. }
  48. var _p2 *uint16
  49. _p2, hr = syscall.UTF16PtrFromString(object)
  50. if hr != nil {
  51. return
  52. }
  53. return __hnsCall(_p0, _p1, _p2, response)
  54. }
  55. func __hnsCall(method *uint16, path *uint16, object *uint16, response **uint16) (hr error) {
  56. hr = procHNSCall.Find()
  57. if hr != nil {
  58. return
  59. }
  60. r0, _, _ := syscall.Syscall6(procHNSCall.Addr(), 4, uintptr(unsafe.Pointer(method)), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(object)), uintptr(unsafe.Pointer(response)), 0, 0)
  61. if int32(r0) < 0 {
  62. if r0&0x1fff0000 == 0x00070000 {
  63. r0 &= 0xffff
  64. }
  65. hr = syscall.Errno(r0)
  66. }
  67. return
  68. }