Tim Cadogan-Cowper : winmm: Correctly calculate dwFileSize for apps installing their own IOproc.

Alexandre Julliard julliard at winehq.org
Mon Jun 28 11:01:19 CDT 2010


Module: wine
Branch: master
Commit: d65031666179bba2f3bcacbd031ab153e4c7e1a2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d65031666179bba2f3bcacbd031ab153e4c7e1a2

Author: Tim Cadogan-Cowper <tccowper at yahoo.com.au>
Date:   Sun Jun 27 04:20:04 2010 -0700

winmm: 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;
 




More information about the wine-cvs mailing list