PDA

View Full Version : A question regarding COM


ronnie291983
February 2nd, 2010, 00:26
Hi,

Had a question regarding COM,

When we create an instance of interface using CoCreateInstance then the pointer returned by this API is suppose "x".

CoCreateInstance(target, NULL, flags, IID_IDispatch, tmpObj)

where "x" is "tmpobj"

Does X point to virtual function table?

does *(x) point to QueryInterface ; and
*(x+4) point to AddRef;
etc......

Is this assumption correct?

Can't find any resources for this. Appreciate any kind of help.

wtbw
February 2nd, 2010, 02:37
http://blogs.msdn.com/oldnewthing/archive/2004/02/05/68017.aspx

ronnie291983
February 2nd, 2010, 03:52
thanks man, i hope it was not too easy to find

wtbw
February 2nd, 2010, 03:55
No problem, had it bookmarked!

FrankRizzo
February 12th, 2010, 20:36
OK, since we're talking about COM here, I can ask my stupid question.

Is there a util which will list all the methods/variables available in a COM object (Outside of object explorer in Visual Studio)?

A nice little .exe that just dumped out the info would be ideal! Does such a thing exist?

disavowed
February 13th, 2010, 15:09
http://www.japheth.de/COMView.html

FrankRizzo
February 13th, 2010, 15:12
WOW! Thanks disavowed, that's one badass app.

disavowed
February 13th, 2010, 18:10
No problem. It's also open source, effectively, since it was written in ASM

ronnie291983
February 14th, 2010, 22:46
thanks for the link, this link wud have saved a lot of effort for me, , i had to write code for this, if ur interested in writing code for this u can use tlbinf32.dll, which is a activex component, this will extract the typelib info for u.

But this will not give u the VFtable address etc.

U need to use CoCreateInstance to get the interface address and then follow two redirections to get to the Vftable.

dELTA
March 10th, 2010, 15:38
There are of course a bunch of other useful COM apps in the CRCETL too, in addition to COMView:

http://www.woodmann.com/collaborative/tools/index.php/Category:COM_Tools