I had this nice little CQueryInfo class that was implementing the methods of
IQueryInfo so that my NSE could provide InfoTips when the mouse pointer
hovered over an item in the shell. The problem is, this CQueryInfo class
was lacking something subtle yet important... which, namely, was the ":
public IQueryInfo" after the declaration of the class "class CQueryInfo".
What this leads to is construction by the compiler of a vtable in which the
2 methods of the interface just happen to be out of order from what the
shell expects them to be. The end result is that the code will compile &
link, and it'll even be executed and you can debug into it. The problem is
that the wrong methods are getting called due to the botched vtable, and the
end result is stack corruption after a method call, and that's only if
you're really lucky. If you're not so lucky, then bogus data may get
returned or the type of stack corruption that occurs doesn't lead to an
immediate crash, but at a later time when your NSE's code isn't on the call
stack at all, the corruption will have been propagated in some way such that
the explorer ends up giving an accvio or some other GPF for no apparent reason.
This same issue can strike if you get hasty and add an interface to an
existing class and you fail to add the appropriate inheritance clauses to
the class declaration.
--
Chuck Chopp
ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com
RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651
Do not send me unsolicited commercial email.