=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: winedump: Add and use IMAGE_DELAYLOAD_DESCRIPTOR.

Alexandre Julliard julliard at winehq.org
Mon Sep 9 16:08:08 CDT 2013


Module: wine
Branch: master
Commit: d9a6deff4b66277e51eef8e42271e7d113a8a2f1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d9a6deff4b66277e51eef8e42271e7d113a8a2f1

Author: André Hentschel <nerv at dawncrow.de>
Date:   Thu Aug 22 18:58:59 2013 +0200

winedump: Add and use IMAGE_DELAYLOAD_DESCRIPTOR.

---

 include/winnt.h     |   22 ++++++++++++++++++++++
 tools/winedump/pe.c |   26 ++++++++------------------
 2 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/include/winnt.h b/include/winnt.h
index 1f71423..be55d9c 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -3052,6 +3052,28 @@ typedef struct _IMAGE_RELOCATION
 
 #define IMAGE_SIZEOF_RELOCATION 10
 
+typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR
+{
+    union
+    {
+        DWORD AllAttributes;
+        struct
+        {
+            DWORD RvaBased:1;
+            DWORD ReservedAttributes:31;
+        } DUMMYSTRUCTNAME;
+    } Attributes;
+
+    DWORD DllNameRVA;
+    DWORD ModuleHandleRVA;
+    DWORD ImportAddressTableRVA;
+    DWORD ImportNameTableRVA;
+    DWORD BoundImportAddressTableRVA;
+    DWORD UnloadInformationTableRVA;
+    DWORD TimeDateStamp;
+} IMAGE_DELAYLOAD_DESCRIPTOR, *PIMAGE_DELAYLOAD_DESCRIPTOR;
+typedef const IMAGE_DELAYLOAD_DESCRIPTOR *PCIMAGE_DELAYLOAD_DESCRIPTOR;
+
 /* generic relocation types */
 #define IMAGE_REL_BASED_ABSOLUTE 		0
 #define IMAGE_REL_BASED_HIGH			1
diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c
index c26ae69..6721898 100644
--- a/tools/winedump/pe.c
+++ b/tools/winedump/pe.c
@@ -864,17 +864,7 @@ static	void	dump_dir_imported_functions(void)
 static void dump_dir_delay_imported_functions(void)
 {
     unsigned  directorySize;
-    const struct ImgDelayDescr
-    {
-        DWORD grAttrs;
-        DWORD szName;
-        DWORD phmod;
-        DWORD pIAT;
-        DWORD pINT;
-        DWORD pBoundIAT;
-        DWORD pUnloadIAT;
-        DWORD dwTimeStamp;
-    } *importDesc = get_dir_and_size(IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT, &directorySize);
+    const IMAGE_DELAYLOAD_DESCRIPTOR *importDesc = get_dir_and_size(IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT, &directorySize);
 
     if (!importDesc) return;
 
@@ -883,19 +873,19 @@ static void dump_dir_delay_imported_functions(void)
     for (;;)
     {
         const IMAGE_THUNK_DATA32*       il;
-        int                             offset = (importDesc->grAttrs & 1) ? 0 : PE_nt_headers->OptionalHeader.ImageBase;
+        int                             offset = (importDesc->Attributes.AllAttributes & 1) ? 0 : PE_nt_headers->OptionalHeader.ImageBase;
 
-        if (!importDesc->szName || !importDesc->pIAT || !importDesc->pINT) break;
+        if (!importDesc->DllNameRVA || !importDesc->ImportAddressTableRVA || !importDesc->ImportNameTableRVA) break;
 
-        printf("  grAttrs %08x offset %08lx %s\n", importDesc->grAttrs, Offset(importDesc),
-               (const char *)RVA(importDesc->szName - offset, sizeof(DWORD)));
-        printf("  Hint/Name Table: %08x\n", importDesc->pINT);
+        printf("  grAttrs %08x offset %08lx %s\n", importDesc->Attributes.AllAttributes, Offset(importDesc),
+               (const char *)RVA(importDesc->DllNameRVA - offset, sizeof(DWORD)));
+        printf("  Hint/Name Table: %08x\n", importDesc->ImportNameTableRVA);
         printf("  TimeDateStamp:   %08X (%s)\n",
-               importDesc->dwTimeStamp, get_time_str(importDesc->dwTimeStamp));
+               importDesc->TimeDateStamp, get_time_str(importDesc->TimeDateStamp));
 
         printf("  Ordn  Name\n");
 
-        il = RVA(importDesc->pINT - offset, sizeof(DWORD));
+        il = RVA(importDesc->ImportNameTableRVA - offset, sizeof(DWORD));
 
         if (!il)
             printf("Can't grab thunk data, going to next imported DLL\n");




More information about the wine-cvs mailing list