Re: EuCOM 2.08 + WinXP Pro SP3
- Posted by Rad Jan 20, 2010
- 2743 views
Hi Matt,
Sorry but I am not much good at systems programming.
I had a look at eucom.ew, but couldn't make out of it much.
CoGetClassObject has already been defined but not used:
CoGetClassObject = define_c_func( ole32, "CoGetClassObject",\\ { C_POINTER, C_INT, C_POINTER, C_POINTER, C_POINTER }, C_LONG),
In function create_com_object:
mset = w32new_memset() ppv = w32acquire_mem( mset, 4 ) rclsid = w32acquire_mem( mset, clsid_table[CLSID_BYTES][clsid_ix] ) riid = w32acquire_mem( mset, iid_table[IID_BYTES][1] ) ok = c_func( CoCreateInstance, { rclsid, 0 , 5, riid, ppv } ) if not ok then obj_ix = ref_com_object( clsid_ix, peek4u(ppv) ) else err:print_com_error( sprintf( "CoCreateInstance Error: %x\n",ok)) err:com_error( ok ) obj_ix = 0 end if
I assume CoGetClassObject will be called before CoCreateInstance.
Now CoGetClassObject has the following parameters:
Syntax C
HRESULT CoGetClassObject(
_in REFCLSID rclsid,
_in DWORD dwClsContext,
_in_opt COSERVERINFO pServerInfo,
_in REFIID riid,
_out LPVOID *ppv
);
How to provide dwClsContext?
dwClsContext [in]
The context in which the executable code is to be run.
To enable a remote activation, include CLSCTX_REMOTE_SERVER.
For more information on the context values and their use,
see the CLSCTX enumeration.
How to provide riid which is supposed to be IID_IClassFactory2:
riid [in] Reference to the identifier of the interface, which will be supplied in
ppv on successful return. This interface will be used to communicate with
the class object. Typically this value is IID_IClassFactory,
although other values – such as IID_IClassFactory2 which supports
a form of licensing – are allowed.
All OLE-defined interface IIDs are defined in the OLE header files as
IID_interfacename, where interfacename is the name of the interface.
Then do I call CoCreateInstance with the *ppv value returned by CoGetClassObject?
And afterwords use ref_com_object function providing the same *ppv?
How to go about it?
Thanks & Regards,
Rad.