Skip to content

Commit 8f8ca11

Browse files
committed
Kernel (Windows): simplifies kernel version detection
1 parent 121d399 commit 8f8ca11

1 file changed

Lines changed: 9 additions & 21 deletions

File tree

src/common/impl/FFPlatform_windows.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,6 @@ static const char* detectWine(void)
208208

209209
static void getSystemReleaseAndVersion(FFPlatformSysinfo* info)
210210
{
211-
RTL_OSVERSIONINFOW osVersion = { .dwOSVersionInfoSize = sizeof(osVersion) };
212-
if (!NT_SUCCESS(RtlGetVersion(&osVersion))) // From PEB, not affected by manifest shenanigans
213-
return;
214-
215211
FF_HKEY_AUTO_DESTROY hKey = NULL;
216212
if(!ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", &hKey, NULL))
217213
return;
@@ -221,31 +217,23 @@ static void getSystemReleaseAndVersion(FFPlatformSysinfo* info)
221217

222218
ffStrbufAppendF(&info->release,
223219
"%u.%u.%u.%u",
224-
(unsigned) osVersion.dwMajorVersion,
225-
(unsigned) osVersion.dwMinorVersion,
226-
(unsigned) osVersion.dwBuildNumber,
220+
(unsigned) SharedUserData->NtMajorVersion,
221+
(unsigned) SharedUserData->NtMinorVersion,
222+
(unsigned) SharedUserData->NtBuildNumber,
227223
(unsigned) ubr);
228224

229225
ffRegReadStrbuf(hKey, L"BuildLabEx", &info->version, NULL);
230226

231227
const char* wineVersion = detectWine();
232228
if (wineVersion)
233-
ffStrbufSetF(&info->name, "Wine_%s", wineVersion);
234-
else
235229
{
236-
switch (osVersion.dwPlatformId) // Hardcoded as WIN32_NT, but just in case
237-
{
238-
case VER_PLATFORM_WIN32s:
239-
ffStrbufSetStatic(&info->name, "WIN32s");
240-
break;
241-
case VER_PLATFORM_WIN32_WINDOWS:
242-
ffStrbufSetStatic(&info->name, "WIN32_WINDOWS");
243-
break;
244-
case VER_PLATFORM_WIN32_NT:
245-
ffStrbufSetStatic(&info->name, "WIN32_NT");
246-
break;
247-
}
230+
if (instance.config.general.detectVersion)
231+
ffStrbufSetF(&info->name, "Wine_%s", wineVersion);
232+
else
233+
ffStrbufSetStatic(&info->name, "Wine");
248234
}
235+
else
236+
ffStrbufSetStatic(&info->name, "WIN32_NT");
249237
}
250238

251239
static void getSystemPageSize(FFPlatformSysinfo* info)

0 commit comments

Comments
 (0)