ShowMEMyOBJREF(aka TRACE My MEOW)

 

 

Out of little bit of curiosity and need, I wrote a simple trace helper called ShowMeMyOBJREF(pStm) which extracts the information out of a marshaled OBJREF in a human readable form and dumps it out on the output window. It tells you all about how the interface was marshaled - IID, the clsid of its proxy(if custom/handler marshaled), IPID, OXID, OID tuple etc. I pulled out the OBJREF and other related definitions from the latest DCOM spec and made it a part of the header. Thought it might be useful to someone...


You can use the helper as follows:

1) include the  ObjRef.H in the file which uses the helper.

2)call CoMarshalInterface / CoMarshalInterThreadInterfaceInStream/ AtlMarshalPtr(InProc) et al get the IStream pointer wrapping the OBJREF like :

IStream* pStm = 0;

if(SUCCEEDED(::CreateStreamOnHGlobal(0, TRUE, &pStm)))

{

    hr = ::CoMarshalInterThreadInterfaceInStream(IID_IDHandler,pHandler, &pStm);

    //hr = ::CoMarshalInterface(pStm,....); or AtlMarshalPtr .. whatever suits you.

    if(hr == S_OK)

    {

3)then call

    hr = ShowMeMyOBJREF(pStm);

    }

    //Release pStm ... do other stuff

}

 


This call to the helper will output the following stuff on the output window:

The signature is MEOW
The IID getting marshaled is --{00000000-0000-0000-C000-000000000046}
The Reference is STANDARD
The SORF flags for the OBJREF are 0
The Reference Counts on the OBJREF is 5
The OXID of the STDOBJREF is 2579688225631109689
The OID of the STDOBJREF is 2579688225631109698
IPID of the STDOBJREF--{00000004-0544-0000-6805-000003000000}


TODOs:

Currently it doesn't show you contents of DUALSTRINGARRAY.


This page and the source contained in(or referred to) by this page are Copyright (c) 1998, Dharma Shukla.
All rights reserved. No warrenties extended. Use at your own risk.
Do send Comments/Bugs to me :-)