]> git.cworth.org Git - apitrace/blobdiff - common/formatter.hpp
Fix scripts absolute earch path (issue #76).
[apitrace] / common / formatter.hpp
index 10661e3b14ebb1b1df1b75f5b92f6e8e082fdbab..43b816eb1ef1fb453817bd850ac5f6aad6e56191 100644 (file)
@@ -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;