Skip to content

Commit

Permalink
desktop: Detect and report Wine
Browse files Browse the repository at this point in the history
  • Loading branch information
irydacea committed Jul 22, 2015
1 parent 40711ff commit e33767f
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/desktop/version.cpp
Expand Up @@ -48,6 +48,29 @@ static lg::log_domain log_desktop("desktop");
namespace desktop
{

#ifdef _WIN32
namespace
{

/**
* Detects whether we are running on Wine or not.
*
* This is for informational purposes only and all Windows code should assume
* we are running on the real thing instead.
*/
bool on_wine()
{
HMODULE ntdll = GetModuleHandle(L"ntdll.dll");
if(!ntdll) {
return false;
}

return GetProcAddress(ntdll, "wine_get_version");
}

} // end anonymous namespace
#endif

std::string os_version()
{
#if defined(_X11) || defined(__APPLE__)
Expand All @@ -64,7 +87,8 @@ std::string os_version()
<< u.machine).str();

#elif defined(_WIN32)
static const std::string base = "Microsoft Windows";
static const std::string base
= !on_wine() ? "Microsoft Windows" : "Wine/Microsoft Windows";

OSVERSIONINFOEX v = { sizeof(OSVERSIONINFOEX) };

Expand Down

0 comments on commit e33767f

Please sign in to comment.