source: Daodan/src/Daodan.c@ 984

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

Daodan:

File size: 1.9 KB
RevLine 
[692]1#include <windows.h>
[346]2#include <string.h>
[838]3#include <stdio.h>
[893]4#include <time.h>
[346]5
[272]6#include "Daodan.h"
7#include "Daodan_Patch.h"
8#include "Daodan_Utility.h"
[339]9#include "Daodan_Cheater.h"
[439]10#include "Daodan_BSL.h"
[476]11#include "Daodan_Console.h"
[838]12#include "Daodan_Config.h"
[839]13#include "patches/Patches.h"
[893]14#include "_Version.h"
[349]15
[273]16#include "Oni.h"
[339]17
[692]18#include "Oni_GL.h"
[272]19
20HMODULE DDrDLLModule;
21HMODULE DDrONiModule;
22
[838]23void __cdecl DDrMain(int argc, char* argv[])
24{
[893]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);
[452]34
[838]35 DDrConfig(argc, argv);
36
[839]37 DD_Patch_Init();
[983]38
[705]39 ONiMain(argc, argv);
[273]40}
[465]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*/
[272]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
[677]72 if (*(uint32_t*)(OniExe + 0x0011acd0) == 0x09d36852)
[689]73 DDrPatch_MakeCall((void*)(OniExe + 0x0010fb49), (void*)DDrMain);
[465]74 else
75 ExitProcess(0);
[272]76 break;
77 }
78 return TRUE;
79}
Note: See TracBrowser for help on using the repository browser.