On Mon, Sep 29, 2008 at 5:34 PM, Jeff Zaroyko jeffzaroyko@gmail.com wrote:
Easier still would be checking for wine_get_version in ntdll...
#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; }
jeffz@genera:~$ i586-mingw32msvc-gcc detect.c -o detect.exe jeffz@genera:~$ ~/git/wine/wine detect.exe Running on Wine... 1.1.5
Jeff
I'de like to nominate this bit of code (if approved as an 'acceptable practice') for the wiki. It seems Wine-devel gets this question at least once a month. Thoughts?