#include <PeHeader.h>
Public Types | |
typedef FieldSizes< x >::VAR4_8 | VAR4_8 |
Public Member Functions | |
void | addDataDirectory () |
int | addSection (const std::string &strName, dword dwSize) |
Add a section to the header. | |
dword | calcNumberOfRvaAndSizes () const |
word | calcNumberOfSections () const |
Returns the number of sections in the current file. | |
unsigned int | calcOffset () const |
Calculates the offset for a new section of size uiSize. | |
unsigned int | calcRva () const |
Calculates the Rva for a new section of size uiSize. | |
unsigned int | calcSizeOfImage () const |
unsigned int | calcSpaceAfterHeader () const |
Returns the unused space after the header. | |
unsigned int | calcStartOfCode () const |
Returns the address of the physically first section (not the first defined section). | |
void | enlargeLastSection (unsigned int uiSize) |
dword | getAddressOfEntryPoint () const |
Returns the AddressOfEntryPoint value of the header. | |
dword | getBaseOfCode () const |
Returns the BaseOfCode value of the header. | |
dword | getCharacteristics (word uiSectionnr) const |
Returns the characteristics of a section. | |
word | getCharacteristics () const |
Returns the Characteristics value of the header. | |
dword | getCheckSum () const |
Returns the CheckSum value of the header. | |
word | getDllCharacteristics () const |
Returns the DllCharacteristics value of the header. | |
dword | getFileAlignment () const |
Returns the FileAlignment value of the header. | |
dword | getIddArchitectureRva () const |
Returns the relative virtual address of the image directory Architecture. | |
dword | getIddArchitectureSize () const |
Returns the size of the image directory Architecture. | |
dword | getIddBaseRelocRva () const |
Returns the relative virtual address of the image directory Base Reloc. | |
dword | getIddBaseRelocSize () const |
Returns the size of the image directory Base Reloc. | |
dword | getIddBoundImportRva () const |
Returns the relative virtual address of the image directory BoundImport. | |
dword | getIddBoundImportSize () const |
Returns the size of the image directory BoundImport. | |
dword | getIddComHeaderRva () const |
Returns the relative virtual address of the image directory COM Descriptor. | |
dword | getIddComHeaderSize () const |
Returns the size of the image directory COM Descriptor. | |
dword | getIddDebugRva () const |
Returns the relative virtual address of the image directory Debug. | |
dword | getIddDebugSize () const |
Returns the size of the image directory Debug. | |
dword | getIddDelayImportRva () const |
Returns the relative virtual address of the image directory DelayImport. | |
dword | getIddDelayImportSize () const |
Returns the size of the image directory DelayImport. | |
dword | getIddExceptionRva () const |
Returns the relative virtual address of the image directory Exception. | |
dword | getIddExceptionSize () const |
Returns the size of the image directory Exception. | |
dword | getIddExportRva () const |
Returns the relative virtual address of the image directory Export. | |
dword | getIddExportSize () const |
Returns the size of the image directory Export. | |
dword | getIddGlobalPtrRva () const |
Returns the relative virtual address of the image directory GlobalPtr. | |
dword | getIddGlobalPtrSize () const |
Returns the size of the image directory GlobalPtr. | |
dword | getIddIatRva () const |
Returns the relative virtual address of the image directory Iat. | |
dword | getIddIatSize () const |
Returns the size of the image directory Iat. | |
dword | getIddImportRva () const |
Returns the relative virtual address of the image directory Import. | |
dword | getIddImportSize () const |
Returns the size of the image directory Import. | |
dword | getIddLoadConfigRva () const |
Returns the relative virtual address of the image directory LoadConfig. | |
dword | getIddLoadConfigSize () const |
Returns the size of the image directory LoadConfig. | |
dword | getIddResourceRva () const |
Returns the relative virtual address of the image directory Resource. | |
dword | getIddResourceSize () const |
Returns the size of the image directory Resource. | |
dword | getIddSecurityRva () const |
Returns the relative virtual address of the image directory Security. | |
dword | getIddSecuritySize () const |
Returns the size of the image directory Security. | |
dword | getIddTlsRva () const |
Returns the relative virtual address of the image directory Tls. | |
dword | getIddTlsSize () const |
Returns the size of the image directory Tls. | |
VAR4_8 | getImageBase () const |
Returns the ImageBase value of the header. | |
dword | getImageDataDirectoryRva (dword dwDirectory) const |
Returns the relative virtual address of an image directory. | |
dword | getImageDataDirectorySize (dword dwDirectory) const |
Returns the size of an image directory. | |
dword | getLoaderFlags () const |
Returns the LoaderFlags value of the header. | |
word | getMachine () const |
Returns the Machine value of the header. | |
word | getMagic () const |
Returns the Magic value of the header. | |
word | getMajorImageVersion () const |
Returns the MajorImageVersion value of the header. | |
byte | getMajorLinkerVersion () const |
Returns the MajorLinkerVersion value of the header. | |
word | getMajorOperatingSystemVersion () const |
Returns the MajorOperatingSystemVersion value of the header. | |
word | getMajorSubsystemVersion () const |
Returns the MajorSubsystemVersion value of the header. | |
word | getMinorImageVersion () const |
Returns the MinorImageVersion value of the header. | |
byte | getMinorLinkerVersion () const |
Returns the MinorLinkerVersion value of the header. | |
word | getMinorOperatingSystemVersion () const |
Returns the MinorOperatingSystemVersion value of the header. | |
word | getMinorSubsystemVersion () const |
Returns the MinorSubsystemVersion value of the header. | |
dword | getNtSignature () const |
Returns the Signature value of the header. | |
dword | getNumberOfLinenumbers (word uiSectionnr) const |
Returns the number of line numbers of a section. | |
dword | getNumberOfRelocations (word uiSectionnr) const |
Returns the number of relocations of a section. | |
dword | getNumberOfRvaAndSizes () const |
Returns the NumberOfRvaAndSizes value of the header. | |
word | getNumberOfSections () const |
Returns the Sections value of the header. | |
dword | getNumberOfSymbols () const |
Returns the NumberOfSymbols value of the header. | |
dword | getPointerToLinenumbers (word uiSectionnr) const |
Returns the rva of the line numbers of a section. | |
dword | getPointerToRawData (word uiSectionnr) const |
Returns file offset of the data of a section. | |
dword | getPointerToRelocations (word uiSectionnr) const |
Returns the rva of the relocations of a section. | |
dword | getPointerToSymbolTable () const |
Returns the PointerToSymbolTable value of the header. | |
dword | getSectionAlignment () const |
Returns the SectionAlignment value of the header. | |
std::string | getSectionName (word uiSectionnr) const |
Returns the name of a section. | |
word | getSectionWithOffset (VAR4_8 dwOffset) const |
Returns the section Id of the section that contains the offset. | |
word | getSectionWithRva (VAR4_8 rva) const |
Returns the number of the section which the given relative address points to. | |
dword | getSizeOfCode () const |
Returns the SizeOfCode value of the header. | |
dword | getSizeOfHeaders () const |
Returns the SizeOfHeaders value of the header. | |
VAR4_8 | getSizeOfHeapCommit () const |
Returns the SizeOfHeapCommit value of the header. | |
VAR4_8 | getSizeOfHeapReserve () const |
Returns the SizeOfHeapReserve value of the header. | |
dword | getSizeOfImage () const |
Returns the SizeOfImage value of the header. | |
dword | getSizeOfInitializedData () const |
Returns the SizeOfInitializedData value of the header. | |
word | getSizeOfOptionalHeader () const |
Returns the SizeOfOptionalHeader value of the header. | |
dword | getSizeOfRawData (word uiSectionnr) const |
Returns the size of a section's raw data. | |
VAR4_8 | getSizeOfStackCommit () const |
Returns the SizeOfStackCommit value of the header. | |
VAR4_8 | getSizeOfStackReserve () const |
Returns the SizeOfStackReserve value of the header. | |
dword | getSizeOfUninitializedData () const |
Returns the SizeOfUninitializedData value of the header. | |
word | getSubsystem () const |
Returns the Subsystem value of the header. | |
dword | getTimeDateStamp () const |
Returns the TimeDateStamp value of the header. | |
dword | getVirtualAddress (word uiSectionnr) const |
Returns the virtual address of a section. | |
dword | getVirtualSize (word uiSectionnr) const |
Returns the virtual size of a section. | |
dword | getWin32VersionValue () const |
Returns the Reserved1 value of the header. | |
bool | isValid (unsigned int) const |
void | makeValid (dword dwOffset) |
Corrects the current PE header. | |
unsigned int | offsetToRva (VAR4_8 dwOffset) const |
Converts a file offset to a relative virtual offset. | |
unsigned int | offsetToVa (VAR4_8 dwOffset) const |
Converts a file offset to a virtual address. | |
int | read (std::string strFilename, unsigned int uiOffset) |
Reads the PE header of a file. | |
void | rebuild (std::vector< byte > &vBuffer) const |
Rebuilds the current PE header. | |
void | removeDataDirectory (dword index) |
FieldSizes< x >::VAR4_8 | rvaToOffset (VAR4_8 dwRva) const |
Converts a relative virtual address to a file offset. | |
FieldSizes< x >::VAR4_8 | rvaToVa (VAR4_8 dwRva) const |
Converts a relative virtual address to a virtual address. | |
void | setAddressOfEntryPoint (dword value) |
Sets the AddressOfEntryPoint value of the header. | |
void | setBaseOfCode (dword value) |
Sets the BaseOfCode value of the header. | |
void | setCharacteristics (word uiSectionnr, dword dwValue) |
Set the characteristics of a section. | |
void | setCharacteristics (word value) |
Sets the Characteristics value of the header. | |
void | setCheckSum (dword value) |
Sets the CheckSum value of the header. | |
void | setDllCharacteristics (word value) |
Sets the DllCharacteristics value of the header. | |
void | setFileAlignment (dword value) |
Sets the FileAlignment value of the header. | |
void | setIddDebugRva (dword dwValue) |
void | setIddDebugSize (dword dwValue) |
void | setIddDelayImportRva (dword dwValue) |
void | setIddDelayImportSize (dword dwValue) |
void | setIddExceptionRva (dword dwValue) |
void | setIddExceptionSize (dword dwValue) |
void | setIddExportRva (dword dwValue) |
void | setIddExportSize (dword dwValue) |
void | setIddGlobalPtrRva (dword dwValue) |
void | setIddGlobalPtrSize (dword dwValue) |
void | setIddIatRva (dword dwValue) |
void | setIddIatSize (dword dwValue) |
void | setIddImportRva (dword dwValue) |
void | setIddImportSize (dword dwValue) |
void | setIddLoadConfigRva (dword dwValue) |
void | setIddLoadConfigSize (dword dwValue) |
void | setIddResourceRva (dword dwValue) |
void | setIddResourceSize (dword dwValue) |
void | setIddSecurityRva (dword dwValue) |
void | setIddSecuritySize (dword dwValue) |
void | setIddTlsRva (dword dwValue) |
void | setIddTlsSize (dword dwValue) |
void | setImageBase (VAR4_8 value) |
Sets the ImageBase value of the header. | |
void | setLoaderFlags (dword value) |
Sets the LoaderFlags value of the header. | |
void | setMachine (word value) |
Sets the Machine value of the header. | |
void | setMagic (word value) |
Sets the Magic value of the header. | |
void | setMajorImageVersion (word value) |
Sets the MajorImageVersion value of the header. | |
void | setMajorLinkerVersion (byte value) |
Sets the MajorLinkerVersion value of the header. | |
void | setMajorOperatingSystemVersion (word value) |
Sets the MajorOperatingSystemVersion value of the header. | |
void | setMajorSubsystemVersion (word value) |
Sets the MajorSubsystemVersion value of the header. | |
void | setMinorImageVersion (word value) |
Sets the MinorImageVersion value of the header. | |
void | setMinorLinkerVersion (byte value) |
Sets the MinorLinkerVersion value of the header. | |
void | setMinorOperatingSystemVersion (word value) |
Sets the MinorOperatingSystemVersion value of the header. | |
void | setMinorSubsystemVersion (word value) |
Sets the MinorSubsystemVersion value of the header. | |
void | setNtSignature (dword value) |
Sets the Signature value of the header. | |
void | setNumberOfLinenumbers (word uiSectionnr, dword dwValue) |
Set the number of linenumbers section. | |
void | setNumberOfRelocations (word uiSectionnr, dword dwValue) |
Set the number of relocations a section. | |
void | setNumberOfRvaAndSizes (dword value) |
Sets the NumberOfRvaAndSizes value of the header. | |
void | setNumberOfSections (word value) |
Sets the Sections value of the header. | |
void | setNumberOfSymbols (dword value) |
Sets the NumberOfSymbols value of the header. | |
void | setPointerToLinenumbers (word uiSectionnr, dword dwValue) |
Set the pointer to linenumbers of a section. | |
void | setPointerToRawData (word uiSectionnr, dword dwValue) |
Set the file offset of a section. | |
void | setPointerToRelocations (word uiSectionnr, dword dwValue) |
Set the pointer to relocations of a section. | |
void | setPointerToSymbolTable (dword value) |
Sets the PointerToSymbolTable value of the header. | |
void | setSectionAlignment (dword value) |
Sets the SectionAlignment value of the header. | |
void | setSectionName (word uiSectionnr, std::string strName) |
Set the name of a section. | |
void | setSizeOfCode (dword value) |
Sets the SizeOfCode value of the header. | |
void | setSizeOfHeaders (dword value) |
Sets the SizeOfHeaders value of the header. | |
void | setSizeOfHeapCommit (VAR4_8 value) |
Sets the SizeOfHeapCommit value of the header. | |
void | setSizeOfHeapReserve (VAR4_8 value) |
Sets the SizeOfHeapReserve value of the header. | |
void | setSizeOfImage (dword value) |
Sets the SizeOfImage value of the header. | |
void | setSizeOfInitializedData (dword value) |
Sets the SizeOfInitializedData value of the header. | |
void | setSizeOfOptionalHeader (word value) |
Sets the SizeOfOptionalHeader value of the header. | |
void | setSizeOfRawData (word uiSectionnr, dword dwValue) |
Set the size of raw data of a section. | |
void | setSizeOfStackCommit (VAR4_8 value) |
Sets the SizeOfStackCommit value of the header. | |
void | setSizeOfStackReserve (VAR4_8 value) |
Sets the SizeOfStackReserve value of the header. | |
void | setSizeOfUninitializedData (dword value) |
Sets the SizeOfUninitializedData value of the header. | |
void | setSubsystem (word value) |
Sets the Subsystem value of the header. | |
void | setTimeDateStamp (dword value) |
Sets the TimeDateStamp value of the header. | |
void | setVirtualAddress (word uiSectionnr, dword dwValue) |
Set the virtual address of a section. | |
void | setVirtualSize (word uiSectionnr, dword dwValue) |
Set the virtual size of a section. | |
void | setWin32VersionValue (dword value) |
Sets the Reserved1 value of the header. | |
unsigned int | size () const |
Calculates the size for the current PE header including all section definitions. | |
FieldSizes< x >::VAR4_8 | vaToOffset (VAR4_8 dwRva) const |
FieldSizes< x >::VAR4_8 | vaToRva (VAR4_8 dwRva) const |
int | write (std::string strFilename, unsigned int uiOffset) const |
Save the PE header to a file. | |
int | writeSectionData (const std::string &strFilename, word wSecnr, const std::vector< byte > &vBuffer) const |
Overwrites a section with new data. | |
int | writeSections (const std::string &strFilename) const |
Writes sections to a file. | |
Protected Attributes | |
PELIB_IMAGE_NT_HEADERS< x > | m_inthHeader |
Stores Nt header information. | |
dword | m_uiOffset |
Equivalent to the value returned by #PeLib::MzHeader::getAddressOfPeFile. | |
std::vector< PELIB_IMAGE_SECTION_HEADER > | m_vIsh |
Stores section header information. |
This class can read and modify PE headers. It provides set- and get functions to access all individual members of a PE header. Furthermore it's possible to validate and rebuild PE headers. A PE header includes the IMAGE_Nt_HEADERS and the section definitions of a PE file.
|
Add a section to the header. Adds a new section to the header. The physical and virtual address as well as the virtual size of the section will be determined automatically from the raw size. The section characteristics will be set to IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_CNT_CODE. All other values will be set to 0. Note: It's important that if the current header's FileAlignment and/or SectionAlignment values are 0 this function will fail.
Here is the call graph for this function: |
|
Returns the number of sections in the current file. Returns the number of currently defined sections. Note that this value can be different from the number of sections according to the header (see PeLib::PeHeaderT<x>::getNumberOfSections).
|
|
Calculates the offset for a new section of size uiSize. Calculates the file offset for a new section. The file offset will already be aligned to the file's FileAlignment.
Here is the call graph for this function: |
|
Calculates the Rva for a new section of size uiSize. Calculates the Rva for a new section. The Rva will already be aligned to the file's SectionAlignment.
Here is the call graph for this function: |
|
Calculates a valid SizeOfImage value given the information from the current PE header. Note that this calculation works in Win2K but probably does not work in Win9X. I didn't test that though.
|
|
Returns the unused space after the header. Calculates the space between the last byte of the header and the first byte that's used for something else (that's either the first section or an image directory).
Here is the call graph for this function: |
|
Returns the address of the physically first section (not the first defined section). Returns the first offset of the file that's actually used for something different than the header. That something is not necessarily code, it can be a data directory too. This offset can be the beginning of a section or the beginning of a directory.
Here is the call graph for this function: |
|
Enlarges the physically last section in the file.
Here is the call graph for this function: |
|
Returns the AddressOfEntryPoint value of the header.
|
|
Returns the BaseOfCode value of the header.
|
|
Returns the characteristics of a section. Returns the characteristics of the section which is specified by the parameter wSectionnr.
|
|
Returns the Characteristics value of the header.
|
|
Returns the CheckSum value of the header.
|
|
Returns the DllCharacteristics value of the header.
|
|
Returns the FileAlignment value of the header.
|
|
Returns the relative virtual address of the image directory Architecture. Returns the relative virtual address of the current file's Architecture directory.
|
|
Returns the size of the image directory Architecture. Returns the size of the current file's Architecture directory.
|
|
Returns the relative virtual address of the image directory Base Reloc. Returns the relative virtual address of the current file's base reloc directory.
|
|
Returns the size of the image directory Base Reloc. Returns the size of the current file's base reloc directory.
|
|
Returns the relative virtual address of the image directory BoundImport. Returns the relative virtual address of the current file's bound import directory.
|
|
Returns the size of the image directory BoundImport. Returns the size of the current file's bound import directory.
|
|
Returns the relative virtual address of the image directory COM Descriptor. Returns the relative virtual address of the current file's COM Descriptor directory.
|
|
Returns the size of the image directory COM Descriptor. Returns the size of the current file's COM Descriptor directory.
|
|
Returns the relative virtual address of the image directory Debug. Returns the relative virtual address of the current file's debug directory.
|
|
Returns the size of the image directory Debug. Returns the size of the current file's debug directory.
|
|
Returns the relative virtual address of the image directory DelayImport. Returns the relative virtual address of the current file's Delay Import directory.
|
|
Returns the size of the image directory DelayImport. Returns the size of the current file's Delay Import directory.
|
|
Returns the relative virtual address of the image directory Exception. Returns the relative virtual address of the current file's exception directory.
|
|
Returns the size of the image directory Exception. Returns the size of the current file's exception directory.
|
|
Returns the relative virtual address of the image directory Export. Returns the relative virtual address of the current file's export directory.
|
|
Returns the size of the image directory Export. Returns the size of the current file's export directory.
|
|
Returns the relative virtual address of the image directory GlobalPtr. Returns the relative virtual address of the current file's global ptr directory.
|
|
Returns the size of the image directory GlobalPtr. Returns the size of the current file's global ptr directory.
|
|
Returns the relative virtual address of the image directory Iat. Returns the relative virtual address of the current file's IAT directory.
|
|
Returns the size of the image directory Iat. Returns the size of the current file's IAT directory.
|
|
Returns the relative virtual address of the image directory Import. Returns the relative virtual address of the current file's import directory.
|
|
Returns the size of the image directory Import. Returns the size of the current file's import directory.
|
|
Returns the relative virtual address of the image directory LoadConfig. Returns the relative virtual address of the current file's load config directory.
|
|
Returns the size of the image directory LoadConfig. Returns the size of the current file's load config directory.
|
|
Returns the relative virtual address of the image directory Resource. Returns the relative virtual address of the current file's resource directory.
|
|
Returns the size of the image directory Resource. Returns the size of the current file'resource resource directory.
|
|
Returns the relative virtual address of the image directory Security. Returns the relative virtual address of the current file's security directory.
|
|
Returns the size of the image directory Security. Returns the size of the current file's security directory.
|
|
Returns the relative virtual address of the image directory Tls. Returns the relative virtual address of the current file's TLS directory.
|
|
Returns the size of the image directory Tls. Returns the size of the current file's TLS directory.
|
|
Returns the ImageBase value of the header.
|
|
Returns the relative virtual address of an image directory. Returns the relative virtual address of an image directory.
|
|
Returns the size of an image directory. Returns the size of an image directory.
|
|
Returns the LoaderFlags value of the header.
|
|
Returns the Machine value of the header. Returns the file's machine.
|
|
Returns the Magic value of the header.
|
|
Returns the MajorImageVersion value of the header.
|
|
Returns the MajorLinkerVersion value of the header.
|
|
Returns the MajorOperatingSystemVersion value of the header.
|
|
Returns the MajorSubsystemVersion value of the header.
|
|
Returns the MinorImageVersion value of the header.
|
|
Returns the MinorLinkerVersion value of the header.
|
|
Returns the MinorOperatingSystemVersion value of the header.
|
|
Returns the MinorSubsystemVersion value of the header.
|
|
Returns the Signature value of the header. Returns the file's Nt signature.
|
|
Returns the number of line numbers of a section. Returns the number of line numbers of the section which is specified by the parameter wSectionnr.
|
|
Returns the number of relocations of a section. Returns the number of relocations of the section which is specified by the parameter wSectionnr.
|
|
Returns the NumberOfRvaAndSizes value of the header.
|
|
Returns the Sections value of the header. Returns the file's number of sections as defined in the header. Note that this value can be different from the number of defined sections (#see PeLib::PeHeaderT<x>::getNumberOfSections).
|
|
Returns the NumberOfSymbols value of the header. Returns the number of symbols of the file's symbol table.
|
|
Returns the rva of the line numbers of a section. Returns the poiner to line numbers of the section which is specified by the parameter wSectionnr.
|
|
Returns file offset of the data of a section. Returns the file offset of the section which is specified by the parameter wSectionnr.
|
|
Returns the rva of the relocations of a section. Returns the pointer to relocations of the section which is specified by the parameter wSectionnr.
|
|
Returns the PointerToSymbolTable value of the header. Returns the relative virtual address of the file's symbol table.
|
|
Returns the SectionAlignment value of the header.
|
|
Returns the name of a section. Returns the name of the section which is specified by the parameter wSectionnr.
|
|
Returns the section Id of the section that contains the offset. Determines the section which contains the file offset.
Here is the call graph for this function: |
|
Returns the number of the section which the given relative address points to. Determines the section which contains the Rva.
Here is the call graph for this function: |
|
Returns the SizeOfCode value of the header.
|
|
Returns the SizeOfHeaders value of the header.
|
|
Returns the SizeOfHeapCommit value of the header.
|
|
Returns the SizeOfHeapReserve value of the header.
|
|
Returns the SizeOfImage value of the header.
|
|
Returns the SizeOfInitializedData value of the header.
|
|
Returns the SizeOfOptionalHeader value of the header. Returns the size of optional header of the file.
|
|
Returns the size of a section's raw data. Returns the size of raw data of the section which is specified by the parameter wSectionnr.
|
|
Returns the SizeOfStackCommit value of the header.
|
|
Returns the SizeOfStackReserve value of the header.
|
|
Returns the SizeOfUninitializedData value of the header.
|
|
Returns the Subsystem value of the header.
|
|
Returns the TimeDateStamp value of the header. Returns the file's TimeDateStamp.
|
|
Returns the virtual address of a section. Returns the relative virtual address of the section which is specified by the parameter wSectionnr.
|
|
Returns the virtual size of a section. Returns the virtual size of the section which is specified by the parameter wSectionnr.
|
|
Returns the Reserved1 value of the header.
|
|
Corrects the current PE header. Corrects all faulty values of the current PE header. The following values will be corrected: NtSignature, NumberOfSections, SizeOfOptionalHeader, FileAlignment (will be aligned to n*0x200), SectionAlignment (will be aligned to n*0x1000), NumberOfRvaAndSizes, SizeOfHeaders, SizeOfImage, Magic, Characteristics.
Here is the call graph for this function: |
|
Converts a file offset to a virtual address. Converts a file offset to a virtual address.
Here is the call graph for this function: |
|
Reads the PE header of a file. Reads the PE header from a file Note that this function does not verify if a file is actually a MZ file. For this purpose see #PeLib::PeHeaderT<x>::isValid. The only check this function makes is a check to see if the file is large enough to be a PE header. If the data is valid doesn't matter.
Here is the call graph for this function: |
|
Rebuilds the current PE header. Rebuilds the PE header so that it can be written to a file. It's not guaranteed that the header will be valid. If you want to make sure that the header will be valid you must call PeLib::PeHeaderT<x>::makeValid first.
Here is the call graph for this function: |
|
Converts a relative virtual address to a file offset. Converts a relative virtual offset to a file offset.
Here is the call graph for this function: |
|
Converts a relative virtual address to a virtual address. Converts a relative virtual offset to a virtual offset.
Here is the call graph for this function: |
|
Sets the AddressOfEntryPoint value of the header. Changes the file's AddressOfEntryPoint.
|
|
Sets the BaseOfCode value of the header. Changes the file's BaseOfCode.
|
|
Set the characteristics of a section. Changes the characteristics of a section.
|
|
Sets the Characteristics value of the header. Changes the file's Characteristics.
|
|
Sets the CheckSum value of the header. Changes the file's CheckSum.
|
|
Sets the DllCharacteristics value of the header. Changes the file's DllCharacteristics.
|
|
Sets the FileAlignment value of the header. Changes the file's FileAlignment.
|
|
Changes the rva of the file's export directory.
|
|
Changes the size of the file's export directory.
|
|
Changes the rva of the file's import directory.
|
|
Changes the size of the file's import directory.
|
|
Sets the LoaderFlags value of the header. Changes the file's LoaderFlags.
|
|
Sets the Machine value of the header. Changes the file's Machine.
|
|
Sets the Magic value of the header. Changes the file's Magic.
|
|
Sets the MajorImageVersion value of the header. Changes the file's MajorImageVersion.
|
|
Sets the MajorLinkerVersion value of the header. Changes the file's MajorLinkerVersion.
|
|
Sets the MajorOperatingSystemVersion value of the header. Changes the file's MajorOperatingSystemVersion.
|
|
Sets the MajorSubsystemVersion value of the header. Changes the file's MajorSubsystemVersion.
|
|
Sets the MinorImageVersion value of the header. Changes the file's MinorImageVersion.
|
|
Sets the MinorLinkerVersion value of the header. Changes the file's MinorLinkerVersion.
|
|
Sets the MinorOperatingSystemVersion value of the header. Changes the file's MinorOperatingSystemVersion.
|
|
Sets the MinorSubsystemVersion value of the header. Changes the file's MinorSubsystemVersion.
|
|
Sets the Signature value of the header. Changes the file's Nt signature.
|
|
Set the number of linenumbers section. Changes the number of line numbers of a section.
|
|
Set the number of relocations a section. Changes the number of relocations of a section.
|
|
Sets the NumberOfRvaAndSizes value of the header. Changes the file's NumberOfRvaAndSizes.
|
|
Sets the Sections value of the header. Changes the number of sections.
|
|
Sets the NumberOfSymbols value of the header. Changes the file's NumberOfSymbols.
|
|
Set the pointer to linenumbers of a section. Changes the pointer to line numbers of a section.
|
|
Set the file offset of a section. Changes the size of raw data of a section.
|
|
Set the pointer to relocations of a section. Changes the pointer to relocations of a section.
|
|
Sets the PointerToSymbolTable value of the header. Changes the file's PointerToSymbolTable.
|
|
Sets the SectionAlignment value of the header. Changes the file's SectionAlignment.
|
|
Set the name of a section. Changes the name of a section.
|
|
Sets the SizeOfCode value of the header. Changes the file's SizeOfCode.
|
|
Sets the SizeOfHeaders value of the header. Changes the file's SizeOfHeaders.
|
|
Sets the SizeOfImage value of the header. Changes the file's SizeOfImage.
|
|
Sets the SizeOfInitializedData value of the header. Changes the file's SizeOfInitializedData.
|
|
Sets the SizeOfOptionalHeader value of the header. Changes the file's SizeOfOptionalHeader.
|
|
Set the size of raw data of a section. Changes the size of raw data of a section.
|
|
Sets the SizeOfUninitializedData value of the header. Changes the file's SizeOfUninitializedData.
|
|
Sets the Subsystem value of the header. Changes the file's Subsystem.
|
|
Sets the TimeDateStamp value of the header. Changes the file's TimeDateStamp.
|
|
Set the virtual address of a section. Changes the virtual address of a section.
|
|
Set the virtual size of a section. Changes the virtual size of a section.
|
|
Sets the Reserved1 value of the header. Changes the file's Win32VersionValue.
|
|
Calculates the size for the current PE header including all section definitions. Calculates the size of the current PE header. This includes the actual header and the section definitions.
Here is the call graph for this function: |
|
Save the PE header to a file. Saves the PE header to a file. Note that this only saves the header information, if you have added sections and want to save these to the file you have to call #PeLib::PeHeaderT<x>::saveSections too. This function also does not verify if the PE header is correct. If you want to make sure that the current PE header is valid, call #PeLib::PeHeaderT<x>::isValid and PeLib::PeHeaderT<x>::makeValid first.
Here is the call graph for this function: |
|
Overwrites a section with new data. Overwrites a section's data.
Here is the call graph for this function: |