https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9276b3f1bf1e34606eaa9…
commit 9276b3f1bf1e34606eaa968efea705d6fc7fa452
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Sun Sep 5 21:07:30 2021 +0200
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Tue Sep 21 21:42:25 2021 +0200
[SHELL32] CFSFolder: Add fallback for failing shell extension
CORE-17673
---
dll/win32/shell32/folders/CFSFolder.cpp | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/dll/win32/shell32/folders/CFSFolder.cpp
b/dll/win32/shell32/folders/CFSFolder.cpp
index efdd2386d4b..f44a71f6b33 100644
--- a/dll/win32/shell32/folders/CFSFolder.cpp
+++ b/dll/win32/shell32/folders/CFSFolder.cpp
@@ -883,10 +883,26 @@ HRESULT WINAPI CFSFolder::BindToObject(
CLSID clsidFolder;
if (_ILIsFolder(pidl))
{
- clsidFolder = CLSID_ShellFSFolder;
-
if ((pData->uFileAttribs & (FILE_ATTRIBUTE_SYSTEM |
FILE_ATTRIBUTE_READONLY)) != 0)
- SHELL32_GetCLSIDForDirectory(pfti.szTargetParsingName, L"CLSID",
&clsidFolder);
+ {
+ hr = SHELL32_GetCLSIDForDirectory(pfti.szTargetParsingName,
L"CLSID", &clsidFolder);
+
+ if (SUCCEEDED(hr))
+ {
+ /* We got a GUID from a desktop.ini, let's try it */
+ hr = SHELL32_BindToSF(m_pidlRoot, &pfti, pidl, &clsidFolder,
riid, ppvOut);
+ if (SUCCEEDED(hr))
+ {
+ TRACE("-- returning (%p) %08x, (%s)\n", *ppvOut, hr,
wine_dbgstr_guid(&clsidFolder));
+ return hr;
+ }
+
+ /* Something went wrong, re-try it with a normal ShellFSFolder */
+ ERR("CFSFolder::BindToObject: %s failed to bind, using fallback
(0x%08x)\n", wine_dbgstr_guid(&clsidFolder), hr);
+ }
+ }
+ /* No system folder or the custom class failed */
+ clsidFolder = CLSID_ShellFSFolder;
}
else
{