6

I am developing a Browser Helper Object running inside Internet Explorer. I am writing debugging messages with ATLTRACE("..."); These appear fine when Visual Studio is attached to the iexplore.exe process, but this is slow for a quick test. DebugView captures nothing from my BHO.

Why does DebugView not show BHO debug messages? Is it something to do with Internet Explorer running at low integrity level?

Mat
  • 82,161
  • 34
  • 89
  • 109

2 Answers2

11

Assuming that you're running IE on Vista or later (which it sounds like since you're talking about integrity levels), you can set the integrity level of DebugView to a lower integrity so any application can send messages to it:

icacls dbgview.exe /setintegritylevel low

And if you don't like the idea of permanently setting dbgview to low integrity (it might make saving logs and whatnot a bit of a pain, as they will only go into the low-integrity store) you can run a particular instance of dbgview at low integrity using Sysinternals' psexec tool:

psexec -l dbgview

Finally, if all you're worried about is the amount of time that it takes to load up the VS debugger to attach to the process, you can use a command line debugger (like ntsd.exe or cdb.exe). Ntsd.exe comes with Windows, but a newer version comes with the "Debugging Tools for Windows" package, which also includes the very similar cdb.exe.

Michael Burr
  • 333,147
  • 50
  • 533
  • 760
  • This sounds odd, do you have any more details on why this would work? Tracing uses OutputDebugString, not messaging. – jdigital Mar 14 '09 at 15:35
  • 3
    My recollection is that OutputDebugString uses a shared memory section with a mutex and events to pass the data around. I assume (possibly incorrectly) that opening a shared section or signaling events from a low integrity process to a higher integrity process is blocked. – Michael Burr Mar 14 '09 at 15:38
  • Gave psexec a go - works great. Vaguely recollect similar issues in the past I'd forgotten how I solved. Running DbgView at low does the job, but rather annoying! Time-wise, its Visual Studio loading IE symbols that's taking the time. I could probably speed it up a bit. – Mat Mar 14 '09 at 18:09
  • If you don't need the symbols, you can disable automatic symbol loading, and then just load them lazily as you need them, if you need them. – Logan Capaldo Mar 14 '09 at 21:40
  • If you use the icacls method and have DbgView.exe pinned to the Windows 7 taskbar, you'll get an annoying Security Warning every time you launch it. Another reason to favour the psexec method (or wish that DbgView was updated to handle capturing low-IL messages properly by itself). – Leo Davidson Dec 23 '10 at 07:16
1

For your quick tests, is Visual Studio still running? If so, that might cause this problem.

jdigital
  • 11,926
  • 4
  • 34
  • 51
  • I follow your line of thinking - Visual Studio is running, but not debugging. – Mat Mar 14 '09 at 18:00
  • Just to confirm: just running Visual Studio DOES intercept the messages and stops them from being visible in DebugView. It is NOT enough to just not run a debug session in it. As a workaround, it seems that if you start DebugView before visual studio, it still shows all the messages. – Cray Nov 17 '12 at 08:29