WINEDUMP: dump the pidl of a lnk file

Mike McCormack mike at codeweavers.com
Fri Feb 25 08:42:27 CST 2005


ChangeLog:
* dump the pidl of a lnk file
-------------- next part --------------
Index: tools/winedump/lnk.c
===================================================================
RCS file: /home/wine/wine/tools/winedump/lnk.c,v
retrieving revision 1.4
diff -u -p -r1.4 lnk.c
--- tools/winedump/lnk.c	22 Feb 2005 14:52:35 -0000	1.4
+++ tools/winedump/lnk.c	25 Feb 2005 14:41:25 -0000
@@ -191,7 +191,8 @@ static lnk_string* load_string(int fd, i
 
 static int dump_pidl(int fd)
 {
-    void *pidl;
+    lnk_string *pidl;
+    int i, n = 0, sz = 0;
 
     pidl = load_pidl(fd);
     if (!pidl)
@@ -200,6 +201,26 @@ static int dump_pidl(int fd)
     printf("PIDL\n");
     printf("----\n\n");
 
+    while(sz<pidl->size)
+    {
+        lnk_string *segment = (lnk_string*) &pidl->str.a[sz];
+
+        if(!segment->size)
+            break;
+        sz+=segment->size;
+        if(sz>pidl->size)
+        {
+            printf("bad pidl\n");
+            break;
+        }
+        n++;
+        printf("segment %d (%2d bytes) : ",n,segment->size);
+        for(i=0; i<segment->size; i++)
+            printf("%02x ",segment->str.a[i]);
+        printf("\n");
+    }
+    printf("\n");
+
     free(pidl);
 
     return 0;
@@ -257,7 +278,7 @@ static int dump_location(int fd)
         printf("size %ld  type %ld  serial %08lx  label %ld ",
                vol->dwSize, vol->dwType, vol->dwVolSerial, vol->dwVolLabelOfs);
         if(vol->dwVolLabelOfs)
-            printf("(\"%s\")", &p[vol->dwVolLabelOfs]);
+            printf("(\"%s\")", &p[loc->dwVolTableOfs + vol->dwVolLabelOfs]);
     }
     printf("\n");
 


More information about the wine-patches mailing list