Skip to content

Commit

Permalink
Added a check to mark the thread as not to be resumed as it's not sus…
Browse files Browse the repository at this point in the history
…pended, because OpenThread failed
  • Loading branch information
FransBouma committed Aug 8, 2024
1 parent 8dd7f7d commit acc8f7d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,12 @@ static MH_STATUS Freeze(PFROZEN_THREADS pThreads, UINT pos, UINT action)
for (i = 0; i < pThreads->size; ++i)
{
HANDLE hThread = OpenThread(THREAD_ACCESS, FALSE, pThreads->pItems[i]);
if (hThread != NULL)
if (hThread == NULL)
{
// Mark thread as not suspended, so it's not resumed later on.
pThreads->pItems[i] = 0;
}
else
{
DWORD result = SuspendThread(hThread);
if (result == 0xFFFFFFFF)
Expand Down

0 comments on commit acc8f7d

Please # to comment.