BearParser
Portable Executable parsing library (from PE-bear)
Loading...
Searching...
No Matches
OptHdrWrapper Class Reference

#include <OptHdrWrapper.h>

Collaboration diagram for OptHdrWrapper:

Public Types

enum  OptHdrFID {
  NONE = FIELD_NONE , MAGIC = 0 , LINKER_MAJOR , LINKER_MINOR ,
  CODE_SIZE , INITDATA_SIZE , UNINITDATA_SIZE , EP ,
  CODE_BASE , DATA_BASE , IMAGE_BASE , SEC_ALIGN ,
  FILE_ALIGN , OSVER_MAJOR , OSVER_MINOR , IMGVER_MAJOR ,
  IMGVER_MINOR , SUBSYSVER_MAJOR , SUBSYSVER_MINOR , WIN32_VER ,
  IMAGE_SIZE , HDRS_SIZE , CHECKSUM , SUBSYS ,
  DLL_CHARACT , STACK_RSRV_SIZE , STACK_COMMIT_SIZE , HEAP_RSRV_SIZE ,
  HEAP_COMMIT_SIZE , LDR_FLAGS , RVAS_SIZES_NUM , DATA_DIR ,
  FIELD_COUNTER
}
 

Public Member Functions

 OptHdrWrapper (PEFile *pe)
 
bool wrap ()
 
virtual void * getPtr ()
 
virtual bufsize_t getSize ()
 
virtual QString getName ()
 
virtual size_t getFieldsCount ()
 
virtual void * getFieldPtr (size_t fieldId, size_t subField=FIELD_NONE)
 
virtual bufsize_t getFieldSize (size_t fieldId, size_t subField=FIELD_NONE)
 
virtual QString translateFieldContent (size_t fieldId)
 
virtual QString getFieldName (size_t fieldId)
 
virtual Executable::addr_type containsAddrType (size_t fieldId, size_t subField=FIELD_NONE)
 
Executable::exe_bits getHdrBitMode ()
 
IMAGE_NT_HEADERS32 * nt32 ()
 
IMAGE_NT_HEADERS64 * nt64 ()
 
- Public Member Functions inherited from PEElementWrapper
 PEElementWrapper (PEFile *pe)
 
virtual ~PEElementWrapper ()
 
PEFilegetPE ()
 
- Public Member Functions inherited from ExeElementWrapper
 ExeElementWrapper (Executable *exe)
 
virtual ~ExeElementWrapper ()
 
virtual bufsize_t getContentSize ()
 
virtual BYTE * getContent ()
 
virtual size_t getSubFieldsCount ()
 
virtual offset_t getOffset ()
 
virtual offset_t getOffset (void *ptr, bool allowExceptions=false)
 
void * getFieldPtr (size_t fieldId)
 
virtual offset_t getFieldOffset (size_t fieldId, size_t subField=FIELD_NONE)
 
virtual bool hasSubfieldWrapper (size_t parentType)
 
virtual WrappedValue getWrappedValue (size_t fieldId, size_t subField)
 
virtual WrappedValue getWrappedValue (size_t fieldId)
 
virtual WrappedValue::data_type containsDataType (size_t fieldId, size_t subField=FIELD_NONE)
 
virtual uint64_t getNumValue (size_t fieldId, size_t subField, bool *isOk)
 
uint64_t getNumValue (size_t fieldId, bool *isOk)
 
virtual bool setNumValue (size_t fieldId, size_t subField, uint64_t val)
 
bool setNumValue (size_t fieldId, uint64_t val)
 
ExecutablegetExe ()
 
bool isBit64 ()
 
bool isBit32 ()
 
- Public Member Functions inherited from AbstractByteBuffer
 AbstractByteBuffer ()
 
virtual ~AbstractByteBuffer ()
 
virtual bool isTruncated ()
 
virtual bool isResized ()
 
BYTE operator[] (size_t idx)
 
virtual BYTE * getContentAt (offset_t offset, bufsize_t size, bool allowExceptions=false)
 
virtual BYTE * getContentAtPtr (BYTE *ptr, bufsize_t size, bool allowExceptions=false)
 
virtual bool setBufferedValue (BYTE *dstPtr, BYTE *srcPtr, bufsize_t srcSize, bufsize_t paddingSize, bool allowExceptions=false)
 
bool setStringValue (offset_t rawOffset, QString newText)
 
QString getStringValue (offset_t rawOffset, bufsize_t len=BUFSIZE_MAX, bool acceptNonTerminated=false)
 
QString getWStringValue (offset_t rawOffset, bufsize_t len)
 
