http://bugs.winehq.org/show_bug.cgi?id=20056
Summary: The Westerner: crash follows bogus DSOUND:SetFormat call Product: Wine Version: 1.1.29 Platform: PC OS/Version: Mac OS X 10.5 Status: UNCONFIRMED Severity: normal Priority: P2 Component: directx-dsound AssignedTo: wine-bugs@winehq.org ReportedBy: hoehle@users.sourceforge.net
When DSOUND_PrimarySetFormat is given a broken format, it will nevertheless HeapReAlloc() and thus forget the old format.
The Westerner happens to call DSOUND_PrimarySetFormat with a completely bogus format. Why? I don't know. DSOUND_PrimarySetFormat (formattag=0x0001,chans=0, samplerate=0,bytespersec=0, blockalign=0,bitspersamp=0,cbSize=0)
From there, two execution traces are possible, each leading to a crash.
A) ReopenDevice fails as WAVE_Open refuses the bogus new format. The device is left in floating state, neither open nor closed, and with a bogus format description in device->pwfx. A subsequent DSOUND_PerformMix() will choke on the broken format.
DSOUND_ReopenDevice waveOutOpen failed DSOUND_PrimarySetFormat DSOUND_ReopenDevice failed: 80070057 DSOUND_PerformMix (0x213620) DSOUND_PrimaryGetPosition pwplay=0, pwqueue=0 DSOUND_PrimaryGetPosition playpos = 0, writepos = 0 ( time=8688) DSOUND_PerformMix primary playpos=0, writepos=0, clrpos=0, mixpos=0, buflen=65536 wine: Unhandled division by zero -- likely BytesPerSec=0
B) One winmm:WAVE_Open initiated by DSOUND_PrimaryOpen succeeds. trace:winmm:WAVE_Open wFormatTag=1, nChannels=3, nSamplesPerSec=96000, nAvgBytesPerSec=576000, nBlockAlign=6, wBitsPerSample=16
The original format structure is still bogus (wBitsPerSample=0) and PrimaryOpen crashes in a division by zero in this case as well.
This is the case I have to investigate further, as I thought my recent patches to wodOpen in wineoss.drv and winecoreaudio.drv for bug #12349 and bug #19901 would have taken care of it. Apparently there are several WAVE_FORMAT structures floating around that one does not know which one to correct. I also need to find out why the app keeps crashing now while I had it working in the past (IIRC I did not use the demo).