From 8694b9a42b5c21ffe96536cc8698a245ed7c0faf Mon Sep 17 00:00:00 2001 From: narzoul Date: Sun, 22 May 2016 23:35:32 +0200 Subject: [PATCH] Log __COMPAT_LAYER environment variable --- DDrawCompat/DllMain.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/DDrawCompat/DllMain.cpp b/DDrawCompat/DllMain.cpp index 1f8bb31..f1bf171 100644 --- a/DDrawCompat/DllMain.cpp +++ b/DDrawCompat/DllMain.cpp @@ -137,6 +137,18 @@ namespace return true; } + void printEnvironmentVariable(const char* var) + { + const DWORD size = GetEnvironmentVariable(var, nullptr, 0); + std::string value(size, 0); + if (!value.empty()) + { + GetEnvironmentVariable(var, &value.front(), size); + value.pop_back(); + } + Compat::Log() << "Environment variable " << var << " = \"" << value << '"'; + } + void suppressEmulatedDirectDraw(GUID*& guid) { if (reinterpret_cast(DDCREATE_EMULATIONONLY) == guid) @@ -158,6 +170,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID /*lpvReserved*/) GetModuleFileName(nullptr, currentProcessPath, MAX_PATH); Compat::Log() << "Process path: " << currentProcessPath; + printEnvironmentVariable("__COMPAT_LAYER"); + char currentDllPath[MAX_PATH] = {}; GetModuleFileName(hinstDLL, currentDllPath, MAX_PATH); Compat::Log() << "Loading DDrawCompat from " << currentDllPath;