我认为标题是自我解释的...我正在用C ++编写一个应用程序,我需要在运行时确定我是否在Wine下运行(为了避免特定的Wine bug,稍微改变一下行为)。 是否有程序员友好的方式或者我应该操作流程?
答案 0 :(得分:8)
有许多Wine特定的注册表项:
HKEY_CURRENT_USER\Software\Wine
HKEY_LOCAL_MACHINE\Software\Wine
Checking if a registry key exists有如何检查这些特定于Wine的注册表项的答案。
答案 1 :(得分:5)
这个答案只是user1457056评论的副本。由于链接经常死亡,答案偶尔会变得毫无用处。我在这里复制了链接内容,以保留这个有用的答案:
#include <windows.h>
#include <stdio.h>
int main(void)
{
static const char *(CDECL *pwine_get_version)(void);
HMODULE hntdll = GetModuleHandle("ntdll.dll");
if(!hntdll)
{
puts("Not running on NT.");
return 1;
}
pwine_get_version = (void *)GetProcAddress(hntdll, "wine_get_version");
if(pwine_get_version)
{
printf("Running on Wine... %s\n",pwine_get_version());
}
else
{
puts("did not detect Wine.");
}
return 0;
}