forked from Sthephanfelix/Overwatch-Aimbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOverx64.cpp
267 lines (228 loc) · 7.3 KB
/
Overx64.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
// Overx64.cpp : 定义应用程序的类行为。
//
#include "stdafx.h"
#include "Overx64.h"
#include "HackProcess.h"
#include "Player.h"
#include "DirectX.h"
#include "Menu.h"
#include "VMProtectSDK.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#define SAFE_RELEASE(P) if(P){P->Release() ; P = NULL ;}
// COverx64App
BEGIN_MESSAGE_MAP(COverx64App, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// COverx64App 构造
CHackProcess HackProcess;
COverx64App::COverx64App()
{
// 支持重新启动管理器
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}
COverx64App theApp;
PCSTR MyWindowName = " nenene";
HWND MyHwnd;
PCSTR GameWindowName = "Overwatch";
PCSTR GamePorcessName = "Overwatch.exe";
HWND GameHwnd;
RECT GameRectSize;
PROCESSENTRY32 GamePorcess;
bool GameWindowMinimize=false;
bool GameWindowResize = false;
extern GameOffsets _GameOffsets;
extern CHackProcess HackProcess;
MyRectangle rectangle;
char zhuchengxu[64];
char tou[64];
char wei[64];
DWORD ID;
INT Read_INT(INT64 address , DWORD 进程ID)
{
HANDLE 内存操作句柄;
BOOL A;
INT ReadValue;
if (进程ID == -1)
{
内存操作句柄 = GetCurrentProcess();
}
else
{
内存操作句柄 = OpenProcess(2035711, NULL, 进程ID);
}
A = ReadProcessMemory(内存操作句柄, (LPVOID)address, &ReadValue, 4, NULL);
CloseHandle(内存操作句柄);
if (A == FALSE) { return INT(-1); }
else { return ReadValue; }
}
BOOL COverx64App::InitInstance()
{
CWinApp::InitInstance();
AfxEnableControlContainer();
CShellManager *pShellManager = new CShellManager;
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
MyCreateWindow();
return TRUE;
}
LRESULT CALLBACK WinProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch (Message)
{
case WM_PAINT:
DirectXInit();
DirectXRender();
break;
case WM_DESTROY:
CleanupDX();
PostQuitMessage(1);
return 0;
default:
return DefWindowProc(hWnd, Message, wParam, lParam);
break;
}
return 0;
}
void COverx64App::MyCreateWindow()
{
::CreateThread(0, 0, (LPTHREAD_START_ROUTINE)GetGameWindowRect, 0, 0, 0);
WNDCLASSEX wndClass;//EX窗口类
wndClass.cbClsExtra = NULL;
wndClass.cbSize = sizeof(WNDCLASSEX);
wndClass.cbWndExtra = NULL;
wndClass.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(0, 0, 0));
wndClass.hCursor = ::LoadCursor(0, IDC_ARROW);
wndClass.hIcon = ::LoadIcon(0, IDI_APPLICATION);
wndClass.hIconSm = ::LoadIcon(0, IDI_APPLICATION);
wndClass.hInstance = theApp.m_hInstance;
wndClass.lpfnWndProc = WinProc;
wndClass.lpszClassName = MyWindowName;
wndClass.lpszMenuName = MyWindowName;
wndClass.style = CS_VREDRAW | CS_HREDRAW;
if (!RegisterClassEx(&wndClass)) exit(1);//判断创建成功 否->关闭
GameHwnd = FindWindow(0, GameWindowName);
if (GameHwnd)
{
GetWindowRect(GameHwnd, &GameRectSize);
MyHwnd = CreateWindowEx(
WS_EX_TOPMOST |
WS_EX_TRANSPARENT |
WS_EX_LAYERED|WS_EX_TOOLWINDOW,//任务栏不显示
MyWindowName,
MyWindowName,
WS_POPUP,
1, 1, 1920, 1080, 0, 0, 0, 0);
SetLayeredWindowAttributes(MyHwnd, 0, 1, LWA_ALPHA);
SetLayeredWindowAttributes(MyHwnd, 0, RGB(0, 0, 0), LWA_COLORKEY);
ShowWindow(MyHwnd, SW_SHOW);
}
MSG Message;
ZeroMemory(&Message, sizeof(Message));
while (GetMessage(&Message, NULL, 0, 0))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
Sleep(1);
}
}
extern GameDataWork _GameData;
extern MyMenu MyMenuA;
extern MyChack Buttn_ESP;
extern MyChack Buttn_Health;
extern MyChack Buttn_Distance;
extern MyChack Buttn_AimBot;
extern MyChack Buttn_AimBotPre;
extern MyChack Buttn_AimBotSpeed;
extern MyChack Buttn_Team;
extern MyHealthButton HealthStyle;
extern MyAimBotHeight AimBotHeight;
extern MyAimBotKey AimBotKey;
extern MyAimBotSpeed Buttn_AimBotSpeedInt;
extern MyChangeButton AimBotPre;
extern MyChangeButton AimBotPreHealth;
extern MyChack Buttn_AimBotPre;
extern MyChack Buttn_AimBotPreHealth;
void GetGameWindowRect()
{
while (true)
{
GameHwnd = NULL;
GameHwnd = FindWindow(0, GameWindowName);
if (GameHwnd == 0)
exit(0);
if (GetKeyState(VK_INSERT) & 0x8000)
{
MyMenuA.MyMenuHideShow = !MyMenuA.MyMenuHideShow;
Sleep(100);
}
if (MyMenuA.MyMenuHideShow)
{
MyMenuA.MyClickPoint(GetMousePoint());
HealthStyle.MyButtonClick(GetMousePoint());
AimBotHeight.MyButtonClick(GetMousePoint());
AimBotKey.MyButtonClick(GetMousePoint());
Buttn_AimBotSpeed.MyChackClick(GetMousePoint());
Buttn_AimBotPre.MyChackClick(GetMousePoint());
Buttn_AimBotPreHealth.MyChackClick(GetMousePoint());
Buttn_ESP.MyChackClick(GetMousePoint());
Buttn_Health.MyChackClick(GetMousePoint());
Buttn_Distance.MyChackClick(GetMousePoint());
Buttn_AimBot.MyChackClick(GetMousePoint());
Buttn_AimBotPre.MyChackClick(GetMousePoint());
Buttn_Team.MyChackClick(GetMousePoint());
Buttn_AimBotSpeedInt.MyButtonClick(GetMousePoint());
AimBotPreHealth.MyButtonClick(GetMousePoint());
AimBotPre.MyButtonClick(GetMousePoint());
}
if (GameHwnd)
{
if (!_GameData.GameProcessID)
{
_GameData.GameProcessID = HackProcess.GetProcess((char*)GamePorcessName, &GamePorcess);
_GameData.GameModuleOffset = HackProcess.GetProcessModuleOffset();
}
RECT targetSize =RECT();
GetWindowRect(GameHwnd, &targetSize);//获取窗口大小
if (targetSize.left <= 0 && targetSize.top <= 0 && targetSize.right <= 0 && targetSize.bottom <= 0)//判断窗口是否最小化
{
GameWindowMinimize = true;
continue;
}
GameWindowMinimize = false;
RECT borderSize = RECT();
GetClientRect(GameHwnd, &borderSize);//获取窗口客户区的大小
DWORD dwStyle = GetWindowLong(GameHwnd, GWL_STYLE);//获取窗口风格
int windowheight;
int windowwidth;
int borderheight;
int borderwidth;
if (rectangle.Width != (targetSize.bottom - targetSize.top)&& rectangle.Width != (borderSize.right - borderSize.left))
GameWindowResize = true;
rectangle.Width = targetSize.right - targetSize.left;
rectangle.Height = targetSize.bottom - targetSize.top;
rectangle.Left = targetSize.left;
rectangle.Top = targetSize.top;
_GameData.rect = rectangle;
if ((dwStyle & WS_BORDER) != 0)
{
windowheight = targetSize.bottom - targetSize.top;
windowwidth = targetSize.right - targetSize.left;
rectangle.Height = borderSize.bottom - borderSize.top;
rectangle.Width = borderSize.right - borderSize.left;
borderheight = (windowheight - borderSize.bottom);
borderwidth = (windowwidth - borderSize.right) / 2; //only want one side
borderheight -= borderwidth; //remove bottom
targetSize.left += borderwidth;
targetSize.top += borderheight;
rectangle.Left = targetSize.left;
rectangle.Top = targetSize.top;
_GameData.rect = rectangle;
}
MoveWindow(MyHwnd, targetSize.left, targetSize.top, rectangle.Width, rectangle.Height, true);
}
Sleep(1);
}
}