Find out which function returned that error

Recently that we found a problem where a frequent called function started returning error 0x80004002 (interface not found). The problem is this function calls many other functions, and most of those functions will create COM object and the error could be coming from any of them. We need to find a way of find out which one returned the error without step into and through each of them. The wt command in WinDbg comes into rescue. Set a breakpoint at the beginning of the function, issue a “wt -oR”  command and look for the first appearance of the error code:

   51   999 [  4]         ole32!CClassCache::SearchForLoadedClass
30     0 [  5]           ole32!CClassCache::CDllFnPtrMoniker::BindToObject
12     0 [  6]             ole32!CClassCache::CDllPathEntry::DllGetClassObject
7     0 [  7]               abc!DllGetClassObject
29     0 [  8]                 ATL100!AtlComModuleGetClassObject
11     0 [  9]                   ATL100!InlineIsEqualGUID eax = 0
44    11 [  8]                 ATL100!AtlComModuleGetClassObject
21     0 [  9]                   ATL100!InlineIsEqualGUID eax = 1
57    32 [  8]                 ATL100!AtlComModuleGetClassObject
2     0 [  9]                   abc![thunk]:ATL::CComObjectCached<CSomeCOMObject::CSomeCOMObject>::QueryInterface`adjustor{4}’
7     0 [  9]                   abc!ATL::CComObjectCached<CSomeCOMObject::CSomeCOMObject>::QueryInterface
17     0 [ 10]                     ATL100!AtlInternalQueryInterface
9     0 [ 11]                       ATL100!ATL::InlineIsEqualUnknown eax = 0
32     9 [ 10]                     ATL100!AtlInternalQueryInterface
11     0 [ 11]                       ATL100!InlineIsEqualGUID eax = 0
50    20 [ 10]                     ATL100!AtlInternalQueryInterface
11     0 [ 11]                       ATL100!InlineIsEqualGUID eax = 0
65    31 [ 10]                     ATL100!AtlInternalQueryInterface eax = ffffffff`80004002
9    96 [  9]                   abc!ATL::CComObjectCached<CSomeCOMObject::CSomeCOMObject>::QueryInterface = HRESULT 0x80004002

Advertisements

Posted on January 11, 2012, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: