From 3012ced8ff1d4bd1febf99d8ffb7bd7e28a552ef Mon Sep 17 00:00:00 2001 From: justanotheranonymoususer Date: Sun, 10 Oct 2021 09:07:46 +0300 Subject: [PATCH] Fixing RegCloseKey invalid handle --- ExplorerPatcher/GUI.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ExplorerPatcher/GUI.c b/ExplorerPatcher/GUI.c index 76378db..dbb51e6 100644 --- a/ExplorerPatcher/GUI.c +++ b/ExplorerPatcher/GUI.c @@ -723,6 +723,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) if (hKey) { RegCloseKey(hKey); + hKey = NULL; RegDeleteKeyExW( HKEY_CURRENT_USER, wcschr(section, L'\\') + 1, @@ -799,7 +800,10 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) } InvalidateRect(hwnd, NULL, FALSE); } - RegCloseKey(hKey); + if (hKey) + { + RegCloseKey(hKey); + } if (bChoice) { for (unsigned int i = 0; i < numChoices; ++i)