- more checks for valid pidl formats
This commit is contained in:
parent
55c0bcaf5c
commit
3ea18db36d
|
@ -195,7 +195,7 @@ static HRESULT WINAPI IExtractIconA_fnGetIconLocation(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE (shell,"-- %s %x\n", debugstr_a(szIconFile), *piIndex);
|
TRACE (shell,"-- %s %x\n", (ret==NOERROR)?debugstr_a(szIconFile):"[error]", *piIndex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
|
@ -694,11 +694,13 @@ BOOL PidlToSicIndex (IShellFolder * sh, LPITEMIDLIST pidl, BOOL bBigIcon, UINT *
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
UINT dwFlags = 0;
|
UINT dwFlags = 0;
|
||||||
|
|
||||||
|
TRACE(shell,"sf=%p pidl=%p\n", sh, pidl);
|
||||||
|
|
||||||
if (SUCCEEDED (IShellFolder_GetUIObjectOf(sh, 0, 1, &pidl, &IID_IExtractIconA, 0, (void **)&ei)))
|
if (SUCCEEDED (IShellFolder_GetUIObjectOf(sh, 0, 1, &pidl, &IID_IExtractIconA, 0, (void **)&ei)))
|
||||||
{
|
{
|
||||||
if (SUCCEEDED (IExtractIconA_GetIconLocation(ei, 0, szIconFile, MAX_PATH, &iSourceIndex, &dwFlags)))
|
if (NOERROR==IExtractIconA_GetIconLocation(ei, 0, szIconFile, MAX_PATH, &iSourceIndex, &dwFlags))
|
||||||
{ *pIndex = SIC_GetIconIndex(szIconFile, iSourceIndex);
|
{ *pIndex = SIC_GetIconIndex(szIconFile, iSourceIndex);
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
IExtractIconA_Release(ei);
|
IExtractIconA_Release(ei);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,45 @@ void pdump (LPCITEMIDLIST pidl)
|
||||||
TRACE(pidl,"empty pidl (Desktop)\n");
|
TRACE(pidl,"empty pidl (Desktop)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL pcheck (LPCITEMIDLIST pidl)
|
||||||
|
{ DWORD type, ret=TRUE;
|
||||||
|
|
||||||
|
LPITEMIDLIST pidltemp = pidl;
|
||||||
|
|
||||||
|
if (pidltemp && pidltemp->mkid.cb)
|
||||||
|
{ do
|
||||||
|
{ type = _ILGetDataPointer(pidltemp)->type;
|
||||||
|
switch (type)
|
||||||
|
{ case PT_DESKTOP:
|
||||||
|
case PT_MYCOMP:
|
||||||
|
case PT_SPECIAL:
|
||||||
|
case PT_DRIVE:
|
||||||
|
case PT_FOLDER:
|
||||||
|
case PT_VALUE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
char szTemp[100]; /* 3*32 + 3 + 1 */
|
||||||
|
int i;
|
||||||
|
for ( i = 0; i < pidltemp->mkid.cb; i++)
|
||||||
|
{
|
||||||
|
sprintf (&(szTemp[i*3]),"%02x ", ((LPBYTE)pidltemp)[i]);
|
||||||
|
if (i>=31)
|
||||||
|
{
|
||||||
|
sprintf (&(szTemp[i*3+3]),"...");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ERR (pidl,"unknown IDLIST type size=%u type=%lx\n%s\n",pidltemp->mkid.cb,type, szTemp);
|
||||||
|
ret = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pidltemp = ILGetNext(pidltemp);
|
||||||
|
} while (pidltemp->mkid.cb);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* ILGetDisplayName [SHELL32.15]
|
* ILGetDisplayName [SHELL32.15]
|
||||||
*/
|
*/
|
||||||
|
@ -170,6 +209,13 @@ HRESULT WINAPI ILLoadFromStream (IStream * pStream, LPITEMIDLIST * ppPidl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* we are not jet fully compatible */
|
||||||
|
if (!pcheck(*ppPidl))
|
||||||
|
{ SHFree(*ppPidl);
|
||||||
|
*ppPidl = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
IStream_Release (pStream);
|
IStream_Release (pStream);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -274,6 +320,11 @@ BOOL WINAPI ILIsEqual(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
|
||||||
|
|
||||||
TRACE(pidl,"pidl1=%p pidl2=%p\n",pidl1, pidl2);
|
TRACE(pidl,"pidl1=%p pidl2=%p\n",pidl1, pidl2);
|
||||||
|
|
||||||
|
/* explorer reads from registry directly (StreamMRU),
|
||||||
|
so we can only check here */
|
||||||
|
if ((!pcheck (pidl1)) || (!pcheck (pidl2)))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
pdump (pidl1);
|
pdump (pidl1);
|
||||||
pdump (pidl2);
|
pdump (pidl2);
|
||||||
|
|
||||||
|
|
|
@ -121,4 +121,5 @@ LPSTR WINAPI _ILGetTextPointer(PIDLTYPE type, LPPIDLDATA pidldata);
|
||||||
LPSTR WINAPI _ILGetSTextPointer(PIDLTYPE type, LPPIDLDATA pidldata);
|
LPSTR WINAPI _ILGetSTextPointer(PIDLTYPE type, LPPIDLDATA pidldata);
|
||||||
|
|
||||||
void pdump (LPCITEMIDLIST pidl);
|
void pdump (LPCITEMIDLIST pidl);
|
||||||
|
BOOL pcheck (LPCITEMIDLIST pidl);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -74,7 +74,7 @@ HRESULT WINAPI StrRetToStrN (LPVOID dest, DWORD len, LPSTRRET src, LPITEMIDLIST
|
||||||
#define INVALID_INDEX -1
|
#define INVALID_INDEX -1
|
||||||
BOOL SIC_Initialize(void);
|
BOOL SIC_Initialize(void);
|
||||||
void SIC_Destroy(void);
|
void SIC_Destroy(void);
|
||||||
/*INT32 SIC_GetIconIndex (LPCSTR sSourceFile, INT32 dwSourceIndex );*/
|
BOOL PidlToSicIndex (IShellFolder * sh, LPITEMIDLIST pidl, BOOL bBigIcon, UINT * pIndex);
|
||||||
|
|
||||||
/* Classes Root */
|
/* Classes Root */
|
||||||
BOOL HCR_MapTypeToValue ( LPCSTR szExtension, LPSTR szFileType, DWORD len);
|
BOOL HCR_MapTypeToValue ( LPCSTR szExtension, LPSTR szFileType, DWORD len);
|
||||||
|
|
|
@ -209,6 +209,9 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFile
|
||||||
pdump (&pImage->Pidl);
|
pdump (&pImage->Pidl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!pcheck (&pImage->Pidl))
|
||||||
|
goto end_3;
|
||||||
|
|
||||||
This->pPidl = ILClone (&pImage->Pidl);
|
This->pPidl = ILClone (&pImage->Pidl);
|
||||||
|
|
||||||
_ILGetPidlPath(&pImage->Pidl, sTemp, 512);
|
_ILGetPidlPath(&pImage->Pidl, sTemp, 512);
|
||||||
|
|
Loading…
Reference in New Issue