Fix FIXME in MMDRV_Install /* FIXME: if all those func calls return FALSE, * then the driver must be unloaded */ ChangeLog: - Unload MM driver if it reports zero devices Index: dlls/winmm/lolvldrv.c =================================================================== RCS file: /home/wine/wine/dlls/winmm/lolvldrv.c,v retrieving revision 1.46 diff -u -r1.46 lolvldrv.c --- dlls/winmm/lolvldrv.c 5 Sep 2003 23:08:28 -0000 1.46 +++ dlls/winmm/lolvldrv.c 19 Sep 2003 03:14:34 -0000 @@ -663,15 +663,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++;