Commit in reactos on MAIN
include/wine/shlguid.h+2-11.5 -> 1.6
w32api/include/shlguid.h+11.3 -> 1.4
lib/shell32/cpanelfolder.c+2-21.5 -> 1.6
           /debughlp.c+2-41.3 -> 1.4
           /pidl.c+42-351.23 -> 1.24
           /pidl.h+36-241.8 -> 1.9
+85-66
6 modified files
Juan Lang <juan_lang@yahoo.com>
- Correct some PIDL types and eliminate some magic numbers in PIDL
  allocation; correct a copy-pasto from a previous patch.

reactos/include/wine
shlguid.h 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- shlguid.h	20 Sep 2004 19:47:13 -0000	1.5
+++ shlguid.h	21 Sep 2004 19:34:21 -0000	1.6
@@ -1,4 +1,4 @@
-/* $Id: shlguid.h,v 1.5 2004/09/20 19:47:13 gvg Exp $
+/* $Id: shlguid.h,v 1.6 2004/09/21 19:34:21 gvg Exp $
  *
  * Compatibility header
  *
@@ -43,6 +43,7 @@
 DEFINE_GUID(CLSID_ShellFSFolder, 0xF3364BA0, 0x65B9, 0x11CE, 0xA9, 0xBA, 0x00, 0xAA, 0x00, 0x4A, 0xE8, 0x37);
 DEFINE_GUID(CLSID_RecycleBin, 0x645FF040, 0x5081, 0x101B, 0x9F, 0x08, 0x00, 0xAA, 0x00, 0x2F, 0x95, 0x4E);
 DEFINE_GUID(CLSID_ControlPanel, 0x21EC2020, 0x3AEA, 0x1069, 0xA2, 0xDD, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
+DEFINE_GUID(CLSID_Printers, 0x2227A280, 0x3AEA, 0x1069, 0xA2, 0xDE, 0x08, 0x00, 0x2B, 0x30, 0x30, 0x9D);
 
 DEFINE_GUID(IID_IQueryAssociations, 0xc46ca590, 0x3c3f, 0x11d2, 0xbe, 0xe6, 0x00, 0x00, 0xf8, 0x05, 0xca, 0x57);
 

reactos/w32api/include
shlguid.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- shlguid.h	20 Sep 2004 19:47:14 -0000	1.3
+++ shlguid.h	21 Sep 2004 19:34:21 -0000	1.4
@@ -17,6 +17,7 @@
 extern const GUID CLSID_NetworkPlaces;
 extern const GUID CLSID_RecycleBin;
 extern const GUID CLSID_ShellFSFolder;
+extern const GUID CLSID_Printers;
 extern const GUID FMTID_Intshcut;
 extern const GUID FMTID_InternetSite;
 extern const GUID CGID_Explorer;

reactos/lib/shell32
cpanelfolder.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- cpanelfolder.c	20 Sep 2004 09:18:52 -0000	1.5
+++ cpanelfolder.c	21 Sep 2004 19:34:21 -0000	1.6
@@ -238,7 +238,7 @@
     int size = size0;
     int l;
 
-    tmp.type = 0;
+    tmp.type = PT_CPLAPPLET;
     tmp.u.cpanel.dummy = 0;
     tmp.u.cpanel.iconIdx = iconIdx;
 
@@ -280,7 +280,7 @@
 {
     LPPIDLDATA pdata = _ILGetDataPointer(pidl);
 
-    if (pdata && pdata->type==0)
+    if (pdata && pdata->type==PT_CPLAPPLET)
         return (PIDLCPanelStruct*)&(pdata->u.cpanel);
 
     return NULL;

reactos/lib/shell32
debughlp.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- debughlp.c	20 Sep 2004 19:47:13 -0000	1.3
+++ debughlp.c	21 Sep 2004 19:34:21 -0000	1.4
@@ -201,9 +201,7 @@
 	      char szName[MAX_PATH];
 
 	      _dbg_ILSimpleGetText(pidltemp, szName, MAX_PATH);
-	      if( PT_FOLDER == type)
-	        dwAttrib = pData->u.folder.uFileAttribs;
-	      else if( PT_VALUE == type)
+	      if( 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",
@@ -230,7 +228,7 @@
         { do
           { type   = _dbg_ILGetDataPointer(pidltemp)->type;
             switch (type)
-	    { case PT_DESKTOP:
+	    { case PT_CPLAPPLET:
 	      case PT_GUID:
 	      case PT_SHELLEXT:
 	      case PT_DRIVE:

reactos/lib/shell32
pidl.c 1.23 -> 1.24
diff -u -r1.23 -r1.24
--- pidl.c	20 Sep 2004 17:47:49 -0000	1.23
+++ pidl.c	21 Sep 2004 19:34:21 -0000	1.24
@@ -1440,9 +1440,38 @@
  *
  *************************************************************************
  */
