0

I need to call unmanaged COM code from C#.NET. By loading unmanaged COM Type libraries from (LoadTypeLibEx), I am able to iterate over all exposed types by COM TLB. I need to know the addresses to call those exposed methods at runtime or by accessing the COM vtable's starting address and apply indexing for getting addresses of those exposed methods under interfaces.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Usman
  • 2,742
  • 4
  • 44
  • 82
  • possible duplicate of [How to access COM vtable and acess its entries from TLB(Type Library) in C#?](http://stackoverflow.com/questions/2818418/how-to-access-com-vtable-and-acess-its-entries-from-tlbtype-library-in-c) – Hans Passant May 13 '10 at 16:18
  • yeah because i didn't got right solution of my problem, i reopened thread from another good way. – Usman May 13 '10 at 16:32

1 Answers1

0

Just a suggestion:

Create a proxy unmanaged COM server which will do that for you, by using only fixed set of methods, than use this proxy service from your c# application

volody
  • 6,946
  • 3
  • 42
  • 54
  • It would be quite tough to write proxy unmanaged COM servers. I dont need to go for code generation for every COM EXE/DLL which is unmanaged binary as DLL/EXE. All I need to ENUMERATE all types with their exposed methods at run time and at run time I need to call exposed methods by accessing their addresses from vtable. No code generation – Usman May 13 '10 at 16:11
  • just one com server, but with ability to enumerate all types and methods for requested dll. follow Enumerate COM object (IDispatch) methods using ATL? http://stackoverflow.com/questions/2112302/enumerate-com-object-idispatch-methods-using-atl – volody May 13 '10 at 17:57
  • my idea that you can do that with unmanaged code what is possible, then provide this informaion to c# client through COM interface – volody May 13 '10 at 18:05
  • Actually I've found InterOpServices namespace under System.Runtime . This enables you to enumerate exaclty all types contained in unmanaged binary. So Why go for Unmanaged code to write this. I want maximum .NET power to exploit. Just one thing remains.. Only to call these functions at runtime using addresses , which I am searching for... – Usman May 14 '10 at 07:38