Robert Shearman
2007-12-20 19:16:27 UTC
See dlls/ole32/compobj.c,
static HRESULT apartment_getclassobject(struct apartment *apt, LPCWSTR dllpath,
BOOL apartment_threaded,
REFCLSID rclsid, REFIID riid,
void **ppv)
{
...................
if (SUCCEEDED(hr))
{
..................
TRACE("calling DllGetClassObject %p\n",
apartment_loaded_dll->dll->DllGetClassObject);
/* OK: get the ClassObject */
hr = apartment_loaded_dll->dll->DllGetClassObject(rclsid, riid, ppv);
^^^^
if (hr != S_OK)
ERR("DllGetClassObject returned error 0x%08x\n", hr);
}
..............
}
Reference to http://msdn2.microsoft.com/en-us/library/ms680760.aspx,
riid
[in] Reference to the identifier of the interface that the caller
is to use to communicate with the class object. Usually, this is
IID_IClassFactory (defined in the OLE headers as the interface
identifier for IClassFactory).
This doesn't mean anything other than CoCreateInstance is usually usedstatic HRESULT apartment_getclassobject(struct apartment *apt, LPCWSTR dllpath,
BOOL apartment_threaded,
REFCLSID rclsid, REFIID riid,
void **ppv)
{
...................
if (SUCCEEDED(hr))
{
..................
TRACE("calling DllGetClassObject %p\n",
apartment_loaded_dll->dll->DllGetClassObject);
/* OK: get the ClassObject */
hr = apartment_loaded_dll->dll->DllGetClassObject(rclsid, riid, ppv);
^^^^
if (hr != S_OK)
ERR("DllGetClassObject returned error 0x%08x\n", hr);
}
..............
}
Reference to http://msdn2.microsoft.com/en-us/library/ms680760.aspx,
riid
[in] Reference to the identifier of the interface that the caller
is to use to communicate with the class object. Usually, this is
IID_IClassFactory (defined in the OLE headers as the interface
identifier for IClassFactory).
instead of CoGetClassObject (and CoCreateInstance always passes in
IID_IClassFactory for the IID).
We can't pass riid to DllGetClassObject directly sometimes, causes some dlls'
DllGetClassObject (like native adsldp.dll) can only return reference-counted
pointer to class factory via IID_IClassFactory, for retrieving the
pointer to the
class object interface requested in riid, we must try another way.
Thank you for your patch, but this behaviour seems a little strange andDllGetClassObject (like native adsldp.dll) can only return reference-counted
pointer to class factory via IID_IClassFactory, for retrieving the
pointer to the
class object interface requested in riid, we must try another way.
needs a little more investigation before I am happy that it is correct.
What parameters are being passed in to CoGetClassObject to cause the
call to fail for you?
--
Rob Shearman
Rob Shearman