-
Notifications
You must be signed in to change notification settings - Fork 1
/
dllmain.cpp
28 lines (26 loc) · 859 Bytes
/
dllmain.cpp
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
#include "stdafx.h"
#include "stdio.h"
#include <string>
#include <windows.h>
#include "includes\injector\injector.hpp"
#include "includes\IniReader.h"
#include "HPCStuff.h"
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD reason, LPVOID /*lpReserved*/)
{
if (reason == DLL_PROCESS_ATTACH)
{
uintptr_t base = (uintptr_t)GetModuleHandleA(NULL);
IMAGE_DOS_HEADER* dos = (IMAGE_DOS_HEADER*)(base);
IMAGE_NT_HEADERS* nt = (IMAGE_NT_HEADERS*)(base + dos->e_lfanew);
if ((base + nt->OptionalHeader.AddressOfEntryPoint + (0x400000 - base)) == 0x7C4040) // Check if .exe file is compatible - Thanks to thelink2012 and MWisBest
{
Init();
}
else
{
MessageBoxA(NULL, "This .exe is not supported.\nPlease use v1.3 speed.exe (5,75 MB (6.029.312 bytes)).", "NFSMW Hot Pursuit Challenges", MB_ICONERROR);
return FALSE;
}
}
return TRUE;
}