1// Code generated by 'go generate'; DO NOT EDIT. 2 3package regstate 4 5import ( 6 "syscall" 7 "unsafe" 8 9 "golang.org/x/sys/windows" 10) 11 12var _ unsafe.Pointer 13 14// Do the interface allocations only once for common 15// Errno values. 16const ( 17 errnoERROR_IO_PENDING = 997 18) 19 20var ( 21 errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) 22) 23 24// errnoErr returns common boxed Errno values, to prevent 25// allocations at runtime. 26func errnoErr(e syscall.Errno) error { 27 switch e { 28 case 0: 29 return nil 30 case errnoERROR_IO_PENDING: 31 return errERROR_IO_PENDING 32 } 33 // TODO: add more here, after collecting data on the common 34 // error values see on Windows. (perhaps when running 35 // all.bat?) 36 return e 37} 38 39var ( 40 modadvapi32 = windows.NewLazySystemDLL("advapi32.dll") 41 42 procRegCreateKeyExW = modadvapi32.NewProc("RegCreateKeyExW") 43) 44 45func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error) { 46 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))) 47 if r0 != 0 { 48 regerrno = syscall.Errno(r0) 49 } 50 return 51} 52