-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdllmain.cpp
36 lines (33 loc) · 913 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
29
30
31
32
33
34
35
36
#include "stdafx.h"
#include "stdio.h"
#include <string>
#include <windows.h>
#include "includes\injector\injector.hpp"
#include "includes\IniReader.h"
#include "TexWizard.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);
#ifdef GAME_PS
if (strstr((const char*)(base + (0xA49742 - base)), "ProStreet08Release.exe"))
{
Init();
}
#else
if ((base + nt->OptionalHeader.AddressOfEntryPoint + (0x400000 - base)) == EntryPoint) // Check if .exe file is compatible - Thanks to thelink2012 and MWisBest
{
Init();
}
#endif
else
{
MessageBoxA(NULL, WrongEntryPointErrorString, "TexWizard", MB_ICONERROR);
return FALSE;
}
}
return TRUE;
}