/*********************************************************************** * DllGetClassObject (OLEAUT32.@) */ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) { *ppv = NULL; if (IsEqualGUID(rclsid,&CLSID_StdFont)) { if (IsEqualGUID(iid,&IID_IClassFactory)) { _get_STDFONT_CF(ppv); IClassFactory_AddRef((IClassFactory*)*ppv); return S_OK; } } if (IsEqualGUID(rclsid,&CLSID_StdPicture)) { if (IsEqualGUID(iid,&IID_IClassFactory)) { _get_STDPIC_CF(ppv); IClassFactory_AddRef((IClassFactory*)*ppv); return S_OK; } } if (IsEqualCLSID(rclsid, &CLSID_PSDispatch) && IsEqualIID(iid, &IID_IPSFactoryBuffer)) { *ppv = &pPSDispatchFacBuf; IPSFactoryBuffer_AddRef((IPSFactoryBuffer *)*ppv); return S_OK; } if (IsEqualGUID(rclsid,&CLSID_PSOAInterface)) { if (S_OK==TMARSHAL_DllGetClassObject(rclsid,iid,ppv)) return S_OK; /*FALLTHROUGH*/ } if (IsEqualCLSID(rclsid, &CLSID_PSTypeInfo) || IsEqualCLSID(rclsid, &CLSID_PSTypeLib) || IsEqualCLSID(rclsid, &CLSID_PSDispatch) || IsEqualCLSID(rclsid, &CLSID_PSEnumVariant)) return OLEAUTPS_DllGetClassObject(&CLSID_PSFactoryBuffer, iid, ppv); return OLEAUTPS_DllGetClassObject(rclsid, iid, ppv); }
static HRESULT WINAPI PSDispatchFacBuf_QueryInterface(IPSFactoryBuffer *iface, REFIID riid, void **ppv) { if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPSFactoryBuffer)) { IPSFactoryBuffer_AddRef(iface); *ppv = iface; return S_OK; } return E_NOINTERFACE; }
static HRESULT WINAPI PSFactoryBuffer_QueryInterface( IPSFactoryBuffer * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void **ppvObject) { if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPSFactoryBuffer)) { *ppvObject = This; IPSFactoryBuffer_AddRef(This); return S_OK; } return E_NOINTERFACE; }
HRESULT StdProxy_Construct(REFIID riid, LPUNKNOWN pUnkOuter, const ProxyFileInfo *ProxyInfo, int Index, LPPSFACTORYBUFFER pPSFactory, LPRPCPROXYBUFFER *ppProxy, LPVOID *ppvObj) { StdProxyImpl *This; PCInterfaceName name = ProxyInfo->pNamesArray[Index]; CInterfaceProxyVtbl *vtbl = ProxyInfo->pProxyVtblList[Index]; TRACE("(%p,%p,%p,%p,%p) %s\n", pUnkOuter, vtbl, pPSFactory, ppProxy, ppvObj, name); /* TableVersion = 2 means it is the stubless version of CInterfaceProxyVtbl */ if (ProxyInfo->TableVersion > 1) { ULONG count = ProxyInfo->pStubVtblList[Index]->header.DispatchTableCount; vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1); TRACE("stubless vtbl %p: count=%d\n", vtbl->Vtbl, count ); fill_stubless_table( (IUnknownVtbl *)vtbl->Vtbl, count ); } if (!IsEqualGUID(vtbl->header.piid, riid)) { ERR("IID mismatch during proxy creation\n"); return RPC_E_UNEXPECTED; } This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(StdProxyImpl)); if (!This) return E_OUTOFMEMORY; if (!pUnkOuter) pUnkOuter = (IUnknown *)This; This->IRpcProxyBuffer_iface.lpVtbl = &StdProxy_Vtbl; This->PVtbl = vtbl->Vtbl; /* one reference for the proxy */ This->RefCount = 1; This->piid = vtbl->header.piid; This->base_object = NULL; This->base_proxy = NULL; This->pUnkOuter = pUnkOuter; This->name = name; This->pPSFactory = pPSFactory; This->pChannel = NULL; if(ProxyInfo->pDelegatedIIDs && ProxyInfo->pDelegatedIIDs[Index]) { HRESULT r = create_proxy( ProxyInfo->pDelegatedIIDs[Index], NULL, &This->base_proxy, (void **)&This->base_object ); if (FAILED(r)) { HeapFree( GetProcessHeap(), 0, This ); return r; } } *ppProxy = &This->IRpcProxyBuffer_iface; *ppvObj = &This->PVtbl; IUnknown_AddRef((IUnknown *)*ppvObj); IPSFactoryBuffer_AddRef(pPSFactory); TRACE( "iid=%s this %p proxy %p obj %p vtbl %p base proxy %p base obj %p\n", debugstr_guid(riid), This, *ppProxy, *ppvObj, This->PVtbl, This->base_proxy, This->base_object ); return S_OK; }