From 38d5ff69b91f3f07b3822eb94f39f57e73631033 Mon Sep 17 00:00:00 2001 From: Tim Cowper Date: Sun, 27 Jun 2010 20:47:06 +1000 Subject: dlls/winmm/mmio: Correctly calculate dwFileSize for apps installing their own IOproc. --- dlls/winmm/mmio.c | 15 +++++---------- 1 files changed, 5 insertions(+), 10 deletions(-) diff --git a/dlls/winmm/mmio.c b/dlls/winmm/mmio.c index f13e090..a6e06b5 100644 --- a/dlls/winmm/mmio.c +++ b/dlls/winmm/mmio.c @@ -667,16 +667,11 @@ static HMMIO MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo, DWORD dwOpenFlags, (LPARAM)szFileName, 0, FALSE); /* grab file size, when possible */ - /* FIXME: the code around dwFileSize is: - * - probably broken - * - needs to be tested when the app installs its own IOproc - * - likely to be removed - * So, restrict dwFileSize usage to DOS ioprocs - */ - if (wm->info.fccIOProc == FOURCC_DOS && (pos = _llseek((HFILE)wm->info.adwInfo[0], 0, SEEK_CUR)) != -1) - { - wm->dwFileSize = _llseek((HFILE)wm->info.adwInfo[0], 0, SEEK_END); - _llseek((HFILE)wm->info.adwInfo[0], pos, SEEK_SET); + if (wm->info.fccIOProc != FOURCC_MEM && (send_message(wm->ioProc, &wm->info, MMIOM_SEEK, 0, SEEK_CUR, FALSE)) != -1) { + pos = wm->info.lDiskOffset; + send_message(wm->ioProc, &wm->info, MMIOM_SEEK, 0, SEEK_END, FALSE); + wm->dwFileSize = wm->info.lDiskOffset; + send_message(wm->ioProc, &wm->info, MMIOM_SEEK, pos, SEEK_SET, FALSE); } else wm->dwFileSize = 0; -- 1.7.0.4