From e1cb6253b1348cb48be46ccd4064a1c2a7c305d5 Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Fri, 24 Dec 2021 02:58:52 +0200 Subject: [PATCH] Fixed bug that still wrote current value to registry when a choice item in the Properties UI was dismissed --- ExplorerPatcher/GUI.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/ExplorerPatcher/GUI.c b/ExplorerPatcher/GUI.c index 346d750..3824eb5 100644 --- a/ExplorerPatcher/GUI.c +++ b/ExplorerPatcher/GUI.c @@ -1361,6 +1361,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) } else { + DWORD val = 0; if (bChoice || bChoiceLefted) { RECT rcTemp; @@ -1379,7 +1380,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) hwnd, &p ); - DWORD val = TrackPopupMenu( + val = TrackPopupMenu( hMenu, TPM_RETURNCMD | TPM_RIGHTBUTTON, p.x, @@ -1402,14 +1403,17 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt) { value = _this->section + 1; } - GUI_RegSetValueExW( - hKey, - name, - 0, - REG_DWORD, - &value, - sizeof(DWORD) - ); + if (!(bChoice || bChoiceLefted) || ((bChoice || bChoiceLefted) && val)) + { + GUI_RegSetValueExW( + hKey, + name, + 0, + REG_DWORD, + &value, + sizeof(DWORD) + ); + } } InvalidateRect(hwnd, NULL, FALSE); }