atl: AtlModuleGetClassObject should store an intermediate pointer in obj->pCF and then query this for the requested interface.

Return CLASS_E_CLASSNOTAVAILABLE instead of E_FAIL.
This commit is contained in:
Rob Shearman 2007-04-25 11:21:48 +01:00 committed by Alexandre Julliard
parent 3af74c5e52
commit 72ddcb5f36
1 changed files with 11 additions and 2 deletions

View File

@ -340,6 +340,7 @@ HRESULT WINAPI AtlModuleGetClassObject(_ATL_MODULEW *pm, REFCLSID rclsid,
REFIID riid, LPVOID *ppv) REFIID riid, LPVOID *ppv)
{ {
int i; int i;
HRESULT hres = CLASS_E_CLASSNOTAVAILABLE;
TRACE("%p %s %s %p\n", pm, debugstr_guid(rclsid), debugstr_guid(riid), ppv); TRACE("%p %s %s %p\n", pm, debugstr_guid(rclsid), debugstr_guid(riid), ppv);
@ -354,13 +355,21 @@ HRESULT WINAPI AtlModuleGetClassObject(_ATL_MODULEW *pm, REFCLSID rclsid,
TRACE("found object %i\n", i); TRACE("found object %i\n", i);
if (obj->pfnGetClassObject) if (obj->pfnGetClassObject)
return obj->pfnGetClassObject(obj->pfnCreateInstance, riid, ppv); {
if (!obj->pCF)
hres = obj->pfnGetClassObject(obj->pfnCreateInstance,
&IID_IUnknown,
(void **)&obj->pCF);
if (obj->pCF)
hres = IUnknown_QueryInterface(obj->pCF, riid, ppv);
break;
}
} }
} }
WARN("no class object found for %s\n", debugstr_guid(rclsid)); WARN("no class object found for %s\n", debugstr_guid(rclsid));
return E_FAIL; return hres;
} }
/*********************************************************************** /***********************************************************************