|
typedef void (*FN)(void)
using FN, how are you going to call those methods like QueryInterface, AddRef.. as they take various number of arguments? u may be able to call without errors, bt result will be unexpected. without having specific info about the functions in interface, u won't be able to proceed..
|
|
|
|
|
Yeah true.!!
but _asm patch helped me out in this regard.
_asm
{
push argument_1
push argument_2
call proc ;function address
}
Here suppose i have given all info (parameters or arguments) at run time for NOW(Which I have passed it on runtime console).
For future(might be later) I will load every thing from TLB's. e.g (How to know that QueryInterface taking 3 params of different type? This is ITypeLibe which provides information from TLB of that Component which I can query from registry to load specific TLB and give me specific function signature and types).
Hence I got all params and function names as well(Which I can decipher from signature working with RE's(regular expression)).
But Now I need to call the function, which would have specific address(NOT KNOWN) arguments(parameters) which I have collected from TLB, and name as well. How that address corresponds to that function name to which I am going to call.
For this I need to traverse vtable which is holding functional addresses, LASTLY need to correspond function address with NAME of that function. This is I dont know. How? More over one function with the same name may appear in vtable(Overloading case). In that case we need to distinguish function names w.r.t their addresses. How to tackle ?
|
|
|
|
|
I have some code in Visual Prolog compiled into a DLL.
I am hoping to build a GUI using C# that would interact with the DLL.
Visual Prolog supports COM.
Is COM the way to make my C# GUI interact with the Prolog DLL, or are there other ways?
|
|
|
|
|
Hello,
Can we use reflections to invoke the exposed methods of certain interfaces of COM Object?
Here we will be able to show all exposed methods of COM DLL or COM exe and and on run time, we can execute all of those methods, by passing parameters.
This is already done for Win32DLL here but any idea about COM?
Regards
Muhammad Usman Khalil
|
|
|
|
|
Afraid I don't understand exactly what it is you are asking, can you clarify or show what you are trying?
|
|
|
|
|
Can we call COM exposed interface METHODS at runtime one by one. This can be achieved in case of WIN32 DLL's using reflections. But SAME job need to be done with COM Dll or COM EXE. We'll be able to view all exposed methods of that COM DLL or COM EXE on client(say on MFC GUI) and ony by one we need to call all of those methods by just clicking "invoke or Execute".(Remember I need to call unmanaged code, purely written in VC++ unmanaged code) . That would not be .NET assembly.
e.g
I had COM DLL
-----------
it has mehods namely int Sum(int,x,int y);
Client should show in its combo the methods signature i.e Sum(int x,int y)
and when I click at invoke it should give me result say (2 OR any thing that would be sum of those x & y params).
this is done here but this is strictly for Win32 DLL's not for COM DLL or COM EXE's
Execute a function in any Win32 DLL - Reflection in Win32 DLL?[^]
|
|
|
|
|
I think you can get the information you need from OLEViewer, which is distributed with the Windows SDK, in the tools section. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
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
|
|
|
|
|
|
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).
|
|
|
|
|
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.
|
|
|
|
|
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.?
|
|
|
|
|
|
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.
|
|
|
|
|
Hi all,
I am getting the following error when i try to update the system registry using the following function in InitInstance():
UpdateRegistry(OAT_DOC_OBJECT_SERVER);
"Failed to update system registry.Please try using regedit"
How to resolve this issue. Could not give admin rights to the user.
Thanks,
|
|
|
|
|
Karthika85 wrote: Could not give admin rights to the user
Assuming you are saying you cannot give these registry update rights to the User, why not have an Administrator install it who would have the rights? This is normal practice as far as I know.
|
|
|
|
|
Hi I am working with Adobe InDesign CS3. I have a VB.NET project where I am providing Indesign file as InPut and generating PDF and EPS files as output. When I create object of InDesign.Application
Ex: Dim appObject = CreateObject("InDesign.Application")
It launches Adobe InDesign Application and then the Document. I tried to Hide the Document using
EX: appObject.Open(InputFile,false);
but How to hide the Application in the Beginning? I dont want the application to be launched, it should work in background and not visible to the User. Can any one please help. Rashmi.M.K
|
|
|
|
|
I have used UrlDownloadToFile for quite some time in firefox and it was working flawlessly. But in the past couple of months or so I am facing this issue in firefox.
I download zip files from web servers inside an ActiveX that runs in a browser. When I log in to a website and try to download the zip file through my ActiveX in firefox, it fails. This worked previously. I have the necessary cookies created on my machine but somehow firefox does not seem to use them anymore. This still works prefectly in IE which downloads the file without any issue.
If the web server does not require a login, the file downloads without any issue.
This function gets stuck during "Sending Request" phase as indicated by the status code in the Progress callback.
I suspect the issue is with some security update in windows XP which has updated urlmon.dll and wininet.dll. I think IE handles the new update but firefox has stopped working because of that. I may be wrong though. If anyone has faced a similar issue, please help me out.
Hasan Khan.
|
|
|
|
|
There are two interfaces IA and IB, but they reference each other in their method.
The problem is, if i declared IA before IB, IA would get a error because IB was unknown to it; if i declared IB before IA, IB would get the same error.
I know i can fix this problem by replacing the parameters from IAs and IBs to IUnkown. but i want to know if there is a resolution like C++'s classes pre-defining?
|
|
|
|
|
IDL has forward declaration of interface, just like C/C++ has forward declarations, viz:
import "oaidl.idl";
import "ocidl.idl";
[
uuid(D39DD965-FC96-4C0A-AA62-CA3F5F117685),
version(1.0),
helpstring("cccc 1.0 Type Library")
]
library ccccLib
{
interface ITest2;
[
object,
uuid(7CD26371-4A6B-4234-A024-6690A53CA450),
nonextensible,
helpstring("Itest Interface"),
pointer_default(unique)
]
interface Itest : IUnknown
{
HRESULT DoSomething([in] ITest2* c);
};
[
object,
uuid(72a5a7e2-0256-428f-8bb5-42d39096892d),
nonextensible,
helpstring("Itest Interface"),
pointer_default(unique)
]
interface ITest2 : IUnknown
{
HRESULT DoSomething([in]Itest* c);
};
importlib("stdole2.tlb");
[
uuid(F8AAE058-76E9-4F2C-995A-FB5B6565CED6),
helpstring("test Class")
]
coclass test
{
[default] interface Itest;
interface ITest2;
};
}; Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Thanks for your reply. I have tried this method but fail, because i always use the right idl files generated by atl project wizards, and i failed because i spelt 'Interface IB' other than 'interface IB'.(VS also highlights 'Interface' and 'interface'!).
Regards.
|
|
|
|