github.com/huandu/go@v0.0.0-20151114150818-04e615e41150/src/internal/syscall/windows/registry/zsyscall_windows.go (about) 1 // MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT 2 3 package registry 4 5 import "unsafe" 6 import "syscall" 7 8 var _ unsafe.Pointer 9 10 var ( 11 modadvapi32 = syscall.NewLazyDLL("advapi32.dll") 12 modkernel32 = syscall.NewLazyDLL("kernel32.dll") 13 14 procRegCreateKeyExW = modadvapi32.NewProc("RegCreateKeyExW") 15 procRegDeleteKeyW = modadvapi32.NewProc("RegDeleteKeyW") 16 procRegSetValueExW = modadvapi32.NewProc("RegSetValueExW") 17 procRegEnumValueW = modadvapi32.NewProc("RegEnumValueW") 18 procRegDeleteValueW = modadvapi32.NewProc("RegDeleteValueW") 19 procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW") 20 ) 21 22 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) { 23 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))) 24 if r0 != 0 { 25 regerrno = syscall.Errno(r0) 26 } 27 return 28 } 29 30 func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) { 31 r0, _, _ := syscall.Syscall(procRegDeleteKeyW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(subkey)), 0) 32 if r0 != 0 { 33 regerrno = syscall.Errno(r0) 34 } 35 return 36 } 37 38 func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error) { 39 r0, _, _ := syscall.Syscall6(procRegSetValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(valueName)), uintptr(reserved), uintptr(vtype), uintptr(unsafe.Pointer(buf)), uintptr(bufsize)) 40 if r0 != 0 { 41 regerrno = syscall.Errno(r0) 42 } 43 return 44 } 45 46 func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { 47 r0, _, _ := syscall.Syscall9(procRegEnumValueW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen)), 0) 48 if r0 != 0 { 49 regerrno = syscall.Errno(r0) 50 } 51 return 52 } 53 54 func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) { 55 r0, _, _ := syscall.Syscall(procRegDeleteValueW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(name)), 0) 56 if r0 != 0 { 57 regerrno = syscall.Errno(r0) 58 } 59 return 60 } 61 62 func expandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) { 63 r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) 64 n = uint32(r0) 65 if n == 0 { 66 if e1 != 0 { 67 err = error(e1) 68 } else { 69 err = syscall.EINVAL 70 } 71 } 72 return 73 }