Skip to content

Commit

Permalink
make sure build is still compatible with older versions of windows
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Jan 12, 2025
1 parent ce91df2 commit a46da14
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ HMODULE WINAPI util_enumerate_modules(_In_opt_ HMODULE hModuleLast)

void util_set_process_affinity()
{
#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
if (snap == INVALID_HANDLE_VALUE)
return;
Expand All @@ -97,10 +98,12 @@ void util_set_process_affinity()
} while (Thread32Next(snap, &entry));

CloseHandle(snap);
#endif
}

void util_set_thread_affinity(DWORD tid)
{
#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
HANDLE thread = OpenThread(THREAD_QUERY_INFORMATION | THREAD_SET_INFORMATION, FALSE, tid);
if (thread)
{
Expand Down Expand Up @@ -149,6 +152,7 @@ void util_set_thread_affinity(DWORD tid)

CloseHandle(thread);
}
#endif
}

void util_pull_messages()
Expand Down

0 comments on commit a46da14

Please sign in to comment.