-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcPortableExecutable.h
43 lines (33 loc) · 958 Bytes
/
cPortableExecutable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include <iostream>
#include <Windows.h>
#include <string>
#include <fstream>
#include <memory>
#include <vector>
#include "cLogger.h"
struct RELOC_INFO
{
DWORD* virtualAddress = nullptr;
DWORD* firstItemAddress = nullptr;
unsigned int numberOfItems = 0;
};
typedef std::vector<RELOC_INFO> RelocationTable_t;
class cPortableExecutable
{
public:
cPortableExecutable(const std::string imagePath);
~cPortableExecutable();
std::shared_ptr<RelocationTable_t> GetRelocations();
private:
std::string _path = "";
WORD _imageNumberOfSections = 0;
void* _imageBase = nullptr;
IMAGE_DOS_HEADER* _dosHeader = nullptr;
IMAGE_NT_HEADERS* _peHeader = nullptr;
IMAGE_FILE_HEADER* _coffHeader = nullptr;
IMAGE_OPTIONAL_HEADER* _optionalHeader = nullptr;
IMAGE_SECTION_HEADER* _sectionHeader = nullptr;
cLogger_t _logger = nullptr;
};
typedef std::shared_ptr<cPortableExecutable> cPortableExecutable_t;