MCPcopy Create free account
hub / github.com/dobin/RedEdr / TestThreadSuspendResume

Function TestThreadSuspendResume

RedTest/redtest.cpp:213–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213void TestThreadSuspendResume() {
214 printf("\n=== TEST 1: Thread Suspend/Resume ===\n\n");
215
216 HANDLE hThread = CreateThread(NULL, 0, WorkerThread, NULL, 0, NULL);
217 if (!hThread) {
218 printf("[!] CreateThread failed: %lu\n", GetLastError());
219 return;
220 }
221 printf("[Main] Created worker thread %lu\n", GetThreadId(hThread));
222
223 Sleep(50);
224
225 printf("[Main] Suspending worker thread\n");
226 DWORD prevSuspendCount = SuspendThread(hThread);
227 if (prevSuspendCount == (DWORD)-1) {
228 printf("[!] SuspendThread failed: %lu\n", GetLastError());
229 }
230 else {
231 printf("[Main] Thread suspended (previous suspend count: %lu)\n", prevSuspendCount);
232 }
233
234 printf("[Main] Thread is suspended (pausing for 0.1 second to demonstrate)...\n");
235 Sleep(100);
236
237 printf("[Main] Resuming worker thread\n");
238 DWORD newSuspendCount = ResumeThread(hThread);
239 if (newSuspendCount == (DWORD)-1) {
240 printf("[!] ResumeThread failed: %lu\n", GetLastError());
241 }
242 else {
243 printf("[Main] Thread resumed (previous suspend count: %lu)\n", newSuspendCount);
244 }
245
246 WaitForSingleObject(hThread, INFINITE);
247 CloseHandle(hThread);
248
249 printf("[Main] Test 1 done\n");
250}
251
252// =============================================================================
253// MODULE 2: Process Spawn + Shellcode Allocation

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected