[PATCH 0/1] MR10214: shell32: Only compute HASSUBFOLDER if requested.
SFGAO_HASSUBFOLDER enumerates the whole subdirectory and the slowness is immediately noticeable in the system file dialog when opening /. Most shell32 users don't require HASSUBFOLDER so skip the computation when not requested. Checked that the file dialog is no longer painfully slow with this change. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10214
From: Tatsuyuki Ishi <ishitatsuyuki@gmail.com> SFGAO_HASSUBFOLDER enumerates the whole subdirectory and the slowness is immediately noticeable in the system file dialog when opening /. Most shell32 users don't require HASSUBFOLDER so skip the computation when not requested. --- dlls/shell32/shlfolder.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index ea44f862222..492116c43f2 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -443,15 +443,18 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder2 *psf, LPCITEMIDLIST pidl, LPDWO *pdwAttributes |= (SFGAO_FOLDER | SFGAO_FILESYSANCESTOR | SFGAO_STORAGEANCESTOR | SFGAO_STORAGE); - if (SUCCEEDED(IShellFolder2_BindToObject(psf, pidl, NULL, &IID_IShellFolder, (void **)&child))) + if (dwAttributes & SFGAO_HASSUBFOLDER) { - if (IShellFolder_EnumObjects(child, NULL, SHCONTF_FOLDERS|SHCONTF_INCLUDEHIDDEN, &enum_ids) == S_OK) + if (SUCCEEDED(IShellFolder2_BindToObject(psf, pidl, NULL, &IID_IShellFolder, (void **)&child))) { - if (IEnumIDList_Skip(enum_ids, 1) != S_OK) - *pdwAttributes &= ~SFGAO_HASSUBFOLDER; - IEnumIDList_Release(enum_ids); + if (IShellFolder_EnumObjects(child, NULL, SHCONTF_FOLDERS|SHCONTF_INCLUDEHIDDEN, &enum_ids) == S_OK) + { + if (IEnumIDList_Skip(enum_ids, 1) != S_OK) + *pdwAttributes &= ~SFGAO_HASSUBFOLDER; + IEnumIDList_Release(enum_ids); + } + IShellFolder_Release(child); } - IShellFolder_Release(child); } } else -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10214
This merge request was approved by Elizabeth Figura. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10214
FWIW we do already have tests to confirm this; they just don't pass yet because the other flags aren't handled quite right either. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10214#note_130834
participants (3)
-
Elizabeth Figura (@zfigura) -
Tatsuyuki Ishi -
Tatsuyuki Ishi (@ishitatsuyuki)