From 5d11d1699cd75fa9214e0beefb1a21694fe5249f Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Sat, 18 Mar 2017 12:54:43 +0000 Subject: [PATCH] [REGEDIT] Fix regedit not showing it's main window when loading view settings fail. CORE-12749 svn path=/trunk/; revision=74186 --- reactos/base/applications/regedit/settings.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/reactos/base/applications/regedit/settings.c b/reactos/base/applications/regedit/settings.c index 50f5a7c10c4..b62fae93d90 100644 --- a/reactos/base/applications/regedit/settings.c +++ b/reactos/base/applications/regedit/settings.c @@ -67,6 +67,7 @@ extern void LoadSettings(void) { RegistryBinaryConfig tConfig; DWORD iBufferSize = sizeof(tConfig); + BOOL bVisible = FALSE; if (RegQueryValueExW(hKey, L"View", NULL, NULL, (LPBYTE)&tConfig, &iBufferSize) == ERROR_SUCCESS) { @@ -90,19 +91,21 @@ extern void LoadSettings(void) /* Apply program window settings */ tConfig.tPlacement.length = sizeof(WINDOWPLACEMENT); - if (SetWindowPlacement(hFrameWnd, &tConfig.tPlacement) == FALSE) - /* In case we fail, show normal */ - ShowWindow(hFrameWnd, SW_SHOWNORMAL); + bVisible = SetWindowPlacement(hFrameWnd, &tConfig.tPlacement); } } + /* In case we fail to restore the window, or open the key, show normal */ + if (!bVisible) + ShowWindow(hFrameWnd, SW_SHOWNORMAL); + /* Restore key position */ if (QueryStringValue(HKEY_CURRENT_USER, g_szGeneralRegKey, L"LastKey", szBuffer, COUNT_OF(szBuffer)) == ERROR_SUCCESS) { SelectNode(g_pChildWnd->hTreeWnd, szBuffer); } - RegCloseKey(hKey); + RegCloseKey(hKey); } else {