MCPcopy Create free account
hub / github.com/NoMercy-ac/NoMercy / ChangeThreadsStatus

Method ChangeThreadsStatus

Source/Client/NM_Engine/ThreadFunctions.cpp:196–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196bool CThreadFunctions::ChangeThreadsStatus(bool bSuspend)
197{
198 auto threadEnumerator = std::make_unique<CSafeThreadHandle>();
199 if (!IS_VALID_SMART_PTR(threadEnumerator))
200 {
201 DEBUG_LOG(LL_ERR, "threadEnumerator allocation failed! Last error: %u", g_winapiApiTable->GetLastError());
202 return false;
203 }
204
205 auto vThreads = threadEnumerator->EnumerateThreads(NtCurrentProcess);
206 if (vThreads.empty())
207 {
208 DEBUG_LOG(LL_ERR, "Thread list is null!");
209 return false;
210 }
211
212 // Suspend/Resume routine
213 for (const auto & hThread : vThreads)
214 {
215 if (g_winapiApiTable->GetThreadId(hThread) == g_winapiApiTable->GetCurrentThreadId())
216 continue;
217
218 if (bSuspend)
219 g_winapiApiTable->SuspendThread(hThread);
220 else
221 g_winapiApiTable->ResumeThread(hThread);
222 }
223
224 return true;
225}
226
227

Callers

nothing calls this directly

Calls 3

SuspendThreadMethod · 0.80
ResumeThreadMethod · 0.80
EnumerateThreadsMethod · 0.45

Tested by

no test coverage detected