ole32: Fix a failed call to DllGetClassObject while retrieving class object interface pointer.

Robert Shearman rob at codeweavers.com
Thu Dec 20 13:16:27 CST 2007


Huang, Zhangrong wrote:
> 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 used 
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 and 
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




More information about the wine-devel mailing list