X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Fformatter.hpp;h=43b816eb1ef1fb453817bd850ac5f6aad6e56191;hb=7c3ea25553564f750b5f5bffea028786bf96f4ed;hp=10661e3b14ebb1b1df1b75f5b92f6e8e082fdbab;hpb=97ac28e65ca20b5649552597afaeee1d67766f6a;p=apitrace diff --git a/common/formatter.hpp b/common/formatter.hpp index 10661e3..43b816e 100644 --- a/common/formatter.hpp +++ b/common/formatter.hpp @@ -195,6 +195,18 @@ public: inline Formatter *defaultFormatter(bool color = true) { if (color) { #ifdef _WIN32 + // http://wiki.winehq.org/DeveloperFaq#detect-wine + static HMODULE hNtDll = NULL; + static bool bWine = false; + if (!hNtDll) { + hNtDll = LoadLibraryA("ntdll"); + if (hNtDll) { + bWine = GetProcAddress(hNtDll, "wine_get_version") != NULL; + } + } + if (bWine) { + return new AnsiFormatter; + } return new WindowsFormatter; #else return new AnsiFormatter;