-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
46 lines (34 loc) · 1.06 KB
/
main.cpp
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
#define WIN32_LEAN_AND_MEAN
#include <filesystem>
#include <thread>
#include <iostream>
#include <Windows.h>
import Inject;
import Loader;
import text;
namespace fs = std::filesystem;
int main() {
SetConsoleOutputCP(CP_UTF8);
fs::path server = loader::findExe();
fs::path dll = loader::findDll();
loader::enableBackwardsCompatibility(true);
STARTUPINFOW startupInfo = { 0 };
PROCESS_INFORMATION procInfo = { nullptr };
startupInfo.cb = sizeof(startupInfo);
DWORD createFlags = CREATE_SUSPENDED;
CreateProcess(
server.c_str(),
nullptr, // no args
nullptr, // default process security
nullptr, // default thread security
FALSE, // don't inherit handles
createFlags,
nullptr, // no new environment
nullptr, // no new cwd
&startupInfo, &procInfo);
using namespace std::chrono_literals;
auto Result = inject(procInfo.dwProcessId, dll);
ResumeThread(procInfo.hThread);
WaitForSingleObject(procInfo.hProcess, INFINITE);
return 0;
}