Robert Shearman : rpcrt4:
Add an exception handler for CStdStubBuffer_Invoke.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 12 07:09:34 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 1c04d9ab20c2627b7af8693f17f3fe3a8ae2881d
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=1c04d9ab20c2627b7af8693f17f3fe3a8ae2881d
Author: Robert Shearman <rob at codeweavers.com>
Date: Sat Jun 10 12:33:40 2006 +0100
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.
---
dlls/rpcrt4/cstub.c | 36 ++++++++++++++++++++++++++++++------
1 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/dlls/rpcrt4/cstub.c b/dlls/rpcrt4/cstub.c
index efb8d06..0b35579 100644
--- a/dlls/rpcrt4/cstub.c
+++ b/dlls/rpcrt4/cstub.c
@@ -25,12 +25,13 @@ #define COBJMACROS
#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(LPR
{
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,
More information about the wine-cvs
mailing list