| 202 | } |
| 203 | |
| 204 | bool ExecuteRemoteKernelFuntion(HANDLE process, const char *functionName, LPVOID param, DWORD &exitCode) { |
| 205 | HMODULE kernelModule = GetModuleHandle("Kernel32"); |
| 206 | FARPROC function = GetProcAddress(kernelModule, functionName); |
| 207 | |
| 208 | if (function == nullptr) { |
| 209 | return false; |
| 210 | } |
| 211 | |
| 212 | DWORD threadId; |
| 213 | HANDLE thread = CreateRemoteThread(process, |
| 214 | nullptr, |
| 215 | 0, |
| 216 | (LPTHREAD_START_ROUTINE) function, |
| 217 | param, |
| 218 | 0, |
| 219 | &threadId); |
| 220 | |
| 221 | if (thread != nullptr) { |
| 222 | WaitForSingleObject(thread, INFINITE); |
| 223 | GetExitCodeThread(thread, &exitCode); |
| 224 | |
| 225 | CloseHandle(thread); |
| 226 | return true; |
| 227 | } |
| 228 | return false; |
| 229 | } |
| 230 | |
| 231 | bool IsBeingInjected(DWORD processId, LPCSTR moduleFileName) { |
| 232 | HANDLE process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId); |
no outgoing calls
no test coverage detected