Detecting Wine

Zachary Goldberg zgold at bluesata.com
Mon Sep 29 16:44:58 CDT 2008


On Mon, Sep 29, 2008 at 5:34 PM, Jeff Zaroyko <jeffzaroyko at 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 at genera:~$ i586-mingw32msvc-gcc detect.c -o detect.exe
> jeffz at 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?



More information about the wine-devel mailing list