I think the title is self explanatory... I'm writing an application in C++ and I need to determine at runtime if I'm running under Wine (to change the bahavior a little in order to avoid a specific Wine bug). Is there a programmer-friendly way or should I fiddle with running processes?
This answer is just a copy of user1457056's comment. Since links often die, answers occasionally become useless. I have copied the link content here in order to preserve this useful answer:
#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; }
There are many Wine specific registry entries:
HKEY_CURRENT_USER\Software\Wine HKEY_LOCAL_MACHINE\Software\Wine
Checking if a registry key exists has the answer of how to check for these Wine-specific registry keys.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With