winess init crash fix.

Rein Klazes wijn at wanadoo.nl
Fri Nov 18 13:52:45 CST 2005


Hi,

This fixes a kernel oops and a wineoss crash in initialization in
combination with an old vortex card. The driver apparently does not like
to be queried for channel numbers more then one then the maximum: its
has two channels, returns an error for 3 channels and crashes when asked
for 4 channels.
Since wineoss is the default, on this system wineprefixcreate and
winecfg will crash and a manual edit of the registry is required to get
wine running.

Changelog:
dlls/winmm/wineoss	: audio.c
Break from the SNDCTL_DSP_CHANNELS loops on first error instead of
continuing with even higher channels numbers.

Rein.  
-------------- next part --------------
--- wine/dlls/winmm/wineoss/audio.c	2005-10-04 15:40:14.000000000 +0200
+++ mywine/dlls/winmm/wineoss/audio.c	2005-11-18 19:51:11.000000000 +0100
@@ -788,6 +788,7 @@ static BOOL OSS_WaveOutInit(OSS_DEVICE* 
         for (c = 1; c <= MAX_CHANNELS; c++) {
             arg=c;
             rc=ioctl(ossdev->fd, SNDCTL_DSP_CHANNELS, &arg);
+            if( rc == -1) break;
             if (rc!=0 || arg!=c) {
                 TRACE("DSP_CHANNELS: rc=%d returned %d for %d\n",rc,arg,c);
                 continue;
@@ -927,6 +928,7 @@ static BOOL OSS_WaveInInit(OSS_DEVICE* o
         for (c = 1; c <= MAX_CHANNELS; c++) {
             arg=c;
             rc=ioctl(ossdev->fd, SNDCTL_DSP_CHANNELS, &arg);
+            if( rc == -1) break;
             if (rc!=0 || arg!=c) {
                 TRACE("DSP_CHANNELS: rc=%d returned %d for %d\n",rc,arg,c);
                 continue;
@@ -1019,6 +1021,7 @@ static void OSS_WaveFullDuplexInit(OSS_D
         for (c = 1; c <= MAX_CHANNELS; c++) {
             arg=c;
             rc=ioctl(ossdev->fd, SNDCTL_DSP_CHANNELS, &arg);
+            if( rc == -1) break;
             if (rc!=0 || arg!=c) {
                 TRACE("DSP_CHANNELS: rc=%d returned %d for %d\n",rc,arg,c);
                 continue;


More information about the wine-patches mailing list