Alexandre Julliard : rpcrt4: Split the vtbl initialization in NdrDllGetClassObject to a separate function .
Alexandre Julliard
julliard at winehq.org
Thu Jun 4 07:59:31 CDT 2009
Module: wine
Branch: master
Commit: 01d00d178e32de3aaf143e3689f5b661143299d1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=01d00d178e32de3aaf143e3689f5b661143299d1
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Jun 3 16:39:25 2009 +0200
rpcrt4: Split the vtbl initialization in NdrDllGetClassObject to a separate function.
---
dlls/rpcrt4/cpsf.c | 54 +++++++++++++++++++++++++++++----------------------
1 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/dlls/rpcrt4/cpsf.c b/dlls/rpcrt4/cpsf.c
index 5d7ffe7..6d94580 100644
--- a/dlls/rpcrt4/cpsf.c
+++ b/dlls/rpcrt4/cpsf.c
@@ -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 {
More information about the wine-cvs
mailing list