1 |
#include <windows.h> |
2 |
#include <string.h> |
3 |
#include <stdio.h> |
4 |
|
5 |
#include "Daodan.h" |
6 |
#include "Daodan_Patch.h" |
7 |
#include "Daodan_Utility.h" |
8 |
#include "Daodan_Cheater.h" |
9 |
#include "Daodan_BSL.h" |
10 |
#include "Daodan_Console.h" |
11 |
#include "Daodan_Config.h" |
12 |
#include "patches/Patches.h" |
13 |
|
14 |
#include "Oni.h" |
15 |
|
16 |
#include "Oni_GL.h" |
17 |
|
18 |
HMODULE DDrDLLModule; |
19 |
HMODULE DDrONiModule; |
20 |
|
21 |
|
22 |
void __cdecl DDrMain(int argc, char* argv[]) |
23 |
{ |
24 |
DDrStartupMessage("Daodan: Daodan attached!"); |
25 |
|
26 |
DDrConfig(argc, argv); |
27 |
|
28 |
DD_Patch_Init(); |
29 |
|
30 |
|
31 |
ONiMain(argc, argv); |
32 |
} |
33 |
/* |
34 |
void DDrWrongExe() |
35 |
{ |
36 |
switch (MessageBox(NULL, "This version of the Daodan DLL is incompatible with your Oni.exe.\n" |
37 |
"Click OK for more information. To continue using Oni without the patch, replace the downloaded binkw32.dll with the original.", "Daodan", MB_OKCANCEL | MB_ICONERROR)) |
38 |
{ |
39 |
case IDOK: |
40 |
{ |
41 |
STARTUPINFO si; |
42 |
PROCESS_INFORMATION pi; |
43 |
FillMemory(&si, 0, sizeof(si)); |
44 |
FillMemory(&pi, 0, sizeof(pi)); |
45 |
si.cb = sizeof(si); |
46 |
if (!CreateProcess(NULL, "cmd /c \"start http://wiki.oni2.net/Daodan_DLL\"", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) |
47 |
MessageBox(NULL, "", "", 0); |
48 |
CloseHandle(pi.hProcess); |
49 |
CloseHandle(pi.hThread); |
50 |
} |
51 |
default: |
52 |
ExitProcess(0); |
53 |
} |
54 |
} |
55 |
*/ |
56 |
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) |
57 |
{ |
58 |
switch (fdwReason) |
59 |
{ |
60 |
case DLL_PROCESS_ATTACH: |
61 |
DDrDLLModule = hinstDLL; |
62 |
DDrONiModule = GetModuleHandle(NULL); |
63 |
|
64 |
if (*(uint32_t*)(OniExe + 0x0011acd0) == 0x09d36852) |
65 |
DDrPatch_MakeCall((void*)(OniExe + 0x0010fb49), (void*)DDrMain); |
66 |
else |
67 |
ExitProcess(0); |
68 |
break; |
69 |
} |
70 |
return TRUE; |
71 |
} |