GeezerVison is showing github.com — Chainload example · techiew/UltimateProxyDLL@164580d
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: dllmain.cpp +26-4Lines changed: 26 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
3 | 3 |
|
4 | 4 | #include "UniversalProxyDLL.h" |
5 | 5 |
|
| 6 | +DWORD WINAPI NewThread(LPVOID lpParam) |
| 7 | +{ |
| 8 | + std::ifstream chainloadFile; |
| 9 | + chainloadFile.open("upd_chainload.txt"); |
| 10 | + if (chainloadFile.is_open()) |
| 11 | + { |
| 12 | + std::string line; |
| 13 | + while (getline(chainloadFile, line)) |
| 14 | + { |
| 15 | + line.erase(line.find_last_not_of(' ') + 1); |
| 16 | + line.erase(0, line.find_first_not_of(' ')); |
| 17 | + UPD::Log("Loading: ", line); |
| 18 | + LoadLibraryA(line.c_str()); |
| 19 | + } |
| 20 | + chainloadFile.close(); |
| 21 | + return 1; |
| 22 | + } |
| 23 | + UPD::Log("upd_chainload.txt not found."); |
| 24 | + return 0; |
| 25 | +} |
| 26 | + |
6 | 27 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) |
7 | 28 | { |
8 | 29 | if (fdwReason == DLL_PROCESS_ATTACH) |
9 | 30 | { |
10 | 31 | DisableThreadLibraryCalls(hinstDLL); |
11 | 32 | try |
12 | | - { |
13 | | - UPD::OpenDebugTerminal(); |
| 33 | + { |
| 34 | + UPD::MuteLogging(); |
14 | 35 | UPD::CreateProxy(hinstDLL); |
| 36 | + CreateThread(0, 0, &NewThread, NULL, 0, NULL); |
15 | 37 | } |
16 | 38 | catch (std::runtime_error e) |
17 | 39 | { |
18 | 40 | std::cout << e.what() << std::endl; |
19 | 41 | return FALSE; |
20 | 42 | } |
21 | 43 | } |
22 | | - return TRUE; |
23 | | -} |
| 44 | + return TRUE; |
| 45 | +} |