[Bug 35371] Battlefield 2 voice setup tool crashes when "Save Settings" button is clicked (winmm.mixerGetDevCaps should also accept mixer device handles)

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Jan 12 06:13:22 CST 2014


http://bugs.winehq.org/show_bug.cgi?id=35371

Anastasius Focht <focht at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |focht at gmx.net
          Component|-unknown                    |winmm&mci
            Summary|Battlefield 2: Wine crashes |Battlefield 2 voice setup
                   |on mic setup                |tool crashes when "Save
                   |                            |Settings" button is clicked
                   |                            |(winmm.mixerGetDevCaps
                   |                            |should also accept mixer
                   |                            |device handles)
     Ever confirmed|0                           |1

--- Comment #1 from Anastasius Focht <focht at gmx.net> ---
Hello folks,

confirming.

This reminded me of bug 16544 which I analyzed years ago (same backtrace).
It's not the same thing though, the backtrace is just a manifestation of
earlier problems.

--- snip ---
$ pwd
/home/focht/.wine/drive_c/Program Files/EA GAMES/Battlefield 2

$ WINEDEBUG=+tid,+seh,+relay,+winmm wine ./BF2VoiceSetup.exe >>log.txt 2>&1
...
0024:Call winmm.mixerGetDevCapsA(00000000,0033f42c,00000030) ret=00408295
0024:trace:winmm:mixerGetDevCapsA (0, 0x33f42c, 48)
0024:trace:winmm:mixerGetDevCapsW (0, 0x33f354, 80) 
...
0024:Ret  winmm.mixerGetDevCapsA() retval=00000000 ret=00408295
0024:Call winmm.mixerOpen(00425f0c,00000000,00000000,00000000,00010000)
ret=004082ac
0024:trace:winmm:mixerOpen (0x425f0c, 0, 0, 0, 10000)
0024:Ret  winmm.mixerOpen() retval=00000000 ret=004082ac
0024:Call winmm.mixerGetDevCapsA(0000c000,0033f290,00000030) ret=00408021
0024:trace:winmm:mixerGetDevCapsA (49152, 0x33f290, 48)
0024:trace:winmm:mixerGetDevCapsW (49152, 0x33f1b4, 80)
0024:Ret  winmm.mixerGetDevCapsA() retval=00000002 ret=00408021 
...
0024:Call msvcrt._wfsopen(0033dac0 L"C:\\users\\focht\\My
Documents\\Battlefield
2\\Profiles\\BattleCommoDefaultUserSettings.con",7e468984 L"w",00000040)
ret=7e40e7a6
0024:Call KERNEL32.CreateFileW(0033dac0 L"C:\\users\\focht\\My
Documents\\Battlefield
2\\Profiles\\BattleCommoDefaultUserSettings.con",40000000,00000003,0033d870,00000002,00000080,00000000)
ret=7e33d409
0024:Ret  KERNEL32.CreateFileW() retval=000000b4 ret=7e33d409
0024:Ret  msvcrt._wfsopen() retval=7e3ae440 ret=7e40e7a6
...
0024:Ret 
msvcp71.?open@?$basic_ofstream at DU?$char_traits at D@std@@@std@@QAEXPBDHH at Z()
retval=0033dd80 ret=00403918
0024:trace:seh:raise_exception code=c0000005 flags=0 addr=0x408661 ip=00408661
tid=0024
0024:trace:seh:raise_exception  info[0]=00000000
0024:trace:seh:raise_exception  info[1]=0000002c
0024:trace:seh:raise_exception  eax=00000000 ebx=00000111 ecx=00000000
edx=00000002 esi=0033dc84 edi=0033dd68
0024:trace:seh:raise_exception  ebp=0033dd68 esp=0033dc84 cs=0023 ds=002b
es=002b fs=0063 gs=006b flags=00010206
0024:trace:seh:call_stack_handlers calling handler at 0x41d00c code=c0000005
flags=0 
--- snip ---

The problem is the failing winmm.mixerGetDevCapsA() call, returning
MMSYSERR_BADDEVICEID.
The mixer id is the handle returned by earlier mixerOpen() call.

MSDN:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd757300%28v=vs.85%29.aspx

--- quote ---
...
This function also accepts a mixer device handle returned by the mixerOpen
function as the uMxId parameter. The application should cast the HMIXER handle
to a UINT.
--- quote ---

Apparently Wine doesn't do this:

Source:
http://source.winehq.org/git/wine.git/blob/06c95af45726674847d12440d904568f59f627bc:/dlls/winmm/waveform.c#l3724

--- snip ---
3724 UINT WINAPI mixerGetDevCapsW(UINT_PTR uDeviceID, LPMIXERCAPSW lpCaps, UINT
uSize)
3725 {
3726     WINMM_MMDevice *mmdevice;
3727     MIXERCAPSW caps;
3728     HRESULT hr;
3729
3730     TRACE("(%lu, %p, %u)\n", uDeviceID, lpCaps, uSize);
3731
3732     hr = WINMM_InitMMDevices();
3733     if(FAILED(hr))
3734         return MMSYSERR_NODRIVER;
3735
3736     if(!lpCaps)
3737         return MMSYSERR_INVALPARAM;
3738
3739     if(!uSize)
3740         return MMSYSERR_NOERROR;
3741
3742     if(uDeviceID >= g_outmmdevices_count + g_inmmdevices_count)
3743         return MMSYSERR_BADDEVICEID;
...
--- snip ---

Additionally a small diagnostic trace in mixerOpen(), printing the actual
returned handle value (out param) would be helpful.

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list