Windows 19H1 SDK dbghelp.dll does not load on Windows 7 RRS feed

  • Question

  • Steps to reproduce:

    • Install the Windows 10.0.18362.0 SDK or WDK with debugging tools enabled on a Windows 7 machine.
    • Open a command prompt in C:\Program Files (x86)\Windows Kits\10\Debuggers\x64 (or \x86) and run a command that requires dbghelp.dll to work. Example: symchk.exe /v symchk.exe.
    • Expected result: the program runs successfully.
    • Actual result: a dialog box pops up with the message "The application was unable to start correctly (0xc0000142). Click OK to close the application."

    NTSTATUS 0xC0000142 is STATUS_DLL_INIT_FAILED. And sure enough, when stepping through the application startup in a debugger, dbghelp.dll fails to load. The underlying cause for this seems to be the delay-loaded RPCRT4.dll, from which dbghelp.dll imports the UuidCreate function which is called in its DllMain. However, UuidCreate depends on some variables internal to RPCRT4.dll being set in its own DllMain, which never gets called despite the library being loaded. If you have a debugger attached, you will see an access violation in RPCRT4!UuidCreate at this point. Regardless of whether a debugger is attached or not, the UuidCreate call fails, which in turn causes dbghelp.dll to fail to load and the application to exit with an error.

    I suspect this is related to the newer delay load API introduced in Windows 8, and dbghelp.dll incorrectly handling the fallback path for Windows 7. But this is just conjecture as I haven't investigated this further. I do question the usefulness of making RPCRT4.dll a delay load DLL if UuidCreate is going to be immediately called in DllMain anyway...

    As a workaround I have added a standard (non-delay load) import descriptor for RPCRT4.dll with CFF Explorer [link removed as apparently my account is not verified] to force it to load and go through its DllMain routine before the dbghelp.dll one is reached and calls UuidCreate. This fixes the issue and makes all of the Windows debugging tools useable on Windows 7.

    • Edited by Mattiwatti Wednesday, May 15, 2019 9:04 AM
    Wednesday, May 15, 2019 9:04 AM

All replies

  • This worked for me. Thanks!

    To give some more details, I downloaded CFF from ntcore, opened symchk.exe in it, used import adder to add a reference to RPCRT4.dll, added an import for UuidCreate, used import table to move the new import before dbghelp.dll, and then saved symchk.dll

    Friday, June 28, 2019 8:15 PM
  • This issue seems to have been fixed in the 10.0.19041.0 SDK/WDK debugging tools.
    Monday, May 18, 2020 4:05 PM