From ba033f373002b2cf6d50af26d96e39636680a0e3 Mon Sep 17 00:00:00 2001
From: Moritz Maxeiner <mm@ucw.sh>
Date: Tue, 23 Jul 2019 16:17:26 +0200
Subject: [PATCH] Support running without administrator rights on Windows

By default, CRegKey::Open tries to get both read and write privileges.
The latter of which are obviously going to be denied (and we don't need
them).
---
 SrcBehaviorLoader/PluginLoader.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SrcBehaviorLoader/PluginLoader.cpp b/SrcBehaviorLoader/PluginLoader.cpp
index 1f0e632..b0dd853 100644
--- a/SrcBehaviorLoader/PluginLoader.cpp
+++ b/SrcBehaviorLoader/PluginLoader.cpp
@@ -72,7 +72,7 @@ std::vector<std::string> QueryKey(HKEY hKey, std::string path)
                 CHAR szBuffer[512];
                 ULONG dwBufferSize = sizeof(szBuffer);
 
-                if(auto error_code = regKey.Open(HKEY_LOCAL_MACHINE, path.c_str()); error_code != ERROR_SUCCESS)
+                if(auto error_code = regKey.Open(HKEY_LOCAL_MACHINE, path.c_str(), KEY_READ); error_code != ERROR_SUCCESS)
                 {
                     qWarning() << "Error opening windows registry path " << path.c_str() << ": " << error_code;
                     regKey.Close();
-- 
GitLab