Skip to content

Commit e705894

Browse files
committed
Kernel (Windows): detect wine
1 parent 71a8978 commit e705894

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/util/platform/FFPlatform_windows.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "FFPlatform_private.h"
22
#include "common/io/io.h"
3+
#include "common/library.h"
34
#include "util/stringUtils.h"
45
#include "util/windows/unicode.h"
56
#include "util/windows/registry.h"
@@ -159,6 +160,16 @@ static void getUserShell(FFPlatform* platform)
159160
ffStrbufReplaceAllC(&platform->userShell, '\\', '/');
160161
}
161162

163+
static void detectWine(FFstrbuf* buf)
164+
{
165+
static const char *(__cdecl *pwine_get_version)(void);
166+
HMODULE hntdll = GetModuleHandleW(L"ntdll.dll");
167+
if (!hntdll) return;
168+
pwine_get_version = (void *)GetProcAddress(hntdll, "wine_get_version");
169+
if (!pwine_get_version) return;
170+
ffStrbufAppendF(buf, " - wine %s", pwine_get_version());
171+
}
172+
162173
static void getSystemReleaseAndVersion(FFPlatformSysinfo* info)
163174
{
164175
RTL_OSVERSIONINFOW osVersion = { .dwOSVersionInfoSize = sizeof(osVersion) };
@@ -187,6 +198,7 @@ static void getSystemReleaseAndVersion(FFPlatformSysinfo* info)
187198
else
188199
ffRegReadStrbuf(hKey, L"ReleaseId", &info->displayVersion, NULL); // For old Windows 10
189200
}
201+
detectWine(&info->displayVersion);
190202

191203
ffRegReadStrbuf(hKey, L"BuildLabEx", &info->version, NULL);
192204

0 commit comments

Comments
 (0)