From 750bc4251c116e692af108886621dcfaf3fd886d Mon Sep 17 00:00:00 2001 From: Xusheng Date: Fri, 21 Aug 2026 18:45:48 -0400 Subject: [PATCH] Delay-load dbghelp.dll in bindiff_similarity (Fix #1860) bindiff_similarity links bindiff/binexport, which pull in Abseil's Win32 symbolizer and its static import of dbghelp.dll. Plugin init therefore maps C:\Windows\System32\dbghelp.dll into the process before the debugger gets a chance to load the WinDbg copy it needs by full path. PE imports resolve by base name, so the already-mapped System32 module wins and dbgeng.dll fails to load with ERROR_PROC_NOT_FOUND -- WinDbg 10.0.29547's dbgeng needs SymGetSymbolsNegativeAuthCache, which System32 dbghelp 10.0.26100 does not export. The result is "Failed to load DbgEng DLLs, the DbgEng adapter cannot work properly" whenever bindiff_similarity is present. /DELAYLOAD:dbghelp.dll defers the bind until the symbolizer is actually used, matching what binaryninjacore, crashreporter, debuggercore and the upstream bindiff/binexport plugin targets already do. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_015SdEhA6Lo2qAi7YjarCxQY --- plugins/bindiff_similarity/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/bindiff_similarity/CMakeLists.txt b/plugins/bindiff_similarity/CMakeLists.txt index c61105282..70778ae3a 100644 --- a/plugins/bindiff_similarity/CMakeLists.txt +++ b/plugins/bindiff_similarity/CMakeLists.txt @@ -57,6 +57,13 @@ target_link_libraries(${PROJECT_NAME} bindiff_shared ) +if (WIN32 AND NOT DEMO) + # Abseil's symbolizer imports dbghelp.dll. A static import maps System32's copy at plugin init, + # which then wins name-based resolution and breaks the debugger's WinDbg dbgeng. + target_link_libraries(${PROJECT_NAME} PRIVATE delayimp.lib) # Helper for /DELAYLOAD + target_link_options(${PROJECT_NAME} PRIVATE /DELAYLOAD:dbghelp.dll) +endif () + if (APPLE) target_link_options(${PROJECT_NAME} PRIVATE "LINKER:-exported_symbol,_CorePluginABIVersion"