aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2002-09-16 20:37:38 +0000
committerWerner Koch <[email protected]>2002-09-16 20:37:38 +0000
commit679452478952378cf1026ea95527b8c177cbb5b3 (patch)
tree52d51f5b265160bb22d62b3928e106c417228c86
parent* gpgkeys_mailto.in: Add quasi-RFC-2368 mailto:email@addr?from= syntax so (diff)
downloadgnupg-679452478952378cf1026ea95527b8c177cbb5b3.tar.gz
gnupg-679452478952378cf1026ea95527b8c177cbb5b3.zip
* w32reg.c (read_w32_registry_string): Fallback to HLM.
Diffstat (limited to '')
-rw-r--r--util/ChangeLog4
-rw-r--r--util/w32reg.c12
2 files changed, 13 insertions, 3 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index fb596f34b..1b87ec0bb 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,7 @@
+2002-09-16 Werner Koch <[email protected]>
+
+ * w32reg.c (read_w32_registry_string): Fallback to HLM.
+
2002-09-12 Stefan Bellon <[email protected]>
* fileutil.c (make_filename): Removed variable for RISC OS to
diff --git a/util/w32reg.c b/util/w32reg.c
index fe63fe6a7..5391c8027 100644
--- a/util/w32reg.c
+++ b/util/w32reg.c
@@ -1,5 +1,5 @@
/* w32reg.c - MS-Windows Registry access
- * Copyright (C) 1999 Free Software Foundation, Inc.
+ * Copyright (C) 1999, 2002 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -59,7 +59,7 @@ get_root_key(const char *root)
/****************
* Return a string from the Win32 Registry or NULL in case of
* error. Caller must release the return value. A NULL for root
- * is an alias fro HKEY_CURRENT_USER
+ * is an alias for HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE in turn.
* NOTE: The value is allocated with a plain malloc() - use free() and not
* the usual m_free()!!!
*/
@@ -74,7 +74,13 @@ read_w32_registry_string( const char *root, const char *dir, const char *name )
return NULL;
if( RegOpenKeyEx( root_key, dir, 0, KEY_READ, &key_handle ) )
- return NULL; /* no need for a RegClose, so return direct */
+ {
+ if (root)
+ return NULL; /* no need for a RegClose, so return direct */
+ /* It seems to be common practise to fall back to HLM. */
+ if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &key_handle) )
+ return NULL; /* still no need for a RegClose, so return direct */
+ }
nbytes = 1;
if( RegQueryValueEx( key_handle, name, 0, NULL, NULL, &nbytes ) )