| 194 | } |
| 195 | |
| 196 | bool 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 |
nothing calls this directly
no test coverage detected