winmm: Initialize struct MMIOINFO in MMIO_Open.

Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Bruno Jesus 2015-10-25 12:38:38 +08:00 committed by Alexandre Julliard
parent f8d78b0d92
commit 54ecab2479
2 changed files with 16 additions and 5 deletions

View File

@ -591,11 +591,7 @@ static HMMIO MMIO_Open(LPSTR szFileName, MMIOINFO* refmminfo, DWORD dwOpenFlags,
if (!refmminfo) {
refmminfo = &mmioinfo;
mmioinfo.fccIOProc = 0;
mmioinfo.pIOProc = NULL;
mmioinfo.pchBuffer = NULL;
mmioinfo.cchBuffer = 0;
memset(&mmioinfo, 0, sizeof(mmioinfo));
is_unicode = FALSE;
}

View File

@ -599,12 +599,15 @@ static void test_mmioSetBuffer(char *fname)
static LRESULT CALLBACK mmio_test_IOProc(LPSTR lpMMIOInfo, UINT uMessage, LPARAM lParam1, LPARAM lParam2)
{
LPMMIOINFO lpInfo = (LPMMIOINFO) lpMMIOInfo;
int i;
switch (uMessage)
{
case MMIOM_OPEN:
if (lpInfo->fccIOProc == FOURCC_DOS)
lpInfo->fccIOProc = mmioFOURCC('F', 'A', 'I', 'L');
for (i = 0; i < sizeof(lpInfo->adwInfo) / sizeof(*lpInfo->adwInfo); i++)
ok(lpInfo->adwInfo[i] == 0, "[%d] Expected 0, got %u\n", i, lpInfo->adwInfo[i]);
return MMSYSERR_NOERROR;
case MMIOM_CLOSE:
return MMSYSERR_NOERROR;
@ -642,6 +645,18 @@ static void test_mmioOpen_fourcc(void)
mmio.lDiskOffset);
mmioClose(hmmio, 0);
/* Same test with NULL info */
memset(&mmio, 0, sizeof(mmio));
hmmio = mmioOpenA(fname, NULL, MMIO_READ);
mmioGetInfo(hmmio, &mmio, 0);
ok(hmmio && mmio.fccIOProc == FOURCC_XYZ, "mmioOpenA error %u, got %4.4s\n",
mmio.wErrorRet, (LPCSTR)&mmio.fccIOProc);
ok(mmio.adwInfo[1] == 0, "mmioOpenA sent MMIOM_SEEK, got %d\n",
mmio.adwInfo[1]);
ok(mmio.lDiskOffset == 0, "mmioOpenA updated lDiskOffset, got %d\n",
mmio.lDiskOffset);
mmioClose(hmmio, 0);
mmioInstallIOProcA(FOURCC_XYZ, NULL, MMIO_REMOVEPROC);
memset(&mmio, 0, sizeof(mmio));