summaryrefslogtreecommitdiff
path: root/csgo-loader/csgo-server/RemoteCode/RemoteInjectionServer.hpp
blob: fe6da0969e47901a10ed3e88016009a1e6ca8318 (plain)
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
#pragma once

#include <windows.h>
#include <cstdint>
#include <vector>

using ByteArray = std::vector<uint8_t>;

namespace RemoteCode
{
	// What the server sends to the client upon transaction start.
	struct RemoteServerHeader
	{
		// Does the cheat support the DirectX thread execution exploit?
		bool      m_ThreadExploitSupported;

		// This will be used for allocating the remote memory.
		uintptr_t m_SizeOfImage;

		// OPTIONAL: The cheat might be using the DllMain function
		// to do injection. Make sure to call that.
		uintptr_t m_EntryPoint;

		// OPTIONAL: The cheat might be using TLS callbacks to
		// do injection. Make sure to call that.
		uintptr_t m_TlsCallbackDirectory;
	};

	// Requests supported by the server.
	// These are stored in a vector and later looked up.
	struct RemoteServerRequest
	{
		// Hash to look up requests by.
		uint64_t	m_LookupHash;

		// Name printed on the console when a user injects.
		char		m_DebugName[128];

		// File name that's used to load the DLL server-side.
		char		m_FileName[260];

		// Does the cheat support the DirectX exploit for creating threads?
		bool		m_ThreadExploitSupported;
	};

	// The initial header we receive from the client.
	struct RemoteClientRequest
	{
		uint64_t m_LookupHash;
	};

	// The response we receive from the client upon transaction start.
	struct RemoteClientHeader
	{
		// Address of remote allocation.
		uintptr_t m_RemoteAddress;

		// Up to six remote modules.
		// NOTE: Stop iterating once a module is NULL.
		uintptr_t m_RemoteModules[6];
	};

	class RemoteInjectionServer
	{
	public:
		// Receive hash of selected cheat.
		// Reply with size of image to allocate.
		ByteArray Start(ByteArray &Response);

		// Receive client header, send over list of imported functions
		ByteArray TransactionStart(ByteArray &Response);

		// Receive list of modules & export addresses
		ByteArray TransactionContinue(ByteArray &Response);
	};
}