http://bugs.winehq.org/show_bug.cgi?id=13892
--- Comment #2 from Eric Work work.eric@gmail.com 2008-06-14 11:48:43 --- The attached patch did not fix the problem. I actually noticed the same bug myself while trying to figure out the problem. I believe this is what the program is trying to do.
"To open a memory file using an application-supplied buffer, set pchBuffer to point to the memory buffer, fccIOProc to FOURCC_MEM, cchBuffer to the size of the buffer, and adwInfo to the incremental expansion size of the buffer. The expansion size in adwInfo should be nonzero only if pchBuffer is a pointer obtained by calling the GlobalAlloc and GlobalLock functions; in this case, the GlobalReAlloc function will be called to expand the buffer. In other words, if pchBuffer points to a local or global array or a block of memory in the local heap, adwInfo must be zero. Specify the MMIO_CREATE flag for the dwOpenFlags parameter to initially set the end of the file to be the beginning of the buffer. Otherwise, the entire block of memory is considered readable."
Since MMIO_ALLOCBUF was set, it reallocates the buffer losing the original buffer with the RIFF data. At least that's what I think is happening.
Running both versions with WINEDEBUG=-all,+mmio; the first line differs.
1.3pb3: trace:mmio:MMIO_Open ('(null)', 0x6e23a8, 00010000, 1); 1.3pb4: trace:mmio:MMIO_Open ('(null)', 0x64f038, 00000000, 1);
The MMIO_ALLOCBUF flag is no longer set, which is how the developer fixed the problem.
Things are mostly the same until these lines.
1.3pb3: trace:mmio:mmioSeek (0x1, 00000000, 1); 1.3pb3: trace:mmio:mmioDescend dwOldPos=-1
1.3pb4: trace:mmio:mmioSeek (0x1, 00000000, 1); 1.3pb4: trace:mmio:mmioSeek => 0 1.3pb4: trace:mmio:mmioDescend dwOldPos=0