Add temporary fix for PeLoader
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 27 Jul 2006 05:07:48 +0000 (05:07 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 27 Jul 2006 05:07:48 +0000 (05:07 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1113 6f19259b-4bc3-4df7-8a09-765794883524

EdkModulePkg/Core/Pei/Image/Image.c

index 6b9a7eb..32f0fe6 100644 (file)
@@ -147,17 +147,20 @@ Returns:
     EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;\r
     UINT32                              NumberOfRvaAndSizes;\r
 \r
-    DosHeader = (EFI_IMAGE_DOS_HEADER *)Pe32Data;\r
-    if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {\r
-      //\r
-      // DOS image header is present, so read the PE header after the DOS image header\r
-      //\r
-      Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + (UINTN)((DosHeader->e_lfanew) & 0x0ffff));\r
-    } else {\r
-      //\r
-      // DOS image header is not present, so PE header is at the image base\r
-      //\r
-      Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;\r
+    Hdr.Pe32 = NULL;\r
+    if (TEImageHeader == NULL) {\r
+      DosHeader = (EFI_IMAGE_DOS_HEADER *)Pe32Data;\r
+      if (DosHeader->e_magic == EFI_IMAGE_DOS_SIGNATURE) {\r
+        //\r
+        // DOS image header is present, so read the PE header after the DOS image header\r
+        //\r
+        Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + (UINTN)((DosHeader->e_lfanew) & 0x0ffff));\r
+      } else {\r
+        //\r
+        // DOS image header is not present, so PE header is at the image base\r
+        //\r
+        Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data;\r
+      }\r
     }\r
 \r
     //\r