diff --git a/dll/win32/shell32/debughlp.cpp b/dll/win32/shell32/debughlp.cpp index 6778418c7a8..f57d399789b 100644 --- a/dll/win32/shell32/debughlp.cpp +++ b/dll/win32/shell32/debughlp.cpp @@ -22,6 +22,17 @@ 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 LPITEMIDLIST _dbg_ILGetNext(LPCITEMIDLIST pidl) { @@ -97,6 +108,9 @@ LPWSTR _dbg_ILGetTextPointerW(LPCITEMIDLIST pidl) if (pdata) { + if (_dbg_ILGetFSType(pidl) & PT_FS_UNICODE_FLAG) + return (LPWSTR)&(pdata->u.file.szNames); + switch (pdata->type) { case PT_GUID: @@ -126,9 +140,6 @@ LPWSTR _dbg_ILGetTextPointerW(LPCITEMIDLIST pidl) case PT_SHARE: /* return (LPSTR)&(pdata->u.network.szNames); */ return NULL; - - case PT_VALUEW: - return (LPWSTR)&(pdata->u.file.szNames); } } return NULL; @@ -271,7 +282,7 @@ static void pdump_impl (LPCITEMIDLIST pidl) char 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; 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]; _dbg_ILSimpleGetText(pidltemp, szName, MAX_PATH); - if ( pData && (PT_FOLDER == type || PT_VALUE == type) ) + if (_dbg_ILGetFSType(pidltemp)) dwAttrib = pData->u.file.uFileAttribs; MESSAGE ("[%p] size=%04u type=%x attr=0x%08x name=%s (%s,%s)\n", diff --git a/dll/win32/shell32/wine/pidl.c b/dll/win32/shell32/wine/pidl.c index 2bca7cdd436..94d9a22387a 100644 --- a/dll/win32/shell32/wine/pidl.c +++ b/dll/win32/shell32/wine/pidl.c @@ -333,8 +333,10 @@ HRESULT WINAPI ILLoadFromStream (IStream * pStream, LPITEMIDLIST * ppPidl) if (*ppPidl && !pcheck(*ppPidl)) { WARN("Check failed\n"); +#ifndef __REACTOS__ /* We don't know all pidl formats, must allow loading unknown */ SHFree(*ppPidl); *ppPidl = NULL; +#endif } IStream_Release (pStream); @@ -2030,11 +2032,9 @@ DWORD _ILGetDrive(LPCITEMIDLIST pidl, LPWSTR pOut, UINT uSize) */ BOOL _ILIsUnicode(LPCITEMIDLIST pidl) { - LPPIDLDATA lpPData = _ILGetDataPointer(pidl); - TRACE("(%p)\n",pidl); - return (pidl && lpPData && PT_VALUEW == lpPData->type); + return (_ILGetFSType(pidl) & PT_FS_UNICODE_FLAG) != 0; } BOOL _ILIsDesktop(LPCITEMIDLIST pidl)