/** @file Implements APIs to retrieve general information about PE/COFF Images. Copyright (c) 2020 - 2021, Marvin Häuser. All rights reserved.
Copyright (c) 2020, Vitaly Cheptsov. All rights reserved.
Copyright (c) 2020, ISP RAS. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause **/ #include #include #include #include #include #include #include #include #include "BasePeCoffLib2Internals.h" UINT32 PeCoffGetAddressOfEntryPoint ( IN CONST PE_COFF_LOADER_IMAGE_CONTEXT *Context ) { ASSERT (Context != NULL); return Context->AddressOfEntryPoint; } UINT16 PeCoffGetMachine ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *Context ) { ASSERT (Context != NULL); return Context->Machine; } UINT16 PeCoffGetSubsystem ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *Context ) { ASSERT (Context != NULL); return Context->Subsystem; } UINT32 PeCoffGetSectionAlignment ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *Context ) { ASSERT (Context != NULL); return Context->SectionAlignment; } UINT32 PeCoffGetSizeOfImage ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *Context ) { ASSERT (Context != NULL); return Context->SizeOfImage; } UINT32 PeCoffGetSizeOfImageInplace ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *Context ) { ASSERT (Context != NULL); return Context->SizeOfImage; } UINT64 PeCoffGetImageBase ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *Context ) { ASSERT (Context != NULL); return Context->ImageBase; } UINT32 PeCoffGetSizeOfHeaders ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *Context ) { ASSERT (Context != NULL); return Context->SizeOfHeaders; } UINT16 PeCoffGetSectionTable ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *Context, OUT CONST EFI_IMAGE_SECTION_HEADER **Sections ) { ASSERT (Context != NULL); ASSERT (Sections != NULL); *Sections = (CONST EFI_IMAGE_SECTION_HEADER *) (CONST VOID *) ( (CONST CHAR8 *) Context->FileBuffer + Context->SectionsOffset ); return Context->NumberOfSections; } BOOLEAN PeCoffGetRelocsStripped ( IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *Context ) { ASSERT (Context != NULL); return Context->RelocsStripped; } // FIXME: Distinguish between base and buffer (XIP TE) UINTN PeCoffLoaderGetImageAddress ( IN CONST PE_COFF_LOADER_IMAGE_CONTEXT *Context ) { ASSERT (Context != NULL); ASSERT (Context->ImageBuffer != NULL); return (UINTN) Context->ImageBuffer; }