+LPITEMIDLIST _ILAlloc(PIDLTYPE type, size_t size)
+{
+    LPITEMIDLIST pidlOut = NULL;
+
+    if((pidlOut = SHAlloc(size + 5)))
+    {
+        LPPIDLDATA pData;
+        LPITEMIDLIST pidlNext;
+
+        ZeroMemory(pidlOut, size + 5);
+        pidlOut->mkid.cb = size + 3;
+
+        if ((pData = _ILGetDataPointer(pidlOut)))
+            pData->type = type;
+
+        if ((pidlNext = ILGetNext(pidlOut)))
+            pidlNext->mkid.cb = 0x00;
+        TRACE("-- (pidl=%p, size=%u)\n", pidlOut, size);
+    }
+
+    return pidlOut;
+}
+
 LPITEMIDLIST _ILCreateDesktop()
-{	TRACE("()\n");
-	return _ILCreateWithTypeAndSize(PT_DESKTOP, 0);
+{
+    LPITEMIDLIST ret;
+
+    TRACE("()\n");
+    ret = SHAlloc(2);
+    if (ret)
+        ret->mkid.cb = 0;
+    return ret;
 }
 
 LPITEMIDLIST _ILCreateMyComputer()
@@ -1481,7 +1510,7 @@
     TRACE("()\n");
     if (parent)
     {
-        LPITEMIDLIST printers = _ILCreateGuid(PT_GUID, &CLSID_ControlPanel);
+        LPITEMIDLIST printers = _ILCreateGuid(PT_GUID, &CLSID_Printers);
 
         if (printers)
         {
@@ -1509,7 +1538,7 @@
 
     if (type == PT_SHELLEXT || type == PT_GUID)
     {
-        pidlOut = _ILCreateWithTypeAndSize(type, 2 + 2 + sizeof(GUID));
+        pidlOut = _ILAlloc(type, sizeof(GUIDStruct));
         if (pidlOut)
         {
             LPPIDLDATA pData = _ILGetDataPointer(pidlOut);
@@ -1539,30 +1568,11 @@
 	return _ILCreateGuid(PT_GUID, &iid);
 }
 
-LPITEMIDLIST _ILCreateWithTypeAndSize(PIDLTYPE type, UINT size)
-{
-    LPITEMIDLIST pidlOut = NULL, pidlTemp = NULL;
-    LPPIDLDATA   pData;
-
-    if(!(pidlOut = SHAlloc(size + 2))) return NULL;
-    ZeroMemory(pidlOut, size + 2);
-    pidlOut->mkid.cb = size;
-
-    if ((pData = _ILGetDataPointer(pidlOut)))
-        pData->type = type;
-
-    if ((pidlTemp = ILGetNext(pidlOut)))
-        pidlTemp->mkid.cb = 0x00;
-
-    TRACE("-- (pidl=%p, size=%u)\n", pidlOut, size);
-    return pidlOut;
-}
-
 LPITEMIDLIST _ILCreateFromFindDataA(WIN32_FIND_DATAA * stffile )
 {
     char	buff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */
     char *	pbuff = buff;
-    ULONG	len, len1;
+    size_t	len, len1;
     LPITEMIDLIST pidl;
     PIDLTYPE type;
 
@@ -1581,8 +1591,10 @@
 
     type = (stffile->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? PT_FOLDER : 
      PT_VALUE;
-    /* FIXME: magic #s! */
-    if ((pidl = _ILCreateWithTypeAndSize(type, 2 + 12 + len + len1)))
+    /* FileStruct already has one byte for the first name, so use len - 1 in
+     * size calculation
+     */
+    if ((pidl = _ILAlloc(type, sizeof(FileStruct) + (len - 1) + len1)))
     {
         LPPIDLDATA pData;
         LPSTR pszDest;
@@ -1591,9 +1603,9 @@
         if ((pData = _ILGetDataPointer(pidl)))
         {
             pData->type = type;
-            FileTimeToDosDateTime(&(stffile->ftLastWriteTime),&pData->u.folder.uFileDate,&pData->u.folder.uFileTime);
-            pData->u.folder.dwFileSize = stffile->nFileSizeLow;
-            pData->u.folder.uFileAttribs = (WORD)stffile->dwFileAttributes;
+            FileTimeToDosDateTime(&(stffile->ftLastWriteTime),&pData->u.file.uFileDate,&pData->u.file.uFileTime);
+            pData->u.file.dwFileSize = stffile->nFileSizeLow;
+            pData->u.file.uFileAttribs = (WORD)stffile->dwFileAttributes;
         }
         if ((pszDest = _ILGetTextPointer(pidl)))
         {
@@ -1632,8 +1644,7 @@
     sTemp[3]=0x00;
     TRACE("(%s)\n",debugstr_w(sTemp));
 
-    /* FIXME: magic #s! */
-    if ((pidlOut = _ILCreateWithTypeAndSize(PT_DRIVE, 25)))
+    if ((pidlOut = _ILAlloc(PT_DRIVE, sizeof(DriveStruct))))
     {
         LPSTR pszDest;
 
@@ -1973,8 +1984,6 @@
     switch (pdata->type)
     {
         case PT_FOLDER:
-            DosDateTimeToFileTime(pdata->u.folder.uFileDate, pdata->u.folder.uFileTime, pFt);
-            break;
         case PT_VALUE:
             DosDateTimeToFileTime(pdata->u.file.uFileDate, pdata->u.file.uFileTime, pFt);
             break;
@@ -2132,8 +2141,6 @@
 	switch(pData->type)
 	{
 	  case PT_FOLDER:
-	    wAttrib = pData->u.folder.uFileAttribs;
-	    break;
 	  case PT_VALUE:
 	    wAttrib = pData->u.file.uFileAttribs;
 	    break;

reactos/lib/shell32
pidl.h 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- pidl.h	20 Sep 2004 17:47:49 -0000	1.8
+++ pidl.h	21 Sep 2004 19:34:21 -0000	1.9
@@ -2,6 +2,7 @@
  * internal pidl functions
  *
  * Copyright 1998 Juergen Schmied
+ * Copyright 2004 Juan Lang
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -85,7 +86,7 @@
 *		GUID	871C5380-42A0-1069-A2EA-08002B30309D
 */
 
-#define PT_DESKTOP	0x00 /* internal */
+#define PT_CPLAPPLET	0x00
 #define PT_GUID		0x1F
 #define PT_DRIVE	0x23
 #define PT_DRIVE2	0x25
@@ -116,29 +117,37 @@
     CHAR szName[1];		/*10*/ /* terminated by 0x00, followed by display name and comment string */
 } PIDLCPanelStruct;
 
+typedef struct tagGUIDStruct
+{
+    BYTE dummy; /* offset 01 is unknown */
+    GUID guid;  /* offset 02 */
+} GUIDStruct;
+
+typedef struct tagDriveStruct
+{
+    CHAR szDriveName[20];	/*01*/
+    WORD unknown;		/*21*/
+} DriveStruct;
+
+typedef struct tagFileStruct
+{
+    BYTE dummy;			/*01 is 0x00 for files or dirs */
+    DWORD dwFileSize;		/*02*/
+    WORD uFileDate;		/*06*/
+    WORD uFileTime;		/*08*/
+    WORD uFileAttribs;		/*10*/
+    CHAR szNames[1];		/*12*/
+    /* Here are coming two strings. The first is the long name.
+    The second the dos name when needed or just 0x00 */
+} FileStruct;
+
 typedef struct tagPIDLDATA
 {	PIDLTYPE type;			/*00*/
 	union
-	{ struct
-	  { BYTE dummy;			/*01*/
-	    GUID guid;			/*02*/
-	    BYTE dummy1;		/*18*/
-	  } guid;
-	  struct
-	  { CHAR szDriveName[20];	/*01*/
-	    DWORD dwUnknown;		/*21*/
-	    /* the drive seems to be 25 bytes every time */
-	  } drive;
-	  struct
-	  { BYTE dummy;			/*01 is 0x00 for files or dirs */
-	    DWORD dwFileSize;		/*02*/
-	    WORD uFileDate;		/*06*/
-	    WORD uFileTime;		/*08*/
-	    WORD uFileAttribs;		/*10*/
-	    CHAR szNames[1];		/*12*/
-	    /* Here are coming two strings. The first is the long name.
-	    The second the dos name when needed or just 0x00 */
-	  } file, folder, generic;
+	{
+	  struct tagGUIDStruct guid;
+	  struct tagDriveStruct drive;
+	  struct tagFileStruct file;
 	  struct
 	  { WORD dummy;		/*01*/
 	    CHAR szNames[1];	/*03*/
@@ -183,10 +192,13 @@
  * simple pidls
  */
 
-/* Basic PIDL constructor.  Allocates size + 2 bytes (to include space for the
- * NULL PIDL terminator), and sets type to type.
+/* Basic PIDL constructor.  Allocates size + 5 bytes, where:
+ * - two bytes are SHITEMID.cb
+ * - one byte is PIDLDATA.type
+ * - two bytes are the NULL PIDL terminator
+ * Sets type of the returned PIDL to type.
  */
-LPITEMIDLIST	_ILCreateWithTypeAndSize(PIDLTYPE type, UINT size);
+LPITEMIDLIST	_ILAlloc(PIDLTYPE type, size_t size);
 
 /* Creates a PIDL with guid format and type type, which must be either PT_GUID
  * or PT_SHELLEXT.
CVSspam 0.2.8