dsound: Check for invalid parameter when locking primary and secondary buffers.
This commit is contained in:
parent
14db70036d
commit
aff1dbe531
|
@ -532,6 +532,9 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Lock(
|
|||
GetTickCount()
|
||||
);
|
||||
|
||||
if (!audiobytes1)
|
||||
return DSERR_INVALIDPARAM;
|
||||
|
||||
/* when this flag is set, writecursor is meaningless and must be calculated */
|
||||
if (flags & DSBLOCK_FROMWRITECURSOR) {
|
||||
/* GetCurrentPosition does too much magic to duplicate here */
|
||||
|
|
|
@ -837,6 +837,9 @@ static HRESULT WINAPI PrimaryBufferImpl_Lock(
|
|||
GetTickCount()
|
||||
);
|
||||
|
||||
if (!audiobytes1)
|
||||
return DSERR_INVALIDPARAM;
|
||||
|
||||
if (device->priolevel != DSSCL_WRITEPRIMARY) {
|
||||
WARN("failed priority check!\n");
|
||||
return DSERR_PRIOLEVELNEEDED;
|
||||
|
|
|
@ -184,6 +184,10 @@ static int buffer_refill(play_state_t* state, DWORD size)
|
|||
if (size>state->wave_len-state->written)
|
||||
size=state->wave_len-state->written;
|
||||
|
||||
/* some broken apps like Navyfield mistakenly pass NULL for a ppValue */
|
||||
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
|
||||
&ptr1,NULL,&ptr2,&len2,0);
|
||||
ok(rc==DSERR_INVALIDPARAM,"expected %08x got %08x\n",DSERR_INVALIDPARAM, rc);
|
||||
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
|
||||
&ptr1,&len1,&ptr2,&len2,0);
|
||||
ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %08x\n", rc);
|
||||
|
|
Loading…
Reference in New Issue