Kernel (Windows): detect wine

This commit is contained in:
李通洲
2024-10-14 15:38:54 +08:00
parent 71a8978f41
commit e70589483d
+12
View File
@@ -1,5 +1,6 @@
#include "FFPlatform_private.h"
#include "common/io/io.h"
#include "common/library.h"
#include "util/stringUtils.h"
#include "util/windows/unicode.h"
#include "util/windows/registry.h"
@@ -159,6 +160,16 @@ static void getUserShell(FFPlatform* platform)
ffStrbufReplaceAllC(&platform->userShell, '\\', '/');
}
static void detectWine(FFstrbuf* buf)
{
static const char *(__cdecl *pwine_get_version)(void);
HMODULE hntdll = GetModuleHandleW(L"ntdll.dll");
if (!hntdll) return;
pwine_get_version = (void *)GetProcAddress(hntdll, "wine_get_version");
if (!pwine_get_version) return;
ffStrbufAppendF(buf, " - wine %s", pwine_get_version());
}
static void getSystemReleaseAndVersion(FFPlatformSysinfo* info)
{
RTL_OSVERSIONINFOW osVersion = { .dwOSVersionInfoSize = sizeof(osVersion) };
@@ -187,6 +198,7 @@ static void getSystemReleaseAndVersion(FFPlatformSysinfo* info)
else
ffRegReadStrbuf(hKey, L"ReleaseId", &info->displayVersion, NULL); // For old Windows 10
}
detectWine(&info->displayVersion);
ffRegReadStrbuf(hKey, L"BuildLabEx", &info->version, NULL);