Add exception handling for stubs.
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 53acd8e..91a96a9 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -419,7 +419,8 @@
switch (msg)
{
case DM_EXECUTERPC:
- return RPC_ExecuteCall((struct dispatch_params *)lParam);
+ RPC_ExecuteCall((struct dispatch_params *)lParam);
+ return 0;
default:
return DefWindowProcW(hWnd, msg, wParam, lParam);
}
diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h
index 97a3177..6947ef4 100644
--- a/dlls/ole32/compobj_private.h
+++ b/dlls/ole32/compobj_private.h
@@ -200,7 +200,7 @@
void RPC_StartRemoting(struct apartment *apt);
HRESULT RPC_CreateClientChannel(const OXID *oxid, const IPID *ipid, IRpcChannelBuffer **pipebuf);
-HRESULT RPC_ExecuteCall(struct dispatch_params *params);
+void RPC_ExecuteCall(struct dispatch_params *params);
HRESULT RPC_RegisterInterface(REFIID riid);
void RPC_UnregisterInterface(REFIID riid);
void RPC_StartLocalServer(REFCLSID clsid, IStream *stream);
diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c
index 117abfd..c6cb8ba 100644
--- a/dlls/ole32/rpc.c
+++ b/dlls/ole32/rpc.c
@@ -42,7 +42,9 @@
#include "winerror.h"
#include "winreg.h"
#include "wtypes.h"
+#include "excpt.h"
#include "wine/unicode.h"
+#include "wine/exception.h"
#include "compobj_private.h"
@@ -105,8 +107,17 @@
IRpcChannelBuffer *chan; /* server channel buffer, if applicable */
HANDLE handle; /* handle that will become signaled when call finishes */
RPC_STATUS status; /* status (out) */
+ HRESULT hr; /* hresult (out) */
};
+static WINE_EXCEPTION_FILTER(ole_filter)
+{
+ if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ||
+ GetExceptionCode() == EXCEPTION_PRIV_INSTRUCTION)
+ return EXCEPTION_CONTINUE_SEARCH;
+ return EXCEPTION_EXECUTE_HANDLER;
+}
+
static HRESULT WINAPI RpcChannelBuffer_QueryInterface(LPRPCCHANNELBUFFER iface, REFIID riid, LPVOID *ppv)
{
*ppv = NULL;
@@ -228,6 +239,7 @@
params->msg = olemsg;
params->status = RPC_S_OK;
+ params->hr = S_OK;
/* Note: this is an optimization in the Microsoft OLE runtime that we need
* to copy, as shown by the test_no_couninitialize_client test. without
@@ -271,6 +283,8 @@
hr = CoWaitForMultipleHandles(0, INFINITE, 1, ¶ms->handle, &index);
CloseHandle(params->handle);
+ if (hr == S_OK) hr = params->hr;
+
status = params->status;
HeapFree(GetProcessHeap(), 0, params);
params = NULL;
@@ -434,12 +448,19 @@
}
-HRESULT RPC_ExecuteCall(struct dispatch_params *params)
+void RPC_ExecuteCall(struct dispatch_params *params)
{
- HRESULT hr = IRpcStubBuffer_Invoke(params->stub, params->msg, params->chan);
+ __TRY
+ {
+ params->hr = IRpcStubBuffer_Invoke(params->stub, params->msg, params->chan);
+ }
+ __EXCEPT(ole_filter)
+ {
+ params->hr = GetExceptionCode();
+ }
+ __ENDTRY
IRpcStubBuffer_Release(params->stub);
if (params->handle) SetEvent(params->handle);
- return hr;
}
static void __RPC_STUB dispatch_rpc(RPC_MESSAGE *msg)