[WINEARTS] recover ftom arts crash

Robert Reif reif at earthlink.net
Fri Jan 20 18:13:54 CST 2006


Try to keep winecfg from crashing by recovering from an arts library crash.
-------------- next part --------------
Index: dlls/winmm/winearts/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/winmm/winearts/Makefile.in,v
retrieving revision 1.9
diff -p -u -r1.9 Makefile.in
--- dlls/winmm/winearts/Makefile.in	27 Jan 2004 20:16:39 -0000	1.9
+++ dlls/winmm/winearts/Makefile.in	20 Jan 2006 23:51:11 -0000
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = winearts.drv
-IMPORTS   = winmm user32 kernel32
+IMPORTS   = winmm user32 kernel32 ntdll
 EXTRAINCL = @ARTSINCL@
 EXTRALIBS = @ARTSLIBS@ -ldxguid -luuid
 
Index: dlls/winmm/winearts/audio.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/winearts/audio.c,v
retrieving revision 1.32
diff -p -u -r1.32 audio.c
--- dlls/winmm/winearts/audio.c	10 Nov 2005 12:14:56 -0000	1.32
+++ dlls/winmm/winearts/audio.c	20 Jan 2006 23:51:13 -0000
@@ -57,6 +57,8 @@
 #include "dsdriver.h"
 #include "arts.h"
 #include "wine/unicode.h"
+#include "wine/exception.h"
+#include "excpt.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(wave);
@@ -383,6 +385,14 @@ LONG		ARTS_WaveClose(void)
     return 1;
 }
 
+/* filter for page-fault exceptions */
+static WINE_EXCEPTION_FILTER(page_fault)
+{
+    if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
+        return EXCEPTION_EXECUTE_HANDLER;
+    return EXCEPTION_CONTINUE_SEARCH;
+}
+
 /******************************************************************
  *		ARTS_WaveInit
  *
@@ -392,14 +402,27 @@ LONG ARTS_WaveInit(void)
 {
     int 	i;
     int		errorcode;
+    LONG	ret = 0;
 
     TRACE("called\n");
 
-    if ((errorcode = ARTS_Init()) < 0)
+    __TRY
+    {
+        if ((errorcode = ARTS_Init()) < 0)
+        {
+            WARN("arts_init() failed (%d)\n", errorcode);
+            ret = -1;
+        }
+    }
+    __EXCEPT(page_fault)
     {
-	WARN("arts_init() failed (%d)\n", errorcode);
-	return -1;
+        ERR("arts_init() crashed\n");
+        ret = -1;
     }
+    __ENDTRY
+
+    if (ret)
+        return ret;
 
     /* initialize all device handles to -1 */
     for (i = 0; i < MAX_WAVEOUTDRV; ++i)


More information about the wine-patches mailing list