diff --git a/DDrawCompat/Common/Hook.cpp b/DDrawCompat/Common/Hook.cpp index cd3ea88..9659317 100644 --- a/DDrawCompat/Common/Hook.cpp +++ b/DDrawCompat/Common/Hook.cpp @@ -22,9 +22,29 @@ namespace ULONG64 g_debugBase = 0; bool g_isDbgEngInitialized = false; + LONG WINAPI dbgEngWinVerifyTrust(HWND hwnd, GUID* pgActionID, LPVOID pWVTData); PIMAGE_NT_HEADERS getImageNtHeaders(HMODULE module); bool initDbgEng(); + FARPROC WINAPI dbgEngGetProcAddress(HMODULE hModule, LPCSTR lpProcName) + { + LOG_FUNC("dbgEngGetProcAddress", hModule, lpProcName); + if (0 == strcmp(lpProcName, "WinVerifyTrust")) + { + return LOG_RESULT(reinterpret_cast(&dbgEngWinVerifyTrust)); + } + return LOG_RESULT(GetProcAddress(hModule, lpProcName)); + } + + LONG WINAPI dbgEngWinVerifyTrust( + [[maybe_unused]] HWND hwnd, + [[maybe_unused]] GUID* pgActionID, + [[maybe_unused]] LPVOID pWVTData) + { + LOG_FUNC("dbgEngWinVerifyTrust", hwnd, pgActionID, pWVTData); + return LOG_RESULT(0); + } + FARPROC* findProcAddressInIat(HMODULE module, const char* procName) { if (!module || !procName) @@ -208,6 +228,8 @@ namespace } g_isDbgEngInitialized = true; + Compat::hookIatFunction(GetModuleHandle("dbgeng"), "GetProcAddress", dbgEngGetProcAddress); + HRESULT result = S_OK; if (FAILED(result = DebugCreate(IID_IDebugClient4, reinterpret_cast(&g_debugClient))) || FAILED(result = g_debugClient->QueryInterface(IID_IDebugControl, reinterpret_cast(&g_debugControl))) ||