-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathmain.cpp
More file actions
49 lines (40 loc) · 940 Bytes
/
Copy pathmain.cpp
File metadata and controls
49 lines (40 loc) · 940 Bytes
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
#include <Windows.h>
#include "log.h"
#include "remap.h"
//
// This linker option forces every pe section to be loaded at an address which
// is aligned to the system allocation granularity. At runtime, each section
// is padded with pages of reserved memory.
//
// NOTE This option does not affect file size.
//
#pragma comment(linker, "/ALIGN:0x10000")
//
// main
//
int
main(
int argc,
char* argv[]
)
{
ULONG_PTR ImageBase = 0;
int mainstatus = EXIT_SUCCESS;
UNREFERENCED_PARAMETER(argc);
UNREFERENCED_PARAMETER(argv);
ImageBase = (ULONG_PTR)GetModuleHandleW(NULL);
if (!ImageBase)
{
ERR_PRINT("GetModuleHandleW failed: %u\n", GetLastError());
mainstatus = EXIT_FAILURE;
goto exit;
}
if (!RmpRemapImage(ImageBase))
{
ERR_PRINT("RmpRemapImage failed.\n");
mainstatus = EXIT_FAILURE;
goto exit;
}
exit:
return mainstatus;
}