Robert Shearman : rpc: Replace the hack that detected stubless proxies with the correct check.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jan 20 13:20:19 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 8c55c6f053370bdcd002340556e1980d88363329
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=8c55c6f053370bdcd002340556e1980d88363329

Author: Robert Shearman <rob at codeweavers.com>
Date:   Fri Jan 20 16:15:25 2006 +0100

rpc: Replace the hack that detected stubless proxies with the correct check.
Pass in the ProxyInfo and Index to StdProxy_Construct instead of just
the three members of the structure that were previously needed.
Fix the detection of stubless proxies.

---

 dlls/rpcrt4/cproxy.c |   18 ++++++++++--------
 dlls/rpcrt4/cpsf.c   |    4 +---
 dlls/rpcrt4/cpsf.h   |    5 ++---
 3 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/dlls/rpcrt4/cproxy.c b/dlls/rpcrt4/cproxy.c
index 89dca95..21f23f3 100644
--- a/dlls/rpcrt4/cproxy.c
+++ b/dlls/rpcrt4/cproxy.c
@@ -119,20 +119,21 @@ struct StublessThunk { int dummy; };
 
 HRESULT WINAPI StdProxy_Construct(REFIID riid,
                                  LPUNKNOWN pUnkOuter,
-                                 PCInterfaceName name,
-                                 CInterfaceProxyVtbl *vtbl,
-                                 CInterfaceStubVtbl *svtbl,
+                                 const ProxyFileInfo *ProxyInfo,
+                                 int Index,
                                  LPPSFACTORYBUFFER pPSFactory,
                                  LPRPCPROXYBUFFER *ppProxy,
                                  LPVOID *ppvObj)
 {
   StdProxyImpl *This;
   const MIDL_STUBLESS_PROXY_INFO *stubless = NULL;
+  PCInterfaceName name = ProxyInfo->pNamesArray[Index];
+  CInterfaceProxyVtbl *vtbl = ProxyInfo->pProxyVtblList[Index];
 
   TRACE("(%p,%p,%p,%p,%p) %s\n", pUnkOuter, vtbl, pPSFactory, ppProxy, ppvObj, name);
 
-  /* I can't find any other way to detect stubless proxies than this hack */
-  if (!IsEqualGUID(vtbl->header.piid, riid)) {
+  /* TableVersion = 2 means it is the stubless version of CInterfaceProxyVtbl */
+  if (ProxyInfo->TableVersion > 1) {
     stubless = *(const void **)vtbl;
     vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
     TRACE("stubless=%p\n", stubless);
@@ -150,11 +151,12 @@ HRESULT WINAPI StdProxy_Construct(REFIID
   if (!This) return E_OUTOFMEMORY;
 
   if (stubless) {
-    unsigned i, count = svtbl->header.DispatchTableCount;
+    CInterfaceStubVtbl *svtbl = ProxyInfo->pStubVtblList[Index];
+    unsigned long i, count = svtbl->header.DispatchTableCount;
     /* Maybe the original vtbl is just modified directly to point at
      * ObjectStublessClientXXX thunks in real Windows, but I don't like it
      */
-    TRACE("stubless thunks: count=%d\n", count);
+    TRACE("stubless thunks: count=%ld\n", count);
     This->thunks = HeapAlloc(GetProcessHeap(),0,sizeof(struct StublessThunk)*count);
     This->PVtbl = HeapAlloc(GetProcessHeap(),0,sizeof(LPVOID)*count);
     for (i=0; i<count; i++) {
@@ -162,7 +164,7 @@ HRESULT WINAPI StdProxy_Construct(REFIID
       if (vtbl->Vtbl[i] == (LPVOID)-1) {
         PFORMAT_STRING fs = stubless->ProcFormatString + stubless->FormatStringOffset[i];
         unsigned bytes = *(const WORD*)(fs+8) - STACK_ADJUST;
-        TRACE("method %d: stacksize=%d\n", i, bytes);
+        TRACE("method %ld: stacksize=%d\n", i, bytes);
         FILL_STUBLESS(thunk, i, bytes)
         This->PVtbl[i] = thunk;
       }
diff --git a/dlls/rpcrt4/cpsf.c b/dlls/rpcrt4/cpsf.c
index 3f0190c..78ac681 100644
--- a/dlls/rpcrt4/cpsf.c
+++ b/dlls/rpcrt4/cpsf.c
@@ -95,9 +95,7 @@ static HRESULT WINAPI CStdPSFactory_Crea
        debugstr_guid(riid),ppProxy,ppv);
   if (!FindProxyInfo(This->pProxyFileList,riid,&ProxyInfo,&Index))
     return E_NOINTERFACE;
-  return StdProxy_Construct(riid, pUnkOuter, ProxyInfo->pNamesArray[Index],
-                            ProxyInfo->pProxyVtblList[Index],
-                            ProxyInfo->pStubVtblList[Index], iface, ppProxy, ppv);
+  return StdProxy_Construct(riid, pUnkOuter, ProxyInfo, Index, iface, ppProxy, ppv);
 }
 
 static HRESULT WINAPI CStdPSFactory_CreateStub(LPPSFACTORYBUFFER iface,
diff --git a/dlls/rpcrt4/cpsf.h b/dlls/rpcrt4/cpsf.h
index 60364d3..0c6d067 100644
--- a/dlls/rpcrt4/cpsf.h
+++ b/dlls/rpcrt4/cpsf.h
@@ -23,9 +23,8 @@
 
 HRESULT WINAPI StdProxy_Construct(REFIID riid,
 				  LPUNKNOWN pUnkOuter,
-				  PCInterfaceName name,
-				  CInterfaceProxyVtbl *vtbl,
-				  CInterfaceStubVtbl *svtbl,
+				  const ProxyFileInfo *ProxyInfo,
+				  int Index,
 				  LPPSFACTORYBUFFER pPSFactory,
 				  LPRPCPROXYBUFFER *ppProxy,
 				  LPVOID *ppvObj);




More information about the wine-cvs mailing list