1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
4 * MMSYSTEM low level drivers handling functions
6 * Copyright 1999 Eric Pouech
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #include "wine/port.h"
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
38 #include "wine/debug.h"
39 #include "wine/exception.h"
44 #include "mmdeviceapi.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(winmm
);
48 /* each known type of driver has an instance of this structure */
49 typedef struct tagWINE_LLTYPE
{
50 /* those attributes depend on the specification of the type */
51 LPCSTR typestr
; /* name (for debugging) */
52 /* those attributes reflect the loaded/current situation for the type */
53 UINT wMaxId
; /* number of loaded devices (sum across all loaded drivers) */
54 LPWINE_MLD lpMlds
; /* "static" mlds to access the part though device IDs */
55 int nMapper
; /* index to mapper */
58 static WINE_LLTYPE llTypes
[MMDRV_MAX
] = {
60 { "Mixer", 0, 0, -1 },
61 { "MidiIn", 0, 0, -1 },
62 { "MidiOut", 0, 0, -1 },
63 { "WaveIn", 0, 0, -1 },
64 { "WaveOut", 0, 0, -1 }
67 static int drivers_loaded
, MMDrvsHi
;
68 static WINE_MM_DRIVER MMDrvs
[8];
69 static LPWINE_MLD MM_MLDrvs
[40];
70 #define MAX_MM_MLDRVS (sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0]))
72 static void MMDRV_Init(void);
74 static void MMDRV_InitSingleType(UINT type
) {
75 if (!drivers_loaded
) {
81 /**************************************************************************
82 * MMDRV_GetNum [internal]
84 UINT
MMDRV_GetNum(UINT type
)
86 TRACE("(%04x)\n", type
);
87 assert(type
< MMDRV_MAX
);
88 MMDRV_InitSingleType(type
);
89 return llTypes
[type
].wMaxId
;
92 /**************************************************************************
93 * MMDRV_Message [internal]
95 DWORD
MMDRV_Message(LPWINE_MLD mld
, UINT wMsg
, DWORD_PTR dwParam1
,
98 LPWINE_MM_DRIVER lpDrv
;
100 WINE_MM_DRIVER_PART
* part
;
101 WINE_LLTYPE
* llType
= &llTypes
[mld
->type
];
103 TRACE("(%s %d %u 0x%08lx 0x%08lx 0x%08lx)\n",
104 llTypes
[mld
->type
].typestr
, mld
->uDeviceID
, wMsg
,
105 mld
->dwDriverInstance
, dwParam1
, dwParam2
);
107 if ((UINT16
)mld
->uDeviceID
== (UINT16
)-1) {
108 if (llType
->nMapper
== -1) {
109 WARN("uDev=-1 requested on non-mapped ll type %s\n",
110 llTypes
[mld
->type
].typestr
);
111 return MMSYSERR_BADDEVICEID
;
114 if (mld
->uDeviceID
>= llType
->wMaxId
) {
115 WARN("uDev(%u) requested >= max (%d)\n", mld
->uDeviceID
, llType
->wMaxId
);
116 return MMSYSERR_BADDEVICEID
;
120 lpDrv
= &MMDrvs
[mld
->mmdIndex
];
121 part
= &lpDrv
->parts
[mld
->type
];
123 assert(part
->fnMessage32
);
125 TRACE("Calling message(dev=%d msg=%u usr=0x%08lx p1=0x%08lx p2=0x%08lx)\n",
126 mld
->uDeviceID
, wMsg
, mld
->dwDriverInstance
, dwParam1
, dwParam2
);
127 ret
= part
->fnMessage32(mld
->uDeviceID
, wMsg
, mld
->dwDriverInstance
, dwParam1
, dwParam2
);
128 TRACE("=> %s\n", WINMM_ErrorToString(ret
));
133 /**************************************************************************
134 * MMDRV_Alloc [internal]
136 LPWINE_MLD
MMDRV_Alloc(UINT size
, UINT type
, LPHANDLE hndl
, DWORD
* dwFlags
,
137 DWORD_PTR
* dwCallback
, DWORD_PTR
* dwInstance
)
141 TRACE("(%d, %04x, %p, %p, %p, %p)\n",
142 size
, type
, hndl
, dwFlags
, dwCallback
, dwInstance
);
144 mld
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, size
);
145 if (!mld
) return NULL
;
147 /* find an empty slot in MM_MLDrvs table */
148 for (i
= 0; i
< MAX_MM_MLDRVS
; i
++) if (!MM_MLDrvs
[i
]) break;
150 if (i
== MAX_MM_MLDRVS
) {
151 /* the MM_MLDrvs table could be made growable in the future if needed */
152 ERR("Too many open drivers\n");
153 HeapFree(GetProcessHeap(), 0, mld
);
157 *hndl
= (HANDLE
)(i
| 0x8000);
160 if ((UINT_PTR
)*hndl
< MMDRV_GetNum(type
) || ((UINT_PTR
)*hndl
>> 16)) {
161 /* FIXME: those conditions must be fulfilled so that:
162 * - we can distinguish between device IDs and handles
163 * - we can use handles as 16 or 32 bit entities
165 ERR("Shouldn't happen. Bad allocation scheme\n");
168 mld
->dwFlags
= HIWORD(*dwFlags
);
169 mld
->dwCallback
= *dwCallback
;
170 mld
->dwClientInstance
= *dwInstance
;
175 /**************************************************************************
176 * MMDRV_Free [internal]
178 void MMDRV_Free(HANDLE hndl
, LPWINE_MLD mld
)
180 TRACE("(%p, %p)\n", hndl
, mld
);
182 if ((UINT_PTR
)hndl
& 0x8000) {
183 UINT_PTR idx
= (UINT_PTR
)hndl
& ~0x8000;
184 if (idx
< sizeof(MM_MLDrvs
) / sizeof(MM_MLDrvs
[0])) {
185 MM_MLDrvs
[idx
] = NULL
;
186 HeapFree(GetProcessHeap(), 0, mld
);
190 ERR("Bad Handle %p at %p (not freed)\n", hndl
, mld
);
193 /**************************************************************************
194 * MMDRV_Open [internal]
196 DWORD
MMDRV_Open(LPWINE_MLD mld
, UINT wMsg
, DWORD_PTR dwParam1
, DWORD dwFlags
)
198 DWORD dwRet
= MMSYSERR_BADDEVICEID
;
199 DWORD_PTR dwInstance
;
200 WINE_LLTYPE
* llType
= &llTypes
[mld
->type
];
201 TRACE("(%p, %04x, 0x%08lx, 0x%08x)\n", mld
, wMsg
, dwParam1
, dwFlags
);
203 mld
->dwDriverInstance
= (DWORD_PTR
)&dwInstance
;
205 if (mld
->uDeviceID
== (UINT
)-1 || mld
->uDeviceID
== (UINT16
)-1) {
206 TRACE("MAPPER mode requested !\n");
207 if (llType
->nMapper
== -1) {
208 WARN("Mapper not supported for type %s\n", llTypes
[mld
->type
].typestr
);
209 return MMSYSERR_BADDEVICEID
;
211 mld
->mmdIndex
= llType
->lpMlds
[-1].mmdIndex
;
212 TRACE("Setting mmdIndex to %u\n", mld
->mmdIndex
);
213 dwRet
= MMDRV_Message(mld
, wMsg
, dwParam1
, dwFlags
);
215 if (mld
->uDeviceID
< llType
->wMaxId
) {
216 mld
->mmdIndex
= llType
->lpMlds
[mld
->uDeviceID
].mmdIndex
;
217 TRACE("Setting mmdIndex to %u\n", mld
->mmdIndex
);
218 dwRet
= MMDRV_Message(mld
, wMsg
, dwParam1
, dwFlags
);
221 if (dwRet
== MMSYSERR_NOERROR
)
222 mld
->dwDriverInstance
= dwInstance
;
226 /**************************************************************************
227 * MMDRV_Close [internal]
229 DWORD
MMDRV_Close(LPWINE_MLD mld
, UINT wMsg
)
231 TRACE("(%p, %04x)\n", mld
, wMsg
);
232 return MMDRV_Message(mld
, wMsg
, 0L, 0L);
235 /**************************************************************************
236 * MMDRV_GetByID [internal]
238 static LPWINE_MLD
MMDRV_GetByID(UINT uDevID
, UINT type
)
240 TRACE("(%04x, %04x)\n", uDevID
, type
);
241 if (uDevID
< llTypes
[type
].wMaxId
)
242 return &llTypes
[type
].lpMlds
[uDevID
];
243 if ((uDevID
== (UINT16
)-1 || uDevID
== (UINT
)-1) && llTypes
[type
].nMapper
!= -1)
244 return &llTypes
[type
].lpMlds
[-1];
248 /**************************************************************************
249 * MMDRV_Get [internal]
251 LPWINE_MLD
MMDRV_Get(HANDLE _hndl
, UINT type
, BOOL bCanBeID
)
253 LPWINE_MLD mld
= NULL
;
254 UINT_PTR hndl
= (UINT_PTR
)_hndl
;
255 TRACE("(%p, %04x, %c)\n", _hndl
, type
, bCanBeID
? 'Y' : 'N');
257 assert(type
< MMDRV_MAX
);
258 MMDRV_InitSingleType(type
);
260 if (hndl
>= llTypes
[type
].wMaxId
&&
261 hndl
!= (UINT16
)-1 && hndl
!= (UINT
)-1) {
263 UINT idx
= hndl
& ~0x8000;
264 if (idx
< sizeof(MM_MLDrvs
) / sizeof(MM_MLDrvs
[0])) {
267 mld
= MM_MLDrvs
[idx
];
268 if (mld
&& mld
->type
!= type
) mld
= NULL
;
278 if (mld
== NULL
&& bCanBeID
) {
279 mld
= MMDRV_GetByID(hndl
, type
);
284 /**************************************************************************
285 * MMDRV_GetRelated [internal]
287 LPWINE_MLD
MMDRV_GetRelated(HANDLE hndl
, UINT srcType
,
288 BOOL bSrcCanBeID
, UINT dstType
)
291 TRACE("(%p, %04x, %c, %04x)\n",
292 hndl
, srcType
, bSrcCanBeID
? 'Y' : 'N', dstType
);
294 if ((mld
= MMDRV_Get(hndl
, srcType
, bSrcCanBeID
)) != NULL
) {
295 WINE_MM_DRIVER_PART
* part
= &MMDrvs
[mld
->mmdIndex
].parts
[dstType
];
296 if (part
->nIDMin
< part
->nIDMax
)
297 return MMDRV_GetByID(part
->nIDMin
, dstType
);
302 /**************************************************************************
303 * MMDRV_PhysicalFeatures [internal]
305 UINT
MMDRV_PhysicalFeatures(LPWINE_MLD mld
, UINT uMsg
,
306 DWORD_PTR dwParam1
, DWORD_PTR dwParam2
)
308 WINE_MM_DRIVER
* lpDrv
= &MMDrvs
[mld
->mmdIndex
];
310 TRACE("(%p, %04x, %08lx, %08lx)\n", mld
, uMsg
, dwParam1
, dwParam2
);
312 /* all those function calls are undocumented */
314 case DRV_QUERYDRVENTRY
:
315 lstrcpynA((LPSTR
)dwParam1
, lpDrv
->drvname
, LOWORD(dwParam2
));
317 case DRV_QUERYDEVNODE
:
318 *(LPDWORD
)dwParam1
= 0L; /* should be DevNode */
321 WARN("NIY QueryName\n");
323 case DRV_QUERYDRIVERIDS
:
324 WARN("NIY call VxD\n");
325 /* should call VxD MMDEVLDR with (DevNode, dwParam1 and dwParam2) as pmts
326 * dwParam1 is buffer and dwParam2 is sizeof(buffer)
327 * I don't know where the result is stored though
330 case DRV_QUERYMAPPABLE
:
331 return (lpDrv
->bIsMapper
) ? 2 : 0;
333 case DRVM_MAPPER_PREFERRED_GET
:
334 /* FIXME: get from registry someday */
335 *((LPDWORD
)dwParam1
) = -1; /* No preferred device */
336 *((LPDWORD
)dwParam2
) = 0;
339 case DRV_QUERYDEVICEINTERFACE
:
340 case DRV_QUERYDEVICEINTERFACESIZE
:
341 return MMDRV_Message(mld
, uMsg
, dwParam1
, dwParam2
);
343 case DRV_QUERYDSOUNDIFACE
: /* Wine-specific: Retrieve DirectSound interface */
344 case DRV_QUERYDSOUNDDESC
: /* Wine-specific: Retrieve DirectSound driver description*/
345 return MMDRV_Message(mld
, uMsg
, dwParam1
, dwParam2
);
348 WARN("Unknown call %04x\n", uMsg
);
349 return MMSYSERR_INVALPARAM
;
354 /**************************************************************************
355 * MMDRV_InitPerType [internal]
357 static BOOL
MMDRV_InitPerType(LPWINE_MM_DRIVER lpDrv
, UINT type
, UINT wMsg
)
359 WINE_MM_DRIVER_PART
* part
= &lpDrv
->parts
[type
];
363 TRACE("(%p, %04x, %04x)\n", lpDrv
, type
, wMsg
);
365 part
->nIDMin
= part
->nIDMax
= 0;
367 /* for DRVM_INIT and DRVM_ENABLE, dwParam2 should be PnP node */
368 /* the DRVM_ENABLE is only required when the PnP node is non zero */
369 if (part
->fnMessage32
) {
370 ret
= part
->fnMessage32(0, DRVM_INIT
, 0L, 0L, 0L);
371 TRACE("DRVM_INIT => %s\n", WINMM_ErrorToString(ret
));
373 ret
= part
->fnMessage32(0, DRVM_ENABLE
, 0L, 0L, 0L);
374 TRACE("DRVM_ENABLE => %08lx\n", ret
);
376 count
= part
->fnMessage32(0, wMsg
, 0L, 0L, 0L);
380 TRACE("Got %u dev for (%s:%s)\n", count
, lpDrv
->drvname
, llTypes
[type
].typestr
);
385 /* got some drivers */
386 if (lpDrv
->bIsMapper
) {
387 llTypes
[type
].nMapper
= MMDrvsHi
;
391 part
->nIDMin
= llTypes
[type
].wMaxId
;
392 llTypes
[type
].wMaxId
+= count
;
393 part
->nIDMax
= llTypes
[type
].wMaxId
;
395 TRACE("Setting min=%d max=%d (ttop=%d) for (%s:%s)\n",
396 part
->nIDMin
, part
->nIDMax
, llTypes
[type
].wMaxId
,
397 lpDrv
->drvname
, llTypes
[type
].typestr
);
398 /* realloc translation table */
399 if (llTypes
[type
].lpMlds
)
400 llTypes
[type
].lpMlds
= (LPWINE_MLD
)
401 HeapReAlloc(GetProcessHeap(), 0, llTypes
[type
].lpMlds
- 1,
402 sizeof(WINE_MLD
) * (llTypes
[type
].wMaxId
+ 1)) + 1;
404 llTypes
[type
].lpMlds
= (LPWINE_MLD
)
405 HeapAlloc(GetProcessHeap(), 0,
406 sizeof(WINE_MLD
) * (llTypes
[type
].wMaxId
+ 1)) + 1;
408 /* re-build the translation table */
409 if (lpDrv
->bIsMapper
) {
410 TRACE("%s:Trans[%d] -> %s\n", llTypes
[type
].typestr
, -1, MMDrvs
[llTypes
[type
].nMapper
].drvname
);
411 llTypes
[type
].lpMlds
[-1].uDeviceID
= (UINT
)-1;
412 llTypes
[type
].lpMlds
[-1].type
= type
;
413 llTypes
[type
].lpMlds
[-1].mmdIndex
= llTypes
[type
].nMapper
;
414 llTypes
[type
].lpMlds
[-1].dwDriverInstance
= 0;
416 for (i
= k
= 0; i
<= MMDrvsHi
; i
++) {
417 while (MMDrvs
[i
].parts
[type
].nIDMin
<= k
&& k
< MMDrvs
[i
].parts
[type
].nIDMax
) {
418 TRACE("%s:Trans[%d] -> %s\n", llTypes
[type
].typestr
, k
, MMDrvs
[i
].drvname
);
419 llTypes
[type
].lpMlds
[k
].uDeviceID
= k
;
420 llTypes
[type
].lpMlds
[k
].type
= type
;
421 llTypes
[type
].lpMlds
[k
].mmdIndex
= i
;
422 llTypes
[type
].lpMlds
[k
].dwDriverInstance
= 0;
429 /**************************************************************************
430 * MMDRV_Install [internal]
432 static BOOL
MMDRV_Install(LPCSTR drvRegName
, LPCSTR drvFileName
, BOOL bIsMapper
)
435 LPWINE_MM_DRIVER lpDrv
= &MMDrvs
[MMDrvsHi
];
437 WINEMM_msgFunc32 func
;
439 TRACE("('%s', '%s', mapper=%c);\n", drvRegName
, drvFileName
, bIsMapper
? 'Y' : 'N');
441 for (i
= 0; i
< MMDrvsHi
; i
++) {
442 if (!strcmp(drvRegName
, MMDrvs
[i
].drvname
)) return FALSE
;
445 /* Be sure that size of MMDrvs matches the max number of loadable
447 * If not just increase size of MMDrvs
449 assert(MMDrvsHi
<= sizeof(MMDrvs
)/sizeof(MMDrvs
[0]));
451 memset(lpDrv
, 0, sizeof(*lpDrv
));
453 if (!(lpDrv
->hDriver
= OpenDriverA(drvFileName
, 0, 0))) {
454 WARN("Couldn't open driver '%s'\n", drvFileName
);
458 d
= DRIVER_FindFromHDrvr(lpDrv
->hDriver
);
460 /* Then look for xxxMessage functions */
461 #define AA(_h,_w,_x,_y,_z) \
462 func = (WINEMM_msgFunc##_y) _z ((_h), #_x); \
464 { lpDrv->parts[_w].fnMessage##_y = func; count++; \
465 TRACE("Got %d bit func '%s'\n", _y, #_x); }
468 #define A(_x,_y) AA(d->hModule,_x,_y,32,GetProcAddress)
469 A(MMDRV_AUX
, auxMessage
);
470 A(MMDRV_MIXER
, mxdMessage
);
471 A(MMDRV_MIDIIN
, midMessage
);
472 A(MMDRV_MIDIOUT
, modMessage
);
473 A(MMDRV_WAVEIN
, widMessage
);
474 A(MMDRV_WAVEOUT
, wodMessage
);
480 CloseDriver(lpDrv
->hDriver
, 0, 0);
481 WARN("No message functions found\n");
485 /* FIXME: being a mapper or not should be known by another way */
486 /* it's known for NE drvs (the description is of the form '*mapper: *'
487 * I don't have any clue for PE drvs
489 lpDrv
->bIsMapper
= bIsMapper
;
490 lpDrv
->drvname
= strcpy(HeapAlloc(GetProcessHeap(), 0, strlen(drvRegName
) + 1), drvRegName
);
492 /* Finish init and get the count of the devices */
494 if (MMDRV_InitPerType(lpDrv
, MMDRV_AUX
, AUXDM_GETNUMDEVS
)) i
= 1;
495 if (MMDRV_InitPerType(lpDrv
, MMDRV_MIXER
, MXDM_GETNUMDEVS
)) i
= 1;
496 if (MMDRV_InitPerType(lpDrv
, MMDRV_MIDIIN
, MIDM_GETNUMDEVS
)) i
= 1;
497 if (MMDRV_InitPerType(lpDrv
, MMDRV_MIDIOUT
, MODM_GETNUMDEVS
)) i
= 1;
498 if (MMDRV_InitPerType(lpDrv
, MMDRV_WAVEIN
, WIDM_GETNUMDEVS
)) i
= 1;
499 if (MMDRV_InitPerType(lpDrv
, MMDRV_WAVEOUT
, WODM_GETNUMDEVS
)) i
= 1;
500 /* if all those func calls return FALSE, then the driver must be unloaded */
502 CloseDriver(lpDrv
->hDriver
, 0, 0);
503 HeapFree(GetProcessHeap(), 0, lpDrv
->drvname
);
504 WARN("Driver initialization failed\n");
513 /**************************************************************************
516 static void MMDRV_Init(void)
518 IMMDeviceEnumerator
*devenum
;
526 static const WCHAR wine_info_deviceW
[] = {'W','i','n','e',' ',
527 'i','n','f','o',' ','d','e','v','i','c','e',0};
531 init_hr
= CoInitialize(NULL
);
533 hr
= CoCreateInstance(&CLSID_MMDeviceEnumerator
, NULL
,
534 CLSCTX_INPROC_SERVER
, &IID_IMMDeviceEnumerator
, (void**)&devenum
);
536 ERR("CoCreateInstance failed: %08x\n", hr
);
540 hr
= IMMDeviceEnumerator_GetDevice(devenum
, wine_info_deviceW
, &device
);
541 IMMDeviceEnumerator_Release(devenum
);
543 ERR("GetDevice failed: %08x\n", hr
);
547 hr
= IMMDevice_OpenPropertyStore(device
, STGM_READ
, &ps
);
549 ERR("OpenPropertyStore failed: %08x\n", hr
);
550 IMMDevice_Release(device
);
554 hr
= IPropertyStore_GetValue(ps
,
555 (const PROPERTYKEY
*)&DEVPKEY_Device_Driver
, &pv
);
556 IPropertyStore_Release(ps
);
557 IMMDevice_Release(device
);
559 ERR("GetValue failed: %08x\n", hr
);
563 size
= WideCharToMultiByte(CP_ACP
, 0, pv
.u
.pwszVal
, -1,
564 NULL
, 0, NULL
, NULL
);
565 drvA
= HeapAlloc(GetProcessHeap(), 0, size
);
566 WideCharToMultiByte(CP_ACP
, 0, pv
.u
.pwszVal
, -1, drvA
, size
, NULL
, NULL
);
568 MMDRV_Install(drvA
, drvA
, FALSE
);
570 HeapFree(GetProcessHeap(), 0, drvA
);
571 PropVariantClear(&pv
);
573 MMDRV_Install("wavemapper", "msacm32.drv", TRUE
);
574 MMDRV_Install("midimapper", "midimap.dll", TRUE
);
577 if(SUCCEEDED(init_hr
))
581 /******************************************************************
586 static BOOL
MMDRV_ExitPerType(LPWINE_MM_DRIVER lpDrv
, UINT type
)
588 WINE_MM_DRIVER_PART
* part
= &lpDrv
->parts
[type
];
590 TRACE("(%p, %04x)\n", lpDrv
, type
);
592 if (part
->fnMessage32
) {
594 ret
= part
->fnMessage32(0, DRVM_DISABLE
, 0L, 0L, 0L);
595 TRACE("DRVM_DISABLE => %08lx\n", ret
);
597 ret
= part
->fnMessage32(0, DRVM_EXIT
, 0L, 0L, 0L);
598 TRACE("DRVM_EXIT => %s\n", WINMM_ErrorToString(ret
));
604 /******************************************************************
609 void MMDRV_Exit(void)
614 for (i
= 0; i
< sizeof(MM_MLDrvs
) / sizeof(MM_MLDrvs
[0]); i
++)
616 if (MM_MLDrvs
[i
] != NULL
)
618 FIXME("Closing while ll-driver open\n");
620 /* FIXME: should generate a message depending on type */
621 MMDRV_Free((HANDLE
)(i
| 0x8000), MM_MLDrvs
[i
]);
626 /* unload driver, in reverse order of loading */
627 i
= sizeof(MMDrvs
) / sizeof(MMDrvs
[0]);
630 MMDRV_ExitPerType(&MMDrvs
[i
], MMDRV_AUX
);
631 MMDRV_ExitPerType(&MMDrvs
[i
], MMDRV_MIXER
);
632 MMDRV_ExitPerType(&MMDrvs
[i
], MMDRV_MIDIIN
);
633 MMDRV_ExitPerType(&MMDrvs
[i
], MMDRV_MIDIOUT
);
634 MMDRV_ExitPerType(&MMDrvs
[i
], MMDRV_WAVEIN
);
635 MMDRV_ExitPerType(&MMDrvs
[i
], MMDRV_WAVEOUT
);
636 CloseDriver(MMDrvs
[i
].hDriver
, 0, 0);
638 if (llTypes
[MMDRV_AUX
].lpMlds
)
639 HeapFree(GetProcessHeap(), 0, llTypes
[MMDRV_AUX
].lpMlds
- 1);
640 if (llTypes
[MMDRV_MIXER
].lpMlds
)
641 HeapFree(GetProcessHeap(), 0, llTypes
[MMDRV_MIXER
].lpMlds
- 1);
642 if (llTypes
[MMDRV_MIDIIN
].lpMlds
)
643 HeapFree(GetProcessHeap(), 0, llTypes
[MMDRV_MIDIIN
].lpMlds
- 1);
644 if (llTypes
[MMDRV_MIDIOUT
].lpMlds
)
645 HeapFree(GetProcessHeap(), 0, llTypes
[MMDRV_MIDIOUT
].lpMlds
- 1);
646 if (llTypes
[MMDRV_WAVEIN
].lpMlds
)
647 HeapFree(GetProcessHeap(), 0, llTypes
[MMDRV_WAVEIN
].lpMlds
- 1);
648 if (llTypes
[MMDRV_WAVEOUT
].lpMlds
)
649 HeapFree(GetProcessHeap(), 0, llTypes
[MMDRV_WAVEOUT
].lpMlds
- 1);