X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Fformatter.hpp;h=43b816eb1ef1fb453817bd850ac5f6aad6e56191;hb=1242ab5cbdc409e2fc2d787edc28c6ac2a8439d1;hp=10661e3b14ebb1b1df1b75f5b92f6e8e082fdbab;hpb=ee659c84695e9f94b1f6a5f8be203dc0012ca685;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;