From 3c772b3743c54cd950545e74f5f334b67e65696f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 10 Oct 2013 16:22:34 -0700 Subject: [PATCH] cli: Don't use the DLL injection method for OpenGL on Windows 8. Works around issue #172. --- cli/cli_trace.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/cli/cli_trace.cpp b/cli/cli_trace.cpp index 5903bdc..3e2b644 100644 --- a/cli/cli_trace.cpp +++ b/cli/cli_trace.cpp @@ -133,7 +133,26 @@ traceProgram(trace::API api, } #if defined(_WIN32) - useInject = true; + /* + * Use DLL injection method on Windows, even for APIs that don't stricly + * need it. Except when tracing OpenGL on Windows 8, as the injection + * method seems to have troubles tracing the internal + * gdi32.dll!SwapBuffers -> opengl32.dll!wglSwapBuffer calls, per github + * issue #172. + */ + { + OSVERSIONINFO osvi; + ZeroMemory(&osvi, sizeof osvi); + osvi.dwOSVersionInfoSize = sizeof osvi; + GetVersionEx(&osvi); + BOOL bIsWindows8orLater = + osvi.dwMajorVersion > 6 || + (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 2); + if (api != trace::API_GL || !bIsWindows8orLater) { + useInject = true; + } + } + if (useInject) { args.push_back("inject"); args.push_back(wrapperPath); -- 2.43.0