QString getWAsciiStringValue (offset_t rawOffset, bufsize_t len, bool acceptNonTerminated=false)
 
bufsize_t getMaxSizeFromOffset (offset_t startOffset)
 
bufsize_t getMaxSizeFromPtr (BYTE *ptr)
 
bool isAreaEmpty (offset_t rawOffset, bufsize_t size)
 
bool fillContent (BYTE filling)
 
bool pasteBuffer (offset_t rawOffset, AbstractByteBuffer *buf, bool allowTrunc)
 
bool containsBlock (offset_t rawOffset, bufsize_t size)
 
bool intersectsBlock (offset_t rawOffset, bufsize_t size)
 
uint64_t getNumValue (offset_t offset, bufsize_t size, bool *isOk)
 
bool setNumValue (offset_t offset, bufsize_t size, uint64_t newVal)
 
bool setTextValue (char *textPtr, std::string newText, size_t fieldLimitLen=0)
 
virtual bool resize (bufsize_t newSize)
 
offset_t substFragmentByFile (offset_t offset, bufsize_t contentSize, QFile &fIn)
 

Static Public Member Functions

static void initDllCharact ()
 
static std::vector< DWORD > splitDllCharact (DWORD characteristics)
 
static QString translateDllCharacteristics (DWORD charact)
 
static QString translateOptMagic (DWORD magic)
 
static QString translateOSVersion (WORD major, WORD minor)
 
static QString translateSubsystem (DWORD subsystem)
 
- Static Public Member Functions inherited from AbstractByteBuffer
static bool isValid (AbstractByteBuffer *buf)
 

Static Public Attributes

static std::map< DWORD, QString > s_optMagic
 
static std::map< std::pair< WORD, WORD >, QString > s_osVersion
 
static std::map< DWORD, QString > s_dllCharact
 
static std::map< DWORD, QString > s_subsystem
 

Protected Attributes

IMAGE_OPTIONAL_HEADER32 * opt32
 
IMAGE_OPTIONAL_HEADER64 * opt64
 
std::vector< DWORD > dllCharact
 
- Protected Attributes inherited from PEElementWrapper
PEFilem_PE
 
- Protected Attributes inherited from ExeElementWrapper
Executablem_Exe
 

Additional Inherited Members

- Protected Member Functions inherited from ExeElementWrapper
virtual bool canCopyToOffset (offset_t rawOffset)
 
bool copyToOffset (offset_t rawOffset)
 

Detailed Description

Definition at line 5 of file OptHdrWrapper.h.

Member Enumeration Documentation

◆ OptHdrFID

Enumerator
NONE 
MAGIC 
LINKER_MAJOR 
LINKER_MINOR 
CODE_SIZE 
INITDATA_SIZE 
UNINITDATA_SIZE 
EP 
CODE_BASE 
DATA_BASE 
IMAGE_BASE 
SEC_ALIGN 
FILE_ALIGN 
OSVER_MAJOR 
OSVER_MINOR 
IMGVER_MAJOR 
IMGVER_MINOR 
SUBSYSVER_MAJOR 
SUBSYSVER_MINOR 
WIN32_VER 
IMAGE_SIZE 
HDRS_SIZE 
CHECKSUM 
SUBSYS 
DLL_CHARACT 
STACK_RSRV_SIZE 
STACK_COMMIT_SIZE 
HEAP_RSRV_SIZE 
HEAP_COMMIT_SIZE 
LDR_FLAGS 
RVAS_SIZES_NUM 
DATA_DIR 
FIELD_COUNTER 

Definition at line 9 of file OptHdrWrapper.h.

Constructor & Destructor Documentation

◆ OptHdrWrapper()

OptHdrWrapper::OptHdrWrapper ( PEFile * pe)
inline

Definition at line 59 of file OptHdrWrapper.h.

Here is the call graph for this function:

Member Function Documentation

◆ containsAddrType()

Executable::addr_type OptHdrWrapper::containsAddrType ( size_t fieldId,
size_t subField = FIELD_NONE )
virtual

Reimplemented from ExeElementWrapper.

Definition at line 331 of file OptHdrWrapper.cpp.

◆ getFieldName()

QString OptHdrWrapper::getFieldName ( size_t fieldId)
virtual

Implements ExeElementWrapper.

Definition at line 282 of file OptHdrWrapper.cpp.

Here is the call graph for this function:

◆ getFieldPtr()

void * OptHdrWrapper::getFieldPtr ( size_t fieldId,
size_t subField = FIELD_NONE )
virtual

Implements ExeElementWrapper.

