rpcrt4: Raise an exception if IRpcChannelBuffer_GetBuffer fails.

Make StdProxy_GetIID and StdProxy_GetChannel return void.
Don't bother checking for This and pRpcChannelBuffer being NULL as 
native doesn't.
This commit is contained in:
Robert Shearman 2006-08-31 17:14:34 +01:00 committed by Alexandre Julliard
parent 6991563d81
commit a6e545a27c
1 changed files with 12 additions and 13 deletions

View File

@ -284,24 +284,22 @@ static const IRpcProxyBufferVtbl StdProxy_Vtbl =
StdProxy_Disconnect StdProxy_Disconnect
}; };
static HRESULT StdProxy_GetChannel(LPVOID iface, static void StdProxy_GetChannel(LPVOID iface,
LPRPCCHANNELBUFFER *ppChannel) LPRPCCHANNELBUFFER *ppChannel)
{ {
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface); ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name); TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name);
*ppChannel = This->pChannel; *ppChannel = This->pChannel;
return S_OK;
} }
static HRESULT StdProxy_GetIID(LPVOID iface, static void StdProxy_GetIID(LPVOID iface,
const IID **ppiid) const IID **ppiid)
{ {
ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface); ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface);
TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name); TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name);
*ppiid = This->piid; *ppiid = This->piid;
return S_OK;
} }
HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface, HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface,
@ -336,16 +334,12 @@ void WINAPI NdrProxyInitialize(void *This,
PMIDL_STUB_DESC pStubDescriptor, PMIDL_STUB_DESC pStubDescriptor,
unsigned int ProcNum) unsigned int ProcNum)
{ {
HRESULT hr;
TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum); TRACE("(%p,%p,%p,%p,%d)\n", This, pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum); NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDescriptor, ProcNum);
if (This) StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer); StdProxy_GetChannel(This, &pStubMsg->pRpcChannelBuffer);
if (pStubMsg->pRpcChannelBuffer) { IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer,
hr = IRpcChannelBuffer_GetDestCtx(pStubMsg->pRpcChannelBuffer, &pStubMsg->dwDestContext,
&pStubMsg->dwDestContext, &pStubMsg->pvDestContext);
&pStubMsg->pvDestContext);
}
TRACE("channel=%p\n", pStubMsg->pRpcChannelBuffer); TRACE("channel=%p\n", pStubMsg->pRpcChannelBuffer);
} }
@ -361,10 +355,15 @@ void WINAPI NdrProxyGetBuffer(void *This,
TRACE("(%p,%p)\n", This, pStubMsg); TRACE("(%p,%p)\n", This, pStubMsg);
pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength; pStubMsg->RpcMsg->BufferLength = pStubMsg->BufferLength;
pStubMsg->dwStubPhase = PROXY_GETBUFFER; pStubMsg->dwStubPhase = PROXY_GETBUFFER;
hr = StdProxy_GetIID(This, &riid); StdProxy_GetIID(This, &riid);
hr = IRpcChannelBuffer_GetBuffer(pStubMsg->pRpcChannelBuffer, hr = IRpcChannelBuffer_GetBuffer(pStubMsg->pRpcChannelBuffer,
(RPCOLEMESSAGE*)pStubMsg->RpcMsg, (RPCOLEMESSAGE*)pStubMsg->RpcMsg,
riid); riid);
if (FAILED(hr))
{
RpcRaiseException(hr);
return;
}
pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer; pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer;
pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength; pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength;
pStubMsg->Buffer = pStubMsg->BufferStart; pStubMsg->Buffer = pStubMsg->BufferStart;