Skip to content

Commit 164580d

Browse files
committed
Chainload example
1 parent f4a0f57 commit 164580d

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

dllmain.cpp

+26-4
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,43 @@
33

44
#include "UniversalProxyDLL.h"
55

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+
627
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
728
{
829
if (fdwReason == DLL_PROCESS_ATTACH)
930
{
1031
DisableThreadLibraryCalls(hinstDLL);
1132
try
12-
{
13-
UPD::OpenDebugTerminal();
33+
{
34+
UPD::MuteLogging();
1435
UPD::CreateProxy(hinstDLL);
36+
CreateThread(0, 0, &NewThread, NULL, 0, NULL);
1537
}
1638
catch (std::runtime_error e)
1739
{
1840
std::cout << e.what() << std::endl;
1941
return FALSE;
2042
}
2143
}
22-
return TRUE;
23-
}
44+
return TRUE;
45+
}

0 commit comments

Comments
 (0)