-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathhead.h
62 lines (52 loc) · 2.46 KB
/
head.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once
#include <assert.h>
#include <malloc.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
using namespace std;
#pragma warning(disable : 4996)
#define FILEPATH_IN "e:\\fg.exe"
#define EXIT_ERROR(x) \
do \
{ \
cout << "error in line " << __LINE__ << endl; \
cout << x; \
getchar(); \
exit(EXIT_FAILURE); \
} while (0)
#define FAIL_LOG(x) \
do \
{ \
cout << "test failure in line " << __LINE__ << endl; \
cout << x; \
getchar(); \
exit(EXIT_FAILURE); \
} while (0)
#define MY_ASSERT(x) \
do \
{ \
if (!x) \
EXIT_ERROR("ASSERTION failed!"); \
} while (0)
#define PRINT_RESULT(t_totaltest, t_successcount) \
do \
{ \
if (t_totaltest == t_successcount) \
cout << "all tests passed!" << endl; \
else \
cout << t_totaltest - t_successcount << "(" \
<< (double)(t_totaltest - t_successcount) / \
(double)t_totaltest * (double)100 \
<< "%)tests falied!" << endl; \
} while (0)
char g_NameOfNewSectionHeader[] ={ 'Y', 'U', 'C', 'H', 'U' };
DWORD ReadPEFile(IN LPCSTR file_in, OUT LPVOID& pFileBuffer,
PIMAGE_DOS_HEADER& pDosHeader, PIMAGE_NT_HEADERS32& pNTHeader,
PIMAGE_SECTION_HEADER& pSectionHeader);
DWORD RVA_TO_FOA(LPVOID pFileBuffer, PIMAGE_DOS_HEADER pDosHeader,
PIMAGE_NT_HEADERS32 pNTHeader,
PIMAGE_SECTION_HEADER pSectionHeader, IN DWORD RVA);
DWORD FOA_TO_RVA(LPVOID pFileBuffer, PIMAGE_DOS_HEADER pDosHeader,
PIMAGE_NT_HEADERS32 pNTHeader,
PIMAGE_SECTION_HEADER pSectionHeader, IN DWORD FOA);