From 685728bc248a3922644c0b7938fa86a236526077 Mon Sep 17 00:00:00 2001 From: Jose Carlos Jesus Date: Sun, 20 Nov 2022 18:10:11 +0000 Subject: [PATCH] [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;