1
0
mirror of https://github.com/narzoul/DDrawCompat synced 2024-12-30 08:55:36 +01:00

Fixed hangup while installing hooks on Windows 11 22H2

This commit is contained in:
narzoul 2022-09-20 23:49:38 +02:00
parent 359256660e
commit f1d8dbd1cb

View File

@ -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<FARPROC>(&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<void**>(&g_debugClient))) ||
FAILED(result = g_debugClient->QueryInterface(IID_IDebugControl, reinterpret_cast<void**>(&g_debugControl))) ||