| 180 | } |
| 181 | |
| 182 | void ResumeProcessLoop(DWORD pid) |
| 183 | { |
| 184 | // Load ntdll.dll |
| 185 | HMODULE hNtdll = GetModuleHandleW(L"ntdll.dll"); |
| 186 | if (!hNtdll) { |
| 187 | std::cerr << "Failed to load ntdll.dll\n"; |
| 188 | return; |
| 189 | } |
| 190 | // Get the address of NtResumeProcess |
| 191 | pNtResumeProcess NtResumeProcess = (pNtResumeProcess)GetProcAddress(hNtdll, "NtResumeProcess"); |
| 192 | if (!NtResumeProcess) |
| 193 | { |
| 194 | std::cerr << "Failed to get NtResumeProcess address\n"; |
| 195 | return; |
| 196 | } |
| 197 | // Open the process with minimal required access |
| 198 | HANDLE hProcess = OpenProcess(PROCESS_SUSPEND_RESUME, FALSE, pid); |
| 199 | if (!hProcess) |
| 200 | { |
| 201 | std::cerr << "Failed to open process with PROCESS_SUSPEND_RESUME. Error: " << GetLastError() << "\n"; |
| 202 | return; |
| 203 | } |
| 204 | // Loop 10 times and call NtResumeProcess |
| 205 | for (int i = 0; i < 10; ++i) |
| 206 | { |
| 207 | Sleep(1000); // Optional: small delay between calls |
| 208 | NTSTATUS status = NtResumeProcess(hProcess); |
| 209 | if (status != 0) { |
| 210 | std::cerr << "NtResumeProcess failed at iteration " << i << " with status: 0x" << std::hex << status << "\n"; |
| 211 | } |
| 212 | else |
| 213 | { |
| 214 | std::cout << "Iteration " << i << ": Process resumed successfully.\n"; |
| 215 | break; |
| 216 | } |
| 217 | // end loop |
| 218 | } |
| 219 | |
| 220 | CloseHandle(hProcess); |
| 221 | } |
| 222 | |
| 223 | BOOL DumpRun(std::wstring werPath, DWORD targetPID, DWORD targetTID) |
| 224 | { |
nothing calls this directly
no outgoing calls
no test coverage detected