Discussion:
Debugging with Dllhost.exe
(too old to reply)
A. Dude
2005-09-06 02:47:02 UTC
Permalink
For some reason every time I try to debug a DLL (using dllhost.exe) it now
just exits with code 0. It _was_ working a few days ago, I havn't done
anything major to the system, I've grabbed the old code again from VSS and
numerous people have inspected my settings all to no avail. It is happening
with any DLL but not straight apps. Debug output as follows:
... loads DLLs ...
The thread 0x328 has exited with code 0 (0x0).
The program 'C:\WINDOWS\system32\dllhost.exe' has exited with code 0 (0x0).

Always happens after it loads comctl32.dll but before clbcatq.dll, if that
helps.

This really has everyone in the office stumped. I will re-install when (if)
the techos find the CD. If anyone has seen this before and can help please do
so.
Oleg Starodumov
2005-09-06 08:18:15 UTC
Permalink
Post by A. Dude
For some reason every time I try to debug a DLL (using dllhost.exe) it now
just exits with code 0. It _was_ working a few days ago, I havn't done
anything major to the system, I've grabbed the old code again from VSS and
numerous people have inspected my settings all to no avail. It is happening
... loads DLLs ...
The thread 0x328 has exited with code 0 (0x0).
The program 'C:\WINDOWS\system32\dllhost.exe' has exited with code 0 (0x0).
Always happens after it loads comctl32.dll but before clbcatq.dll, if that
helps.
Can DllHost with this DLL start when you are not debugging it?
What happens if you attach the debugger to a running instance of DllHost?
What happens if you try to step into a running instance of DllHost when debugging
the client?

You can also try to enable loader snaps and see if they can give some information
on the reason of the process exit:

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\YourApp.exe
GlobalFlag = 0x2 (REG_DWORD)

(when this flag is set, run the app under debugger and see messages with
LDR prefix in Debug Output window)

Regards,
Oleg
[VC++ MVP]
A. Dude
2005-09-07 01:43:05 UTC
Permalink
Thanks for the reply Oleg.

We tried attaching the debugger to the DllHost instance and now I can debug,
although it's not quite the same (but it is much better than what I had).

I'm only new to this program and am still learning most of it. I can explain
the architecture a bit: we use C++ for the business layer and Java for the
front-end using DCOM to go in between. As such there is only a jar file (no
exe) to launch the app. I am not sure how to proceed with enabling loader
snaps using Java, if indeed it is possible.

Thanks again.
A. Dude
2005-09-08 04:07:01 UTC
Permalink
An update:

I used the Image File Execution Options using dllhost.exe. I compared the
debug output with a working machine and I could not find anything that stood
out as being wrong. I now know that it dies after trying to load mscoree.dll,
a .Net component. I uninstalled .Net but he problem still occurs. I would
post all the output but it is too long.
Oleg Starodumov
2005-09-08 06:53:31 UTC
Permalink
Post by A. Dude
I used the Image File Execution Options using dllhost.exe. I compared the
debug output with a working machine and I could not find anything that stood
out as being wrong. I now know that it dies after trying to load mscoree.dll,
a .Net component. I uninstalled .Net but he problem still occurs. I would
post all the output but it is too long.
You can post the final part of the output.

Also, when starting DllHost under debugger, set breakpoint at
ntdll!NtTerminateProcess (the expression for the breakpoint should be
"{,,ntdll.dll}***@8", requires good symbols for ntdll.dll).
Then let it go, and hopefully this breakpoint will be hit when the process
is terminating. What will be on the call stack then?

Oleg
A. Dude
2005-09-12 07:24:03 UTC
Permalink
I have no experience with WinDbg, so I havn't followed your instructions yet.
I will post debug output later as I need to grab the XP debug symbols and
they will take a while to download.
Oleg Starodumov
2005-09-12 07:33:29 UTC
Permalink
Post by A. Dude
I have no experience with WinDbg, so I havn't followed your instructions yet.
I will post debug output later as I need to grab the XP debug symbols and
they will take a while to download.
If you are going to use WinDbg, take a look at symbol server topics
in its documentation. It allows to download symbols only when needed,
so no need to download the whole symbol package.
(VS.NET can also do it)

Oleg
A. Dude
2005-09-13 00:10:02 UTC
Permalink
Well my service request was finally filled, the re-install was successful -
the problem has gone away. Unfortunately I didn't find out what it was.
Thanks for your help Oleg, you definitely deserve that MVP title!. Here's the
last part of the output if anyone is interested:

[normal stuff]
...
LDR: LdrGetDllHandle, searching for mscoree.dll from
C:\WINDOWS\system32;C:\WINDOWS\system32; ... [%path%]
QLDR: LdrGetProcedureAddress by NAME - NotifyShims
LDR: PID: 0xc6c finished - '"C:\WINDOWS\system32\dllhost.exe"
/ProcessId:{6EC6BC74-AEAF-4511-BAFF-DEEFC5E54FBC}'
LDR: LdrGetDllHandle, searching for Kernel32.dll from
LDR: LdrGetProcedureAddress by NAME - ReleaseActCtx
LDR: LdrGetDllHandle, searching for Kernel32.dll from
LDR: LdrGetProcedureAddress by NAME - ReleaseActCtx
The thread 0x3C8 has exited with code 0 (0x0).
The program 'C:\WINDOWS\system32\dllhost.exe' has exited with code 0 (0x0).
Loading...