Commit 4628ff41 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

for reading preferences on Windows, try HKCU first, then fall back to HKLM....

for reading preferences on Windows, try HKCU first, then fall back to HKLM. For writing, only write to HKCU
parent 90698141
......@@ -189,11 +189,16 @@ static int sys_getpreference(const char *key, char *value, int size)
{
HKEY hkey;
DWORD bigsize = size;
LONG err = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
LONG err = RegOpenKeyEx(HKEY_CURRENT_USER,
"Software\\Purr-Data", 0, KEY_QUERY_VALUE, &hkey);
if (err != ERROR_SUCCESS)
{
return (0);
err = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"Software\\Purr-Data", 0, KEY_QUERY_VALUE, &hkey);
if (err != ERROR_SUCCESS)
{
return (0);
}
}
err = RegQueryValueEx(hkey, key, 0, 0, value, &bigsize);
if (err != ERROR_SUCCESS)
......@@ -216,7 +221,7 @@ static void sys_initsavepreferences( void)
static void sys_putpreference(const char *key, const char *value)
{
HKEY hkey;
LONG err = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
LONG err = RegCreateKeyEx(HKEY_CURRENT_USER,
"Software\\Purr-Data", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE,
NULL, &hkey, NULL);
if (err != ERROR_SUCCESS)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment