forked from danielkrupinski/Osiris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSvCheatsHooks.h
35 lines (27 loc) · 881 Bytes
/
SvCheatsHooks.h
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
#pragma once
#include <Endpoints.h>
#include <HookType.h>
#include <Platform/Macros/CallingConventions.h>
#include <Platform/Macros/PlatformSpecific.h>
#include <RetSpoof/FunctionInvoker.h>
namespace csgo { struct ConVarPOD; }
class SvCheatsHooks {
public:
void install(csgo::ConVarPOD* svCheats)
{
hookImpl.init(svCheats);
originalSvCheatsGetInt = reinterpret_cast<decltype(originalSvCheatsGetInt)>(hookImpl.hookAt(WIN32_LINUX(13, 16), &getInt));
}
void uninstall()
{
hookImpl.restore();
}
[[nodiscard]] auto getOriginalSvCheatsGetInt() const
{
return FunctionInvoker{ retSpoofGadgets->client, originalSvCheatsGetInt };
}
static int FASTCALL_CONV getInt(csgo::ConVarPOD* thisptr) noexcept;
private:
HookType hookImpl;
int (THISCALL_CONV* originalSvCheatsGetInt)(csgo::ConVarPOD* thisptr);
};