rpcrt4: Split the vtbl initialization in NdrDllGetClassObject to a separate function.

This commit is contained in:
Alexandre Julliard 2009-06-03 16:39:25 +02:00
parent 1643679476
commit 01d00d178e
1 changed files with 30 additions and 22 deletions

View File

@ -145,6 +145,35 @@ static const IPSFactoryBufferVtbl CStdPSFactory_Vtbl =
CStdPSFactory_CreateStub
};
static void init_psfactory( CStdPSFactoryBuffer *psfac, const ProxyFileInfo **file_list )
{
DWORD i, j, k;
psfac->lpVtbl = &CStdPSFactory_Vtbl;
psfac->RefCount = 0;
psfac->pProxyFileList = file_list;
for (i = 0; file_list[i]; i++)
{
const PCInterfaceStubVtblList *stubs = file_list[i]->pStubVtblList;
for (j = 0; j < file_list[i]->TableSize; j++)
{
/* FIXME: i think that different vtables should be copied for
* async interfaces */
void * const *pSrcRpcStubVtbl = (void * const *)&CStdStubBuffer_Vtbl;
void **pRpcStubVtbl = (void **)&stubs[j]->Vtbl;
if (file_list[i]->pDelegatedIIDs && file_list[i]->pDelegatedIIDs[j])
pSrcRpcStubVtbl = (void * const *)&CStdStubBuffer_Delegating_Vtbl;
for (k = 0; k < sizeof(IRpcStubBufferVtbl)/sizeof(void *); k++)
if (!pRpcStubVtbl[k]) pRpcStubVtbl[k] = pSrcRpcStubVtbl[k];
}
}
}
/***********************************************************************
* NdrDllGetClassObject [RPCRT4.@]
*/
@ -158,29 +187,8 @@ HRESULT WINAPI NdrDllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv,
pPSFactoryBuffer);
*ppv = NULL;
if (!pPSFactoryBuffer->lpVtbl) {
const ProxyFileInfo **pProxyFileList2;
pPSFactoryBuffer->lpVtbl = &CStdPSFactory_Vtbl;
pPSFactoryBuffer->RefCount = 0;
pPSFactoryBuffer->pProxyFileList = pProxyFileList;
for (pProxyFileList2 = pProxyFileList; *pProxyFileList2; pProxyFileList2++) {
int i;
for (i = 0; i < (*pProxyFileList2)->TableSize; i++) {
/* FIXME: i think that different vtables should be copied for
* async interfaces */
void * const *pSrcRpcStubVtbl = (void * const *)&CStdStubBuffer_Vtbl;
void **pRpcStubVtbl = (void **)&(*pProxyFileList2)->pStubVtblList[i]->Vtbl;
unsigned int j;
if (!pPSFactoryBuffer->lpVtbl) init_psfactory( pPSFactoryBuffer, pProxyFileList );
if ((*pProxyFileList2)->pDelegatedIIDs && (*pProxyFileList2)->pDelegatedIIDs[i])
pSrcRpcStubVtbl = (void * const *)&CStdStubBuffer_Delegating_Vtbl;
for (j = 0; j < sizeof(IRpcStubBufferVtbl)/sizeof(void *); j++)
if (!pRpcStubVtbl[j])
pRpcStubVtbl[j] = pSrcRpcStubVtbl[j];
}
}
}
if (pclsid && IsEqualGUID(rclsid, pclsid))
return IPSFactoryBuffer_QueryInterface((LPPSFACTORYBUFFER)pPSFactoryBuffer, iid, ppv);
else {