diff --git a/dlls/winmm/mmio.c b/dlls/winmm/mmio.c index 352da62a215..d61b3c90c49 100644 --- a/dlls/winmm/mmio.c +++ b/dlls/winmm/mmio.c @@ -1234,7 +1234,7 @@ MMRESULT WINAPI mmioDescend(HMMIO hmmio, LPMMCKINFO lpck, LONG ix; ix = mmioRead(hmmio, (LPSTR)lpck, 3 * sizeof(DWORD)); - if (ix < 2*sizeof(DWORD)) + if (ix < 0 || ix < 2*sizeof(DWORD)) { mmioSeek(hmmio, dwOldPos, SEEK_SET); WARN("return ChunkNotFound\n"); @@ -1336,7 +1336,7 @@ MMRESULT WINAPI mmioCreateChunk(HMMIO hmmio, MMCKINFO* lpck, UINT uFlags) ix = mmioWrite(hmmio, (LPSTR)lpck, size); TRACE("after mmioWrite ix = %ld req = %ld, errno = %d\n", ix, size, errno); - if (ix < size) { + if (ix != size) { mmioSeek(hmmio, dwOldPos, SEEK_SET); WARN("return CannotWrite\n"); return MMIOERR_CANNOTWRITE; diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c index 0858f958583..d844bf9b0ab 100644 --- a/dlls/winmm/playsound.c +++ b/dlls/winmm/playsound.c @@ -262,6 +262,7 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg) INT count, bufsize, left, index; struct playsound_data s; void* data; + LONG r; s.hEvent = 0; @@ -361,7 +362,8 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg) lpWaveFormat = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize); if (!lpWaveFormat) goto errCleanUp; - if (mmioRead(hmmio, (HPSTR)lpWaveFormat, mmckInfo.cksize) < sizeof(PCMWAVEFORMAT)) + r = mmioRead(hmmio, (HPSTR)lpWaveFormat, mmckInfo.cksize); + if (r < 0 || r < sizeof(PCMWAVEFORMAT)) goto errCleanUp; TRACE("wFormatTag=%04X !\n", lpWaveFormat->wFormatTag);