From c53ffab664311ae32cd476cfc75b9bd4abaf0379 Mon Sep 17 00:00:00 2001 From: narzoul Date: Sat, 3 Nov 2018 01:36:38 +0100 Subject: [PATCH] Indented function logging --- DDrawCompat/Common/CompatVtable.h | 9 +- DDrawCompat/Common/Log.cpp | 21 +- DDrawCompat/Common/Log.h | 267 +++++++++++------- DDrawCompat/D3dDdi/Hooks.cpp | 5 +- DDrawCompat/D3dDdi/KernelModeThunks.cpp | 54 ++-- DDrawCompat/DDraw/ActivateAppHandler.cpp | 8 +- DDrawCompat/DDraw/RealPrimarySurface.cpp | 9 +- DDrawCompat/DDraw/Surfaces/PrimarySurface.cpp | 4 +- DDrawCompat/Direct3d/DepthBuffer.cpp | 6 +- DDrawCompat/Dll/DllMain.cpp | 24 +- DDrawCompat/Gdi/AccessGuard.cpp | 8 +- DDrawCompat/Gdi/DcFunctions.cpp | 27 +- DDrawCompat/Gdi/PaintHandlers.cpp | 14 +- DDrawCompat/Gdi/ScrollFunctions.cpp | 12 +- DDrawCompat/Gdi/VirtualScreen.cpp | 9 +- DDrawCompat/Gdi/WinProc.cpp | 6 +- DDrawCompat/Win32/DisplayMode.cpp | 60 ++-- DDrawCompat/Win32/Registry.cpp | 17 +- 18 files changed, 268 insertions(+), 292 deletions(-) diff --git a/DDrawCompat/Common/CompatVtable.h b/DDrawCompat/Common/CompatVtable.h index 79363da..86e73e1 100644 --- a/DDrawCompat/Common/CompatVtable.h +++ b/DDrawCompat/Common/CompatVtable.h @@ -138,10 +138,8 @@ private: DDraw::ScopedThreadLock lock; #ifdef _DEBUG const char* funcName = s_funcNames[getKey()].c_str(); - Compat::LogEnter(funcName, firstParam, params...); - Result result = Hook::getCompatFunc(firstParam)(firstParam, params...); - Compat::LogLeave(funcName, firstParam, params...) << result; - return result; + LOG_FUNC(funcName, firstParam, params...); + return LOG_RESULT(Hook::getCompatFunc(firstParam)(firstParam, params...)); #else return (s_compatVtable.*ptr)(firstParam, params...); #endif @@ -153,9 +151,8 @@ private: DDraw::ScopedThreadLock lock; #ifdef _DEBUG const char* funcName = s_funcNames[getKey()].c_str(); - Compat::LogEnter(funcName, firstParam, params...); + LOG_FUNC(funcName, firstParam, params...); Hook::getCompatFunc(firstParam)(firstParam, params...); - Compat::LogLeave(funcName, firstParam, params...); #else (s_compatVtable.*ptr)(firstParam, params...); #endif diff --git a/DDrawCompat/Common/Log.cpp b/DDrawCompat/Common/Log.cpp index b23e33b..7436a6f 100644 --- a/DDrawCompat/Common/Log.cpp +++ b/DDrawCompat/Common/Log.cpp @@ -1,13 +1,17 @@ #define WIN32_LEAN_AND_MEAN +#include #include #include +#include "Common/Hook.h" #include "Common/Log.h" namespace { + Compat::CriticalSection g_logCs; + template std::ostream& streamDevMode(std::ostream& os, const DevMode& dm) { @@ -76,7 +80,7 @@ std::ostream& operator<<(std::ostream& os, const RECT& rect) std::ostream& operator<<(std::ostream& os, HDC__& dc) { - return os << "DC(" << static_cast(&dc) << ',' << WindowFromDC(&dc) << ')'; + return os << "DC(" << static_cast(&dc) << ',' << CALL_ORIG_FUNC(WindowFromDC)(&dc) << ')'; } std::ostream& operator<<(std::ostream& os, HRGN__& rgn) @@ -178,15 +182,20 @@ std::ostream& operator<<(std::ostream& os, const CWPRETSTRUCT& cwrp) namespace Compat { - Log::Log() + Log::Log() : m_lock(g_logCs) { SYSTEMTIME st = {}; GetLocalTime(&st); - char time[100]; - sprintf_s(time, "%02hu:%02hu:%02hu.%03hu ", st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); + char header[20]; + sprintf_s(header, "%04hx %02hu:%02hu:%02hu.%03hu ", + GetCurrentThreadId(), st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); + s_logFile << header; - s_logFile << GetCurrentThreadId() << " " << time; + if (0 != s_indent) + { + std::fill_n(std::ostreambuf_iterator(s_logFile), s_indent, ' '); + } } Log::~Log() @@ -194,6 +203,8 @@ namespace Compat s_logFile << std::endl; } + thread_local DWORD Log::s_indent = 0; + std::ofstream Log::s_logFile("ddraw.log"); DWORD Log::s_outParamDepth = 0; bool Log::s_isLeaveLog = false; diff --git a/DDrawCompat/Common/Log.h b/DDrawCompat/Common/Log.h index b4d1924..d5c1273 100644 --- a/DDrawCompat/Common/Log.h +++ b/DDrawCompat/Common/Log.h @@ -2,9 +2,15 @@ #include #include +#include #include #include +#include "Common/ScopedCriticalSection.h" + +#define LOG_FUNC(...) Compat::LogFunc logFunc(__VA_ARGS__) +#define LOG_RESULT(...) logFunc.setResult(__VA_ARGS__) + #define LOG_ONCE(msg) \ static bool isAlreadyLogged##__LINE__ = false; \ if (!isAlreadyLogged##__LINE__) \ @@ -34,37 +40,104 @@ namespace Compat { using ::operator<<; - template - struct Hex + namespace detail { - explicit Hex(Num val) : val(val) {} - Num val; - }; + template + struct Hex + { + explicit Hex(T val) : val(val) {} + T val; + }; - template Hex hex(Num val) { return Hex(val); } + template + struct Array + { + Array(const Elem* elem, const unsigned long size) : elem(elem), size(size) {} + const Elem* elem; + const unsigned long size; + }; - template - struct Array - { - Array(const Elem* elem, const unsigned long size) : elem(elem), size(size) {} - const Elem* elem; - const unsigned long size; - }; + template + struct Out + { + explicit Out(T val) : val(val) {} + T val; + }; - template - Array array(const Elem* elem, const unsigned long size) - { - return Array(elem, size); + class LogParams; + + class LogFirstParam + { + public: + LogFirstParam(std::ostream& os) : m_os(os) {} + template LogParams operator<<(const T& val) { m_os << val; return LogParams(m_os); } + + protected: + std::ostream& m_os; + }; + + class LogParams + { + public: + LogParams(std::ostream& os) : m_os(os) {} + template LogParams& operator<<(const T& val) { m_os << ',' << val; return *this; } + + operator std::ostream&() { return m_os; } + + private: + std::ostream& m_os; + }; + + template + std::ostream& operator<<(std::ostream& os, Hex hex) + { + os << "0x" << std::hex << hex.val << std::dec; + return os; + } + + template + std::ostream& operator<<(std::ostream& os, Array array) + { + os << '['; + if (Log::isPointerDereferencingAllowed()) + { + if (0 != array.size) + { + os << array.elem[0]; + } + for (unsigned long i = 1; i < array.size; ++i) + { + os << ',' << array.elem[i]; + } + } + return os << ']'; + } + + template + std::ostream& operator<<(std::ostream& os, Out out) + { + ++Log::s_outParamDepth; + os << out.val; + --Log::s_outParamDepth; + return os; + } } - template - struct Out + template detail::Hex hex(T val) { - explicit Out(const T& val) : val(val) {} - const T& val; - }; + return detail::Hex(val); + } - template Out out(const T& val) { return Out(val); } + template + detail::Array array(const Elem* elem, const unsigned long size) + { + return detail::Array(elem, size); + } + + template detail::Out out(const T& val) + { + return detail::Out(val); + } class Log { @@ -91,8 +164,8 @@ namespace Compat } private: - friend class LogLeaveGuard; - template friend std::ostream& operator<<(std::ostream& os, Out out); + friend class LogFunc; + template friend std::ostream& detail::operator<<(std::ostream& os, detail::Out out); void toList() { @@ -111,126 +184,102 @@ namespace Compat toList(remainingParams...); } + ScopedCriticalSection m_lock; + + static thread_local DWORD s_indent; + static std::ofstream s_logFile; static DWORD s_outParamDepth; static bool s_isLeaveLog; }; - class LogParams; - - class LogFirstParam + class LogStruct : public detail::LogFirstParam { public: - LogFirstParam(std::ostream& os) : m_os(os) {} - template LogParams operator<<(const T& val) { m_os << val; return LogParams(m_os); } - - protected: - std::ostream& m_os; - }; - - class LogParams - { - public: - LogParams(std::ostream& os) : m_os(os) {} - template LogParams& operator<<(const T& val) { m_os << ',' << val; return *this; } - - operator std::ostream&() { return m_os; } - - private: - std::ostream& m_os; - }; - - class LogStruct : public LogFirstParam - { - public: - LogStruct(std::ostream& os) : LogFirstParam(os) { m_os << '{'; } + LogStruct(std::ostream& os) : detail::LogFirstParam(os) { m_os << '{'; } ~LogStruct() { m_os << '}'; } }; #ifdef _DEBUG typedef Log LogDebug; - class LogEnter : private Log + class LogFunc { public: template - LogEnter(const char* funcName, Params... params) : Log("-->", funcName, params...) + LogFunc(const char* funcName, Params... params) + : m_printCall([=](Log& log) { log << funcName << '('; toList(log, params...); log << ')'; }) { + Log log; + log << "> "; + m_printCall(log); + Log::s_indent += 2; } - }; - class LogLeaveGuard - { - public: - LogLeaveGuard() { Log::s_isLeaveLog = true; } - ~LogLeaveGuard() { Log::s_isLeaveLog = false; } - }; + ~LogFunc() + { + Log::s_indent -= 2; + Log log; + log << "< "; + m_printCall(log); - class LogLeave : private LogLeaveGuard, private Log - { - public: - template - LogLeave(const char* funcName, Params... params) : Log("<--", funcName, params...) + if (m_printResult) + { + log << " = "; + m_printResult(log); + } + } + + template + T setResult(T result) + { + m_printResult = [=](Log& log) { log << std::hex << result << std::dec; }; + return result; + } + + private: + void toList(Log&) { } - template - void operator<<(const Result& result) + template + void toList(Log& log, Param param) { - static_cast(*this) << " = " << std::hex << result << std::dec; + log << param; } + + template + void toList(Log& log, Param firstParam, Params... remainingParams) + { + log << firstParam << ", "; + toList(log, remainingParams...); + } + + std::function m_printCall; + std::function m_printResult; }; #else - class LogNull + class LogDebug { public: - template LogNull& operator<<(const T&) { return *this; } + template LogDebug& operator<<(const T&) { return *this; } }; - typedef LogNull LogDebug; - - class LogEnter : public LogNull + class LogFunc { public: - template LogEnter(const char*, Params...) {} - }; - - typedef LogEnter LogLeave; -#endif - - template - std::ostream& operator<<(std::ostream& os, Hex hex) - { - os << "0x" << std::hex << hex.val << std::dec; - return os; - } - - template - std::ostream& operator<<(std::ostream& os, Array array) - { - os << '['; - if (Log::isPointerDereferencingAllowed()) + template + LogFunc(const char* /*funcName*/, Params...) { - if (0 != array.size) - { - os << array.elem[0]; - } - for (unsigned long i = 1; i < array.size; ++i) - { - os << ',' << array.elem[i]; - } } - return os << ']'; - } - template - std::ostream& operator<<(std::ostream& os, Out out) - { - ++Log::s_outParamDepth; - os << out.val; - --Log::s_outParamDepth; - return os; - } + template + T setResult(T result) + { + return result; + } + }; +#endif } template diff --git a/DDrawCompat/D3dDdi/Hooks.cpp b/DDrawCompat/D3dDdi/Hooks.cpp index 3e30bdc..c62b2b8 100644 --- a/DDrawCompat/D3dDdi/Hooks.cpp +++ b/DDrawCompat/D3dDdi/Hooks.cpp @@ -46,7 +46,7 @@ namespace HRESULT APIENTRY openAdapter(D3DDDIARG_OPENADAPTER* pOpenData) { - Compat::LogEnter("openAdapter", pOpenData); + LOG_FUNC("openAdapter", pOpenData); D3dDdi::AdapterCallbacks::hookVtable(pOpenData->pAdapterCallbacks); HRESULT result = g_origOpenAdapter(pOpenData); if (SUCCEEDED(result)) @@ -61,8 +61,7 @@ namespace D3dDdi::AdapterFuncs::hookDriverVtable(pOpenData->hAdapter, pOpenData->pAdapterFuncs); D3dDdi::AdapterFuncs::onOpenAdapter(pOpenData->hAdapter); } - Compat::LogLeave("openAdapter", pOpenData) << result; - return result; + return LOG_RESULT(result); } void unhookOpenAdapter() diff --git a/DDrawCompat/D3dDdi/KernelModeThunks.cpp b/DDrawCompat/D3dDdi/KernelModeThunks.cpp index d8ae05c..5112e2a 100644 --- a/DDrawCompat/D3dDdi/KernelModeThunks.cpp +++ b/DDrawCompat/D3dDdi/KernelModeThunks.cpp @@ -55,31 +55,29 @@ namespace NTSTATUS APIENTRY createContext(D3DKMT_CREATECONTEXT* pData) { - Compat::LogEnter("D3DKMTCreateContext", pData); + LOG_FUNC("D3DKMTCreateContext", pData); NTSTATUS result = CALL_ORIG_FUNC(D3DKMTCreateContext)(pData); if (SUCCEEDED(result)) { g_contexts[pData->hContext].device = pData->hDevice; } - Compat::LogLeave("D3DKMTCreateContext", pData) << result; - return result; + return LOG_RESULT(result); } NTSTATUS APIENTRY createContextVirtual(D3DKMT_CREATECONTEXTVIRTUAL* pData) { - Compat::LogEnter("D3DKMTCreateContextVirtual", pData); + LOG_FUNC("D3DKMTCreateContextVirtual", pData); NTSTATUS result = g_origD3dKmtCreateContextVirtual(pData); if (SUCCEEDED(result)) { g_contexts[pData->hContext].device = pData->hDevice; } - Compat::LogLeave("D3DKMTCreateContextVirtual", pData) << result; - return result; + return LOG_RESULT(result); } NTSTATUS APIENTRY createDcFromMemory(D3DKMT_CREATEDCFROMMEMORY* pData) { - Compat::LogEnter("D3DKMTCreateDCFromMemory", pData); + LOG_FUNC("D3DKMTCreateDCFromMemory", pData); NTSTATUS result = 0; if (pData && D3DDDIFMT_P8 == pData->Format && !pData->pColorTable && DDraw::PrimarySurface::s_palette) @@ -92,13 +90,12 @@ namespace { result = CALL_ORIG_FUNC(D3DKMTCreateDCFromMemory)(pData); } - Compat::LogLeave("D3DKMTCreateDCFromMemory", pData) << result; - return result; + return LOG_RESULT(result); } NTSTATUS APIENTRY createDevice(D3DKMT_CREATEDEVICE* pData) { - Compat::LogEnter("D3DKMTCreateDevice", pData); + LOG_FUNC("D3DKMTCreateDevice", pData); NTSTATUS result = CALL_ORIG_FUNC(D3DKMTCreateDevice)(pData); if (SUCCEEDED(result)) { @@ -108,13 +105,12 @@ namespace limit.QueuedPresentLimit = 2; CALL_ORIG_FUNC(D3DKMTSetQueuedLimit)(&limit); } - Compat::LogLeave("D3DKMTCreateDevice", pData) << result; - return result; + return LOG_RESULT(result); } NTSTATUS APIENTRY destroyContext(const D3DKMT_DESTROYCONTEXT* pData) { - Compat::LogEnter("D3DKMTDestroyContext", pData); + LOG_FUNC("D3DKMTDestroyContext", pData); NTSTATUS result = CALL_ORIG_FUNC(D3DKMTDestroyContext)(pData); if (SUCCEEDED(result)) { @@ -124,8 +120,7 @@ namespace g_lastPresentContext = 0; } } - Compat::LogLeave("D3DKMTDestroyContext", pData) << result; - return result; + return LOG_RESULT(result); } AdapterInfo getAdapterInfo(const D3DKMT_OPENADAPTERFROMHDC& data) @@ -146,20 +141,19 @@ namespace NTSTATUS APIENTRY openAdapterFromHdc(D3DKMT_OPENADAPTERFROMHDC* pData) { - Compat::LogEnter("D3DKMTOpenAdapterFromHdc", pData); + LOG_FUNC("D3DKMTOpenAdapterFromHdc", pData); NTSTATUS result = CALL_ORIG_FUNC(D3DKMTOpenAdapterFromHdc)(pData); if (SUCCEEDED(result)) { Compat::ScopedCriticalSection lock(g_vblankCs); g_lastOpenAdapterInfo = getAdapterInfo(*pData); } - Compat::LogLeave("D3DKMTOpenAdapterFromHdc", pData) << result; - return result; + return LOG_RESULT(result); } NTSTATUS APIENTRY present(D3DKMT_PRESENT* pData) { - Compat::LogEnter("D3DKMTPresent", pData); + LOG_FUNC("D3DKMTPresent", pData); if (pData->Flags.Flip) { @@ -168,8 +162,7 @@ namespace if (UINT_MAX == g_flipIntervalOverride) { - Compat::LogLeave("D3DKMTPresent", pData) << S_OK; - return S_OK; + return LOG_RESULT(S_OK); } ++g_presentCount; @@ -183,40 +176,33 @@ namespace pData->FlipInterval = static_cast(g_flipIntervalOverride); } - NTSTATUS result = CALL_ORIG_FUNC(D3DKMTPresent)(pData); - - Compat::LogLeave("D3DKMTPresent", pData) << result; - return result; + return LOG_RESULT(CALL_ORIG_FUNC(D3DKMTPresent)(pData)); } NTSTATUS APIENTRY queryAdapterInfo(const D3DKMT_QUERYADAPTERINFO* pData) { - Compat::LogEnter("D3DKMTQueryAdapterInfo", pData); + LOG_FUNC("D3DKMTQueryAdapterInfo", pData); NTSTATUS result = CALL_ORIG_FUNC(D3DKMTQueryAdapterInfo)(pData); if (SUCCEEDED(result) && KMTQAITYPE_UMDRIVERNAME == pData->Type) { auto info = static_cast(pData->pPrivateDriverData); D3dDdi::onUmdFileNameQueried(info->UmdFileName); } - Compat::LogLeave("D3DKMTQueryAdapterInfo", pData) << result; - return result; + return LOG_RESULT(result); } NTSTATUS APIENTRY setQueuedLimit(const D3DKMT_SETQUEUEDLIMIT* pData) { - Compat::LogEnter("D3DKMTSetQueuedLimit", pData); + LOG_FUNC("D3DKMTSetQueuedLimit", pData); if (D3DKMT_SET_QUEUEDLIMIT_PRESENT == pData->Type) { const UINT origLimit = pData->QueuedPresentLimit; const_cast(pData)->QueuedPresentLimit = 2; NTSTATUS result = CALL_ORIG_FUNC(D3DKMTSetQueuedLimit)(pData); const_cast(pData)->QueuedPresentLimit = origLimit; - Compat::LogLeave("D3DKMTSetQueuedLimit", pData) << result; - return result; + return LOG_RESULT(result); } - NTSTATUS result = CALL_ORIG_FUNC(D3DKMTSetQueuedLimit)(pData); - Compat::LogLeave("D3DKMTSetQueuedLimit", pData) << result; - return result; + return LOG_RESULT(CALL_ORIG_FUNC(D3DKMTSetQueuedLimit)(pData)); } void updateGdiAdapterInfo() diff --git a/DDrawCompat/DDraw/ActivateAppHandler.cpp b/DDrawCompat/DDraw/ActivateAppHandler.cpp index 83f7202..b941b40 100644 --- a/DDrawCompat/DDraw/ActivateAppHandler.cpp +++ b/DDrawCompat/DDraw/ActivateAppHandler.cpp @@ -1,6 +1,7 @@ #include #include "Common/Hook.h" +#include "Common/Log.h" #include "DDraw/ActivateAppHandler.h" #include "DDraw/RealPrimarySurface.h" #include "Gdi/Gdi.h" @@ -25,6 +26,7 @@ namespace LRESULT CALLBACK ddWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + LOG_FUNC("ddWndProc", hwnd, Compat::hex(uMsg), Compat::hex(wParam), Compat::hex(lParam)); static bool isDisplayChangeNotificationEnabled = true; switch (uMsg) @@ -44,7 +46,7 @@ namespace LRESULT result = g_origDdWndProc(hwnd, uMsg, wParam, lParam); isDisplayChangeNotificationEnabled = true; DDraw::RealPrimarySurface::enableUpdates(); - return result; + return LOG_RESULT(result); } case WM_DISPLAYCHANGE: @@ -52,13 +54,13 @@ namespace // Fix for alt-tabbing in Commandos 2 if (!isDisplayChangeNotificationEnabled) { - return 0; + return LOG_RESULT(0); } break; } } - return g_origDdWndProc(hwnd, uMsg, wParam, lParam); + return LOG_RESULT(g_origDdWndProc(hwnd, uMsg, wParam, lParam)); } } diff --git a/DDrawCompat/DDraw/RealPrimarySurface.cpp b/DDrawCompat/DDraw/RealPrimarySurface.cpp index ede3c3f..c185535 100644 --- a/DDrawCompat/DDraw/RealPrimarySurface.cpp +++ b/DDrawCompat/DDraw/RealPrimarySurface.cpp @@ -287,7 +287,7 @@ namespace void onRelease() { - Compat::LogEnter("RealPrimarySurface::onRelease"); + LOG_FUNC("RealPrimarySurface::onRelease"); g_frontBuffer = nullptr; g_clipper.release(); @@ -297,8 +297,6 @@ namespace g_waitingForPrimaryUnlock = false; g_paletteConverter.release(); g_surfaceDesc = {}; - - Compat::LogLeave("RealPrimarySurface::onRelease"); } void onRestore() @@ -348,14 +346,13 @@ namespace void presentToPrimaryChain(CompatWeakPtr src) { - Compat::LogEnter("RealPrimarySurface::presentToPrimaryChain", src.get()); + LOG_FUNC("RealPrimarySurface::presentToPrimaryChain", src.get()); Gdi::VirtualScreen::update(); if (!g_frontBuffer || !src || DDraw::RealPrimarySurface::isLost()) { bltToWindowViaGdi(nullptr); - Compat::LogLeave("RealPrimarySurface::presentToPrimaryChain", src.get()) << false; return; } @@ -392,8 +389,6 @@ namespace { bltVisibleLayeredWindowsToBackBuffer(); } - - Compat::LogLeave("RealPrimarySurface::presentToPrimaryChain", src.get()); } void updateNow(CompatWeakPtr src, UINT flipInterval) diff --git a/DDrawCompat/DDraw/Surfaces/PrimarySurface.cpp b/DDrawCompat/DDraw/Surfaces/PrimarySurface.cpp index 4811ec2..78e67ef 100644 --- a/DDrawCompat/DDraw/Surfaces/PrimarySurface.cpp +++ b/DDrawCompat/DDraw/Surfaces/PrimarySurface.cpp @@ -31,7 +31,7 @@ namespace DDraw PrimarySurface::~PrimarySurface() { - Compat::LogEnter("PrimarySurface::~PrimarySurface"); + LOG_FUNC("PrimarySurface::~PrimarySurface"); g_gdiResourceHandle = nullptr; g_primarySurface = nullptr; @@ -42,8 +42,6 @@ namespace DDraw ZeroMemory(&g_primarySurfaceDesc, sizeof(g_primarySurfaceDesc)); DDraw::RealPrimarySurface::release(); - - Compat::LogLeave("PrimarySurface::~PrimarySurface"); } template diff --git a/DDrawCompat/Direct3d/DepthBuffer.cpp b/DDrawCompat/Direct3d/DepthBuffer.cpp index fabf745..5c8d40b 100644 --- a/DDrawCompat/Direct3d/DepthBuffer.cpp +++ b/DDrawCompat/Direct3d/DepthBuffer.cpp @@ -18,7 +18,7 @@ namespace HRESULT CALLBACK enumZBufferFormatsCallback(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext) { - Compat::LogEnter("CompatDepthBuffer::enumZBufferFormatsCallback", lpDDPixFmt, lpContext); + LOG_FUNC("CompatDepthBuffer::enumZBufferFormatsCallback", lpDDPixFmt, lpContext); if (DDPF_ZBUFFER == lpDDPixFmt->dwFlags && (static_cast(1) << lpDDPixFmt->dwZBufferBitDepth) - 1 == lpDDPixFmt->dwZBitMask) { @@ -31,9 +31,7 @@ namespace case 32: supportedBitDepths |= DDBD_32; break; } } - Compat::LogLeave("CompatDepthBuffer::enumZBufferFormatsCallback", - lpDDPixFmt, lpContext) << D3DENUMRET_OK; - return D3DENUMRET_OK; + return LOG_RESULT(D3DENUMRET_OK); } GUID getDeviceGuid(const D3DDEVICEDESC& /*desc*/) diff --git a/DDrawCompat/Dll/DllMain.cpp b/DDrawCompat/Dll/DllMain.cpp index 3c03b16..1c9299b 100644 --- a/DDrawCompat/Dll/DllMain.cpp +++ b/DDrawCompat/Dll/DllMain.cpp @@ -166,12 +166,10 @@ extern "C" HRESULT WINAPI DirectDrawCreate( LPDIRECTDRAW* lplpDD, IUnknown* pUnkOuter) { - Compat::LogEnter(__func__, lpGUID, lplpDD, pUnkOuter); + LOG_FUNC(__func__, lpGUID, lplpDD, pUnkOuter); installHooks(); DDraw::suppressEmulatedDirectDraw(lpGUID); - HRESULT result = CALL_ORIG_PROC(DirectDrawCreate, lpGUID, lplpDD, pUnkOuter); - Compat::LogLeave(__func__, lpGUID, lplpDD, pUnkOuter) << result; - return result; + return LOG_RESULT(CALL_ORIG_PROC(DirectDrawCreate, lpGUID, lplpDD, pUnkOuter)); } extern "C" HRESULT WINAPI DirectDrawCreateEx( @@ -180,12 +178,10 @@ extern "C" HRESULT WINAPI DirectDrawCreateEx( REFIID iid, IUnknown* pUnkOuter) { - Compat::LogEnter(__func__, lpGUID, lplpDD, iid, pUnkOuter); + LOG_FUNC(__func__, lpGUID, lplpDD, iid, pUnkOuter); installHooks(); DDraw::suppressEmulatedDirectDraw(lpGUID); - HRESULT result = CALL_ORIG_PROC(DirectDrawCreateEx, lpGUID, lplpDD, iid, pUnkOuter); - Compat::LogLeave(__func__, lpGUID, lplpDD, iid, pUnkOuter) << result; - return result; + return LOG_RESULT(CALL_ORIG_PROC(DirectDrawCreateEx, lpGUID, lplpDD, iid, pUnkOuter)); } extern "C" HRESULT WINAPI DirectInputCreateA( @@ -194,18 +190,14 @@ extern "C" HRESULT WINAPI DirectInputCreateA( IDirectInput** lplpDirectInput, LPUNKNOWN punkOuter) { - Compat::LogEnter(__func__, hinst, dwVersion, lplpDirectInput, punkOuter); - HRESULT result = CALL_ORIG_PROC(DirectInputCreateA, hinst, dwVersion, lplpDirectInput, punkOuter); - Compat::LogLeave(__func__, hinst, dwVersion, lplpDirectInput, punkOuter) << result; - return result; + LOG_FUNC(__func__, hinst, dwVersion, lplpDirectInput, punkOuter); + return LOG_RESULT(CALL_ORIG_PROC(DirectInputCreateA, hinst, dwVersion, lplpDirectInput, punkOuter)); } extern "C" HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { - Compat::LogEnter(__func__, rclsid, riid, ppv); + LOG_FUNC(__func__, rclsid, riid, ppv); LOG_ONCE("COM instantiation of DirectDraw detected"); installHooks(); - HRESULT result = CALL_ORIG_PROC(DllGetClassObject, rclsid, riid, ppv); - Compat::LogLeave(__func__, rclsid, riid, ppv) << result; - return result; + return LOG_RESULT(CALL_ORIG_PROC(DllGetClassObject, rclsid, riid, ppv)); } diff --git a/DDrawCompat/Gdi/AccessGuard.cpp b/DDrawCompat/Gdi/AccessGuard.cpp index 8394039..92654e8 100644 --- a/DDrawCompat/Gdi/AccessGuard.cpp +++ b/DDrawCompat/Gdi/AccessGuard.cpp @@ -28,7 +28,7 @@ namespace void beginAccess(Gdi::User user, Gdi::Access access) { - Compat::LogEnter("beginAccess", user, access); + LOG_FUNC("beginAccess", user, access); Accessor& accessor = Gdi::USER_DDRAW == user ? g_ddrawAccessor : g_gdiAccessor; DWORD& accessDepth = Gdi::ACCESS_READ == access ? accessor.readAccessDepth : accessor.writeAccessDepth; @@ -41,12 +41,12 @@ namespace otherAccessor.isSynced = false; } - Compat::LogLeave("beginAccess", user, access) << accessor.isSynced; + LOG_RESULT(accessor.isSynced); } void endAccess(Gdi::User user, Gdi::Access access) { - Compat::LogEnter("endAccess", user, access); + LOG_FUNC("endAccess", user, access); Accessor& accessor = Gdi::USER_DDRAW == user ? g_ddrawAccessor : g_gdiAccessor; DWORD& accessDepth = Gdi::ACCESS_READ == access ? accessor.readAccessDepth : accessor.writeAccessDepth; @@ -72,8 +72,6 @@ namespace DDraw::RealPrimarySurface::update(); } } - - Compat::LogLeave("endAccess", user, access); } bool synchronize(Gdi::User user) diff --git a/DDrawCompat/Gdi/DcFunctions.cpp b/DDrawCompat/Gdi/DcFunctions.cpp index f5db3aa..c730680 100644 --- a/DDrawCompat/Gdi/DcFunctions.cpp +++ b/DDrawCompat/Gdi/DcFunctions.cpp @@ -98,35 +98,27 @@ namespace Result WINAPI compatGdiDcFunc(Params... params) { #ifdef _DEBUG - Compat::LogEnter(g_funcNames[origFunc], params...); + LOG_FUNC(g_funcNames[origFunc], params...); +#else + LOG_FUNC("", params...); #endif - Result result = 0; if (hasDisplayDcArg(params...)) { const bool isReadOnlyAccess = !hasDisplayDcArg(getDestinationDc(params...)); Gdi::GdiAccessGuard accessGuard(isReadOnlyAccess ? Gdi::ACCESS_READ : Gdi::ACCESS_WRITE); - result = Compat::getOrigFuncPtr()(replaceDc(params)...); - } - else - { - result = Compat::getOrigFuncPtr()(params...); + return LOG_RESULT(Compat::getOrigFuncPtr()(replaceDc(params)...)); } -#ifdef _DEBUG - Compat::LogLeave(g_funcNames[origFunc], params...) << result; -#endif - - return result; + return LOG_RESULT(Compat::getOrigFuncPtr()(params...)); } template <> BOOL WINAPI compatGdiDcFunc( HDC hdc, int x, int y, UINT options, const RECT* lprect, LPCWSTR lpString, UINT c, const INT* lpDx) { - Compat::LogEnter("ExtTextOutW", hdc, x, y, options, lprect, lpString, c, lpDx); + LOG_FUNC("ExtTextOutW", hdc, x, y, options, lprect, lpString, c, lpDx); - BOOL result = TRUE; if (hasDisplayDcArg(hdc)) { HWND hwnd = CALL_ORIG_FUNC(WindowFromDC)(hdc); @@ -150,16 +142,15 @@ namespace else { Gdi::GdiAccessGuard accessGuard(Gdi::ACCESS_WRITE); - result = CALL_ORIG_FUNC(ExtTextOutW)(replaceDc(hdc), x, y, options, lprect, lpString, c, lpDx); + return LOG_RESULT(CALL_ORIG_FUNC(ExtTextOutW)(replaceDc(hdc), x, y, options, lprect, lpString, c, lpDx)); } } else { - result = CALL_ORIG_FUNC(ExtTextOutW)(hdc, x, y, options, lprect, lpString, c, lpDx); + return LOG_RESULT(CALL_ORIG_FUNC(ExtTextOutW)(hdc, x, y, options, lprect, lpString, c, lpDx)); } - Compat::LogLeave("ExtTextOutW", hdc, x, y, options, lprect, lpString, c, lpDx) << result; - return result; + return LOG_RESULT(TRUE); } BOOL CALLBACK excludeRgnForOverlappingWindow(HWND hwnd, LPARAM lParam) diff --git a/DDrawCompat/Gdi/PaintHandlers.cpp b/DDrawCompat/Gdi/PaintHandlers.cpp index 879d2d0..b2ddfd8 100644 --- a/DDrawCompat/Gdi/PaintHandlers.cpp +++ b/DDrawCompat/Gdi/PaintHandlers.cpp @@ -121,10 +121,8 @@ namespace LRESULT defPaintProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC origWndProc, const char* origWndProcName) { - Compat::LogEnter(origWndProcName, hwnd, Compat::hex(msg), Compat::hex(wParam), Compat::hex(lParam)); - LRESULT result = defPaintProc(hwnd, msg, wParam, lParam, origWndProc); - Compat::LogLeave(origWndProcName, hwnd, Compat::hex(msg), Compat::hex(wParam), Compat::hex(lParam)) << result; - return result; + LOG_FUNC(origWndProcName, hwnd, Compat::hex(msg), Compat::hex(wParam), Compat::hex(lParam)); + return LOG_RESULT(defPaintProc(hwnd, msg, wParam, lParam, origWndProc)); } LRESULT WINAPI defWindowProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -378,12 +376,8 @@ namespace LRESULT CALLBACK user32WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, const User32WndProc& user32WndProc, WndProcHook wndProcHook) { - Compat::LogEnter(user32WndProc.name.c_str(), - hwnd, Compat::hex(uMsg), Compat::hex(wParam), Compat::hex(lParam)); - LRESULT result = wndProcHook(hwnd, uMsg, wParam, lParam, user32WndProc.oldWndProcTrampoline); - Compat::LogLeave(user32WndProc.name.c_str(), - hwnd, Compat::hex(uMsg), Compat::hex(wParam), Compat::hex(lParam)) << result; - return result; + LOG_FUNC(user32WndProc.name.c_str(), hwnd, Compat::hex(uMsg), Compat::hex(wParam), Compat::hex(lParam)); + return LOG_RESULT(wndProcHook(hwnd, uMsg, wParam, lParam, user32WndProc.oldWndProcTrampoline)); } template diff --git a/DDrawCompat/Gdi/ScrollFunctions.cpp b/DDrawCompat/Gdi/ScrollFunctions.cpp index 56c742c..e976be9 100644 --- a/DDrawCompat/Gdi/ScrollFunctions.cpp +++ b/DDrawCompat/Gdi/ScrollFunctions.cpp @@ -10,21 +10,19 @@ namespace BOOL WINAPI scrollWindow(HWND hWnd, int XAmount, int YAmount, const RECT* lpRect, const RECT* lpClipRect) { - Compat::LogEnter("scrollWindow", hWnd, XAmount, YAmount, lpRect, lpClipRect); + LOG_FUNC("scrollWindow", hWnd, XAmount, YAmount, lpRect, lpClipRect); BOOL result = CALL_ORIG_FUNC(ScrollWindow)(hWnd, XAmount, YAmount, lpRect, lpClipRect); if (result) { Gdi::ScrollFunctions::updateScrolledWindow(hWnd); } - Compat::LogLeave("scrollWindow", hWnd, XAmount, YAmount, lpRect, lpClipRect) << result; - return result; + return LOG_RESULT(result); } int WINAPI scrollWindowEx(HWND hWnd, int dx, int dy, const RECT* prcScroll, const RECT* prcClip, HRGN hrgnUpdate, LPRECT prcUpdate, UINT flags) { - Compat::LogEnter("scrollWindowEx", - hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags); + LOG_FUNC("scrollWindowEx", hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags); if (flags & SW_SMOOTHSCROLL) { @@ -38,9 +36,7 @@ namespace Gdi::ScrollFunctions::updateScrolledWindow(hWnd); } - Compat::LogLeave("scrollWindowEx", - hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags) << result; - return result; + return LOG_RESULT(result); } } diff --git a/DDrawCompat/Gdi/VirtualScreen.cpp b/DDrawCompat/Gdi/VirtualScreen.cpp index 576c72e..492f2ef 100644 --- a/DDrawCompat/Gdi/VirtualScreen.cpp +++ b/DDrawCompat/Gdi/VirtualScreen.cpp @@ -173,15 +173,14 @@ namespace Gdi bool update() { - Compat::LogEnter("VirtualScreen::update"); + LOG_FUNC("VirtualScreen::update"); DDraw::ScopedThreadLock lock; static auto prevDisplaySettingsUniqueness = Win32::DisplayMode::queryDisplaySettingsUniqueness() - 1; const auto currentDisplaySettingsUniqueness = Win32::DisplayMode::queryDisplaySettingsUniqueness(); if (currentDisplaySettingsUniqueness == prevDisplaySettingsUniqueness) { - Compat::LogLeave("VirtualScreen::update") << false; - return false; + return LOG_RESULT(false); } prevDisplaySettingsUniqueness = currentDisplaySettingsUniqueness; @@ -215,9 +214,7 @@ namespace Gdi } Gdi::redraw(nullptr); - - Compat::LogLeave("VirtualScreen::update") << true; - return true; + return LOG_RESULT(true); } void updatePalette() diff --git a/DDrawCompat/Gdi/WinProc.cpp b/DDrawCompat/Gdi/WinProc.cpp index 5217c6f..cab1b18 100644 --- a/DDrawCompat/Gdi/WinProc.cpp +++ b/DDrawCompat/Gdi/WinProc.cpp @@ -37,7 +37,7 @@ namespace LRESULT CALLBACK callWndRetProc(int nCode, WPARAM wParam, LPARAM lParam) { auto ret = reinterpret_cast(lParam); - Compat::LogEnter("callWndRetProc", Compat::hex(nCode), Compat::hex(wParam), ret); + LOG_FUNC("callWndRetProc", Compat::hex(nCode), Compat::hex(wParam), ret); if (HC_ACTION == nCode && !Gdi::Window::isPresentationWindow(ret->hwnd)) { @@ -63,9 +63,7 @@ namespace } } - LRESULT result = CallNextHookEx(nullptr, nCode, wParam, lParam); - Compat::LogLeave("callWndRetProc", Compat::hex(nCode), Compat::hex(wParam), ret) << result; - return result; + return LOG_RESULT(CallNextHookEx(nullptr, nCode, wParam, lParam)); } void disableDwmAttributes(HWND hwnd) diff --git a/DDrawCompat/Win32/DisplayMode.cpp b/DDrawCompat/Win32/DisplayMode.cpp index 9ee934f..48dab07 100644 --- a/DDrawCompat/Win32/DisplayMode.cpp +++ b/DDrawCompat/Win32/DisplayMode.cpp @@ -105,25 +105,21 @@ namespace LONG WINAPI changeDisplaySettingsExA( LPCSTR lpszDeviceName, DEVMODEA* lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam) { - Compat::LogEnter("ChangeDisplaySettingsExA", lpszDeviceName, lpDevMode, hwnd, dwflags, lParam); - LONG result = changeDisplaySettingsEx( + LOG_FUNC("ChangeDisplaySettingsExA", lpszDeviceName, lpDevMode, hwnd, dwflags, lParam); + return LOG_RESULT(changeDisplaySettingsEx( CALL_ORIG_FUNC(ChangeDisplaySettingsExA), CALL_ORIG_FUNC(EnumDisplaySettingsExA), - lpszDeviceName, lpDevMode, hwnd, dwflags, lParam); - Compat::LogLeave("ChangeDisplaySettingsExA", lpszDeviceName, lpDevMode, hwnd, dwflags, lParam) << result; - return result; + lpszDeviceName, lpDevMode, hwnd, dwflags, lParam)); } LONG WINAPI changeDisplaySettingsExW( LPCWSTR lpszDeviceName, DEVMODEW* lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam) { - Compat::LogEnter("ChangeDisplaySettingsExW", lpszDeviceName, lpDevMode, hwnd, dwflags, lParam); - LONG result = changeDisplaySettingsEx( + LOG_FUNC("ChangeDisplaySettingsExW", lpszDeviceName, lpDevMode, hwnd, dwflags, lParam); + return LOG_RESULT(changeDisplaySettingsEx( CALL_ORIG_FUNC(ChangeDisplaySettingsExW), CALL_ORIG_FUNC(EnumDisplaySettingsExW), - lpszDeviceName, lpDevMode, hwnd, dwflags, lParam); - Compat::LogLeave("ChangeDisplaySettingsExW", lpszDeviceName, lpDevMode, hwnd, dwflags, lParam) << result; - return result; + lpszDeviceName, lpDevMode, hwnd, dwflags, lParam)); } template @@ -271,35 +267,28 @@ namespace BOOL WINAPI enumDisplaySettingsExA( LPCSTR lpszDeviceName, DWORD iModeNum, DEVMODEA* lpDevMode, DWORD dwFlags) { - Compat::LogEnter("EnumDisplaySettingsExA", lpszDeviceName, iModeNum, lpDevMode, dwFlags); - BOOL result = enumDisplaySettingsEx(CALL_ORIG_FUNC(EnumDisplaySettingsExA), - lpszDeviceName, iModeNum, lpDevMode, dwFlags); - Compat::LogLeave("EnumDisplaySettingsExA", lpszDeviceName, iModeNum, lpDevMode, dwFlags) << result; - return result; + LOG_FUNC("EnumDisplaySettingsExA", lpszDeviceName, iModeNum, lpDevMode, dwFlags); + return LOG_RESULT(enumDisplaySettingsEx(CALL_ORIG_FUNC(EnumDisplaySettingsExA), + lpszDeviceName, iModeNum, lpDevMode, dwFlags)); } BOOL WINAPI enumDisplaySettingsExW( LPCWSTR lpszDeviceName, DWORD iModeNum, DEVMODEW* lpDevMode, DWORD dwFlags) { - Compat::LogEnter("EnumDisplaySettingsExW", lpszDeviceName, iModeNum, lpDevMode, dwFlags); - BOOL result = enumDisplaySettingsEx(CALL_ORIG_FUNC(EnumDisplaySettingsExW), - lpszDeviceName, iModeNum, lpDevMode, dwFlags); - Compat::LogLeave("EnumDisplaySettingsExW", lpszDeviceName, iModeNum, lpDevMode, dwFlags) << result; - return result; + LOG_FUNC("EnumDisplaySettingsExW", lpszDeviceName, iModeNum, lpDevMode, dwFlags); + return LOG_RESULT(enumDisplaySettingsEx(CALL_ORIG_FUNC(EnumDisplaySettingsExW), + lpszDeviceName, iModeNum, lpDevMode, dwFlags)); } int WINAPI getDeviceCaps(HDC hdc, int nIndex) { - Compat::LogEnter("GetDeviceCaps", hdc, nIndex); + LOG_FUNC("GetDeviceCaps", hdc, nIndex); if (hdc && BITSPIXEL == nIndex && DT_RASDISPLAY == GetDeviceCaps(hdc, TECHNOLOGY) && OBJ_DC == GetObjectType(hdc)) { - Compat::LogLeave("GetDeviceCaps", hdc, nIndex) << g_currentBpp; - return g_currentBpp; + return LOG_RESULT(g_currentBpp); } - int result = CALL_ORIG_FUNC(GetDeviceCaps)(hdc, nIndex); - Compat::LogLeave("GetDeviceCaps", hdc, nIndex) << result; - return result; + return LOG_RESULT(CALL_ORIG_FUNC(GetDeviceCaps)(hdc, nIndex)); } void releaseCompatibleDc() @@ -340,31 +329,24 @@ namespace Win32 { HBITMAP WINAPI createCompatibleBitmap(HDC hdc, int cx, int cy) { - Compat::LogEnter("CreateCompatibleBitmap", hdc, cx, cy); + LOG_FUNC("CreateCompatibleBitmap", hdc, cx, cy); replaceDc(hdc); - HBITMAP result = CALL_ORIG_FUNC(CreateCompatibleBitmap)(hdc, cx, cy); - Compat::LogLeave("CreateCompatibleBitmap", hdc, cx, cy) << result; - return result; + return LOG_RESULT(CALL_ORIG_FUNC(CreateCompatibleBitmap)(hdc, cx, cy)); } HBITMAP WINAPI createDIBitmap(HDC hdc, const BITMAPINFOHEADER* lpbmih, DWORD fdwInit, const void* lpbInit, const BITMAPINFO* lpbmi, UINT fuUsage) { - Compat::LogEnter("CreateDIBitmap", hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage); + LOG_FUNC("CreateDIBitmap", hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage); replaceDc(hdc); - HBITMAP result = CALL_ORIG_FUNC(CreateDIBitmap)(hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage); - Compat::LogLeave("CreateDIBitmap", hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage) - << result; - return result; + return LOG_RESULT(CALL_ORIG_FUNC(CreateDIBitmap)(hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage)); } HBITMAP WINAPI createDiscardableBitmap(HDC hdc, int nWidth, int nHeight) { - Compat::LogEnter("CreateDiscardableBitmap", hdc, nWidth, nHeight); + LOG_FUNC("CreateDiscardableBitmap", hdc, nWidth, nHeight); replaceDc(hdc); - HBITMAP result = CALL_ORIG_FUNC(createDiscardableBitmap)(hdc, nWidth, nHeight); - Compat::LogLeave("CreateDiscardableBitmap", hdc, nWidth, nHeight) << result; - return result; + return LOG_RESULT(CALL_ORIG_FUNC(createDiscardableBitmap)(hdc, nWidth, nHeight)); } DWORD getBpp() diff --git a/DDrawCompat/Win32/Registry.cpp b/DDrawCompat/Win32/Registry.cpp index 5605b14..965651a 100644 --- a/DDrawCompat/Win32/Registry.cpp +++ b/DDrawCompat/Win32/Registry.cpp @@ -91,7 +91,7 @@ namespace LONG WINAPI regGetValueW(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData) { - Compat::LogEnter("regGetValueW", hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData); + LOG_FUNC("regGetValueW", hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData); LONG result = ERROR_SUCCESS; const auto it = hkey && lpSubKey && lpValue && (dwFlags & RRF_RT_REG_DWORD) @@ -131,15 +131,13 @@ namespace result = CALL_ORIG_FUNC(RegGetValueW)(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData); } - Compat::LogLeave("regGetValueW", hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData) << result; - return result; + return LOG_RESULT(result); } LONG WINAPI regQueryValueExA(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData) { - Compat::LogEnter("regQueryValueExA", hKey, lpValueName, lpReserved, lpType, - static_cast(lpData), lpcbData); + LOG_FUNC("regQueryValueExA", hKey, lpValueName, lpReserved, lpType, static_cast(lpData), lpcbData); if (hKey && lpValueName) { @@ -153,17 +151,12 @@ namespace keyName.substr(localMachinePrefix.size()), oss.str())); if (it != g_unsetValues.end()) { - return ERROR_FILE_NOT_FOUND; + return LOG_RESULT(ERROR_FILE_NOT_FOUND); } } } - LONG result = CALL_ORIG_FUNC(RegQueryValueExA)(hKey, lpValueName, lpReserved, lpType, - lpData, lpcbData); - - Compat::LogLeave("regQueryValueExA", hKey, lpValueName, lpReserved, lpType, - static_cast(lpData), lpcbData) << result; - return result; + return LOG_RESULT(CALL_ORIG_FUNC(RegQueryValueExA)(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData)); } }