Commit 4ad5de28 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

rpcrt4: Use a CONTAINING_RECORD helper to retrieve CInterfaceStubHeader from CStdStubBuffer.

parent 180edc5a
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(ole); WINE_DEFAULT_DEBUG_CHANNEL(ole);
#define STUB_HEADER(This) (((const CInterfaceStubHeader*)((This)->lpVtbl))[-1])
static LONG WINAPI stub_filter(EXCEPTION_POINTERS *eptr) static LONG WINAPI stub_filter(EXCEPTION_POINTERS *eptr)
{ {
if (eptr->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE) if (eptr->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)
...@@ -57,6 +55,13 @@ static inline cstdstubbuffer_delegating_t *impl_from_delegating( IRpcStubBuffer ...@@ -57,6 +55,13 @@ static inline cstdstubbuffer_delegating_t *impl_from_delegating( IRpcStubBuffer
return CONTAINING_RECORD(impl_from_IRpcStubBuffer(iface), cstdstubbuffer_delegating_t, stub_buffer); return CONTAINING_RECORD(impl_from_IRpcStubBuffer(iface), cstdstubbuffer_delegating_t, stub_buffer);
} }
static const CInterfaceStubHeader *get_stub_header(const CStdStubBuffer *stub)
{
const CInterfaceStubVtbl *vtbl = CONTAINING_RECORD(stub->lpVtbl, CInterfaceStubVtbl, Vtbl);
return &vtbl->header;
}
HRESULT CStdStubBuffer_Construct(REFIID riid, HRESULT CStdStubBuffer_Construct(REFIID riid,
LPUNKNOWN pUnkServer, LPUNKNOWN pUnkServer,
PCInterfaceName name, PCInterfaceName name,
...@@ -473,7 +478,7 @@ HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface, ...@@ -473,7 +478,7 @@ HRESULT WINAPI CStdStubBuffer_Connect(LPRPCSTUBBUFFER iface,
TRACE("(%p)->Connect(%p)\n",This,lpUnkServer); TRACE("(%p)->Connect(%p)\n",This,lpUnkServer);
r = IUnknown_QueryInterface(lpUnkServer, STUB_HEADER(This).piid, (void**)&new); r = IUnknown_QueryInterface(lpUnkServer, get_stub_header(This)->piid, (void**)&new);
new = InterlockedExchangePointer((void**)&This->pvServerObject, new); new = InterlockedExchangePointer((void**)&This->pvServerObject, new);
if(new) if(new)
IUnknown_Release(new); IUnknown_Release(new);
...@@ -497,6 +502,7 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface, ...@@ -497,6 +502,7 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
LPRPCCHANNELBUFFER pChannel) LPRPCCHANNELBUFFER pChannel)
{ {
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface); CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface);
const CInterfaceStubHeader *header = get_stub_header(This);
DWORD dwPhase = STUB_UNMARSHAL; DWORD dwPhase = STUB_UNMARSHAL;
HRESULT hr = S_OK; HRESULT hr = S_OK;
...@@ -504,8 +510,8 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface, ...@@ -504,8 +510,8 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
__TRY __TRY
{ {
if (STUB_HEADER(This).pDispatchTable) if (header->pDispatchTable)
STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase); header->pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
else /* pure interpreted */ else /* pure interpreted */
NdrStubCall2(iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase); NdrStubCall2(iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
} }
...@@ -526,9 +532,13 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface, ...@@ -526,9 +532,13 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface, LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface,
REFIID riid) REFIID riid)
{ {
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface); CStdStubBuffer *stub = impl_from_IRpcStubBuffer(iface);
TRACE("(%p)->IsIIDSupported(%s)\n",This,debugstr_guid(riid));
return IsEqualGUID(STUB_HEADER(This).piid, riid) ? iface : NULL; TRACE("(%p)->IsIIDSupported(%s)\n", stub, debugstr_guid(riid));
if (IsEqualGUID(get_stub_header(stub)->piid, riid))
return iface;
return NULL;
} }
ULONG WINAPI CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface) ULONG WINAPI CStdStubBuffer_CountRefs(LPRPCSTUBBUFFER iface)
...@@ -618,8 +628,9 @@ const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl = ...@@ -618,8 +628,9 @@ const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl =
const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface) const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface)
{ {
CStdStubBuffer *This = impl_from_IRpcStubBuffer(iface); CStdStubBuffer *stub = impl_from_IRpcStubBuffer(iface);
return STUB_HEADER(This).pServerInfo;
return get_stub_header(stub)->pServerInfo;
} }
/************************************************************************ /************************************************************************
...@@ -666,7 +677,7 @@ void WINAPI NdrStubGetBuffer(LPRPCSTUBBUFFER iface, ...@@ -666,7 +677,7 @@ void WINAPI NdrStubGetBuffer(LPRPCSTUBBUFFER iface,
pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength; pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
hr = IRpcChannelBuffer_GetBuffer(pRpcChannelBuffer, hr = IRpcChannelBuffer_GetBuffer(pRpcChannelBuffer,
(RPCOLEMESSAGE *)pStubMsg->RpcMsg, STUB_HEADER(This).piid); (RPCOLEMESSAGE *)pStubMsg->RpcMsg, get_stub_header(This)->piid);
if (FAILED(hr)) if (FAILED(hr))
{ {
RpcRaiseException(hr); RpcRaiseException(hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment