shell32: Update the debug functions to handle Unicode value pidl.

Add _ILIsUnicode as a simple pidl test.
This commit is contained in:
Aric Stewart 2007-04-09 20:52:21 +09:00 committed by Alexandre Julliard
parent 3533be811c
commit c0db9e573e
3 changed files with 124 additions and 12 deletions

View File

@ -103,6 +103,51 @@ LPSTR _dbg_ILGetTextPointer(LPCITEMIDLIST pidl)
return NULL;
}
static
LPWSTR _dbg_ILGetTextPointerW(LPCITEMIDLIST pidl)
{
LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl);
if (pdata)
{
switch (pdata->type)
{
case PT_GUID:
case PT_SHELLEXT:
case PT_YAGUID:
return NULL;
case PT_DRIVE:
case PT_DRIVE1:
case PT_DRIVE2:
case PT_DRIVE3:
/* return (LPSTR)&(pdata->u.drive.szDriveName);*/
return NULL;
case PT_FOLDER:
case PT_FOLDER1:
case PT_VALUE:
case PT_IESPECIAL1:
case PT_IESPECIAL2:
/* return (LPSTR)&(pdata->u.file.szNames); */
return NULL;
case PT_WORKGRP:
case PT_COMP:
case PT_NETWORK:
case PT_NETPROVIDER:
case PT_SHARE:
/* return (LPSTR)&(pdata->u.network.szNames); */
return NULL;
case PT_VALUEW:
return (LPWSTR)&(pdata->u.file.szNames);
}
}
return NULL;
}
static
LPSTR _dbg_ILGetSTextPointer(LPCITEMIDLIST pidl)
{
@ -125,6 +170,34 @@ LPSTR _dbg_ILGetSTextPointer(LPCITEMIDLIST pidl)
return NULL;
}
static
LPWSTR _dbg_ILGetSTextPointerW(LPCITEMIDLIST pidl)
{
LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl);
if (pdata)
{
switch (pdata->type)
{
case PT_FOLDER:
case PT_VALUE:
case PT_IESPECIAL1:
case PT_IESPECIAL2:
/*return (LPSTR)(pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1); */
return NULL;
case PT_WORKGRP:
/* return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1); */
return NULL;
case PT_VALUEW:
return (LPWSTR)(pdata->u.file.szNames + lstrlenW ((LPWSTR)pdata->u.file.szNames) + 1);
}
}
return NULL;
}
static
IID* _dbg_ILGetGUIDPointer(LPCITEMIDLIST pidl)
{
@ -147,6 +220,7 @@ static
void _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
{
LPSTR szSrc;
LPWSTR szSrcW;
GUID const * riid;
if (!pidl) return;
@ -164,6 +238,13 @@ void _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
/* filesystem */
if (szOut) lstrcpynA(szOut, szSrc, uOutSize);
}
else if (( szSrcW = _dbg_ILGetTextPointerW(pidl) ))
{
CHAR tmp[MAX_PATH];
/* unicode filesystem */
WideCharToMultiByte(CP_ACP,0,szSrcW, -1, tmp, MAX_PATH, NULL, NULL);
if (szOut) lstrcpynA(szOut, tmp, uOutSize);
}
else if (( riid = _dbg_ILGetGUIDPointer(pidl) ))
{
if (szOut)
@ -194,20 +275,40 @@ void pdump (LPCITEMIDLIST pidl)
{
do
{
DWORD dwAttrib = 0;
LPPIDLDATA pData = _dbg_ILGetDataPointer(pidltemp);
DWORD type = pData ? pData->type : 0;
LPSTR szLongName = _dbg_ILGetTextPointer(pidltemp);
LPSTR szShortName = _dbg_ILGetSTextPointer(pidltemp);
char szName[MAX_PATH];
if (_ILIsUnicode(pidltemp))
{
DWORD dwAttrib = 0;
LPPIDLDATA pData = _dbg_ILGetDataPointer(pidltemp);
DWORD type = pData ? pData->type : 0;
LPWSTR szLongName = _dbg_ILGetTextPointerW(pidltemp);
LPWSTR szShortName = _dbg_ILGetSTextPointerW(pidltemp);
char szName[MAX_PATH];
_dbg_ILSimpleGetText(pidltemp, szName, MAX_PATH);
if ( pData && (PT_FOLDER == type || PT_VALUE == type) )
dwAttrib = pData->u.file.uFileAttribs;
_dbg_ILSimpleGetText(pidltemp, szName, MAX_PATH);
if ( pData && (PT_FOLDER == type || PT_VALUE == type) )
dwAttrib = pData->u.file.uFileAttribs;
MESSAGE ("[%p] size=%04u type=%x attr=0x%08x name=%s (%s,%s)\n",
pidltemp, pidltemp->mkid.cb, type, dwAttrib,
debugstr_a(szName), debugstr_a(szLongName), debugstr_a(szShortName));
MESSAGE ("[%p] size=%04u type=%x attr=0x%08x name=%s (%s,%s)\n",
pidltemp, pidltemp->mkid.cb, type, dwAttrib,
debugstr_a(szName), debugstr_w(szLongName), debugstr_w(szShortName));
}
else
{
DWORD dwAttrib = 0;
LPPIDLDATA pData = _dbg_ILGetDataPointer(pidltemp);
DWORD type = pData ? pData->type : 0;
LPSTR szLongName = _dbg_ILGetTextPointer(pidltemp);
LPSTR szShortName = _dbg_ILGetSTextPointer(pidltemp);
char szName[MAX_PATH];
_dbg_ILSimpleGetText(pidltemp, szName, MAX_PATH);
if ( pData && (PT_FOLDER == type || PT_VALUE == type) )
dwAttrib = pData->u.file.uFileAttribs;
MESSAGE ("[%p] size=%04u type=%x attr=0x%08x name=%s (%s,%s)\n",
pidltemp, pidltemp->mkid.cb, type, dwAttrib,
debugstr_a(szName), debugstr_a(szLongName), debugstr_a(szShortName));
}
pidltemp = _dbg_ILGetNext(pidltemp);

View File

@ -1642,6 +1642,7 @@ DWORD _ILGetDrive(LPCITEMIDLIST pidl,LPSTR pOut, UINT uSize)
* ### 2. section testing pidls ###
*
**************************************************************************
* _ILIsUnicode()
* _ILIsDesktop()
* _ILIsMyComputer()
* _ILIsSpecialFolder()
@ -1650,6 +1651,15 @@ DWORD _ILGetDrive(LPCITEMIDLIST pidl,LPSTR pOut, UINT uSize)
* _ILIsValue()
* _ILIsPidlSimple()
*/
BOOL _ILIsUnicode(LPCITEMIDLIST pidl)
{
LPPIDLDATA lpPData = _ILGetDataPointer(pidl);
TRACE("(%p)\n",pidl);
return (pidl && lpPData && PT_VALUEW == lpPData->type);
}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
{
TRACE("(%p)\n",pidl);

View File

@ -201,6 +201,7 @@ DWORD _ILGetDrive (LPCITEMIDLIST, LPSTR, UINT);
/*
* testing simple pidls
*/
BOOL _ILIsUnicode (LPCITEMIDLIST pidl);
BOOL _ILIsDesktop (LPCITEMIDLIST pidl);
BOOL _ILIsMyComputer (LPCITEMIDLIST pidl);
BOOL _ILIsDrive (LPCITEMIDLIST pidl);