Is it possible for reflections for COM Exe or COM DLL?
-
OLEView just facilitate to view information of interfaces, co-classes and other types and it might take these info's from TLB. I need to call any exposed methods of COM object at RUN TIME using reflections just we can do the same job in Win32 DLL's.
I don't think you can do this in COM or in WIN32 DLL as neither of them support reflection in the .NET sense. I know it is possible to figure out some aspects of functions from decorated function names, but if the names are undecorated (i.e. C style) then such information is not available.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
-
I don't think you can do this in COM or in WIN32 DLL as neither of them support reflection in the .NET sense. I know it is possible to figure out some aspects of functions from decorated function names, but if the names are undecorated (i.e. C style) then such information is not available.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
See here.. download this demo and give it any win32 dll. It'll allow you to execute its functions(which it'll extract and pull in its combo) by clicking "Execute" button. Execute a function in any Win32 DLL - Reflection in Win32 DLL?[^]
-
See here.. download this demo and give it any win32 dll. It'll allow you to execute its functions(which it'll extract and pull in its combo) by clicking "Execute" button. Execute a function in any Win32 DLL - Reflection in Win32 DLL?[^]
That may be true, but it is not reflection in the proper sense. Microsoft does not offer reflection in Win32 dll libraries, so anything you rely on may change in the future. .NET reflection is an official part of the .NET architecture and will be supported by Microsoft.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
-
That may be true, but it is not reflection in the proper sense. Microsoft does not offer reflection in Win32 dll libraries, so anything you rely on may change in the future. .NET reflection is an official part of the .NET architecture and will be supported by Microsoft.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
Yeah that's true. That's not exactly reflection underway.It's effort to make the result similar what reflection facilitates programmer. So I need to get same behavior which's being done in that (Executing function in Win32 DLL by clicking "Execute"). Can we load COM DLL or COM EXE dynamically(in case of DLL its LoadLibrary) and get its functions/methods (in DLL by GetProcAddress. One way which I sought out is to iterate over vtable which'll contain addresses of COM interface's virtual methods. But that technique only applicable with virtual functions(as they only go in vtable) . What about simple(non-virtual) methods of COM interfaces. Where we can get addresses of those methods(non-virtual).
-
Yeah that's true. That's not exactly reflection underway.It's effort to make the result similar what reflection facilitates programmer. So I need to get same behavior which's being done in that (Executing function in Win32 DLL by clicking "Execute"). Can we load COM DLL or COM EXE dynamically(in case of DLL its LoadLibrary) and get its functions/methods (in DLL by GetProcAddress. One way which I sought out is to iterate over vtable which'll contain addresses of COM interface's virtual methods. But that technique only applicable with virtual functions(as they only go in vtable) . What about simple(non-virtual) methods of COM interfaces. Where we can get addresses of those methods(non-virtual).
glitteringsound wrote:
Where we can get addresses of those methods(non-virtual).
Sorry, no idea; also I don't believe COM was ever designed with that in mind. My only suggestion is to try it and see what results you get.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
-
glitteringsound wrote:
Where we can get addresses of those methods(non-virtual).
Sorry, no idea; also I don't believe COM was ever designed with that in mind. My only suggestion is to try it and see what results you get.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
Any body else that can help in this regard? I think we need to lookup .data or .code sections of COM EXE or COM DLL then to lookup exaxct addresses of plain COM interfaces methods.
-
Any body else that can help in this regard? I think we need to lookup .data or .code sections of COM EXE or COM DLL then to lookup exaxct addresses of plain COM interfaces methods.
You can use the same Informations, OLEViewer uses for his visual representation of objects and interfaces. Is that what you are looking for ?
-
You can use the same Informations, OLEViewer uses for his visual representation of objects and interfaces. Is that what you are looking for ?
I Got the idea.!! As no any function(method) in interface which's implemented by COM object which's not virtual. All interface methods that implemented by COM component always pure virtaul, thus always go inside vtable. So we can easily traverse vtable and can get exact addresses of all of those. Now rest is calling those functions. It includes knowing about full signature and every thing it takes as parameter. This is the one which is still missing ..an idea.?
-
I Got the idea.!! As no any function(method) in interface which's implemented by COM object which's not virtual. All interface methods that implemented by COM component always pure virtaul, thus always go inside vtable. So we can easily traverse vtable and can get exact addresses of all of those. Now rest is calling those functions. It includes knowing about full signature and every thing it takes as parameter. This is the one which is still missing ..an idea.?
I thought of something like this: http://msdn.microsoft.com/en-us/magazine/bb985086.aspx[^]
-
I Got the idea.!! As no any function(method) in interface which's implemented by COM object which's not virtual. All interface methods that implemented by COM component always pure virtaul, thus always go inside vtable. So we can easily traverse vtable and can get exact addresses of all of those. Now rest is calling those functions. It includes knowing about full signature and every thing it takes as parameter. This is the one which is still missing ..an idea.?
Done all!! Only one thing is left.? How to iterate (infact access) the vtable of COM coclass(that will implement the methods of its exposed interfaces).? Only I need to access vtable where all addresses of exposed methods of its interfaces are stored.