[SHELL32] Don't show error when closing disk prop sheet (#144)

CORE-14035
This commit is contained in:
Katayama Hirofumi MZ 2017-11-25 18:27:20 +09:00 committed by Giannis Adamopoulos
parent d85023c9c9
commit 87d276f05d
4 changed files with 15 additions and 10 deletions

View file

@ -2,6 +2,7 @@
* Shell Library Functions
*
* Copyright 2005 Johannes Anderwald
* Copyright 2017 Katayama Hirofumi MZ
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -127,7 +128,7 @@ typedef struct _DRIVE_PROP_PAGE
UINT DriveType;
} DRIVE_PROP_PAGE;
BOOL
HRESULT
SH_ShowDriveProperties(WCHAR *pwszDrive, LPCITEMIDLIST pidlFolder, PCUITEMID_CHILD_ARRAY apidl)
{
HPSXA hpsx = NULL;
@ -145,7 +146,7 @@ SH_ShowDriveProperties(WCHAR *pwszDrive, LPCITEMIDLIST pidlFolder, PCUITEMID_CHI
LPITEMIDLIST completePidl = ILCombine(pidlFolder, apidl[0]);
if (!completePidl)
return FALSE;
return E_OUTOFMEMORY;
if (ILGetDisplayNameExW(NULL, completePidl, wszName, ILGDN_NORMAL))
{
@ -179,16 +180,19 @@ SH_ShowDriveProperties(WCHAR *pwszDrive, LPCITEMIDLIST pidlFolder, PCUITEMID_CHI
SHAddFromPropSheetExtArray(hpsx, (LPFNADDPROPSHEETPAGE)AddPropSheetPageCallback, (LPARAM)&psh);
}
HWND hwnd = (HWND)PropertySheetW(&psh);
// NOTE: Currently property sheet is modal. If we make it modeless, then it returns HWND.
INT_PTR ret = PropertySheetW(&psh);
if (hpsx)
SHDestroyPropSheetExtArray(hpsx);
if (pDrvDefExt)
pDrvDefExt->Release();
if (!hwnd)
return FALSE;
return TRUE;
if (ret > 0)
return S_OK;
if (ret == 0)
return S_FALSE;
return E_FAIL;
}
static VOID

View file

@ -3,6 +3,7 @@
*
* Copyright 2005 Johannes Anderwald
* Copyright 2012 Rafal Harabien
* Copyright 2017 Katayama Hirofumi MZ
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -117,7 +118,7 @@ SH_ShowPropertiesDialog(LPCWSTR pwszPath, LPCITEMIDLIST pidlFolder, PCUITEMID_CH
/* Handle drives */
if (PathIsRootW(wszPath))
return SH_ShowDriveProperties(wszPath, pidlFolder, apidl);
return SUCCEEDED(SH_ShowDriveProperties(wszPath, pidlFolder, apidl));
/* Handle files and folders */
PROPSHEETHEADERW Header;

View file

@ -215,9 +215,9 @@ HRESULT CALLBACK DrivesContextMenuCallback(IShellFolder *psf,
if (wParam == DFM_CMD_PROPERTIES)
{
if (!SH_ShowDriveProperties(wszBuf, pidlFolder, apidl))
hr = SH_ShowDriveProperties(wszBuf, pidlFolder, apidl);
if (FAILED(hr))
{
hr = E_FAIL;
dwError = ERROR_CAN_NOT_COMPLETE;
nStringID = IDS_CANTSHOWPROPERTIES;
}

View file

@ -184,7 +184,7 @@ BOOL SHELL_IsShortcut(LPCITEMIDLIST) DECLSPEC_HIDDEN;
INT_PTR CALLBACK SH_FileGeneralDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK SH_FileVersionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
HPROPSHEETPAGE SH_CreatePropertySheetPage(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, LPCWSTR pwszTitle);
BOOL SH_ShowDriveProperties(WCHAR *drive, LPCITEMIDLIST pidlFolder, PCUITEMID_CHILD_ARRAY apidl);
HRESULT SH_ShowDriveProperties(WCHAR *drive, LPCITEMIDLIST pidlFolder, PCUITEMID_CHILD_ARRAY apidl);
BOOL SH_ShowRecycleBinProperties(WCHAR sDrive);
BOOL SH_ShowPropertiesDialog(LPCWSTR pwszPath, LPCITEMIDLIST pidlFolder, PCUITEMID_CHILD_ARRAY apidl);
LPWSTR SH_FormatFileSizeWithBytes(PULARGE_INTEGER lpQwSize, LPWSTR pszBuf, UINT cchBuf);