aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/w32-reg.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/common/w32-reg.c b/common/w32-reg.c
index fda2d1cfa..816531fd5 100644
--- a/common/w32-reg.c
+++ b/common/w32-reg.c
@@ -160,8 +160,18 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
}
nbytes = 1;
- if (RegQueryValueEx( key_handle, name, 0, NULL, NULL, &nbytes ) )
- goto leave;
+ if (RegQueryValueEx (key_handle, name, 0, NULL, NULL, &nbytes))
+ {
+ if (root)
+ goto leave;
+ /* Try to fallback to HKLM also for a missing value. */
+ RegCloseKey (key_handle);
+ if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle))
+ return NULL; /* Nope. */
+ if (RegQueryValueEx (key_handle, name, 0, NULL, NULL, &nbytes))
+ goto leave;
+ }
+
result = xtrymalloc ((n1=nbytes+1));
if (!result)
goto leave;