winmm: Return error in waveOutMessage if either dwParam1 or dwParam2 is null.

Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Louis Lenders 2018-04-24 11:52:18 +02:00 committed by Alexandre Julliard
parent 11702a31d2
commit d7bd861ae6
2 changed files with 20 additions and 10 deletions

View File

@ -1440,6 +1440,16 @@ static void wave_out_tests(void)
ok((ndev == 0 && (preferred == -1 || broken(preferred != -1))) || ok((ndev == 0 && (preferred == -1 || broken(preferred != -1))) ||
preferred < ndev, "Got invalid preferred device: 0x%x\n", preferred); preferred < ndev, "Got invalid preferred device: 0x%x\n", preferred);
rc = waveOutMessage((HWAVEOUT)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET,
(DWORD_PTR)-1 , 0);
ok(rc == MMSYSERR_INVALPARAM || rc == MMSYSERR_BADDEVICEID, /* w2008+wvista */
"waveOutMessage(DRVM_MAPPER_PREFERRED_GET) failed: %u\n", rc);
rc = waveOutMessage((HWAVEOUT)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET,
0, (DWORD_PTR)&status);
ok(rc == MMSYSERR_INVALPARAM || rc == MMSYSERR_BADDEVICEID, /* w2008+wvista */
"waveOutMessage(DRVM_MAPPER_PREFERRED_GET) failed: %u\n", rc);
rc=waveOutGetDevCapsA(ndev+1,&capsA,sizeof(capsA)); rc=waveOutGetDevCapsA(ndev+1,&capsA,sizeof(capsA));
ok(rc==MMSYSERR_BADDEVICEID, ok(rc==MMSYSERR_BADDEVICEID,
"waveOutGetDevCapsA(%s): MMSYSERR_BADDEVICEID expected, got %s\n", "waveOutGetDevCapsA(%s): MMSYSERR_BADDEVICEID expected, got %s\n",

View File

@ -3262,17 +3262,17 @@ UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage,
case DRV_QUERYMAPPABLE: case DRV_QUERYMAPPABLE:
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
case DRVM_MAPPER_PREFERRED_GET: case DRVM_MAPPER_PREFERRED_GET:
if(dwParam1) { if(!dwParam1 || !dwParam2)
if(g_outmmdevices_count > 0) return MMSYSERR_INVALPARAM;
/* Device 0 is always the default device */
*(DWORD *)dwParam1 = 0;
else
*(DWORD *)dwParam1 = -1;
}
if(dwParam2) if(g_outmmdevices_count > 0)
/* Status flags */ /* Device 0 is always the default device */
*(DWORD *)dwParam2 = 0; *(DWORD *)dwParam1 = 0;
else
*(DWORD *)dwParam1 = -1;
/* Status flags */
*(DWORD *)dwParam2 = 0;
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
} }