libs: Import upstream code from libjpeg 9d.
[wine.git] / dlls / winmm / lolvldrv.c
blobd3bd5536976c575fff97548bb64ebdcd7a4c753d
1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
3 /*
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
23 #define NONAMELESSUNION
24 #define COBJMACROS
26 #include <string.h>
27 #include <stdarg.h>
28 #include <stdio.h>
29 #include <assert.h>
30 #include "windef.h"
31 #include "winbase.h"
32 #include "winreg.h"
33 #include "winnls.h"
34 #include "winemm.h"
35 #include "wine/debug.h"
36 #include "wine/exception.h"
38 #include "wingdi.h"
39 #include "ole2.h"
40 #include "devpkey.h"
41 #include "mmdeviceapi.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(winmm);
45 /* each known type of driver has an instance of this structure */
46 typedef struct tagWINE_LLTYPE {
47 /* those attributes depend on the specification of the type */
48 LPCSTR typestr; /* name (for debugging) */
49 /* those attributes reflect the loaded/current situation for the type */
50 UINT wMaxId; /* number of loaded devices (sum across all loaded drivers) */
51 LPWINE_MLD lpMlds; /* "static" mlds to access the part though device IDs */
52 int nMapper; /* index to mapper */
53 } WINE_LLTYPE;
55 static WINE_LLTYPE llTypes[MMDRV_MAX] = {
56 { "Aux", 0, 0, -1 },
57 { "Mixer", 0, 0, -1 },
58 { "MidiIn", 0, 0, -1 },
59 { "MidiOut", 0, 0, -1 },
60 { "WaveIn", 0, 0, -1 },
61 { "WaveOut", 0, 0, -1 }
64 static BOOL drivers_loaded;
65 static int MMDrvsHi;
66 static WINE_MM_DRIVER MMDrvs[8];
67 static LPWINE_MLD MM_MLDrvs[40];
69 static void MMDRV_Init(void);
71 static void MMDRV_InitSingleType(UINT type) {
72 if (!drivers_loaded) {
73 drivers_loaded = TRUE;
74 MMDRV_Init();
78 /**************************************************************************
79 * MMDRV_GetNum [internal]
81 UINT MMDRV_GetNum(UINT type)
83 TRACE("(%04x)\n", type);
84 assert(type < MMDRV_MAX);
85 MMDRV_InitSingleType(type);
86 return llTypes[type].wMaxId;
89 /**************************************************************************
90 * MMDRV_Message [internal]
92 DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
93 DWORD_PTR dwParam2)
95 LPWINE_MM_DRIVER lpDrv;
96 DWORD ret;
97 WINE_MM_DRIVER_PART* part;
98 WINE_LLTYPE* llType = &llTypes[mld->type];
100 TRACE("(%s %d %u 0x%08lx 0x%08lx 0x%08lx)\n",
101 llTypes[mld->type].typestr, mld->uDeviceID, wMsg,
102 mld->dwDriverInstance, dwParam1, dwParam2);
104 if ((UINT16)mld->uDeviceID == (UINT16)-1) {
105 if (llType->nMapper == -1) {
106 WARN("uDev=-1 requested on non-mapped ll type %s\n",
107 llTypes[mld->type].typestr);
108 return MMSYSERR_BADDEVICEID;
110 } else {
111 if (mld->uDeviceID >= llType->wMaxId) {
112 WARN("uDev(%u) requested >= max (%d)\n", mld->uDeviceID, llType->wMaxId);
113 return MMSYSERR_BADDEVICEID;
117 lpDrv = &MMDrvs[mld->mmdIndex];
118 part = &lpDrv->parts[mld->type];
120 assert(part->fnMessage32);
122 TRACE("Calling message(dev=%d msg=%u usr=0x%08lx p1=0x%08lx p2=0x%08lx)\n",
123 mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
124 ret = part->fnMessage32(mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
125 TRACE("=> %s\n", WINMM_ErrorToString(ret));
127 return ret;
130 /**************************************************************************
131 * MMDRV_Alloc [internal]
133 LPWINE_MLD MMDRV_Alloc(UINT size, UINT type, LPHANDLE hndl, DWORD* dwFlags,
134 DWORD_PTR* dwCallback, DWORD_PTR* dwInstance)
136 LPWINE_MLD mld;
137 UINT_PTR i;
138 TRACE("(%d, %04x, %p, %p, %p, %p)\n",
139 size, type, hndl, dwFlags, dwCallback, dwInstance);
141 mld = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
142 if (!mld) return NULL;
144 /* find an empty slot in MM_MLDrvs table */
145 for (i = 0; i < ARRAY_SIZE(MM_MLDrvs); i++) if (!MM_MLDrvs[i]) break;
147 if (i == ARRAY_SIZE(MM_MLDrvs)) {
148 /* the MM_MLDrvs table could be made growable in the future if needed */
149 ERR("Too many open drivers\n");
150 HeapFree(GetProcessHeap(), 0, mld);
151 return NULL;
153 MM_MLDrvs[i] = mld;
154 *hndl = (HANDLE)(i | 0x8000);
156 mld->type = type;
157 if ((UINT_PTR)*hndl < MMDRV_GetNum(type) || ((UINT_PTR)*hndl >> 16)) {
158 /* FIXME: those conditions must be fulfilled so that:
159 * - we can distinguish between device IDs and handles
160 * - we can use handles as 16 or 32 bit entities
162 ERR("Shouldn't happen. Bad allocation scheme\n");
165 mld->dwFlags = HIWORD(*dwFlags);
166 mld->dwCallback = *dwCallback;
167 mld->dwClientInstance = *dwInstance;
169 return mld;
172 /**************************************************************************
173 * MMDRV_Free [internal]
175 void MMDRV_Free(HANDLE hndl, LPWINE_MLD mld)
177 TRACE("(%p, %p)\n", hndl, mld);
179 if ((UINT_PTR)hndl & 0x8000) {
180 UINT_PTR idx = (UINT_PTR)hndl & ~0x8000;
181 if (idx < ARRAY_SIZE(MM_MLDrvs)) {
182 MM_MLDrvs[idx] = NULL;
183 HeapFree(GetProcessHeap(), 0, mld);
184 return;
187 ERR("Bad Handle %p at %p (not freed)\n", hndl, mld);
190 /**************************************************************************
191 * MMDRV_Open [internal]
193 DWORD MMDRV_Open(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, DWORD dwFlags)
195 DWORD dwRet = MMSYSERR_BADDEVICEID;
196 DWORD_PTR dwInstance;
197 WINE_LLTYPE* llType = &llTypes[mld->type];
198 TRACE("(%p, %04x, 0x%08lx, 0x%08x)\n", mld, wMsg, dwParam1, dwFlags);
200 mld->dwDriverInstance = (DWORD_PTR)&dwInstance;
202 if (mld->uDeviceID == (UINT)-1 || mld->uDeviceID == (UINT16)-1) {
203 TRACE("MAPPER mode requested !\n");
204 if (llType->nMapper == -1) {
205 WARN("Mapper not supported for type %s\n", llTypes[mld->type].typestr);
206 return MMSYSERR_BADDEVICEID;
208 mld->mmdIndex = llType->lpMlds[-1].mmdIndex;
209 TRACE("Setting mmdIndex to %u\n", mld->mmdIndex);
210 dwRet = MMDRV_Message(mld, wMsg, dwParam1, dwFlags);
211 } else {
212 if (mld->uDeviceID < llType->wMaxId) {
213 mld->mmdIndex = llType->lpMlds[mld->uDeviceID].mmdIndex;
214 TRACE("Setting mmdIndex to %u\n", mld->mmdIndex);
215 dwRet = MMDRV_Message(mld, wMsg, dwParam1, dwFlags);
218 if (dwRet == MMSYSERR_NOERROR)
219 mld->dwDriverInstance = dwInstance;
220 return dwRet;
223 /**************************************************************************
224 * MMDRV_Close [internal]
226 DWORD MMDRV_Close(LPWINE_MLD mld, UINT wMsg)
228 TRACE("(%p, %04x)\n", mld, wMsg);
229 return MMDRV_Message(mld, wMsg, 0L, 0L);
232 /**************************************************************************
233 * MMDRV_GetByID [internal]
235 static LPWINE_MLD MMDRV_GetByID(UINT uDevID, UINT type)
237 TRACE("(%04x, %04x)\n", uDevID, type);
238 if (uDevID < llTypes[type].wMaxId)
239 return &llTypes[type].lpMlds[uDevID];
240 if ((uDevID == (UINT16)-1 || uDevID == (UINT)-1) && llTypes[type].nMapper != -1)
241 return &llTypes[type].lpMlds[-1];
242 return NULL;
245 /**************************************************************************
246 * MMDRV_Get [internal]
248 LPWINE_MLD MMDRV_Get(HANDLE _hndl, UINT type, BOOL bCanBeID)
250 LPWINE_MLD mld = NULL;
251 UINT_PTR hndl = (UINT_PTR)_hndl;
252 TRACE("(%p, %04x, %c)\n", _hndl, type, bCanBeID ? 'Y' : 'N');
254 assert(type < MMDRV_MAX);
255 MMDRV_InitSingleType(type);
257 if (hndl >= llTypes[type].wMaxId &&
258 hndl != (UINT16)-1 && hndl != (UINT)-1) {
259 if (hndl & 0x8000) {
260 UINT idx = hndl & ~0x8000;
261 if (idx < ARRAY_SIZE(MM_MLDrvs)) {
262 __TRY
264 mld = MM_MLDrvs[idx];
265 if (mld && mld->type != type) mld = NULL;
267 __EXCEPT_PAGE_FAULT
269 mld = NULL;
271 __ENDTRY;
275 if (mld == NULL && bCanBeID) {
276 mld = MMDRV_GetByID(hndl, type);
278 return mld;
281 /**************************************************************************
282 * MMDRV_PhysicalFeatures [internal]
284 UINT MMDRV_PhysicalFeatures(LPWINE_MLD mld, UINT uMsg,
285 DWORD_PTR dwParam1, DWORD_PTR dwParam2)
287 WINE_MM_DRIVER* lpDrv = &MMDrvs[mld->mmdIndex];
289 TRACE("(%p, %04x, %08lx, %08lx)\n", mld, uMsg, dwParam1, dwParam2);
291 /* all those function calls are undocumented */
292 switch (uMsg) {
293 case DRV_QUERYDRVENTRY:
294 lstrcpynA((LPSTR)dwParam1, lpDrv->drvname, LOWORD(dwParam2));
295 break;
296 case DRV_QUERYDEVNODE:
297 *(LPDWORD)dwParam1 = 0L; /* should be DevNode */
298 break;
299 case DRV_QUERYNAME:
300 WARN("NIY QueryName\n");
301 break;
302 case DRV_QUERYDRIVERIDS:
303 WARN("NIY call VxD\n");
304 /* should call VxD MMDEVLDR with (DevNode, dwParam1 and dwParam2) as pmts
305 * dwParam1 is buffer and dwParam2 is sizeof(buffer)
306 * I don't know where the result is stored though
308 break;
309 case DRV_QUERYMAPPABLE:
310 return (lpDrv->bIsMapper) ? 2 : 0;
312 case DRVM_MAPPER_PREFERRED_GET:
313 /* FIXME: get from registry someday */
314 *((LPDWORD)dwParam1) = -1; /* No preferred device */
315 *((LPDWORD)dwParam2) = 0;
316 break;
318 case DRV_QUERYDEVICEINTERFACE:
319 case DRV_QUERYDEVICEINTERFACESIZE:
320 return MMDRV_Message(mld, uMsg, dwParam1, dwParam2);
322 default:
323 WARN("Unknown call %04x\n", uMsg);
324 return MMSYSERR_INVALPARAM;
326 return 0L;
329 /**************************************************************************
330 * MMDRV_InitPerType [internal]
332 static BOOL MMDRV_InitPerType(LPWINE_MM_DRIVER lpDrv, UINT type, UINT wMsg)
334 WINE_MM_DRIVER_PART* part = &lpDrv->parts[type];
335 DWORD ret;
336 UINT count = 0;
337 int i, k;
338 TRACE("(%p, %04x, %04x)\n", lpDrv, type, wMsg);
340 part->nIDMin = part->nIDMax = 0;
342 /* for DRVM_INIT and DRVM_ENABLE, dwParam2 should be PnP node */
343 /* the DRVM_ENABLE is only required when the PnP node is non zero */
344 if (part->fnMessage32) {
345 ret = part->fnMessage32(0, DRVM_INIT, 0L, 0L, 0L);
346 TRACE("DRVM_INIT => %s\n", WINMM_ErrorToString(ret));
347 #if 0
348 ret = part->fnMessage32(0, DRVM_ENABLE, 0L, 0L, 0L);
349 TRACE("DRVM_ENABLE => %08lx\n", ret);
350 #endif
351 count = part->fnMessage32(0, wMsg, 0L, 0L, 0L);
353 else return FALSE;
355 TRACE("Got %u dev for (%s:%s)\n", count, lpDrv->drvname, llTypes[type].typestr);
357 if (HIWORD(count))
358 return FALSE;
360 /* got some drivers */
361 if (lpDrv->bIsMapper) {
362 llTypes[type].nMapper = MMDrvsHi;
363 } else {
364 if (count == 0)
365 return FALSE;
366 part->nIDMin = llTypes[type].wMaxId;
367 llTypes[type].wMaxId += count;
368 part->nIDMax = llTypes[type].wMaxId;
370 TRACE("Setting min=%d max=%d (ttop=%d) for (%s:%s)\n",
371 part->nIDMin, part->nIDMax, llTypes[type].wMaxId,
372 lpDrv->drvname, llTypes[type].typestr);
373 /* realloc translation table */
374 if (llTypes[type].lpMlds)
375 llTypes[type].lpMlds = (LPWINE_MLD)
376 HeapReAlloc(GetProcessHeap(), 0, llTypes[type].lpMlds - 1,
377 sizeof(WINE_MLD) * (llTypes[type].wMaxId + 1)) + 1;
378 else
379 llTypes[type].lpMlds = (LPWINE_MLD)
380 HeapAlloc(GetProcessHeap(), 0,
381 sizeof(WINE_MLD) * (llTypes[type].wMaxId + 1)) + 1;
383 /* re-build the translation table */
384 if (lpDrv->bIsMapper) {
385 TRACE("%s:Trans[%d] -> %s\n", llTypes[type].typestr, -1, MMDrvs[llTypes[type].nMapper].drvname);
386 llTypes[type].lpMlds[-1].uDeviceID = (UINT)-1;
387 llTypes[type].lpMlds[-1].type = type;
388 llTypes[type].lpMlds[-1].mmdIndex = llTypes[type].nMapper;
389 llTypes[type].lpMlds[-1].dwDriverInstance = 0;
391 for (i = k = 0; i <= MMDrvsHi; i++) {
392 while (MMDrvs[i].parts[type].nIDMin <= k && k < MMDrvs[i].parts[type].nIDMax) {
393 TRACE("%s:Trans[%d] -> %s\n", llTypes[type].typestr, k, MMDrvs[i].drvname);
394 llTypes[type].lpMlds[k].uDeviceID = k;
395 llTypes[type].lpMlds[k].type = type;
396 llTypes[type].lpMlds[k].mmdIndex = i;
397 llTypes[type].lpMlds[k].dwDriverInstance = 0;
398 k++;
401 return TRUE;
404 /**************************************************************************
405 * MMDRV_Install [internal]
407 static BOOL MMDRV_Install(LPCSTR drvRegName, LPCSTR drvFileName, BOOL bIsMapper)
409 int i, count = 0;
410 LPWINE_MM_DRIVER lpDrv = &MMDrvs[MMDrvsHi];
411 LPWINE_DRIVER d;
412 WINEMM_msgFunc32 func;
414 TRACE("('%s', '%s', mapper=%c);\n", drvRegName, drvFileName, bIsMapper ? 'Y' : 'N');
416 for (i = 0; i < MMDrvsHi; i++) {
417 if (!strcmp(drvRegName, MMDrvs[i].drvname)) return FALSE;
420 /* Be sure that size of MMDrvs matches the max number of loadable
421 * drivers !!
422 * If not just increase size of MMDrvs
424 assert(MMDrvsHi <= ARRAY_SIZE(MMDrvs));
426 memset(lpDrv, 0, sizeof(*lpDrv));
428 if (!(lpDrv->hDriver = OpenDriverA(drvFileName, 0, 0))) {
429 WARN("Couldn't open driver '%s'\n", drvFileName);
430 return FALSE;
433 d = DRIVER_FindFromHDrvr(lpDrv->hDriver);
435 /* Then look for xxxMessage functions */
436 #define AA(_h,_w,_x,_y,_z) \
437 func = (WINEMM_msgFunc##_y) _z ((_h), #_x); \
438 if (func != NULL) \
439 { lpDrv->parts[_w].fnMessage##_y = func; count++; \
440 TRACE("Got %d bit func '%s'\n", _y, #_x); }
442 if (d->hModule) {
443 #define A(_x,_y) AA(d->hModule,_x,_y,32,GetProcAddress)
444 A(MMDRV_AUX, auxMessage);
445 A(MMDRV_MIXER, mxdMessage);
446 A(MMDRV_MIDIIN, midMessage);
447 A(MMDRV_MIDIOUT, modMessage);
448 A(MMDRV_WAVEIN, widMessage);
449 A(MMDRV_WAVEOUT, wodMessage);
450 #undef A
452 #undef AA
454 if (!count) {
455 CloseDriver(lpDrv->hDriver, 0, 0);
456 WARN("No message functions found\n");
457 return FALSE;
460 /* FIXME: being a mapper or not should be known by another way */
461 /* it's known for NE drvs (the description is of the form '*mapper: *'
462 * I don't have any clue for PE drvs
464 lpDrv->bIsMapper = bIsMapper;
465 lpDrv->drvname = strcpy(HeapAlloc(GetProcessHeap(), 0, strlen(drvRegName) + 1), drvRegName);
467 /* Finish init and get the count of the devices */
468 i = 0;
469 if (MMDRV_InitPerType(lpDrv, MMDRV_AUX, AUXDM_GETNUMDEVS)) i = 1;
470 if (MMDRV_InitPerType(lpDrv, MMDRV_MIXER, MXDM_GETNUMDEVS)) i = 1;
471 if (MMDRV_InitPerType(lpDrv, MMDRV_MIDIIN, MIDM_GETNUMDEVS)) i = 1;
472 if (MMDRV_InitPerType(lpDrv, MMDRV_MIDIOUT, MODM_GETNUMDEVS)) i = 1;
473 if (MMDRV_InitPerType(lpDrv, MMDRV_WAVEIN, WIDM_GETNUMDEVS)) i = 1;
474 if (MMDRV_InitPerType(lpDrv, MMDRV_WAVEOUT, WODM_GETNUMDEVS)) i = 1;
475 /* if all those func calls return FALSE, then the driver must be unloaded */
476 if (!i) {
477 CloseDriver(lpDrv->hDriver, 0, 0);
478 HeapFree(GetProcessHeap(), 0, lpDrv->drvname);
479 WARN("Driver initialization failed\n");
480 return FALSE;
483 MMDrvsHi++;
485 return TRUE;
488 /**************************************************************************
489 * MMDRV_Init
491 static void MMDRV_Init(void)
493 IMMDeviceEnumerator *devenum;
494 IMMDevice *device;
495 IPropertyStore *ps;
496 PROPVARIANT pv;
497 DWORD size;
498 char *drvA;
499 HRESULT init_hr, hr;
501 TRACE("()\n");
503 init_hr = CoInitialize(NULL);
505 hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL,
506 CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (void**)&devenum);
507 if(FAILED(hr)){
508 ERR("CoCreateInstance failed: %08x\n", hr);
509 goto exit;
512 hr = IMMDeviceEnumerator_GetDevice(devenum, L"Wine info device", &device);
513 IMMDeviceEnumerator_Release(devenum);
514 if(FAILED(hr)){
515 ERR("GetDevice failed: %08x\n", hr);
516 goto exit;
519 hr = IMMDevice_OpenPropertyStore(device, STGM_READ, &ps);
520 if(FAILED(hr)){
521 ERR("OpenPropertyStore failed: %08x\n", hr);
522 IMMDevice_Release(device);
523 goto exit;
526 hr = IPropertyStore_GetValue(ps,
527 (const PROPERTYKEY *)&DEVPKEY_Device_Driver, &pv);
528 IPropertyStore_Release(ps);
529 IMMDevice_Release(device);
530 if(FAILED(hr)){
531 ERR("GetValue failed: %08x\n", hr);
532 goto exit;
535 size = WideCharToMultiByte(CP_ACP, 0, pv.pwszVal, -1,
536 NULL, 0, NULL, NULL);
537 drvA = HeapAlloc(GetProcessHeap(), 0, size);
538 WideCharToMultiByte(CP_ACP, 0, pv.pwszVal, -1, drvA, size, NULL, NULL);
540 MMDRV_Install(drvA, drvA, FALSE);
542 HeapFree(GetProcessHeap(), 0, drvA);
543 PropVariantClear(&pv);
545 MMDRV_Install("wavemapper", "msacm32.drv", TRUE);
546 MMDRV_Install("midimapper", "midimap.dll", TRUE);
548 exit:
549 if(SUCCEEDED(init_hr))
550 CoUninitialize();
553 /******************************************************************
554 * ExitPerType
558 static BOOL MMDRV_ExitPerType(LPWINE_MM_DRIVER lpDrv, UINT type)
560 WINE_MM_DRIVER_PART* part = &lpDrv->parts[type];
561 DWORD ret;
562 TRACE("(%p, %04x)\n", lpDrv, type);
564 if (part->fnMessage32) {
565 #if 0
566 ret = part->fnMessage32(0, DRVM_DISABLE, 0L, 0L, 0L);
567 TRACE("DRVM_DISABLE => %08lx\n", ret);
568 #endif
569 ret = part->fnMessage32(0, DRVM_EXIT, 0L, 0L, 0L);
570 TRACE("DRVM_EXIT => %s\n", WINMM_ErrorToString(ret));
573 return TRUE;
576 /******************************************************************
577 * Exit
581 void MMDRV_Exit(void)
583 unsigned int i;
584 TRACE("()\n");
586 for (i = 0; i < ARRAY_SIZE(MM_MLDrvs); i++)
588 if (MM_MLDrvs[i] != NULL)
590 FIXME("Closing while ll-driver open\n");
591 #if 0
592 /* FIXME: should generate a message depending on type */
593 MMDRV_Free((HANDLE)(i | 0x8000), MM_MLDrvs[i]);
594 #endif
598 /* unload driver, in reverse order of loading */
599 i = ARRAY_SIZE(MMDrvs);
600 while (i-- > 0)
602 MMDRV_ExitPerType(&MMDrvs[i], MMDRV_AUX);
603 MMDRV_ExitPerType(&MMDrvs[i], MMDRV_MIXER);
604 MMDRV_ExitPerType(&MMDrvs[i], MMDRV_MIDIIN);
605 MMDRV_ExitPerType(&MMDrvs[i], MMDRV_MIDIOUT);
606 MMDRV_ExitPerType(&MMDrvs[i], MMDRV_WAVEIN);
607 MMDRV_ExitPerType(&MMDrvs[i], MMDRV_WAVEOUT);
608 CloseDriver(MMDrvs[i].hDriver, 0, 0);
610 if (llTypes[MMDRV_AUX].lpMlds)
611 HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_AUX].lpMlds - 1);
612 if (llTypes[MMDRV_MIXER].lpMlds)
613 HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_MIXER].lpMlds - 1);
614 if (llTypes[MMDRV_MIDIIN].lpMlds)
615 HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_MIDIIN].lpMlds - 1);
616 if (llTypes[MMDRV_MIDIOUT].lpMlds)
617 HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_MIDIOUT].lpMlds - 1);
618 if (llTypes[MMDRV_WAVEIN].lpMlds)
619 HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_WAVEIN].lpMlds - 1);
620 if (llTypes[MMDRV_WAVEOUT].lpMlds)
621 HeapFree(GetProcessHeap(), 0, llTypes[MMDRV_WAVEOUT].lpMlds - 1);