From bf75c5c16381a8ca85040963c23825cfeed8a2e8 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Wed, 5 May 2004 01:00:54 +0000 Subject: [PATCH] Taking into account wavemap and midimap there can be up to 8 output drivers. So increase the size of the MMDrvs array accordingly. Skip already loaded drivers before complaining (asserting) that they don't fit in the MMDrvs array. --- dlls/winmm/lolvldrv.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dlls/winmm/lolvldrv.c b/dlls/winmm/lolvldrv.c index 07ef45de9b0..1dd56249ee1 100644 --- a/dlls/winmm/lolvldrv.c +++ b/dlls/winmm/lolvldrv.c @@ -53,7 +53,7 @@ typedef struct tagWINE_LLTYPE { } WINE_LLTYPE; static int MMDrvsHi /* = 0 */; -static WINE_MM_DRIVER MMDrvs[3]; +static WINE_MM_DRIVER MMDrvs[8]; static LPWINE_MLD MM_MLDrvs[40]; #define MAX_MM_MLDRVS (sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0])) @@ -610,14 +610,16 @@ static BOOL MMDRV_Install(LPCSTR drvRegName, LPCSTR drvFileName, BOOL bIsMapper) TRACE("('%s', '%s', mapper=%c);\n", drvRegName, drvFileName, bIsMapper ? 'Y' : 'N'); - /* be sure that size of MMDrvs matches the max number of loadable drivers !! - * if not just increase size of MMDrvs */ - assert(MMDrvsHi <= sizeof(MMDrvs)/sizeof(MMDrvs[0])); - for (i = 0; i < MMDrvsHi; i++) { - if (!strcmp(drvRegName, MMDrvs[i].drvname)) return FALSE; + if (!strcmp(drvRegName, MMDrvs[i].drvname)) return FALSE; } + /* Be sure that size of MMDrvs matches the max number of loadable + * drivers !! + * If not just increase size of MMDrvs + */ + assert(MMDrvsHi <= sizeof(MMDrvs)/sizeof(MMDrvs[0])); + memset(lpDrv, 0, sizeof(*lpDrv)); if (!(lpDrv->hDriver = OpenDriverA(drvFileName, 0, 0))) {