source: Daodan/src/Daodan.c@ 985

Last change on this file since 985 was 983, checked in by alloc, 11 years ago

Daodan:

File size: 1.9 KB
Line 
1#include <windows.h>
2#include <string.h>
3#include <stdio.h>
4#include <time.h>
5
6#include "Daodan.h"
7#include "Daodan_Patch.h"
8#include "Daodan_Utility.h"
9#include "Daodan_Cheater.h"
10#include "Daodan_BSL.h"
11#include "Daodan_Console.h"
12#include "Daodan_Config.h"
13#include "patches/Patches.h"
14#include "_Version.h"
15
16#include "Oni.h"
17
18#include "Oni_GL.h"
19
20HMODULE DDrDLLModule;
21HMODULE DDrONiModule;
22
23void __cdecl DDrMain(int argc, char* argv[])
24{
25 time_t rawtime;
26 struct tm* timeinfo;
27 char buffer[80];
28 time(&rawtime);
29 timeinfo = localtime(&rawtime);
30 strftime(buffer, 80, "Daodan: %Y-%m-%d %H:%M:%S", timeinfo);
31
32 DDrStartupMessage("Daodan: Daodan v."DAODAN_VERSION_STRING" attached!");
33 DDrStartupMessage(buffer);
34
35 DDrConfig(argc, argv);
36
37 DD_Patch_Init();
38
39 ONiMain(argc, argv);
40}
41/*
42void DDrWrongExe()
43{
44 switch (MessageBox(NULL, "This version of the Daodan DLL is incompatible with your Oni.exe.\n"
45 "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))
46 {
47 case IDOK:
48 {
49 STARTUPINFO si;
50 PROCESS_INFORMATION pi;
51 FillMemory(&si, 0, sizeof(si));
52 FillMemory(&pi, 0, sizeof(pi));
53 si.cb = sizeof(si);
54 if (!CreateProcess(NULL, "cmd /c \"start http://wiki.oni2.net/Daodan_DLL\"", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
55 MessageBox(NULL, "", "", 0);
56 CloseHandle(pi.hProcess);
57 CloseHandle(pi.hThread);
58 }
59 default:
60 ExitProcess(0);
61 }
62}
63*/
64BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
65{
66 switch (fdwReason)
67 {
68 case DLL_PROCESS_ATTACH:
69 DDrDLLModule = hinstDLL;
70 DDrONiModule = GetModuleHandle(NULL);
71
72 if (*(uint32_t*)(OniExe + 0x0011acd0) == 0x09d36852)
73 DDrPatch_MakeCall((void*)(OniExe + 0x0010fb49), (void*)DDrMain);
74 else
75 ExitProcess(0);
76 break;
77 }
78 return TRUE;
79}
Note: See TracBrowser for help on using the repository browser.