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:
parent
5b629e9509
commit
8c55c6f053
|
@ -119,20 +119,21 @@ struct StublessThunk { int dummy; };
|
||||||
|
|
||||||
HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
||||||
LPUNKNOWN pUnkOuter,
|
LPUNKNOWN pUnkOuter,
|
||||||
PCInterfaceName name,
|
const ProxyFileInfo *ProxyInfo,
|
||||||
CInterfaceProxyVtbl *vtbl,
|
int Index,
|
||||||
CInterfaceStubVtbl *svtbl,
|
|
||||||
LPPSFACTORYBUFFER pPSFactory,
|
LPPSFACTORYBUFFER pPSFactory,
|
||||||
LPRPCPROXYBUFFER *ppProxy,
|
LPRPCPROXYBUFFER *ppProxy,
|
||||||
LPVOID *ppvObj)
|
LPVOID *ppvObj)
|
||||||
{
|
{
|
||||||
StdProxyImpl *This;
|
StdProxyImpl *This;
|
||||||
const MIDL_STUBLESS_PROXY_INFO *stubless = NULL;
|
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);
|
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 */
|
/* TableVersion = 2 means it is the stubless version of CInterfaceProxyVtbl */
|
||||||
if (!IsEqualGUID(vtbl->header.piid, riid)) {
|
if (ProxyInfo->TableVersion > 1) {
|
||||||
stubless = *(const void **)vtbl;
|
stubless = *(const void **)vtbl;
|
||||||
vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
|
vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
|
||||||
TRACE("stubless=%p\n", stubless);
|
TRACE("stubless=%p\n", stubless);
|
||||||
|
@ -150,11 +151,12 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
||||||
if (!This) return E_OUTOFMEMORY;
|
if (!This) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
if (stubless) {
|
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
|
/* Maybe the original vtbl is just modified directly to point at
|
||||||
* ObjectStublessClientXXX thunks in real Windows, but I don't like it
|
* 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->thunks = HeapAlloc(GetProcessHeap(),0,sizeof(struct StublessThunk)*count);
|
||||||
This->PVtbl = HeapAlloc(GetProcessHeap(),0,sizeof(LPVOID)*count);
|
This->PVtbl = HeapAlloc(GetProcessHeap(),0,sizeof(LPVOID)*count);
|
||||||
for (i=0; i<count; i++) {
|
for (i=0; i<count; i++) {
|
||||||
|
@ -162,7 +164,7 @@ HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
||||||
if (vtbl->Vtbl[i] == (LPVOID)-1) {
|
if (vtbl->Vtbl[i] == (LPVOID)-1) {
|
||||||
PFORMAT_STRING fs = stubless->ProcFormatString + stubless->FormatStringOffset[i];
|
PFORMAT_STRING fs = stubless->ProcFormatString + stubless->FormatStringOffset[i];
|
||||||
unsigned bytes = *(const WORD*)(fs+8) - STACK_ADJUST;
|
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)
|
FILL_STUBLESS(thunk, i, bytes)
|
||||||
This->PVtbl[i] = thunk;
|
This->PVtbl[i] = thunk;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,9 +95,7 @@ static HRESULT WINAPI CStdPSFactory_CreateProxy(LPPSFACTORYBUFFER iface,
|
||||||
debugstr_guid(riid),ppProxy,ppv);
|
debugstr_guid(riid),ppProxy,ppv);
|
||||||
if (!FindProxyInfo(This->pProxyFileList,riid,&ProxyInfo,&Index))
|
if (!FindProxyInfo(This->pProxyFileList,riid,&ProxyInfo,&Index))
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
return StdProxy_Construct(riid, pUnkOuter, ProxyInfo->pNamesArray[Index],
|
return StdProxy_Construct(riid, pUnkOuter, ProxyInfo, Index, iface, ppProxy, ppv);
|
||||||
ProxyInfo->pProxyVtblList[Index],
|
|
||||||
ProxyInfo->pStubVtblList[Index], iface, ppProxy, ppv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI CStdPSFactory_CreateStub(LPPSFACTORYBUFFER iface,
|
static HRESULT WINAPI CStdPSFactory_CreateStub(LPPSFACTORYBUFFER iface,
|
||||||
|
|
|
@ -23,9 +23,8 @@
|
||||||
|
|
||||||
HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
HRESULT WINAPI StdProxy_Construct(REFIID riid,
|
||||||
LPUNKNOWN pUnkOuter,
|
LPUNKNOWN pUnkOuter,
|
||||||
PCInterfaceName name,
|
const ProxyFileInfo *ProxyInfo,
|
||||||
CInterfaceProxyVtbl *vtbl,
|
int Index,
|
||||||
CInterfaceStubVtbl *svtbl,
|
|
||||||
LPPSFACTORYBUFFER pPSFactory,
|
LPPSFACTORYBUFFER pPSFactory,
|
||||||
LPRPCPROXYBUFFER *ppProxy,
|
LPRPCPROXYBUFFER *ppProxy,
|
||||||
LPVOID *ppvObj);
|
LPVOID *ppvObj);
|
||||||
|
|
Loading…
Reference in New Issue