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

Method ThreadIsItAlive

Source/Client/NM_Engine/ThreadFunctions.cpp:36–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36bool CThreadFunctions::ThreadIsItAlive(DWORD dwThreadID)
37{
38 auto hSnap = g_winapiApiTable->CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, NULL);
39 if (!IS_VALID_HANDLE(hSnap))
40 {
41 DEBUG_LOG(LL_ERR, "CreateToolhelp32Snapshot fail! Error: %u", g_winapiApiTable->GetLastError());
42 return 0;
43 }
44
45 THREADENTRY32 ti = { 0 };
46 ti.dwSize = sizeof(ti);
47
48 if (g_winapiApiTable->Thread32First(hSnap, &ti))
49 {
50 do
51 {
52 if (dwThreadID == ti.th32ThreadID)
53 {
54 g_winapiApiTable->CloseHandle(hSnap);
55 return true;
56 }
57 } while (g_winapiApiTable->Thread32Next(hSnap, &ti));
58 }
59
60 g_winapiApiTable->CloseHandle(hSnap);
61 return false;
62}
63
64DWORD CThreadFunctions::GetThreadStartAddress(HANDLE hThread)
65{

Callers

nothing calls this directly

Calls 1

CloseHandleMethod · 0.80

Tested by

no test coverage detected