zsyscall_windows.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //go:build windows
  2. // Code generated by 'go generate' using "github.com/Microsoft/go-winio/tools/mkwinsyscall"; DO NOT EDIT.
  3. package regstate
  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. modadvapi32 = windows.NewLazySystemDLL("advapi32.dll")
  35. procRegCreateKeyExW = modadvapi32.NewProc("RegCreateKeyExW")
  36. )
  37. func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error) {
  38. r0, _, _ := syscall.Syscall9(procRegCreateKeyExW.Addr(), 9, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(reserved), uintptr(unsafe.Pointer(class)), uintptr(options), uintptr(desired), uintptr(unsafe.Pointer(sa)), uintptr(unsafe.Pointer(result)), uintptr(unsafe.Pointer(disposition)))
  39. if r0 != 0 {
  40. regerrno = syscall.Errno(r0)
  41. }
  42. return
  43. }