-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTraceRayCallHk.cpp
More file actions
32 lines (26 loc) · 810 Bytes
/
TraceRayCallHk.cpp
File metadata and controls
32 lines (26 loc) · 810 Bytes
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
#include <cstddef>
#include "pch.h"
#include "Utils.h"
#include "TraceRayCallHk.h"
#include <iostream>
uintptr_t jump_back_traceray = 0;
uintptr_t current_crosshair_ent_addr = 0;
void __declspec(naked) getCrossHairEnt() {
__asm {
mov current_crosshair_ent_addr, eax
jmp jump_back_traceray
}
}
void hookTracerayCall()
{
int stolen_len = 7;
uintptr_t traceray_hook = static_cast<uintptr_t>(0x45F573);
jump_back_traceray = traceray_hook + stolen_len;
std::cout << jump_back_traceray << std::endl;
jump_back_traceray = TrampHook(reinterpret_cast<void *>(traceray_hook), getCrossHairEnt, stolen_len);
}
void unHookTracerayCall()
{
uintptr_t traceray_hook = static_cast<uintptr_t>(0x45F573);
Patch((void*)traceray_hook, "\x83\xC4\x10\x89\x44\x24\x10", 7);
}