Jonathan Ernst <jonathan@ernstfamily.ch>

- Update the address of the Free Software Foundation.
Andrew Talbot <Andrew.Talbot@talbotville.com>
- Exclude unused headers.
Aric Stewart <aric@codeweavers.com>
- Update the debug functions to handle Unicode value pidl.
- Add _ILIsUnicode as a simple pidl test.
Michael Stefaniuc <mstefani@redhat.de>
- The Data1 member of the GUID struct needs to be an unsigned int too for Win64 compatibility.
Hans Leidekker <hans@it.vu.nl>
- Win64 printf format warning fixes.

svn path=/trunk/; revision=29492
This commit is contained in:
Johannes Anderwald 2007-10-11 10:13:05 +00:00
parent a262dfe3cb
commit 7d51d9fd56
2 changed files with 120 additions and 19 deletions

View file

@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <ctype.h>
@ -25,7 +25,6 @@
#include "windef.h"
#include "wingdi.h"
#include "pidl.h"
#include "shlguid.h"
#include "shldisp.h"
#include "wine/debug.h"
#include "debughlp.h"
@ -103,6 +102,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 +169,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 +219,7 @@ static
void _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
{
LPSTR szSrc;
LPWSTR szSrcW;
GUID const * riid;
if (!pidl) return;
@ -164,10 +237,17 @@ 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)
sprintf( szOut, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
sprintf( szOut, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
riid->Data1, riid->Data2, riid->Data3,
riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] );
@ -194,20 +274,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=%lx attr=0x%08lx 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);
@ -224,7 +324,8 @@ void pdump (LPCITEMIDLIST pidl)
static void dump_pidl_hex( LPCITEMIDLIST pidl )
{
const unsigned char *p = (const unsigned char *)pidl;
const int max_bytes = 0x80, max_line = 0x10;
const int max_bytes = 0x80;
#define max_line 0x10
char szHex[max_line*3+1], szAscii[max_line+1];
int i, n;
@ -275,7 +376,7 @@ BOOL pcheck( LPCITEMIDLIST pidl )
case PT_SHARE:
break;
default:
ERR("unknown IDLIST %p [%p] size=%u type=%lx\n",
ERR("unknown IDLIST %p [%p] size=%u type=%x\n",
pidl, pidltemp, pidltemp->mkid.cb,type );
dump_pidl_hex( pidltemp );
return FALSE;
@ -329,7 +430,7 @@ const char * shdebugstr_guid( const struct _GUID *id )
name = clsidbuf;
}
return wine_dbg_sprintf( "\n\t{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x} (%s)",
return wine_dbg_sprintf( "\n\t{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x} (%s)",
id->Data1, id->Data2, id->Data3,
id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7], name ? name : "unknown" );

View file

@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_SHELL32_DEBUGHLP_H