[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
This commit is contained in:
Jose Carlos Jesus 2022-11-20 18:10:11 +00:00 committed by GitHub
parent c093d4f803
commit 685728bc24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -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;

View file

@ -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;