Commit e2779a4c authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

winmm: Don't call the custom MMIOM_SEEK handler while opening.

parent d5345e64
...@@ -667,7 +667,7 @@ static HMMIO MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo, DWORD dwOpenFlags, ...@@ -667,7 +667,7 @@ static HMMIO MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo, DWORD dwOpenFlags,
(LPARAM)szFileName, 0, FALSE); (LPARAM)szFileName, 0, FALSE);
/* update offsets and grab file size, when possible */ /* update offsets and grab file size, when possible */
if (wm->info.fccIOProc != FOURCC_MEM && (send_message(wm->ioProc, &wm->info, MMIOM_SEEK, 0, SEEK_CUR, FALSE)) != -1) { if (wm->info.fccIOProc == FOURCC_DOS && (send_message(wm->ioProc, &wm->info, MMIOM_SEEK, 0, SEEK_CUR, FALSE)) != -1) {
pos = wm->info.lBufOffset = wm->info.lDiskOffset; pos = wm->info.lBufOffset = wm->info.lDiskOffset;
send_message(wm->ioProc, &wm->info, MMIOM_SEEK, 0, SEEK_END, FALSE); send_message(wm->ioProc, &wm->info, MMIOM_SEEK, 0, SEEK_END, FALSE);
wm->dwFileSize = wm->info.lDiskOffset; wm->dwFileSize = wm->info.lDiskOffset;
...@@ -885,7 +885,17 @@ LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, INT iOrigin) ...@@ -885,7 +885,17 @@ LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, INT iOrigin)
offset = wm->info.lBufOffset + (wm->info.pchNext - wm->info.pchBuffer) + lOffset; offset = wm->info.lBufOffset + (wm->info.pchNext - wm->info.pchBuffer) + lOffset;
break; break;
case SEEK_END: case SEEK_END:
offset = ((wm->info.fccIOProc == FOURCC_MEM)? wm->info.cchBuffer : wm->dwFileSize) - lOffset; switch (wm->info.fccIOProc) {
case FOURCC_MEM:
offset = wm->info.cchBuffer - lOffset;
break;
case FOURCC_DOS:
offset = wm->dwFileSize - lOffset;
break;
default:
offset = send_message(wm->ioProc, &wm->info, MMIOM_SEEK, lOffset, SEEK_END, FALSE);
break;
}
break; break;
default: default:
return -1; return -1;
...@@ -896,7 +906,7 @@ LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, INT iOrigin) ...@@ -896,7 +906,7 @@ LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, INT iOrigin)
if ((wm->info.cchBuffer > 0) && if ((wm->info.cchBuffer > 0) &&
((offset < wm->info.lBufOffset) || ((offset < wm->info.lBufOffset) ||
(offset > wm->info.lBufOffset + wm->info.cchBuffer) || (offset > wm->info.lBufOffset + wm->info.cchBuffer) ||
(offset > wm->dwFileSize && wm->info.fccIOProc != FOURCC_MEM) || (offset > wm->dwFileSize && wm->info.fccIOProc == FOURCC_DOS) ||
!wm->bBufferLoaded)) { !wm->bBufferLoaded)) {
/* condition to change buffer */ /* condition to change buffer */
...@@ -1023,7 +1033,7 @@ MMRESULT WINAPI mmioAdvance(HMMIO hmmio, MMIOINFO* lpmmioinfo, UINT uFlags) ...@@ -1023,7 +1033,7 @@ MMRESULT WINAPI mmioAdvance(HMMIO hmmio, MMIOINFO* lpmmioinfo, UINT uFlags)
if (MMIO_Flush(wm, 0) != MMSYSERR_NOERROR) if (MMIO_Flush(wm, 0) != MMSYSERR_NOERROR)
return MMIOERR_CANNOTWRITE; return MMIOERR_CANNOTWRITE;
if (lpmmioinfo) { if (lpmmioinfo && lpmmioinfo->fccIOProc == FOURCC_DOS) {
wm->dwFileSize = max(wm->dwFileSize, lpmmioinfo->lBufOffset + wm->dwFileSize = max(wm->dwFileSize, lpmmioinfo->lBufOffset +
(lpmmioinfo->pchNext - lpmmioinfo->pchBuffer)); (lpmmioinfo->pchNext - lpmmioinfo->pchBuffer));
} }
......
...@@ -636,9 +636,9 @@ static void test_mmioOpen_fourcc(void) ...@@ -636,9 +636,9 @@ static void test_mmioOpen_fourcc(void)
mmioGetInfo(hmmio, &mmio, 0); mmioGetInfo(hmmio, &mmio, 0);
ok(hmmio && mmio.fccIOProc == FOURCC_XYZ, "mmioOpenA error %u, got %4.4s\n", ok(hmmio && mmio.fccIOProc == FOURCC_XYZ, "mmioOpenA error %u, got %4.4s\n",
mmio.wErrorRet, (LPCSTR)&mmio.fccIOProc); mmio.wErrorRet, (LPCSTR)&mmio.fccIOProc);
todo_wine ok(mmio.adwInfo[1] == 0, "mmioOpenA sent MMIOM_SEEK, got %d\n", ok(mmio.adwInfo[1] == 0, "mmioOpenA sent MMIOM_SEEK, got %d\n",
mmio.adwInfo[1]); mmio.adwInfo[1]);
todo_wine ok(mmio.lDiskOffset == 0, "mmioOpenA updated lDiskOffset, got %d\n", ok(mmio.lDiskOffset == 0, "mmioOpenA updated lDiskOffset, got %d\n",
mmio.lDiskOffset); mmio.lDiskOffset);
mmioClose(hmmio, 0); mmioClose(hmmio, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment