| 82 | } |
| 83 | |
| 84 | bool DllInjection::unloadDllInProcess(HANDLE hProcess, HMODULE hModule) |
| 85 | { |
| 86 | HANDLE hThread = 0; |
| 87 | DWORD lpThreadId = 0; |
| 88 | BOOL freeLibraryRet = 0; |
| 89 | |
| 90 | |
| 91 | hThread = startRemoteThread(hProcess,FreeLibrary,hModule); |
| 92 | |
| 93 | if (hThread) |
| 94 | { |
| 95 | WaitForSingleObject(hThread, INFINITE); |
| 96 | |
| 97 | if (!GetExitCodeThread(hThread, (LPDWORD) &freeLibraryRet)) |
| 98 | { |
| 99 | #ifdef DEBUG_COMMENTS |
| 100 | Scylla::debugLog.log(L"unloadDllInProcess :: GetExitCodeThread failed 0x%X", GetLastError()); |
| 101 | #endif |
| 102 | freeLibraryRet = 0; |
| 103 | } |
| 104 | |
| 105 | CloseHandle(hThread); |
| 106 | } |
| 107 | else |
| 108 | { |
| 109 | #ifdef DEBUG_COMMENTS |
| 110 | Scylla::debugLog.log(L"unloadDllInProcess :: CreateRemoteThread failed 0x%X", GetLastError()); |
| 111 | #endif |
| 112 | } |
| 113 | |
| 114 | return freeLibraryRet != 0; |
| 115 | } |
| 116 | |
| 117 | HMODULE DllInjection::getModuleHandleByFilename( HANDLE hProcess, const WCHAR * filename ) |
| 118 | { |
no test coverage detected