Definition at line 184 of file OptHdrWrapper.cpp.

Here is the call graph for this function:

◆ getFieldsCount()

virtual size_t OptHdrWrapper::getFieldsCount ( )
inlinevirtual

Implements ExeElementWrapper.

Definition at line 66 of file OptHdrWrapper.h.

◆ getFieldSize()

bufsize_t OptHdrWrapper::getFieldSize ( size_t fieldId,
size_t subField = FIELD_NONE )
virtual

Reimplemented from ExeElementWrapper.

Definition at line 174 of file OptHdrWrapper.cpp.

Here is the call graph for this function:

◆ getHdrBitMode()

Executable::exe_bits OptHdrWrapper::getHdrBitMode ( )

Definition at line 120 of file OptHdrWrapper.cpp.

Here is the call graph for this function:

◆ getName()

virtual QString OptHdrWrapper::getName ( )
inlinevirtual

Implements ExeElementWrapper.

Definition at line 65 of file OptHdrWrapper.h.

◆ getPtr()

void * OptHdrWrapper::getPtr ( )
virtual

Implements ExeElementWrapper.

Definition at line 149 of file OptHdrWrapper.cpp.

Here is the call graph for this function:

◆ getSize()

bufsize_t OptHdrWrapper::getSize ( )
virtual

Implements ExeElementWrapper.

Definition at line 164 of file OptHdrWrapper.cpp.

Here is the call graph for this function:

◆ initDllCharact()

void OptHdrWrapper::initDllCharact ( )
static

Definition at line 11 of file OptHdrWrapper.cpp.

◆ nt32()

IMAGE_NT_HEADERS32 * OptHdrWrapper::nt32 ( )

Definition at line 128 of file OptHdrWrapper.cpp.

Here is the call graph for this function:

◆ nt64()

IMAGE_NT_HEADERS64 * OptHdrWrapper::nt64 ( )

Definition at line 138 of file OptHdrWrapper.cpp.

Here is the call graph for this function:

◆ splitDllCharact()

std::vector< DWORD > OptHdrWrapper::splitDllCharact ( DWORD characteristics)
static

Definition at line 36 of file OptHdrWrapper.cpp.

Here is the call graph for this function:

◆ translateDllCharacteristics()

QString OptHdrWrapper::translateDllCharacteristics ( DWORD charact)
static

Definition at line 28 of file OptHdrWrapper.cpp.

Here is the call graph for this function:

◆ translateFieldContent()

QString OptHdrWrapper::translateFieldContent ( size_t fieldId)
virtual

Reimplemented from ExeElementWrapper.

Definition at line 264 of file OptHdrWrapper.cpp.

Here is the call graph for this function:

◆ translateOptMagic()

QString OptHdrWrapper::translateOptMagic ( DWORD magic)
static

Definition at line 50 of file OptHdrWrapper.cpp.

◆ translateOSVersion()

QString OptHdrWrapper::translateOSVersion ( WORD major,
WORD minor )
static

Definition at line 61 of file OptHdrWrapper.cpp.

◆ translateSubsystem()

QString OptHdrWrapper::translateSubsystem ( DWORD subsystem)
static

Definition at line 84 of file OptHdrWrapper.cpp.

◆ wrap()

bool OptHdrWrapper::wrap ( )
virtual

Reimplemented from ExeElementWrapper.

Definition at line 106 of file OptHdrWrapper.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ dllCharact

std::vector<DWORD> OptHdrWrapper::dllCharact
protected

Definition at line 85 of file OptHdrWrapper.h.

◆ opt32

IMAGE_OPTIONAL_HEADER32* OptHdrWrapper::opt32
protected

Definition at line 83 of file OptHdrWrapper.h.

◆ opt64

IMAGE_OPTIONAL_HEADER64* OptHdrWrapper::opt64
protected

Definition at line 84 of file OptHdrWrapper.h.

◆ s_dllCharact

std::map< DWORD, QString > OptHdrWrapper::s_dllCharact
static

Definition at line 47 of file OptHdrWrapper.h.

◆ s_optMagic

std::map< DWORD, QString > OptHdrWrapper::s_optMagic
static

Definition at line 45 of file OptHdrWrapper.h.

◆ s_osVersion

std::map< std::pair< WORD, WORD >, QString > OptHdrWrapper::s_osVersion
static

Definition at line 46 of file OptHdrWrapper.h.

◆ s_subsystem

std::map< DWORD, QString > OptHdrWrapper::s_subsystem
static

Definition at line 48 of file OptHdrWrapper.h.


The documentation for this class was generated from the following files: