Add current user GPG4Win lookup test_diphoton
authorThomas
Wed, 24 May 2017 15:19:41 +0200
branchtest_diphoton
changeset 1804775bb90eccd5
parent 1780 07a6773bd842
child 1816 dc9bc5fa3f18
Add current user GPG4Win lookup
src/platform_windows.cpp
     1.1 --- a/src/platform_windows.cpp	Fri May 12 11:44:43 2017 +0200
     1.2 +++ b/src/platform_windows.cpp	Wed May 24 15:19:41 2017 +0200
     1.3 @@ -139,11 +139,17 @@
     1.4      assert(filename);
     1.5  	assert(flag == RTLD_LAZY); // only lazy binding is implemented
     1.6  
     1.7 -    bool result = readRegistryString(HKEY_LOCAL_MACHINE,
     1.8 -            TEXT("SOFTWARE\\GNU\\GnuPG"), TEXT("Install Directory"), path,
     1.9 -            PATH_BUF_SIZE, NULL);
    1.10 -	assert(result);
    1.11 -	if (!result)
    1.12 +	// Look up GnuPG installation in current user scope
    1.13 +	bool result = readRegistryString(HKEY_CURRENT_USER,
    1.14 +		TEXT("SOFTWARE\\GNU\\GnuPG"), TEXT("Install Directory"), path,
    1.15 +		PATH_BUF_SIZE, NULL);
    1.16 +	// If not found in current user, look up in local machine
    1.17 +	if (!result)
    1.18 +		result = readRegistryString(HKEY_LOCAL_MACHINE,
    1.19 +			TEXT("SOFTWARE\\GNU\\GnuPG"), TEXT("Install Directory"), path,
    1.20 +			PATH_BUF_SIZE, NULL);
    1.21 +	assert(result);
    1.22 +	if (!result)
    1.23  		return NULL;
    1.24  
    1.25      SetDllDirectory(TEXT(""));