Avoid trap in mixerGetLineControlsA when cControls is uninitialized

and MIXER_GETLINECONTROLSSF_ONEBYTYPE requested.
This commit is contained in:
Jason Edmeades 2005-03-15 15:38:34 +00:00 committed by Alexandre Julliard
parent 1a7a4fbe58
commit 17cff085fb
1 changed files with 9 additions and 1 deletions

View File

@ -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;
/* 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);