-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInjector.h
More file actions
30 lines (23 loc) · 782 Bytes
/
Injector.h
File metadata and controls
30 lines (23 loc) · 782 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
#pragma once
#include <string>
#include <windows.h>
class Injector
{
public:
static Injector& Get();
bool Initialize();
void Execute(const std::string& code);
private:
Injector() = default;
using PTR_PyRun_SimpleStringFlags = int (*)(const char*, void*);
using PTR_PyEval_InitThreads = void (*)();
enum PyGILState_STATE { PyGILState_LOCKED, PyGILState_UNLOCKED };
using PTR_PyGILState_Ensure = PyGILState_STATE (*)();
using PTR_PyGILState_Release = void (*)(PyGILState_STATE);
HMODULE m_python = nullptr;
PTR_PyRun_SimpleStringFlags m_run = nullptr;
PTR_PyEval_InitThreads m_initThreads = nullptr;
PTR_PyGILState_Ensure m_gilEnsure = nullptr;
PTR_PyGILState_Release m_gilRelease = nullptr;
bool m_ready = false;
};