Merge pull request #132 from Fanixtar/master

Wait for injector thread to end and release unnecessary data
This commit is contained in:
Callow 2022-06-19 14:42:08 +03:00 committed by GitHub
commit d01a226cbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,10 +81,14 @@ static bool LoadLibraryInject(HANDLE hProc, const std::string& dllpath)
VirtualFreeEx(hProc, pDLLPath, 0, MEM_RELEASE); VirtualFreeEx(hProc, pDLLPath, 0, MEM_RELEASE);
return false; return false;
} }
CloseHandle(hThread);
// TODO: Add waiting for thread end and release unneccessary data. // Waiting for thread end and release unnecessary data.
// VirtualFreeEx(hProc, pDLLPath, 0, MEM_RELEASE); if (WaitForSingleObject(hThread, 2000) == WAIT_OBJECT_0) {
// ILog("[DLL Injection] Remote thread ended successfully.\n");
VirtualFreeEx(hProc, pDLLPath, 0, MEM_RELEASE);
}
CloseHandle(hThread);
ILog("[DLL Injection] Successfully LoadLibraryA injection.\n"); ILog("[DLL Injection] Successfully LoadLibraryA injection.\n");
return true; return true;