From 8c55c6f053370bdcd002340556e1980d88363329 Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Fri, 20 Jan 2006 16:15:25 +0100 Subject: [PATCH] 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 89dca95a4d7..21f23f31734 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 riid, 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; iVtbl[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 3f0190c24aa..78ac6819efa 100644 --- a/dlls/rpcrt4/cpsf.c +++ b/dlls/rpcrt4/cpsf.c @@ -95,9 +95,7 @@ static HRESULT WINAPI CStdPSFactory_CreateProxy(LPPSFACTORYBUFFER iface, 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 60364d39db2..0c6d067f4a0 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);