Ejemplo n.º 1
0
// Returns a new ClientConfiguration object, filled with the configuration data, loaded from the
// Windows registry (Hostname, Port, ForwardedKeys) and Windows credential store (encryption secret).
func LoadClientConfiguration() *ClientConfiguration {
	ret := new(ClientConfiguration)
	ret.Hostname = w32.RegGetString(w32.HKEY_CURRENT_USER, CLIENT_CONFIGURATION_KEY, CLIENT_CONFIGURATION_HOSTNAME)
	ret.Port = binary.LittleEndian.Uint64(w32.RegGetRaw(w32.HKEY_CURRENT_USER, CLIENT_CONFIGURATION_KEY, CLIENT_CONFIGURATION_PORT))
	json.Unmarshal([]byte(w32.RegGetString(w32.HKEY_CURRENT_USER, CLIENT_CONFIGURATION_KEY, CLIENT_CONFIGURATION_FORWARDED_KEYS)), &ret.ForwardedKeys)
	cred, err := wincred.GetGenericCredential(CLIENT_CONFIGURATION_SECRET)
	if err == nil {
		ret.Secret = cred.CredentialBlob
	}
	return ret
}
Ejemplo n.º 2
0
func main() {
	fmt.Println(w32.RegGetString(w32.HKEY_CURRENT_USER, "environment", "path"))
	RegSetKey(w32.HKEY_CURRENT_USER, "environment", "path_test_say", "hello world")
	fmt.Println(w32.RegGetString(w32.HKEY_CURRENT_USER, "environment", "path_test_say"))
}
Ejemplo n.º 3
0
func main() {
	fmt.Println(w32.RegGetString(w32.HKEY_CURRENT_USER, "environment", "path"))
}