From e70589483dad6c123b20ca9e8a7f7782938eb83a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 14 Oct 2024 15:38:54 +0800 Subject: [PATCH] Kernel (Windows): detect wine --- src/util/platform/FFPlatform_windows.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/util/platform/FFPlatform_windows.c b/src/util/platform/FFPlatform_windows.c index 961f88237..cef95fff0 100644 --- a/src/util/platform/FFPlatform_windows.c +++ b/src/util/platform/FFPlatform_windows.c @@ -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);