• Welcome to Theos PowerBasic Museum 2017.

News:

Attachments are only available to registered users.
Please register using your full, real name.

Main Menu

How to enumerate a COM DLL's methods & vtable offsets ?

Started by Gérôme Guillemin, February 06, 2009, 12:24:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Gérôme Guillemin

Hello,

I wanted to know if someone has already a bit of code that will be able to open and parse a COM DLL that already has its TLB inside in order to enumerate its methods names + its corresponding Vtable methods addresses please?

Thanks a lot!

José Roca

 
The easiest way is to use TLBINF32.DLL, the ActiveX used by Visual Basic for this purpose.

See the thread Using TLBINF32.INC: http://www.jose.it-berater.org/smfforum/index.php?topic=2872.0

Gérôme Guillemin

Hello,
Quote from: José Roca on February 06, 2009, 04:05:12 PM

The easiest way is to use TLBINF32.DLL, the ActiveX used by Visual Basic for this purpose.

See the thread Using TLBINF32.INC: http://www.jose.it-berater.org/smfforum/index.php?topic=2872.0


Nice but... TLBINF32.DLL is not natively part of the windows system32 distribution :/
I thought there was another API way apart this external DLL...

José Roca



Frederick J. Harris

#5
I was playing with that a few months ago Gerome, and have some pretty rough C/C++ code that dumps the type lib to the console.  Its not real polished but it will get you started if you want it.  I've been meaning to translate it to PowerBASIC, but just havn't got that far yet.  It uses ITypeLib* and ITypeInfo* like Jose posted above.  It is rather messy, but goes with the territory I guess.

Gérôme Guillemin

Hello,

Yes you can send the C/c++ code as I'm a C/C++ developer, I think this can be clear enough for me :)
The idea behind this is to see if I can insert this kind of feature within my language (FBSL) to see if I can extend the actual COM layer that FBSL has ( late binding supported ).

You can PM me the code if it's possible, else you can send it to my email adress you can see within my profile.

Thanks!

Frederick J. Harris

I'll try to pull it together today Gerome and send it.  I took a look at Jose's links above and found them real interesting.  That guy has some good stuff on his site.

What I was doing with ITypeLib & ITypeInfo was about exactly what he was doing, but I immediately took note of some of his fancy C++ iostream crap I hate.  I dispise that library and as soon as I get my hands on any C++ code that contains what looks useful to me the 1st thing I do is search out and destroy every last vestige of iostream, mfc or anything like that in it, so all you'll find in any code of mine is good 'ol stdio.h.

James C. Fuller

What is missing in José's TypeLib browser that you need.
I'd just parse the PowerBASIC code file.

James

Frederick J. Harris

Quote
What is missing in José's TypeLib browser that you need.
I'd just parse the PowerBASIC code file.

Nothing.  I just wanted to see how those interfaces worked.  In Guy & Henry Eddon's book "Inside Distributed COM" (Microsoft Press) they showed how to create a typelib programatically, and I thought that was neat although quite difficult and tedius.  Seeing how that worked though, dismantling it was just like creating it - but in reverse.

José Roca


Frederick J. Harris

Yes, I'm aware of that Jose, and in fact I'm one of the relatively small number of folks who downloaded it!  It just so happened that I was working with the above mentioned book at the time I was studying this material last Sept/Oct or so, and I managed to figure it out from the book discussion & code.  However, please don't feel slighted as I do intend to study your code when I get to working with this again with PowerBASIC and I greatly appreciated that you posted what you did.

José Roca

 
I don't feel slighted at all. Just thought that maybe you didn't know it.

I posted the first version in August 2006, in the old forum:
http://www.forum.it-berater.org/index.php?topic=301.0

and in January 2007, I reposted it in this forum:
http://www.jose.it-berater.org/smfforum/index.php?topic=116.msg200#msg200

As noted in the code, is just a translation of the C program TypeBld, written by Microsoft Product Support Services.

Gérôme Guillemin

Hello,
Quote from: Frederick J. Harris on February 12, 2009, 03:16:35 AM
Yes, I'm aware of that Jose, and in fact I'm one of the relatively small number of folks who downloaded it!  It just so happened that I was working with the above mentioned book at the time I was studying this material last Sept/Oct or so, and I managed to figure it out from the book discussion & code.  However, please don't feel slighted as I do intend to study your code when I get to working with this again with PowerBASIC and I greatly appreciated that you posted what you did.

In fact I don't really use Powerbasic, I study samples and ideas that can be found, and the low level COM part is really exciting for me, if i find some interesting ideas I try to develop my own libraries in pure C to see what can I do for my FBSL project, and I find José's forum very impressive, really rich and really open minded to find real good informations!

Thanks

Frederick J. Harris

I emailed that code a few days ago Gerome.  Don't know if you got it?

Fred