EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

VBoxPkg/Include/Library/PeCoffLib.h

Go to the documentation of this file.
00001 
00020 #ifndef __BASE_PE_COFF_LIB_H__
00021 #define __BASE_PE_COFF_LIB_H__
00022 
00023 #include <IndustryStandard/PeImage.h>
00024 //
00025 // Return status codes from the PE/COFF Loader services
00026 //
00027 #define IMAGE_ERROR_SUCCESS                      0
00028 #define IMAGE_ERROR_IMAGE_READ                   1  
00029 #define IMAGE_ERROR_INVALID_PE_HEADER_SIGNATURE  2
00030 #define IMAGE_ERROR_INVALID_MACHINE_TYPE         3
00031 #define IMAGE_ERROR_INVALID_SUBSYSTEM            4
00032 #define IMAGE_ERROR_INVALID_IMAGE_ADDRESS        5
00033 #define IMAGE_ERROR_INVALID_IMAGE_SIZE           6
00034 #define IMAGE_ERROR_INVALID_SECTION_ALIGNMENT    7
00035 #define IMAGE_ERROR_SECTION_NOT_LOADED           8
00036 #define IMAGE_ERROR_FAILED_RELOCATION            9
00037 #define IMAGE_ERROR_FAILED_ICACHE_FLUSH          10
00038 
00068 typedef
00069 RETURN_STATUS
00070 (EFIAPI *PE_COFF_LOADER_READ_FILE)(
00071   IN     VOID   *FileHandle,
00072   IN     UINTN  FileOffset,
00073   IN OUT UINTN  *ReadSize,
00074   OUT    VOID   *Buffer
00075   );
00076 
00080 typedef struct {
00084   PHYSICAL_ADDRESS                  ImageAddress;
00089   UINT64                            ImageSize;
00096   PHYSICAL_ADDRESS                  DestinationAddress;
00100   PHYSICAL_ADDRESS                  EntryPoint;
00105   PE_COFF_LOADER_READ_FILE          ImageRead;
00109   VOID                              *Handle;
00116   VOID                              *FixupData;
00121   UINT32                            SectionAlignment;
00127   UINT32                            PeCoffHeaderOffset;
00132   UINT32                            DebugDirectoryEntryRva;
00136   VOID                              *CodeView;
00142   CHAR8                             *PdbPointer;
00146   UINTN                             SizeOfHeaders;
00153   UINT32                            ImageCodeMemoryType;
00160   UINT32                            ImageDataMemoryType;
00164   UINT32                            ImageError;
00169   UINTN                             FixupDataSize;
00173   UINT16                            Machine;
00177   UINT16                            ImageType;
00182   BOOLEAN                           RelocationsStripped;
00188   BOOLEAN                           IsTeImage;
00194   PHYSICAL_ADDRESS                  HiiResourceData;
00198   BOOLEAN                           IsFat;
00199   UINT32                            FatOffset;
00200   UINT64                            Context;      
00201 } PE_COFF_LOADER_IMAGE_CONTEXT;
00202 
00226 RETURN_STATUS
00227 EFIAPI
00228 PeCoffLoaderGetImageInfo (
00229   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
00230   );
00231 
00262 RETURN_STATUS
00263 EFIAPI
00264 PeCoffLoaderRelocateImage (
00265   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
00266   );
00267 
00299 RETURN_STATUS
00300 EFIAPI
00301 PeCoffLoaderLoadImage (
00302   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
00303   );
00304 
00305 
00329 RETURN_STATUS
00330 EFIAPI
00331 PeCoffLoaderImageReadFromMemory (
00332   IN     VOID    *FileHandle,
00333   IN     UINTN   FileOffset,
00334   IN OUT UINTN   *ReadSize,
00335   OUT    VOID    *Buffer
00336   );
00337 
00338 
00362 VOID
00363 EFIAPI
00364 PeCoffLoaderRelocateImageForRuntime (
00365   IN  PHYSICAL_ADDRESS        ImageBase,
00366   IN  PHYSICAL_ADDRESS        VirtImageBase,
00367   IN  UINTN                   ImageSize,
00368   IN  VOID                    *RelocationData
00369   );
00370 
00387 RETURN_STATUS
00388 EFIAPI
00389 PeCoffLoaderUnloadImage (
00390   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
00391   );
00392 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines