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.
This commit is contained in:
Robert Shearman 2006-01-20 16:15:25 +01:00 committed by Alexandre Julliard
parent 5b629e9509
commit 8c55c6f053
3 changed files with 13 additions and 14 deletions

View File

@ -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; i<count; i++) {
@ -162,7 +164,7 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
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;
}

View File

@ -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,

View File

@ -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);