• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 749
  • Last Modified:

Debugging Shell Extensions

Platform: VC 2005, on Windows XP.

I am having a lot of trouble debugging my NameSpace Extension (NSE).

When I say ‘debugging’ I do not mean to step through my code and debug it, but rather to understand what is happening inside the shell while loading and using my extension.

More specifically, I can see the folder, when I double-click it, my code is called, and completes successfully, but then nothing happens. I have no way of knowing what is wrong. I would like to receive a message such as “Failed opening folder: missing Interface / error value returned from function X, etc…”

I have heard about debug versions of windows, for driver development, is this useful?

Do you know any other way of understanding the internal state of the shell?

Any help will be greatly appreciated.

Cheers,
Michael
0
xmichaelm
Asked:
xmichaelm
  • 2
3 Solutions
 
adg080898Commented:
Microsoft docs:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_programming/debugging.asp

Debug versions of windows won't really help, they're mainly for driver development.

Windows explorer is a piece of crap. It barely works, and ignores errors all the time, and has very poor documentation. The answer to everything in MS land is to abort. Something goes wrong in the middle of copying 5000 files, abort. If anything goes wrong, aborts. Don't be surprised if you have trouble integrating with it.

The best way to handle this type of programming problem is to put extensive logging in your app. Log everything, by printing messages to a log file. Then, you can examine your log file and see what is happening without stepping.
0
 
DanRollinsCommented:
There's not much to go on here...

How do you know that your NSE "completes successfully"?
What behavior would you expect ... compared to what actually happens?  Describe both in detail.

As far as I know there is no option in Explorer to output "verbose error messages" or to have it write detailed info to a log.  It's a long shot, but perhaps there might be something in the System Event Log.  Also, I see that you can set the Group Policy settings to audit lots of stuff that is normally not logged (e.g., "Audit object access") and I suppose that that could provide a hint when something internal goes awry in Windows Explorer.
0
 
adg080898Commented:
I have a suggestion, use the debugging tools for windows on the windows xp cd. It has a tool called "logger" which records all function calls. It is the best API logger I have seen. Perhaps you could start explorer using logger.exe and record calls to your dll (actually records all calls to any dll from the logged program).

To use logger:

Start/Run/cmd

cd \program files\debugging tools for windows

logger "...full path to program to log..."

It records all function calls to a log.
To view the log, use logview (same place as logger).
0
 
xmichaelmAuthor Commented:
What worked for me:

1. A working sample is the best documentation.
2. Download the debugging symbols from microsoft, to see human-readable stack traces.
3. Get a hold of the partial Windows source code, and take a very good look at CDefView.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now