Commit 01d00d17 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 16436794
......@@ -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 ((*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 (!pPSFactoryBuffer->lpVtbl) init_psfactory( pPSFactoryBuffer, pProxyFileList );
if (pclsid && IsEqualGUID(rclsid, pclsid))
return IPSFactoryBuffer_QueryInterface((LPPSFACTORYBUFFER)pPSFactoryBuffer, iid, ppv);
else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment