BearParser
Portable Executable parsing library (from PE-bear)
parser
pe
DataDirEntryWrapper.cpp
Go to the documentation of this file.
1
#include "
pe/DataDirEntryWrapper.h
"
2
#include "
pe/PEFile.h
"
3
4
DataDirEntryWrapper::DataDirEntryWrapper
(
PEFile
* pe, pe:: dir_entry v_entryType)
5
:
PENodeWrapper
(pe), entryType(v_entryType)
6
{
7
wrap
();
8
}
9
10
IMAGE_DATA_DIRECTORY*
DataDirEntryWrapper::getDataDirectory
()
11
{
12
13
if
(
m_PE
== NULL)
return
NULL;
14
15
IMAGE_DATA_DIRECTORY *d =
m_PE
->
getDataDirectory
();
16
return
d;
17
}
18
19
offset_t
DataDirEntryWrapper::getDirEntryAddress
()
20
{
21
if
(this->
entryType
>= pe::DIR_ENTRIES_COUNT)
return
INVALID_ADDR
;
22
23
IMAGE_DATA_DIRECTORY *d =
getDataDirectory
();
24
if
(!d)
return
INVALID_ADDR
;
25
26
offset_t
rva =
static_cast<
offset_t
>
(d[this->
entryType
].VirtualAddress);
27
if
(rva == 0)
return
INVALID_ADDR
;
28
return
rva;
29
}
30
31
bufsize_t
DataDirEntryWrapper::getDirEntrySize
()
32
{
33
if
(this->
entryType
>= pe::DIR_ENTRIES_COUNT)
return
0;
34
35
IMAGE_DATA_DIRECTORY *d =
getDataDirectory
();
36
if
(!d)
return
0;
37
38
bufsize_t
size =
static_cast<
bufsize_t
>
(d[this->
entryType
].Size);
39
return
size;
40
}
bufsize_t
uint32_t bufsize_t
Definition:
AbstractByteBuffer.h:14
INVALID_ADDR
const offset_t INVALID_ADDR
Definition:
AbstractByteBuffer.h:18
offset_t
uint64_t offset_t
Definition:
AbstractByteBuffer.h:17
DataDirEntryWrapper.h
PEFile.h
DataDirEntryWrapper::getDirEntrySize
bufsize_t getDirEntrySize()
Definition:
DataDirEntryWrapper.cpp:31
DataDirEntryWrapper::getDirEntryAddress
offset_t getDirEntryAddress()
Definition:
DataDirEntryWrapper.cpp:19
DataDirEntryWrapper::entryType
int entryType
Definition:
DataDirEntryWrapper.h:20
DataDirEntryWrapper::DataDirEntryWrapper
DataDirEntryWrapper(PEFile *pe, pe::dir_entry v_entryType)
Definition:
DataDirEntryWrapper.cpp:4
DataDirEntryWrapper::getDataDirectory
IMAGE_DATA_DIRECTORY * getDataDirectory()
Definition:
DataDirEntryWrapper.cpp:10
ExeNodeWrapper::wrap
virtual bool wrap()
Definition:
ExeNodeWrapper.h:16
PEFile
Definition:
PEFile.h:41
PEFile::getDataDirectory
IMAGE_DATA_DIRECTORY * getDataDirectory()
Definition:
PEFile.cpp:195
PENodeWrapper
Definition:
PENodeWrapper.h:25
PENodeWrapper::m_PE
PEFile * m_PE
Definition:
PENodeWrapper.h:36
Generated by
1.9.1