First patch adds unloading of MM drivers if all initializations fail (as was written in FIXME). Changelog: [MQ] unloading failing WinMM drivers Second one is just a indentation correction. -- Michal Miroslaw
diff -u -r1.42 lolvldrv.c --- dlls/winmm/lolvldrv.c 2 Jan 2003 17:56:41 -0000 1.42 +++ dlls/winmm/lolvldrv.c 18 Jan 2003 02:19:04 -0000 @@ -654,15 +654,20 @@ lpDrv->drvname = strcpy(HeapAlloc(GetProcessHeap(), 0, strlen(drvRegName) + 1), drvRegName); /* Finish init and get the count of the devices */ - MMDRV_InitPerType(lpDrv, MMDRV_AUX, AUXDM_GETNUMDEVS); - MMDRV_InitPerType(lpDrv, MMDRV_MIXER, MXDM_GETNUMDEVS); - MMDRV_InitPerType(lpDrv, MMDRV_MIDIIN, MIDM_GETNUMDEVS); - MMDRV_InitPerType(lpDrv, MMDRV_MIDIOUT, MODM_GETNUMDEVS); - MMDRV_InitPerType(lpDrv, MMDRV_WAVEIN, WIDM_GETNUMDEVS); - MMDRV_InitPerType(lpDrv, MMDRV_WAVEOUT, WODM_GETNUMDEVS); - /* FIXME: if all those func calls return FALSE, - * then the driver must be unloaded - */ + i = 0; + if (MMDRV_InitPerType(lpDrv, MMDRV_AUX, AUXDM_GETNUMDEVS)) i = 1; + if (MMDRV_InitPerType(lpDrv, MMDRV_MIXER, MXDM_GETNUMDEVS)) i = 1; + if (MMDRV_InitPerType(lpDrv, MMDRV_MIDIIN, MIDM_GETNUMDEVS)) i = 1; + if (MMDRV_InitPerType(lpDrv, MMDRV_MIDIOUT, MODM_GETNUMDEVS)) i = 1; + if (MMDRV_InitPerType(lpDrv, MMDRV_WAVEIN, WIDM_GETNUMDEVS)) i = 1; + if (MMDRV_InitPerType(lpDrv, MMDRV_WAVEOUT, WODM_GETNUMDEVS)) i = 1; + /* if all those func calls return FALSE, then the driver must be unloaded */ + if (!i) { + CloseDriver(lpDrv->hDriver, 0, 0); + HeapFree(GetProcessHeap(), 0, lpDrv->drvname); + WARN("Driver initialization failed\n"); + return FALSE; + } MMDrvsHi++;
diff -u -r1.42 lolvldrv.c --- dlls/winmm/lolvldrv.c 2 Jan 2003 17:56:41 -0000 1.42 +++ dlls/winmm/lolvldrv.c 18 Jan 2003 02:19:04 -0000 @@ -631,9 +631,9 @@ } if (TRACE_ON(winmm)) { if (MMDRV_GetDescription32(drvFileName, buffer, sizeof(buffer))) - TRACE("%s => %s\n", drvFileName, buffer); - else - TRACE("%s => No description\n", drvFileName); + TRACE("%s => %s\n", drvFileName, buffer); + else + TRACE("%s => No description\n", drvFileName); } } else if (WINMM_CheckForMMSystem() && pFnLoadMMDrvFunc16) { count += pFnLoadMMDrvFunc16(drvFileName, d, lpDrv);