X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FBasePeCoffGetEntryPointLib%2FPeCoffGetEntryPoint.c;fp=MdePkg%2FLibrary%2FBasePeCoffGetEntryPointLib%2FPeCoffGetEntryPoint.c;h=82d67e057a19f99fdaa6be51e54eec49fb4432d1;hp=36370ba4f71f458c075a797631467eeb3fd9e46d;hb=afa223265a8c8c8e7e57654b22927778d1fb599a;hpb=bb347ec2750f416da929f9995b1eb6b3fbe77cf7 diff --git a/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c index 36370ba4f7..82d67e057a 100644 --- a/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c +++ b/MdePkg/Library/BasePeCoffGetEntryPointLib/PeCoffGetEntryPoint.c @@ -1,7 +1,7 @@ /** @file - Tiano PE/COFF loader. - - Copyright (c) 2006 - 2007, Intel Corporation
+ Provides the services to get the entry point to a PE/COFF image that has either been + loaded into memory or is executing at it¡¯s linked address + Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -15,7 +15,6 @@ #include - #include #include @@ -52,7 +51,7 @@ PeCoffLoaderGetEntryPoint ( ASSERT (EntryPoint != NULL); DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data; - if (EFI_IMAGE_DOS_SIGNATURE == DosHdr->e_magic) { + if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) { // // DOS image header is present, so read the PE header after the DOS image header. // @@ -104,7 +103,7 @@ PeCoffLoaderGetMachineType ( ASSERT (Pe32Data != NULL); DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data; - if (EFI_IMAGE_DOS_SIGNATURE == DosHdr->e_magic) { + if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) { // // DOS image header is present, so read the PE header after the DOS image header. // @@ -116,9 +115,9 @@ PeCoffLoaderGetMachineType ( Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data; } - if (EFI_TE_IMAGE_HEADER_SIGNATURE == Hdr.Te->Signature) { + if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) { return Hdr.Te->Machine; - } else if (EFI_IMAGE_NT_SIGNATURE == Hdr.Pe32->Signature) { + } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) { return Hdr.Pe32->FileHeader.Machine; } @@ -168,7 +167,7 @@ PeCoffLoaderGetPdbPointer ( NumberOfRvaAndSizes = 0; DosHdr = (EFI_IMAGE_DOS_HEADER *)Pe32Data; - if (EFI_IMAGE_DOS_SIGNATURE == DosHdr->e_magic) { + if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) { // // DOS image header is present, so read the PE header after the DOS image header. // @@ -180,7 +179,7 @@ PeCoffLoaderGetPdbPointer ( Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)Pe32Data; } - if (EFI_TE_IMAGE_HEADER_SIGNATURE == Hdr.Te->Signature) { + if (Hdr.Te->Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) { if (Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress != 0) { DirectoryEntry = &Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG]; TEImageAdjust = sizeof (EFI_TE_IMAGE_HEADER) - Hdr.Te->StrippedSize; @@ -188,7 +187,7 @@ PeCoffLoaderGetPdbPointer ( Hdr.Te->DataDirectory[EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress + TEImageAdjust); } - } else if (EFI_IMAGE_NT_SIGNATURE == Hdr.Pe32->Signature) { + } else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) { // // NOTE: We use Machine field to identify PE32/PE32+, instead of Magic. // It is due to backward-compatibility, for some system might @@ -215,7 +214,7 @@ PeCoffLoaderGetPdbPointer ( Magic = Hdr.Pe32->OptionalHeader.Magic; } - if (EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC == Magic) { + if (Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) { // // Use PE32 offset get Debug Directory Entry // @@ -239,7 +238,7 @@ PeCoffLoaderGetPdbPointer ( return NULL; } - if (NULL == DebugEntry || NULL == DirectoryEntry) { + if (DebugEntry == NULL || DirectoryEntry == NULL) { return NULL; }