Skip to content

Commit 87d276f

Browse files
katahiromzyagoulas
authored andcommitted
[SHELL32] Don't show error when closing disk prop sheet (reactos#144)
CORE-14035
1 parent d85023c commit 87d276f

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

dll/win32/shell32/dialogs/drive.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Shell Library Functions
33
*
44
* Copyright 2005 Johannes Anderwald
5+
* Copyright 2017 Katayama Hirofumi MZ
56
*
67
* This library is free software; you can redistribute it and/or
78
* modify it under the terms of the GNU Lesser General Public
@@ -127,7 +128,7 @@ typedef struct _DRIVE_PROP_PAGE
127128
UINT DriveType;
128129
} DRIVE_PROP_PAGE;
129130

130-
BOOL
131+
HRESULT
131132
SH_ShowDriveProperties(WCHAR *pwszDrive, LPCITEMIDLIST pidlFolder, PCUITEMID_CHILD_ARRAY apidl)
132133
{
133134
HPSXA hpsx = NULL;
@@ -145,7 +146,7 @@ SH_ShowDriveProperties(WCHAR *pwszDrive, LPCITEMIDLIST pidlFolder, PCUITEMID_CHI
145146

146147
LPITEMIDLIST completePidl = ILCombine(pidlFolder, apidl[0]);
147148
if (!completePidl)
148-
return FALSE;
149+
return E_OUTOFMEMORY;
149150

150151
if (ILGetDisplayNameExW(NULL, completePidl, wszName, ILGDN_NORMAL))
151152
{
@@ -179,16 +180,19 @@ SH_ShowDriveProperties(WCHAR *pwszDrive, LPCITEMIDLIST pidlFolder, PCUITEMID_CHI
179180
SHAddFromPropSheetExtArray(hpsx, (LPFNADDPROPSHEETPAGE)AddPropSheetPageCallback, (LPARAM)&psh);
180181
}
181182

182-
HWND hwnd = (HWND)PropertySheetW(&psh);
183+
// NOTE: Currently property sheet is modal. If we make it modeless, then it returns HWND.
184+
INT_PTR ret = PropertySheetW(&psh);
183185

184186
if (hpsx)
185187
SHDestroyPropSheetExtArray(hpsx);
186188
if (pDrvDefExt)
187189
pDrvDefExt->Release();
188190

189-
if (!hwnd)
190-
return FALSE;
191-
return TRUE;
191+
if (ret > 0)
192+
return S_OK;
193+
if (ret == 0)
194+
return S_FALSE;
195+
return E_FAIL;
192196
}
193197

194198
static VOID

dll/win32/shell32/dialogs/fprop.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*
44
* Copyright 2005 Johannes Anderwald
55
* Copyright 2012 Rafal Harabien
6+
* Copyright 2017 Katayama Hirofumi MZ
67
*
78
* This library is free software; you can redistribute it and/or
89
* modify it under the terms of the GNU Lesser General Public
@@ -117,7 +118,7 @@ SH_ShowPropertiesDialog(LPCWSTR pwszPath, LPCITEMIDLIST pidlFolder, PCUITEMID_CH
117118

118119
/* Handle drives */
119120
if (PathIsRootW(wszPath))
120-
return SH_ShowDriveProperties(wszPath, pidlFolder, apidl);
121+
return SUCCEEDED(SH_ShowDriveProperties(wszPath, pidlFolder, apidl));
121122

122123
/* Handle files and folders */
123124
PROPSHEETHEADERW Header;

dll/win32/shell32/folders/CDrivesFolder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ HRESULT CALLBACK DrivesContextMenuCallback(IShellFolder *psf,
215215

216216
if (wParam == DFM_CMD_PROPERTIES)
217217
{
218-
if (!SH_ShowDriveProperties(wszBuf, pidlFolder, apidl))
218+
hr = SH_ShowDriveProperties(wszBuf, pidlFolder, apidl);
219+
if (FAILED(hr))
219220
{
220-
hr = E_FAIL;
221221
dwError = ERROR_CAN_NOT_COMPLETE;
222222
nStringID = IDS_CANTSHOWPROPERTIES;
223223
}

dll/win32/shell32/wine/shell32_main.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ BOOL SHELL_IsShortcut(LPCITEMIDLIST) DECLSPEC_HIDDEN;
184184
INT_PTR CALLBACK SH_FileGeneralDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
185185
INT_PTR CALLBACK SH_FileVersionDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
186186
HPROPSHEETPAGE SH_CreatePropertySheetPage(WORD wDialogId, DLGPROC pfnDlgProc, LPARAM lParam, LPCWSTR pwszTitle);
187-
BOOL SH_ShowDriveProperties(WCHAR *drive, LPCITEMIDLIST pidlFolder, PCUITEMID_CHILD_ARRAY apidl);
187+
HRESULT SH_ShowDriveProperties(WCHAR *drive, LPCITEMIDLIST pidlFolder, PCUITEMID_CHILD_ARRAY apidl);
188188
BOOL SH_ShowRecycleBinProperties(WCHAR sDrive);
189189
BOOL SH_ShowPropertiesDialog(LPCWSTR pwszPath, LPCITEMIDLIST pidlFolder, PCUITEMID_CHILD_ARRAY apidl);
190190
LPWSTR SH_FormatFileSizeWithBytes(PULARGE_INTEGER lpQwSize, LPWSTR pszBuf, UINT cchBuf);

0 commit comments

Comments
 (0)