-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathD2Intercepts.cpp
93 lines (74 loc) · 1.95 KB
/
D2Intercepts.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include "main.h"
#include "D2Intercepts.h"
HMODULE __stdcall Multi(LPSTR Class, LPSTR Window){ return 0; }
DWORD MainMenuAddress(){ return GetDllOffset("D2Launch.dll",0x10B08); } //Backjmp.
VOID __declspec(naked) __fastcall InitMainMenu()
{
__asm{
call Shutdown
pop esi
pop ebp
add esp,0x20
jmp [MainMenuAddress]
}
}
HANDLE __stdcall Windowname(DWORD dwExStyle,LPCSTR lpClassName,LPCSTR lpWindowName,DWORD dwStyle,int x,int y,int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam)
{
ParseCommandLine(GetCommandLineA());
CHAR szWindowName[100] = "Diablo II";
sLine *Command = GetCommand("-title");
if(Command)
if(strlen(Command->szText) > 1)
strcpy_s(szWindowName,sizeof(szWindowName),Command->szText);
return CreateWindowExA(dwExStyle,lpClassName,szWindowName,dwStyle,x,y,nWidth,nHeight,hWndParent,hMenu,hInstance,lpParam);
}
HANDLE __stdcall CacheFix(LPCSTR lpFileName,DWORD dwDesiredAccess,DWORD dwShareMode,LPSECURITY_ATTRIBUTES lpSecurityAttributes,DWORD dwCreationDisposition,DWORD dwFlagsAndAttributes,HANDLE hTemplateFile)
{
EraseCacheFiles();
CHAR path[MAX_PATH];
GetCurrentDirectoryA(MAX_PATH,path);
if (Globals::cachefix)
{
ParseCommandLine(GetCommandLineA());
sLine *Command = GetCommand("-title");
CHAR Def[100] = "";
if (Command)
{
sprintf_s(Def,"\\bncache%d.dat", Command);
strcat_s(path,Def);
}
else
{
srand((unsigned int)time(NULL));
sprintf_s(Def,"\\bncache%d.dat",rand()%0x2000);
strcat_s(path,Def);
}
}
else
strcat_s(path,"\\bncache.dat");
return CreateFileA(path,dwDesiredAccess,dwShareMode,lpSecurityAttributes,dwCreationDisposition,dwFlagsAndAttributes,hTemplateFile);
}
void GameDraw(void)
{
if (Globals::sleepy)
Sleep(10);
}
void __declspec(naked) GameDraw_STUB()
{
__asm
{
call GameDraw;
POP ESI
POP EBX
POP ECX
RETN 4
}
}
void __declspec(naked) FailToJoin_Interception()
{
__asm
{
cmp esi, 4000;
ret;
}
}