BearParser
Portable Executable parsing library (from PE-bear)
Loading...
Searching...
No Matches
FileHdrWrapper.h
Go to the documentation of this file.
1#pragma once
2
3#include "PENodeWrapper.h"
4
5#include "pe_formats.h"
6
7#include <map>
8#include <vector>
9
11{
12public:
13 /* fields :*/
25
26 static std::map<DWORD, QString> s_fHdrCharact;
27 static std::map<DWORD, QString> s_machine;
28
29 static void initCharact();
30 static std::vector<DWORD> splitCharact(DWORD characteristics);
31 static QString translateCharacteristics(DWORD charact);
32
33 static void initMachine();
34 static QString translateMachine(DWORD val);
35
36 FileHdrWrapper(PEFile *pe) : PEElementWrapper(pe), hdr(NULL) {}
37 bool wrap() { hdr = NULL; getPtr(); return true; }
38
39 /* full structure boundaries */
40 virtual void* getPtr();
41 virtual bufsize_t getSize() { return sizeof(IMAGE_FILE_HEADER); }
42 virtual QString getName() { return "File Hdr"; }
43 virtual size_t getFieldsCount() { return FIELD_COUNTER; }
44
45 /* specific field boundaries */
46 virtual void* getFieldPtr(size_t fieldId, size_t subField = FIELD_NONE);
47 virtual QString getFieldName(size_t fieldId);
48 virtual Executable::addr_type containsAddrType(size_t fieldId, size_t subField = FIELD_NONE);
49
50 virtual QString translateFieldContent(size_t fieldId);
51private:
52 IMAGE_FILE_HEADER* hdr;
53};
54
uint32_t bufsize_t
#define FIELD_NONE
static QString translateMachine(DWORD val)
virtual QString translateFieldContent(size_t fieldId)
virtual void * getFieldPtr(size_t fieldId, size_t subField=FIELD_NONE)
virtual Executable::addr_type containsAddrType(size_t fieldId, size_t subField=FIELD_NONE)
static std::vector< DWORD > splitCharact(DWORD characteristics)
virtual bufsize_t getSize()
virtual void * getPtr()
virtual QString getFieldName(size_t fieldId)
virtual size_t getFieldsCount()
static void initCharact()
static std::map< DWORD, QString > s_fHdrCharact
virtual QString getName()
static std::map< DWORD, QString > s_machine
FileHdrWrapper(PEFile *pe)
static void initMachine()
static QString translateCharacteristics(DWORD charact)