zsyscall_windows.go 1.6 KB

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