From 958a9a6b20c765c247aef54dcf1c2335ea14c112 Mon Sep 17 00:00:00 2001 From: Valentin-Gabriel Radu Date: Sun, 10 Oct 2021 22:37:47 +0300 Subject: [PATCH] Close registry key in GUI --- ExplorerPatcher/GUI.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ExplorerPatcher/GUI.c b/ExplorerPatcher/GUI.c index dbb51e6..3e9e7b2 100644 --- a/ExplorerPatcher/GUI.c +++ b/ExplorerPatcher/GUI.c @@ -603,7 +603,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) if (d) *d = 0; wchar_t* p = wcschr(name, L'"'); if (p) *p = 0; - HKEY hKey; + HKEY hKey = NULL; DWORD dwDisposition; DWORD dwSize = sizeof(DWORD); DWORD value = FALSE; @@ -1159,7 +1159,7 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow) { - HKEY hKey; + HKEY hKey = NULL; DWORD dwDisposition; DWORD dwSize = sizeof(DWORD); RegCreateKeyExW( @@ -1193,6 +1193,10 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin stdout ); } + if (hKey) + { + RegCloseKey(hKey); + } printf("Started \"GUI\" thread.\n"); @@ -1301,4 +1305,4 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin } printf("Ended \"GUI\" thread.\n"); -} \ No newline at end of file +}