Я пытаюсь внедрить mutliple (2) DLL в работающий процесс.Первый, который я пытаюсь внедрить, это sdk, необходимый второму для решительных действий.
При внедрении одной DLL без зависимостей она работает безупречно.Кроме того, проблема не в библиотеках DLL, так как при введении их с помощью Xenos они работают отлично.
Это моя функция «инжектора».Довольно стандартный метод.
bool Core::b_Inject(DWORD id, const char* spath)
{
System::Diagnostics::Trace::TraceInformation("Started DLL injection on {0}", System::DateTime::Now);
HANDLE tarProcess = OpenProcess(PROCESS_ALL_ACCESS, false, id);
if (tarProcess) {
/*LoadLibrary is always on the same adress, so calling it is as easy as*/
LPVOID loadLibW = (LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA");
if (!loadLibW) {
System::Diagnostics::Trace::TraceError("Failed to LoadLibrary {0}", GetLastError());
return false;
}
/*
Allocate the dll
*/
LPVOID loadPath = VirtualAllocEx(tarProcess,
0,
strlen(spath) + 1,
MEM_RESERVE | MEM_COMMIT,
PAGE_EXECUTE_READWRITE);
/*
IF WPM goes wrong.
*/
if (!WriteProcessMemory(tarProcess,
loadPath,
(LPVOID)spath,
strlen(spath) + 1,
0)) {
System::Diagnostics::Trace::TraceError("Failed to WPM {0}", GetLastError());
return false;
}
/*
WPM has been succesful. Let's create the remote thread
*/
HANDLE remThread = CreateRemoteThread(tarProcess,
0,
NULL,
(LPTHREAD_START_ROUTINE)loadLibW,
loadPath,
NULL,
NULL);
/*
Oh noes, something's gone wrong
*/
if (!remThread) {
System::Diagnostics::Trace::TraceError("Failed to create remote thread {0}", GetLastError());
return false;
}
/*
Wait until CRT finishes
*/
WaitForSingleObject(remThread, INFINITE);
/*
We no longer need RemoteThread, Openprocess or RemoteProcess. So let's free em
*/
CloseHandle(remThread);
VirtualFreeEx(tarProcess,
loadPath,
strlen(spath) + 1,
MEM_RELEASE);
CloseHandle(tarProcess);
/*Everything gone's properly*/
return true;
}
/*Shit's gone wrong*/
System::Diagnostics::Trace::TraceError("Failed to inject {0}", GetLastError());
return false;
}
This is where my inject function is called. pID is correct, too
```cpp
if (b_Inject(id, "sdk.dll")) {
System::Diagnostics::Trace::TraceInformation("Injected sdkdll on {0}", id);
if (b_Inject(id, "Client.dll")) {
System::Diagnostics::Trace::TraceInformation("Injected Client dll on {0}", id);
}
I'd expect to either my injector fuction to fail and get an error in the log or the Client dll to load (it should create a logs folder + a log file, none of those is the case). None of those is the case