Skip to content
Snippets Groups Projects
Commit 9c9b1ae7 authored by calrama's avatar calrama
Browse files

Log windows error code when reading from registry fails

parent dfdb93cc
Branches
No related tags found
No related merge requests found
...@@ -72,15 +72,15 @@ std::vector<std::string> QueryKey(HKEY hKey, std::string path) ...@@ -72,15 +72,15 @@ std::vector<std::string> QueryKey(HKEY hKey, std::string path)
CHAR szBuffer[512]; CHAR szBuffer[512];
ULONG dwBufferSize = sizeof(szBuffer); ULONG dwBufferSize = sizeof(szBuffer);
if(ERROR_SUCCESS != regKey.Open(HKEY_LOCAL_MACHINE, path.c_str())) if(auto error_code = regKey.Open(HKEY_LOCAL_MACHINE, path.c_str()); error_code != ERROR_SUCCESS)
{ {
qWarning() << "Error opening registry path " << path.c_str(); qWarning() << "Error opening windows registry path " << path.c_str() << ": " << error_code;
regKey.Close(); regKey.Close();
continue; continue;
} }
if( ERROR_SUCCESS != regKey.QueryStringValue(achValue,szBuffer,&dwBufferSize)) if(auto error_code = regKey.QueryStringValue(achValue,szBuffer,&dwBufferSize); error_code != ERROR_SUCCESS)
{ {
qWarning() << "Error opening registry value " << achValue; qWarning() << "Error opening windows registry value " << achValue << ": " << error_code;
regKey.Close(); regKey.Close();
continue; continue;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment