winmm: Correctly calculate dwFileSize for apps installing their own IOproc.

This commit is contained in:
Tim Cadogan-Cowper 2010-06-27 04:20:04 -07:00 committed by Alexandre Julliard
parent c5e88a3a69
commit d650316661
1 changed files with 5 additions and 10 deletions

View File

@ -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;