Fixed recursion count while calling midiStream(Pause|Restart).

This commit is contained in:
Eric Pouech 1999-11-12 00:58:52 +00:00 committed by Alexandre Julliard
parent f49cb52c69
commit 78044a2d1e
1 changed files with 11 additions and 3 deletions

View File

@ -3371,7 +3371,7 @@ MMRESULT WINAPI midiStreamPause(HMIDISTRM hMidiStrm)
if (SuspendThread(lpMidiStrm->hThread) == 0xFFFFFFFF) { if (SuspendThread(lpMidiStrm->hThread) == 0xFFFFFFFF) {
WARN("bad Suspend (%ld)\n", GetLastError()); WARN("bad Suspend (%ld)\n", GetLastError());
ret = MMSYSERR_ERROR; ret = MMSYSERR_ERROR;
} }
} }
return ret; return ret;
} }
@ -3468,12 +3468,20 @@ MMRESULT WINAPI midiStreamRestart(HMIDISTRM hMidiStrm)
if (!MMSYSTEM_GetMidiStream(hMidiStrm, &lpMidiStrm, NULL)) { if (!MMSYSTEM_GetMidiStream(hMidiStrm, &lpMidiStrm, NULL)) {
ret = MMSYSERR_INVALHANDLE; ret = MMSYSERR_INVALHANDLE;
} else { } else {
if (ResumeThread(lpMidiStrm->hThread) == 0xFFFFFFFF) { DWORD ret;
/* since we increase the thread suspend count on each midiStreamPause
* there may be a need for several midiStreamResume
*/
do {
ret = ResumeThread(lpMidiStrm->hThread);
} while (ret != 0xFFFFFFFF && ret != 0);
if (ret == 0xFFFFFFFF) {
WARN("bad Resume (%ld)\n", GetLastError()); WARN("bad Resume (%ld)\n", GetLastError());
ret = MMSYSERR_ERROR; ret = MMSYSERR_ERROR;
} else { } else {
lpMidiStrm->dwStartTicks = GetTickCount() - lpMidiStrm->dwPositionMS; lpMidiStrm->dwStartTicks = GetTickCount() - lpMidiStrm->dwPositionMS;
} }
} }
return ret; return ret;
} }