Author: janderwald
Date: Thu Oct 11 14:13:05 2007
New Revision: 29492
URL:
http://svn.reactos.org/svn/reactos?rev=29492&view=rev
Log:
Jonathan Ernst <jonathan(a)ernstfamily.ch>
- Update the address of the Free Software Foundation.
Andrew Talbot <Andrew.Talbot(a)talbotville.com>
- Exclude unused headers.
Aric Stewart <aric(a)codeweavers.com>
- Update the debug functions to handle Unicode value pidl.
- Add _ILIsUnicode as a simple pidl test.
Michael Stefaniuc <mstefani(a)redhat.de>
- The Data1 member of the GUID struct needs to be an unsigned int too for Win64
compatibility.
Hans Leidekker <hans(a)it.vu.nl>
- Win64 printf format warning fixes.
Modified:
trunk/reactos/dll/win32/shell32/debughlp.c
trunk/reactos/dll/win32/shell32/debughlp.h
Modified: trunk/reactos/dll/win32/shell32/debughlp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/debughlp…
==============================================================================
--- trunk/reactos/dll/win32/shell32/debughlp.c (original)
+++ trunk/reactos/dll/win32/shell32/debughlp.c Thu Oct 11 14:13:05 2007
@@ -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"
@@ -104,6 +103,51 @@
}
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)
{
LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl);
@@ -126,6 +170,34 @@
}
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)
{
LPPIDLDATA pdata =_ILGetDataPointer(pidl);
@@ -147,6 +219,7 @@
void _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
{
LPSTR szSrc;
+ LPWSTR szSrcW;
GUID const * riid;
if (!pidl) return;
@@ -164,10 +237,17 @@
/* 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 @@
{
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];
-
- _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));
+ 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;
+
+ 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 @@
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 @@
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 @@
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" );
Modified: trunk/reactos/dll/win32/shell32/debughlp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/debughlp…
==============================================================================
--- trunk/reactos/dll/win32/shell32/debughlp.h (original)
+++ trunk/reactos/dll/win32/shell32/debughlp.h Thu Oct 11 14:13:05 2007
@@ -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