This repository was archived by the owner on Dec 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmouse.cpp
More file actions
69 lines (61 loc) · 1.96 KB
/
Copy pathmouse.cpp
File metadata and controls
69 lines (61 loc) · 1.96 KB
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
#include "mouse.hpp"
#include "mem.hpp"
#include "ui.hpp"
#include <iostream>
using std::cout;
BOOL(__stdcall* GetCursorPosOrig)(LPPOINT lpPoint) = nullptr;
static BOOL __stdcall GetCursorPosHook(LPPOINT lpPoint) {
if (win_shown || no_cursor_kill)
return FALSE;
return GetCursorPosOrig(lpPoint);
}
HCURSOR(__stdcall* SetCursorOrig)(HCURSOR hCursor) = nullptr;
static HCURSOR __stdcall SetCursorHook(HCURSOR hCursor) {
if (win_shown && 0)
return nullptr;
return SetCursorOrig(hCursor);
}
static unsigned int __stdcall SetCursorYHook(void* param_1, int param_2, void *pshit)
{
if (win_shown || no_cursor_kill)
return 0;
BOOL uVar1;
tagPOINT local_c;
GetCursorPosOrig(&local_c);
uVar1 = SetCursorPos(param_2, local_c.y);
return uVar1 & 0xffff0000;
}
static unsigned int __stdcall SetCursorXHook(void* param_1, int param_2, void *pshit)
{
if (win_shown || no_cursor_kill)
return 0;
BOOL uVar1;
tagPOINT local_c;
GetCursorPosOrig(&local_c);
uVar1 = SetCursorPos(local_c.x, param_2);
return uVar1 & 0xffff0000;
}
static SHORT(__stdcall* GetKeyStateOrig)(int) = nullptr;
static SHORT __stdcall GetKeyStateHook(int key) {
if (win_shown) {
return 0;
}
auto ret = GetKeyStateOrig(key);
return ret;
}
static SHORT(__stdcall* GetAsyncKeyStateOrig)(int) = nullptr;
static SHORT __stdcall GetAsyncKeyStateHook(int key) {
if (win_shown) {
return 0;
}
auto ret = GetKeyStateOrig(key);
return ret;
}
void init_mouse() {
hook(get_ptr("GetAsyncKeyState", "user32.dll"), GetAsyncKeyStateHook, &GetAsyncKeyStateOrig);
hook(get_ptr("GetKeyState", "user32.dll"), GetKeyStateHook, &GetKeyStateOrig);
hook(get_ptr("GetCursorPos", "user32.dll"), GetCursorPosHook, &GetCursorPosOrig);
hook(get_ptr("SetCursor", "user32.dll"), SetCursorHook, &SetCursorOrig);
hook(get_base("kcmouse.mfx") + 0x1103, SetCursorYHook);
hook(get_base("kcmouse.mfx") + 0x1125, SetCursorXHook);
}