https://git.reactos.org/?p=reactos.git;a=commitdiff;h=685728bc248a3922644c0b7938fa86a236526077

commit 685728bc248a3922644c0b7938fa86a236526077
Author:     Jose Carlos Jesus <[email protected]>
AuthorDate: Sun Nov 20 18:10:11 2022 +0000
Commit:     GitHub <[email protected]>
CommitDate: Sun Nov 20 21:10:11 2022 +0300

    [SHELL32] Prevent a second call to Drive Properties dialog (#4888)
    
    CDefaultContextMenu::DoProperties provides a fallback call
    to the property sheet testing the return value of the _DoCallback method,
    which is ultimately the return value of SH_ShowDriveProperties().
    
    SH_ShowDriveProperties() sometimes returns an HRESULT, however it is marked
    as returning a BOOL. Then, DrivesContextMenuCallback() always handles this
    result as an HRESULT.
    
    Fix SH_ShowDriveProperties() to always return a BOOL as it is intended,
    and in DrivesContextMenuCallback() handle the result accordingly.
    
    CORE-18537
---
 dll/win32/shell32/dialogs/drive.cpp         | 2 +-
 dll/win32/shell32/folders/CDrivesFolder.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dll/win32/shell32/dialogs/drive.cpp 
b/dll/win32/shell32/dialogs/drive.cpp
index 1a09a6ed712..ed57ccc9793 100644
--- a/dll/win32/shell32/dialogs/drive.cpp
+++ b/dll/win32/shell32/dialogs/drive.cpp
@@ -175,7 +175,7 @@ SH_ShowDriveProperties(WCHAR *pwszDrive, IDataObject 
*pDataObj)
 
     CDataObjectHIDA cida(pDataObj);
     if (FAILED_UNEXPECTEDLY(cida.hr()))
-        return cida.hr();
+        return FAILED(cida.hr());
 
     RECT rcPosition = {CW_USEDEFAULT, CW_USEDEFAULT, 0, 0};
     POINT pt;
diff --git a/dll/win32/shell32/folders/CDrivesFolder.cpp 
b/dll/win32/shell32/folders/CDrivesFolder.cpp
index bf0dde7c9d6..565c1dc6052 100644
--- a/dll/win32/shell32/folders/CDrivesFolder.cpp
+++ b/dll/win32/shell32/folders/CDrivesFolder.cpp
@@ -345,7 +345,7 @@ HRESULT CALLBACK DrivesContextMenuCallback(IShellFolder 
*psf,
         {
             // pdtobj should be valid at this point!
             ATLASSERT(pdtobj);
-            hr = SH_ShowDriveProperties(wszBuf, pdtobj);
+            hr = SH_ShowDriveProperties(wszBuf, pdtobj) ? S_OK : E_UNEXPECTED;
             if (FAILED(hr))
             {
                 dwError = ERROR_CAN_NOT_COMPLETE;

Reply via email to