github.com/aloncn/graphics-go@v0.0.1/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  import "internal/syscall/windows/sysdll"
     8  
     9  var _ unsafe.Pointer
    10  
    11  var (
    12  	modadvapi32 = syscall.NewLazyDLL(sysdll.Add("advapi32.dll"))
    13  	modkernel32 = syscall.NewLazyDLL(sysdll.Add("kernel32.dll"))
    14  
    15  	procRegCreateKeyExW           = modadvapi32.NewProc("RegCreateKeyExW")
    16  	procRegDeleteKeyW             = modadvapi32.NewProc("RegDeleteKeyW")
    17  	procRegSetValueExW            = modadvapi32.NewProc("RegSetValueExW")
    18  	procRegEnumValueW             = modadvapi32.NewProc("RegEnumValueW")
    19  	procRegDeleteValueW           = modadvapi32.NewProc("RegDeleteValueW")
    20  	procRegLoadMUIStringW         = modadvapi32.NewProc("RegLoadMUIStringW")
    21  	procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW")
    22  )
    23  
    24  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) {
    25  	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)))
    26  	if r0 != 0 {
    27  		regerrno = syscall.Errno(r0)
    28  	}
    29  	return
    30  }
    31  
    32  func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) {
    33  	r0, _, _ := syscall.Syscall(procRegDeleteKeyW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(subkey)), 0)
    34  	if r0 != 0 {
    35  		regerrno = syscall.Errno(r0)
    36  	}
    37  	return
    38  }
    39  
    40  func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error) {
    41  	r0, _, _ := syscall.Syscall6(procRegSetValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(valueName)), uintptr(reserved), uintptr(vtype), uintptr(unsafe.Pointer(buf)), uintptr(bufsize))
    42  	if r0 != 0 {
    43  		regerrno = syscall.Errno(r0)
    44  	}
    45  	return
    46  }
    47  
    48  func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) {
    49  	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)
    50  	if r0 != 0 {
    51  		regerrno = syscall.Errno(r0)
    52  	}
    53  	return
    54  }
    55  
    56  func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) {
    57  	r0, _, _ := syscall.Syscall(procRegDeleteValueW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(name)), 0)
    58  	if r0 != 0 {
    59  		regerrno = syscall.Errno(r0)
    60  	}
    61  	return
    62  }
    63  
    64  func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint32, buflenCopied *uint32, flags uint32, dir *uint16) (regerrno error) {
    65  	r0, _, _ := syscall.Syscall9(procRegLoadMUIStringW.Addr(), 7, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(unsafe.Pointer(buflenCopied)), uintptr(flags), uintptr(unsafe.Pointer(dir)), 0, 0)
    66  	if r0 != 0 {
    67  		regerrno = syscall.Errno(r0)
    68  	}
    69  	return
    70  }
    71  
    72  func expandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) {
    73  	r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size))
    74  	n = uint32(r0)
    75  	if n == 0 {
    76  		if e1 != 0 {
    77  			err = error(e1)
    78  		} else {
    79  			err = syscall.EINVAL
    80  		}
    81  	}
    82  	return
    83  }