Skip to content

Commit

Permalink
only enable workaround for win 11 24H2
Browse files Browse the repository at this point in the history
  • Loading branch information
FunkyFr3sh committed Jan 1, 2025
1 parent c4ece39 commit ee24779
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions inc/versionhelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ VERSIONHELPERAPI IsWindowsVersion(DWORD major, DWORD minor, DWORD build, WORD se
VER_SERVICEPACKMAJOR, VER_EQUAL));
}

VERSIONHELPERAPI IsWindowsVersionExcactBuild(DWORD major, DWORD minor, DWORD build, WORD servpack)
{
RTL_OSVERSIONINFOEXW vi = { sizeof(vi),major,minor,build,0,{0},servpack };
return verhelp_verify_version(&vi, VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER | VER_SERVICEPACKMAJOR,
VerSetConditionMask(VerSetConditionMask(VerSetConditionMask(VerSetConditionMask(0,
VER_MAJORVERSION, VER_EQUAL),
VER_MINORVERSION, VER_EQUAL),
VER_BUILDNUMBER, VER_EQUAL),
VER_SERVICEPACKMAJOR, VER_EQUAL));
}

VERSIONHELPERAPI IsWindowsVersionAnySP(DWORD major, DWORD minor, DWORD build)
{
RTL_OSVERSIONINFOEXW vi = { sizeof(vi),major,minor,build,0,{0},0 };
Expand Down Expand Up @@ -135,6 +146,10 @@ VERSIONHELPERAPI IsWindows11OrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN11), LOBYTE(_WIN32_WINNT_WIN11), 22000, 0);
}

VERSIONHELPERAPI IsWindows11Version24H2OrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN11), LOBYTE(_WIN32_WINNT_WIN11), 26100, 0);
}

VERSIONHELPERAPI IsWindowsServer(void) {
OSVERSIONINFOEXW vi = {sizeof(vi),0,0,0,0,{0},0,0,0,VER_NT_WORKSTATION};
return !verhelp_verify_version(&vi, VER_PRODUCT_TYPE, VerSetConditionMask(0, VER_PRODUCT_TYPE, VER_EQUAL));
Expand Down Expand Up @@ -212,6 +227,10 @@ VERSIONHELPERAPI IsWindows11(void) {
return IsWindowsVersion(HIBYTE(_WIN32_WINNT_WIN11), LOBYTE(_WIN32_WINNT_WIN11), 22000, 0);
}

VERSIONHELPERAPI IsWindows11Version24H2(void) {
return IsWindowsVersionExcactBuild(HIBYTE(_WIN32_WINNT_WIN11), LOBYTE(_WIN32_WINNT_WIN11), 26100, 0);
}

VERSIONHELPERAPI IsWine(void) {
return verhelp_wine_get_version() != NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion src/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,7 @@ HRESULT dd_CreateEx(GUID* lpGuid, LPVOID* lplpDD, REFIID iid, IUnknown* pUnkOute

if (g_config.singlecpu)
{
if (!IsWine() && IsWindows11OrGreater())
if (!IsWine() && IsWindows11Version24H2())
{
if (GetProcessAffinityMask(proc, &proc_affinity, &system_affinity))
SetProcessAffinityMask(proc, system_affinity);
Expand Down
2 changes: 1 addition & 1 deletion src/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
}
case DLL_THREAD_ATTACH:
{
if (g_config.singlecpu && !IsWine() && IsWindows11OrGreater())
if (g_config.singlecpu && !IsWine() && IsWindows11Version24H2())
{
util_set_thread_affinity(GetCurrentThreadId());
}
Expand Down

0 comments on commit ee24779

Please sign in to comment.