The Old New Thing

Debug session: Why is an LPC server not responding?

A particular scenario was hanging, and the team responsible for the scenario debugged it to the point where they saw that their X component was waiting for their Y component, which was waiting for Explorer, so they asked for help chasing the hang into Explorer. The team was kind enough to have shared what they've learned so far...

Display an overlay on the taskbar button

Today's "Little Program" displays an overlay on the taskbar button. I've seen some people call this a "badge", but "overlay" is the official term. Start with our scratch program and make the following changes: #include <comip.h> #include <comdef.h> #include <shlobj.h> #include <shellapi.h> _COM_SMARTPTR_TYPEDEF(...

Obtaining the parsing name (and pidl) for a random shell object

The parsing name for a shell item is handy, because it lets you regenerate the item later. Actually, the pidl for the shell item is even better, because that is the official way of saving and restoring objects. It's the pidl that gets saved in a shortcut, and since shortcuts can be copied around from machine to machine, pidls must be ...

Psychic debugging: Why your IContextMenu::InvokeCommand doesn’t get called even though you returned success from IContextMenu::QueryContextMenu

A customer was having trouble with their IContext­Menu implementation. They observed that their IContext­Menu::Query­Context­Menu method was being called, but when the user selected their menu item, IContext­Menu::Invoke­Command was not being called. Given what you know about shell context menus, you can already ...

Why doesn’t HeapValidate detect corruption in the managed heap?

A customer had a program that was corrupting the managed heap by p/invoking incorrectly. The problem didn't show up until the next garbage collection pass, at which point the CLR got all freaked-out-like. "According to Knowledge Base article 286470, the tool is supposed to catch heap corruption, but it doesn't catch squat." Depending on ...