[SHELL32] ILLoadFromStream must allow loading unknown pidl formats (#7570)

This commit is contained in:
Whindmar Saksit 2024-12-25 20:32:08 +01:00 committed by GitHub
parent 3dd6e3103f
commit 7d75bfb449
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 8 deletions

View file

@ -22,6 +22,17 @@
WINE_DEFAULT_DEBUG_CHANNEL(pidl); WINE_DEFAULT_DEBUG_CHANNEL(pidl);
static inline BYTE _dbg_ILGetType(LPCITEMIDLIST pidl)
{
return pidl && pidl->mkid.cb >= 3 ? pidl->mkid.abID[0] : 0;
}
static inline BYTE _dbg_ILGetFSType(LPCITEMIDLIST pidl)
{
const BYTE type = _dbg_ILGetType(pidl);
return (type & PT_FOLDERTYPEMASK) == PT_FS ? type : 0;
}
static static
LPITEMIDLIST _dbg_ILGetNext(LPCITEMIDLIST pidl) LPITEMIDLIST _dbg_ILGetNext(LPCITEMIDLIST pidl)
{ {
@ -97,6 +108,9 @@ LPWSTR _dbg_ILGetTextPointerW(LPCITEMIDLIST pidl)
if (pdata) if (pdata)
{ {
if (_dbg_ILGetFSType(pidl) & PT_FS_UNICODE_FLAG)
return (LPWSTR)&(pdata->u.file.szNames);
switch (pdata->type) switch (pdata->type)
{ {
case PT_GUID: case PT_GUID:
@ -126,9 +140,6 @@ LPWSTR _dbg_ILGetTextPointerW(LPCITEMIDLIST pidl)
case PT_SHARE: case PT_SHARE:
/* return (LPSTR)&(pdata->u.network.szNames); */ /* return (LPSTR)&(pdata->u.network.szNames); */
return NULL; return NULL;
case PT_VALUEW:
return (LPWSTR)&(pdata->u.file.szNames);
} }
} }
return NULL; return NULL;
@ -271,7 +282,7 @@ static void pdump_impl (LPCITEMIDLIST pidl)
char szName[MAX_PATH]; char szName[MAX_PATH];
_dbg_ILSimpleGetText(pidltemp, szName, MAX_PATH); _dbg_ILSimpleGetText(pidltemp, szName, MAX_PATH);
if ( pData && (PT_FOLDER == type || PT_VALUE == type) ) if (_dbg_ILGetFSType(pidltemp))
dwAttrib = pData->u.file.uFileAttribs; dwAttrib = pData->u.file.uFileAttribs;
MESSAGE ("[%p] size=%04u type=%x attr=0x%08x name=%s (%s,%s)\n", MESSAGE ("[%p] size=%04u type=%x attr=0x%08x name=%s (%s,%s)\n",
@ -288,7 +299,7 @@ static void pdump_impl (LPCITEMIDLIST pidl)
char szName[MAX_PATH]; char szName[MAX_PATH];
_dbg_ILSimpleGetText(pidltemp, szName, MAX_PATH); _dbg_ILSimpleGetText(pidltemp, szName, MAX_PATH);
if ( pData && (PT_FOLDER == type || PT_VALUE == type) ) if (_dbg_ILGetFSType(pidltemp))
dwAttrib = pData->u.file.uFileAttribs; dwAttrib = pData->u.file.uFileAttribs;
MESSAGE ("[%p] size=%04u type=%x attr=0x%08x name=%s (%s,%s)\n", MESSAGE ("[%p] size=%04u type=%x attr=0x%08x name=%s (%s,%s)\n",

View file

@ -333,8 +333,10 @@ HRESULT WINAPI ILLoadFromStream (IStream * pStream, LPITEMIDLIST * ppPidl)
if (*ppPidl && !pcheck(*ppPidl)) if (*ppPidl && !pcheck(*ppPidl))
{ {
WARN("Check failed\n"); WARN("Check failed\n");
#ifndef __REACTOS__ /* We don't know all pidl formats, must allow loading unknown */
SHFree(*ppPidl); SHFree(*ppPidl);
*ppPidl = NULL; *ppPidl = NULL;
#endif
} }
IStream_Release (pStream); IStream_Release (pStream);
@ -2030,11 +2032,9 @@ DWORD _ILGetDrive(LPCITEMIDLIST pidl, LPWSTR pOut, UINT uSize)
*/ */
BOOL _ILIsUnicode(LPCITEMIDLIST pidl) BOOL _ILIsUnicode(LPCITEMIDLIST pidl)
{ {
LPPIDLDATA lpPData = _ILGetDataPointer(pidl);
TRACE("(%p)\n",pidl); TRACE("(%p)\n",pidl);
return (pidl && lpPData && PT_VALUEW == lpPData->type); return (_ILGetFSType(pidl) & PT_FS_UNICODE_FLAG) != 0;
} }
BOOL _ILIsDesktop(LPCITEMIDLIST pidl) BOOL _ILIsDesktop(LPCITEMIDLIST pidl)