https://git.reactos.org/?p=reactos.git;a=commitdiff;h=32c20ab1129d62921bb37842644a0d97c299f7fb

commit 32c20ab1129d62921bb37842644a0d97c299f7fb
Author:     Kyle Katarn <cont...@kcsoftwares.com>
AuthorDate: Mon Sep 19 03:06:47 2022 +0200
Commit:     GitHub <nore...@github.com>
CommitDate: Mon Sep 19 04:06:47 2022 +0300

    [SHELL32] Fix property sheets that can't be closed due to failed init 
(#4709)
    
    When a PropertySheet fails to init, that fact is being logged
    and it shows an empty page, but it can't be closed.
    
    Handle second failure properly by using FAILED_UNEXPECTEDLY macro.
    
    CORE-18333
---
 dll/win32/shell32/dialogs/fprop.cpp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/dll/win32/shell32/dialogs/fprop.cpp 
b/dll/win32/shell32/dialogs/fprop.cpp
index 3cab59b1f3b..b43ee566e85 100644
--- a/dll/win32/shell32/dialogs/fprop.cpp
+++ b/dll/win32/shell32/dialogs/fprop.cpp
@@ -132,13 +132,20 @@ SH_ShowPropertiesDialog(LPCWSTR pwszPath, LPCITEMIDLIST 
pidlFolder, PCUITEMID_CH
         {
             pFileDefExt->AddRef(); // CreateInstance returns object with 0 ref 
count
             hr = pFileDefExt->Initialize(pidlFolder, pDataObj, NULL);
-            if (SUCCEEDED(hr))
+            if (!FAILED_UNEXPECTEDLY(hr))
             {
                 hr = pFileDefExt->AddPages(AddPropSheetPageCallback, 
(LPARAM)&Header);
-                if (FAILED(hr))
+                if (FAILED_UNEXPECTEDLY(hr))
+                {
                     ERR("AddPages failed\n");
-            } else
+                    return FALSE;
+                }
+            }
+            else
+            {
                 ERR("Initialize failed\n");
+                return FALSE;
+            }
         }
 
         LoadPropSheetHandlers(wszPath, &Header, MAX_PROPERTY_SHEET_PAGE - 1, 
hpsxa, pDataObj);

Reply via email to