From 2b680cadd3765991f08b439f8ab7effefb1defb6 Mon Sep 17 00:00:00 2001 From: Michael Schuster Date: Tue, 9 Jun 2020 16:17:04 +0200 Subject: [PATCH] Fix nullptr regression in RegistryUtil::ReadRegistry Merging PR #2057 caused the Windows build to fail: shell_integration\windows\OCUtil\RegistryUtil.cpp(43): error C2664: 'LSTATUS RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY)': cannot convert argument 3 from 'nullptr' to 'DWORD' The previous implementation prior the PR supplied NULL as the argument 3 to RegOpenKeyEx, so it was silently accepted and translated to zero, satisfying the DWORD's type requirement. Signed-off-by: Michael Schuster --- shell_integration/windows/OCUtil/RegistryUtil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell_integration/windows/OCUtil/RegistryUtil.cpp b/shell_integration/windows/OCUtil/RegistryUtil.cpp index fc8b125dc..29a8c8903 100644 --- a/shell_integration/windows/OCUtil/RegistryUtil.cpp +++ b/shell_integration/windows/OCUtil/RegistryUtil.cpp @@ -40,7 +40,7 @@ bool RegistryUtil::ReadRegistry(const wchar_t* key, const wchar_t* name, wstring HKEY rootKey = nullptr; - hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CURRENT_USER, (LPCWSTR)key, nullptr, KEY_READ, &rootKey)); + hResult = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CURRENT_USER, (LPCWSTR)key, 0, KEY_READ, &rootKey)); if(!SUCCEEDED(hResult)) { -- 2.30.2