BearParser
Portable Executable parsing library (from PE-bear)
Loading...
Searching...
No Matches
ExportDirWrapper.h
Go to the documentation of this file.
1#pragma once
2
4
6{
7public:
8
24
26 : DataDirEntryWrapper(pe, pe::DIR_EXPORT) { wrap(); }
27
28 bool wrap();
29
30 virtual void* getPtr() { return exportDir(); }
31 virtual bufsize_t getSize();
32 virtual QString getName();
33 virtual size_t getFieldsCount() { return FIELD_COUNTER; }
34 virtual size_t getSubFieldsCount() { return 1; }
35
36 virtual void* getFieldPtr(size_t fieldId, size_t subField);
37 virtual QString getFieldName(size_t fieldId);
38 virtual QString getLibraryName();
39
40 virtual Executable::addr_type containsAddrType(size_t fieldId, size_t subField = FIELD_NONE);
41
42protected:
43 char* _getLibraryName();
44 void clear();
45 size_t mapNames();
46
47 IMAGE_EXPORT_DIRECTORY* exportDir();
48 std::map<WORD, DWORD> ordToNameId;
49
50friend class ExportEntryWrapper;
51};
52
53
55{
56public:
57 // fields :
64
65 ExportEntryWrapper(Executable *pe, ExportDirWrapper *parentDir, size_t entryNumber)
66 : ExeNodeWrapper(pe, parentDir, entryNumber) { this->parentDir = parentDir; }
67
68 // full structure boundaries
69 virtual void* getPtr() { return getFuncRvaPtr(); }
70 virtual bufsize_t getSize();
71 virtual QString getName();
72
73 virtual size_t getFieldsCount() { return FIELD_COUNTER; }
74 virtual size_t getSubFieldsCount() { return 1; }
75
76 // specific field boundaries
77 virtual void* getFieldPtr(size_t fieldId, size_t subField = FIELD_NONE);// { return getPtr(); }
78 virtual bufsize_t getFieldSize(size_t fieldId, size_t subField = FIELD_NONE) { return sizeof(DWORD); }
79
80 virtual QString getFieldName(size_t fieldId);
81 virtual Executable::addr_type containsAddrType(size_t fieldId, size_t subField) { return Executable::RVA; }
82
83 bool isByOrdinal();
84 uint32_t getOrdinal();
85
88
89 char* getFuncName();
90 QString getuncNameStr() { char* name = getFuncName(); return name ? name : ""; }
91 char* getForwarder(); // NULL if not forwarded
92 QString getForwarderStr() { char* forwarder = getForwarder(); return forwarder ? forwarder : ""; }
93
94private:
95 DWORD* getFuncRvaPtr();
96 uint32_t getFuncNameId();
97 void* getFuncNameRvaPtr();
98
99 ExportDirWrapper* parentDir;
100};
101
uint32_t bufsize_t
uint64_t offset_t
#define FIELD_NONE
virtual QString getLibraryName()
virtual size_t getSubFieldsCount()
virtual size_t getFieldsCount()
virtual void * getPtr()
ExportDirWrapper(PEFile *pe)
std::map< WORD, DWORD > ordToNameId
virtual void * getFieldPtr(size_t fieldId, size_t subField)
IMAGE_EXPORT_DIRECTORY * exportDir()
virtual QString getName()
virtual Executable::addr_type containsAddrType(size_t fieldId, size_t subField=FIELD_NONE)
virtual QString getFieldName(size_t fieldId)
virtual bufsize_t getSize()
virtual QString getFieldName(size_t fieldId)
virtual size_t getSubFieldsCount()
virtual bufsize_t getFieldSize(size_t fieldId, size_t subField=FIELD_NONE)
QString getForwarderStr()
ExportEntryWrapper(Executable *pe, ExportDirWrapper *parentDir, size_t entryNumber)
char * getFuncName()
uint32_t getOrdinal()
virtual void * getPtr()
bool isByOrdinal()
virtual bufsize_t getSize()
virtual Executable::addr_type containsAddrType(size_t fieldId, size_t subField)
offset_t getFuncNameRva()
QString getuncNameStr()
virtual void * getFieldPtr(size_t fieldId, size_t subField=FIELD_NONE)
offset_t getFuncRva()
FieldID
@ FUNCTION_RVA
@ NONE
@ FIELD_COUNTER
@ NAME_RVA
char * getForwarder()
virtual QString getName()
virtual size_t getFieldsCount()