Skip to content

Commit

Permalink
Fixed RegRead to use Default when key does not exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lexikos committed May 19, 2021
1 parent 2d086e9 commit 4662e0d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions source/script_registry.cpp
Expand Up @@ -190,10 +190,7 @@ void RegRead(ResultToken &aResultToken, HKEY aRootKey, LPTSTR aRegSubkey, LPTSTR
// Open the registry key
result = RegOpenKeyEx(aRootKey, aRegSubkey, 0, KEY_READ | g->RegView, &hRegKey);
if (result != ERROR_SUCCESS)
{
g->LastError = result;
_f_throw_win32(result);
}
goto finish_skip_close;

// Read the value and determine the type. If aValueName is the empty string, the key's default value is used.
result = RegQueryValueEx(hRegKey, aValueName, NULL, &dwType, NULL, NULL);
Expand Down Expand Up @@ -337,6 +334,7 @@ void RegRead(ResultToken &aResultToken, HKEY aRootKey, LPTSTR aRegSubkey, LPTSTR
// not clear whether NULL is actually an invalid registry handle value:
//if (hRegKey)
RegCloseKey(hRegKey);
finish_skip_close:
g->LastError = result;
if (result == ERROR_FILE_NOT_FOUND && aDefault)
{
Expand Down

0 comments on commit 4662e0d

Please sign in to comment.