-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathloaderFree.cpp
More file actions
71 lines (57 loc) · 1.58 KB
/
Copy pathloaderFree.cpp
File metadata and controls
71 lines (57 loc) · 1.58 KB
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
#include "loaderFree.hpp"
void downloadFile(const char *dllLink, const char *dllPath)
{
URLDownloadToFileA(0, dllLink, dllPath, 0, 0);
DeleteUrlCacheEntryA(dllLink);
std::cout << "[INFO]: software downloaded!" << std::endl;
}
bool injectDll(const char *dllPath) // by ICoded
{
HWND hWnd = FindWindowA("cryENGINE", "Warface");
if (!hWnd) {
std::cout << "[ERROR]: please, start game" << std::endl;
return false;
}
DWORD pid;
DWORD tid = GetWindowThreadProcessId(hWnd, &pid);
if (!tid)
{
std::cout << "[ERROR]: cannot get process id" << std::endl;
return false;
}
HANDLE hThread = OpenThread(THREAD_ALL_ACCESS, FALSE, tid);
if (!hThread || hThread == INVALID_HANDLE_VALUE)
{
std::cout << "[ERROR]: cannot open process" << std::endl;
return false;
}
HMODULE hMod = LoadLibraryExA(dllPath, NULL, DONT_RESOLVE_DLL_REFERENCES);
if (!hMod)
{
std::cout << "[ERROR]: cannot load software" << std::endl;
return false;
}
if (!SetWindowsHookExW(3, (HOOKPROC)GetProcAddress, hMod, tid))
{
std::cout << "[ERROR]: cannot set hook" << std::endl;
return false;
}
std::cout << "[INFO]: injected!" << std::endl;
Sleep(5000);
if (PostThreadMessageW(tid, 0, 0, 0))
{
ShowWindow(GetConsoleWindow(), SW_HIDE);
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
}
return true;
}
int main()
{
std::cout << "[INFO]: starting download..." << std::endl;
downloadFile(DLL_LINK, DLL_PATH);
std::cout << "[INFO]: injecting..." << std::endl;
injectDll(DLL_PATH);
system("pause");
return true;
}