forked from vRare/AutoSpitta-x64
-
Notifications
You must be signed in to change notification settings - Fork 1
/
hacks.c
144 lines (117 loc) · 2.44 KB
/
hacks.c
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
#include "hacks.h"
#include "mousehook.h"
#include "keyboardhook.h"
#include <ntifs.h>
int procID = 0, memaddr = 0;
NTSTATUS Sleep(ULONGLONG milliseconds)
{
LARGE_INTEGER delay;
ULONG *split;
milliseconds *= 1000000;
milliseconds /= 100;
milliseconds = -milliseconds;
split = (ULONG*)&milliseconds;
delay.LowPart = *split;
split++;
delay.HighPart = *split;
KeDelayExecutionThread(KernelMode, 0, &delay);
return STATUS_SUCCESS;
}
UINT32 ReadMemory(int PID, int Addr) {
KAPC_STATE apc;
UINT32 Buffer = 0;
static PEPROCESS GameProcess;
UNREFERENCED_PARAMETER(Addr);
if (!GameProcess)
PsLookupProcessByProcessId((HANDLE)PID, &GameProcess);
if (GameProcess) {
try {
if ((void*)Addr != NULL) {
KeStackAttachProcess(GameProcess, &apc);
RtlCopyMemory(&Buffer, (const void*)Addr, sizeof(UINT32));
KeUnstackDetachProcess(&apc);
}
}
except(EXCEPTION_EXECUTE_HANDLER)
{
DbgPrint("We hit an Exeption");
KeUnstackDetachProcess(&apc);
ObDereferenceObject(GameProcess);
return NULL;
}
}
return Buffer;
}
NTSTATUS shotbot_thread( PASSDATACTRL pd )
{
NTSTATUS status;
if (pd->controlswitch == TRUE)
{
if (pd->address != NULL && pd->pid != NULL)
{
int crosshair = ReadMemory((int)pd->pid, (int)pd->address);
if (crosshair > 0) {
if (!GetMouseState(0)) // if mouse button isn't already down.
{
DbgPrint("Crosshair picked! Sending input..\n");
mouse_click();
}
}
}
}
return STATUS_SUCCESS;
}
//Use these scan codes for GetKeyState()
//http://msdn.microsoft.com/en-us/library/aa299374%28v=vs.60%29.aspx
//#define __F4 62
//#define __F5 63
//typedef ULONGLONG FWORD;
//NTSTATUS SystemRoutine()
//{
// FWORD gamebase = 0;
// int activate = 0;
//
// while (TRUE)
// {
//
// if (GetKeyState(__F4))
// {
// // ENABLE
// activate = 1;
// }
//
// if (GetKeyState(__F5))
// {
// // DISABLE
// activate = 0;
// }
//
//
// if (/**procID != 0 && **/ activate != 0)
// {
// int crosshair = ReadMemory(4140, 0x44EA9844);
//
//
// /** 0 - Left mouse
// 1 - Right mouse
// 2 - Middle button
// 3 - Mouse button 4
// 4 - Mouse button 5
// **/
// if (crosshair > 0) {
//
// if (!GetMouseState(0)) // if mouse button isn't already down.
// {
// DbgPrint("Crosshair picked! Sending input..\n");
// mouse_click();
// Sleep(350);
// reload_click();
// }
// }
// }
//
// Sleep(5);
// }
//
// return STATUS_SUCCESS;
//}