error on architecture mismatch
This commit is contained in:
parent
cda2cefc28
commit
588b013392
18
host/host.cc
18
host/host.cc
@ -57,8 +57,20 @@ namespace Host
|
||||
FreeLibrary(textHooker);
|
||||
|
||||
if (HANDLE processHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId))
|
||||
{
|
||||
#ifdef _WIN64
|
||||
BOOL invalidProcess = FALSE;
|
||||
IsWow64Process(processHandle, &invalidProcess);
|
||||
if (invalidProcess)
|
||||
{
|
||||
AddConsoleOutput(L"architecture mismatch: try 32 bit NextHooker instead");
|
||||
CloseHandle(processHandle);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
if (LPVOID remoteData = VirtualAllocEx(processHandle, nullptr, textHookerPathSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE))
|
||||
if (WriteProcessMemory(processHandle, remoteData, textHookerPath, textHookerPathSize, nullptr))
|
||||
{
|
||||
WriteProcessMemory(processHandle, remoteData, textHookerPath, textHookerPathSize, nullptr);
|
||||
if (HANDLE thread = CreateRemoteThread(processHandle, nullptr, 0, (LPTHREAD_START_ROUTINE)LoadLibraryW, remoteData, 0, nullptr))
|
||||
{
|
||||
WaitForSingleObject(thread, timeout);
|
||||
@ -67,6 +79,10 @@ namespace Host
|
||||
CloseHandle(processHandle);
|
||||
return true;
|
||||
}
|
||||
VirtualFreeEx(processHandle, remoteData, 0, MEM_RELEASE);
|
||||
CloseHandle(processHandle);
|
||||
}
|
||||
}
|
||||
|
||||
AddConsoleOutput(L"couldn't inject dll");
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user