From 751a1e94199dd84b81986113e56392d038fb0273 Mon Sep 17 00:00:00 2001 From: FunkyFr3sh Date: Sat, 20 Jul 2024 02:19:31 +0200 Subject: [PATCH] detect D3DWindower as well --- src/utils.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/utils.c b/src/utils.c index 44772f2..16bdd37 100644 --- a/src/utils.c +++ b/src/utils.c @@ -162,6 +162,24 @@ BOOL util_caller_is_ddraw_wrapper(void* return_address) HMODULE mod = NULL; DWORD flags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT; + HMODULE D3dHook_dll = GetModuleHandleA("D3dHook.dll"); + if (D3dHook_dll) + { + if ((getModuleHandleExA(flags, return_address, &mod) && mod == D3dHook_dll) || + (getModuleHandleExA(flags, directDrawCreate, &mod) && mod == D3dHook_dll) || + (getModuleHandleExA(flags, directDrawCreateEx, &mod) && mod == D3dHook_dll)) + { + MessageBoxA( + NULL, + "Error: You cannot combine cnc-ddraw with other DirectDraw wrappers. \n\n" + "Please disable D3DWindower and then try to start the game again.", + "Conflicting DirectDraw wrapper detected - cnc-ddraw", + MB_OK | MB_TOPMOST); + + return TRUE; + } + } + HMODULE wndmode_dll = GetModuleHandleA("wndmode.dll"); if (wndmode_dll) {