From 17cff085fbca1c95df3cf832a2c3c7207b3b9d35 Mon Sep 17 00:00:00 2001 From: Jason Edmeades Date: Tue, 15 Mar 2005 15:38:34 +0000 Subject: [PATCH] Avoid trap in mixerGetLineControlsA when cControls is uninitialized and MIXER_GETLINECONTROLSSF_ONEBYTYPE requested. --- dlls/winmm/winmm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/winmm/winmm.c b/dlls/winmm/winmm.c index 5c2f3a73949..a9b3eea0c1e 100644 --- a/dlls/winmm/winmm.c +++ b/dlls/winmm/winmm.c @@ -488,7 +488,15 @@ UINT WINAPI mixerGetLineControlsA(HMIXEROBJ hmix, LPMIXERLINECONTROLSA lpmlcA, mlcW.dwLineID = lpmlcA->dwLineID; mlcW.u.dwControlID = lpmlcA->u.dwControlID; mlcW.u.dwControlType = lpmlcA->u.dwControlType; - mlcW.cControls = lpmlcA->cControls; + + /* Debugging on Windows shows for MIXER_GETLINECONTROLSF_ONEBYTYPE only, + the control count is assumed to be 1 - This is relied upon by a game, + "Dynomite Deluze" */ + if (MIXER_GETLINECONTROLSF_ONEBYTYPE == fdwControls) { + mlcW.cControls = 1; + } else { + mlcW.cControls = lpmlcA->cControls; + } mlcW.cbmxctrl = sizeof(MIXERCONTROLW); mlcW.pamxctrl = HeapAlloc(GetProcessHeap(), 0, mlcW.cControls * mlcW.cbmxctrl);