mmioDescend: fixed FIND_xxxx, verified with mciavi32.dll.

mciLoadCommandResource32: second arg is wide string
mciGetDriverData: spec has just one long argument
This commit is contained in:
Marcus Meissner 1999-02-17 16:10:17 +00:00 committed by Alexandre Julliard
parent 452db3f18a
commit 72f12e7285
4 changed files with 36 additions and 23 deletions

View File

@ -2939,7 +2939,7 @@ BOOL32 WINAPI mciDriverNotify32(HWND32 hwndCallback, UINT32 uDeviceID,
UINT16 WINAPI mciLoadCommandResource16(HINSTANCE16 hInstance,
LPCSTR lpResName, UINT16 uType);
UINT32 WINAPI mciLoadCommandResource32(HINSTANCE32 hInstance,
LPCSTR lpResName, UINT32 uType);
LPCWSTR lpResName, UINT32 uType);
#define mciLoadCommandResource WINELIB_NAME(mciLoadCommandResource)
BOOL16 WINAPI mciFreeCommandResource16(UINT16 uTable);

View File

@ -931,6 +931,7 @@ UINT16 WINAPI mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck,
const MMCKINFO * lpckParent, UINT16 uFlags)
{
DWORD dwfcc, dwOldPos;
LPDWORD tocheck;
TRACE(mmio, "(%04X, %p, %p, %04X);\n",
hmmio, lpck, lpckParent, uFlags);
@ -948,18 +949,27 @@ UINT16 WINAPI mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck,
TRACE(mmio, "seek inside parent at %ld !\n", lpckParent->dwDataOffset);
dwOldPos = mmioSeek32(hmmio,lpckParent->dwDataOffset,SEEK_SET);
}
/*
It seems to be that FINDRIFF should not be treated the same as the
other FINDxxx so I treat it as a MMIO_FINDxxx
/* The SDK docu says 'ckid' is used for all cases. Real World
* examples disagree -Marcus,990216.
*/
if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDRIFF) ||
(uFlags & MMIO_FINDLIST)) {
*/
if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDLIST)) {
/* find_chunk looks for 'ckid' */
if (uFlags & MMIO_FINDCHUNK) {
tocheck = &(lpck->ckid);
dwfcc = lpck->ckid;
}
/* find_riff and find_list look for 'fccType' */
if (uFlags & (MMIO_FINDLIST|MMIO_FINDRIFF)) {
dwfcc = lpck->fccType;
tocheck = &(lpck->fccType);
}
if (uFlags & (MMIO_FINDCHUNK|MMIO_FINDLIST|MMIO_FINDRIFF)) {
TRACE(mmio, "MMIO_FINDxxxx dwfcc=%08lX !\n", dwfcc);
while (TRUE) {
LONG ix;
char fcc[5],ckid[5];
ix = mmioRead32(hmmio, (LPSTR)lpck, 3 * sizeof(DWORD));
TRACE(mmio, "after _lread32 ix = %ld req = %d, errno = %d\n",ix,3 * sizeof(DWORD),errno);
@ -969,23 +979,28 @@ UINT16 WINAPI mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck,
return MMIOERR_CHUNKNOTFOUND;
}
lpck->dwDataOffset = dwOldPos + 2 * sizeof(DWORD);
if (lpck->ckid == FOURCC_RIFF || lpck->ckid == FOURCC_LIST)
lpck->dwDataOffset += sizeof(DWORD);
if (ix < lpck->dwDataOffset - dwOldPos) {
mmioSeek32(hmmio, dwOldPos, SEEK_SET);
WARN(mmio, "return ChunkNotFound\n");
return MMIOERR_CHUNKNOTFOUND;
}
TRACE(mmio, "dwfcc=%08lX ckid=%08lX cksize=%08lX !\n",
dwfcc, lpck->ckid, lpck->cksize);
if (dwfcc == lpck->ckid)
memcpy(fcc,&dwfcc,4);fcc[4]='\0';
memcpy(ckid,&lpck->ckid,4);ckid[4]='\0';
TRACE(mmio, "dwfcc=%s ckid=%s cksize=%08lX !\n", fcc, ckid, lpck->cksize);
if (dwfcc == *tocheck)
break;
dwOldPos = lpck->dwDataOffset + lpck->cksize;
mmioSeek32(hmmio, dwOldPos, SEEK_SET);
}
}
else {
/* If we were looking for RIFF/LIST chunks, the final dataptr
* is after the chunkid. If we were just looking for the chunk
* it is after the cksize. So add 4 in RIFF/LIST case.
*/
if (uFlags & (MMIO_FINDLIST|MMIO_FINDRIFF))
lpck->dwDataOffset+=sizeof(DWORD);
} else {
/* FIXME: unverified, does it do this? */
if (mmioRead32(hmmio, (LPSTR)lpck, sizeof(MMCKINFO)) < sizeof(MMCKINFO)) {
mmioSeek32(hmmio, dwOldPos, SEEK_SET);
WARN(mmio, "return ChunkNotFound 2nd\n");
@ -996,11 +1011,8 @@ UINT16 WINAPI mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck,
lpck->dwDataOffset += sizeof(DWORD);
}
mmioSeek32(hmmio, lpck->dwDataOffset, SEEK_SET);
TRACE(mmio, "lpck->ckid=%08lX lpck->cksize=%ld !\n",
lpck->ckid, lpck->cksize);
TRACE(mmio, "lpck->ckid=%08lX lpck->cksize=%ld !\n", lpck->ckid, lpck->cksize);
TRACE(mmio, "lpck->fccType=%08lX !\n", lpck->fccType);
return 0;
}

View File

@ -37,6 +37,7 @@
#include "callback.h"
#include "module.h"
#include "selectors.h"
#include "debugstr.h"
#include "debug.h"
int mciInstalledCount;
@ -1535,9 +1536,9 @@ BOOL32 WINAPI mciFreeCommandResource32(UINT32 uTable)
/**************************************************************************
* mciLoadCommandResource [WINMM.48]
*/
UINT32 WINAPI mciLoadCommandResource32(HANDLE32 hinst, LPCSTR resname,UINT32 type)
UINT32 WINAPI mciLoadCommandResource32(HANDLE32 hinst, LPCWSTR resname,UINT32 type)
{
return mciLoadCommandResource16(hinst, resname, type);
FIXME(mmsys,"(%04x,%s,%d): stub!\n", hinst, debugstr_w(resname), type);
}
const char* MCI_CommandToString(UINT16 wMsg)

View File

@ -44,11 +44,11 @@ type win32
41 stdcall mciGetDeviceIDA(str) mciGetDeviceID32A
42 stdcall mciGetDeviceIDFromElementIDW(long str) mciGetDeviceIDFromElementID32W
43 stdcall mciGetDeviceIDW(str) mciGetDeviceID32W
44 stdcall mciGetDriverData(long long) mciGetDriverData32
44 stdcall mciGetDriverData(long) mciGetDriverData32
45 stdcall mciGetErrorStringA(long ptr long) mciGetErrorString32A
46 stdcall mciGetErrorStringW(long ptr long) mciGetErrorString32W
47 stdcall mciGetYieldProc(long ptr) mciGetYieldProc32
48 stdcall mciLoadCommandResource(long str long) mciLoadCommandResource32
48 stdcall mciLoadCommandResource(long wstr long) mciLoadCommandResource32
49 stdcall mciSendCommandA(long long long long) mciSendCommand32A
50 stdcall mciSendCommandW(long long long long) mciSendCommand32W
51 stdcall mciSendStringA(str ptr long long) mciSendString32A