rpcrt4: Add an exception handler for CStdStubBuffer_Invoke.

This is needed because IRpcStubBuffer::Invoke should not allow RPC
exceptions to be passed to the caller.
This commit is contained in:
Robert Shearman 2006-06-10 12:33:40 +01:00 committed by Alexandre Julliard
parent 35982d72f5
commit 1c04d9ab20
1 changed files with 30 additions and 6 deletions

View File

@ -25,12 +25,13 @@
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "excpt.h"
#include "objbase.h"
#include "rpcproxy.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "cpsf.h"
@ -38,6 +39,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
#define STUB_HEADER(This) (((CInterfaceStubHeader*)((This)->lpVtbl))[-1])
static WINE_EXCEPTION_FILTER(stub_filter)
{
if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
return EXCEPTION_CONTINUE_SEARCH;
return EXCEPTION_EXECUTE_HANDLER;
}
HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
LPUNKNOWN pUnkServer,
PCInterfaceName name,
@ -142,13 +150,29 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
{
CStdStubBuffer *This = (CStdStubBuffer *)iface;
DWORD dwPhase = STUB_UNMARSHAL;
HRESULT hr = S_OK;
TRACE("(%p)->Invoke(%p,%p)\n",This,pMsg,pChannel);
if (STUB_HEADER(This).pDispatchTable)
STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
else /* pure interpreted */
NdrStubCall2(iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
return S_OK;
__TRY
{
if (STUB_HEADER(This).pDispatchTable)
STUB_HEADER(This).pDispatchTable[pMsg->iMethod](iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
else /* pure interpreted */
NdrStubCall2(iface, pChannel, (PRPC_MESSAGE)pMsg, &dwPhase);
}
__EXCEPT(stub_filter)
{
DWORD dwExceptionCode = GetExceptionCode();
WARN("a stub call failed with exception 0x%08lx (%ld)\n", dwExceptionCode, dwExceptionCode);
if (FAILED(dwExceptionCode))
hr = dwExceptionCode;
else
hr = HRESULT_FROM_WIN32(dwExceptionCode);
}
__ENDTRY
return hr;
}
LPRPCSTUBBUFFER WINAPI CStdStubBuffer_IsIIDSupported(LPRPCSTUBBUFFER iface,