Module: wine Branch: master Commit: 2d3f3204633388e0bba5ace02ebd370a9be1692d URL: http://source.winehq.org/git/wine.git/?a=commit;h=2d3f3204633388e0bba5ace02e...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Tue Nov 13 00:26:45 2012 +0900
winmm: Fix SEEK_END direction of mmio files without buffering.
---
dlls/winmm/mmio.c | 5 ++++- dlls/winmm/tests/mmio.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/winmm/mmio.c b/dlls/winmm/mmio.c index 7f35480..b6f60d1 100644 --- a/dlls/winmm/mmio.c +++ b/dlls/winmm/mmio.c @@ -127,7 +127,10 @@ static LRESULT CALLBACK mmioDosIOProc(LPMMIOINFO lpmmioinfo, UINT uMessage, * lParam2 = from whence to seek (SEEK_SET, SEEK_CUR, SEEK_END) * Returns: new file position, -1 on error */ - ret = _llseek((HFILE)lpmmioinfo->adwInfo[0], (LONG)lParam1, (LONG)lParam2); + if (lParam2 == SEEK_END) + ret = _llseek((HFILE)lpmmioinfo->adwInfo[0], -(LONG)lParam1, (LONG)lParam2); + else + ret = _llseek((HFILE)lpmmioinfo->adwInfo[0], (LONG)lParam1, (LONG)lParam2); if (ret != -1) lpmmioinfo->lDiskOffset = ret; return ret; diff --git a/dlls/winmm/tests/mmio.c b/dlls/winmm/tests/mmio.c index 64f0149..a4e7a2d 100644 --- a/dlls/winmm/tests/mmio.c +++ b/dlls/winmm/tests/mmio.c @@ -750,7 +750,7 @@ static void test_mmioSeek(void)
/* seek backward from the end */ pos = mmioSeek(hmmio, offset, SEEK_END); - todo_wine ok(pos == size-offset, "expected %d, got %d\n", size-offset, pos); + ok(pos == size-offset, "expected %d, got %d\n", size-offset, pos);
mmioClose(hmmio, 0); }