Exemple #1
0
func (k *Key) SetString(name string, value string) error {
	buf := syscall.StringToUTF16(value)
	return winapi.RegSetValueEx(
		k.Handle, syscall.StringToUTF16Ptr(name),
		0, syscall.REG_SZ,
		(*byte)(unsafe.Pointer(&buf[0])), uint32(len(buf)*2))
}
Exemple #2
0
func (k *Key) SetUInt32(name string, value uint32) error {
	return winapi.RegSetValueEx(
		k.Handle, syscall.StringToUTF16Ptr(name),
		0, syscall.REG_DWORD,
		(*byte)(unsafe.Pointer(&value)), uint32(unsafe.Sizeof(value)))
}