1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
6 * Copyright 1993 Martin Ayotte
11 * 98/9 added support for Win32 MCI
14 /* FIXME: I think there are some segmented vs. linear pointer weirdnesses
15 * and long term pointers to 16 bit space in here
22 #include <sys/ioctl.h>
26 #include "wine/winbase16.h"
30 #include "multimedia.h"
33 #include "selectors.h"
37 UINT16 WINAPI midiGetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize);
38 static UINT16 waveGetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize);
39 LONG WINAPI DrvDefDriverProc(DWORD dwDevID, HDRVR16 hDrv, WORD wMsg,
40 DWORD dwParam1, DWORD dwParam2);
42 /**************************************************************************
43 * MMSYSTEM_WEP [MMSYSTEM.1]
45 int WINAPI MMSYSTEM_WEP(HINSTANCE16 hInstance, WORD wDataSeg,
46 WORD cbHeapSize, LPSTR lpCmdLine)
48 FIXME(mmsys, "STUB: Unloading MMSystem DLL ... hInst=%04X \n", hInstance);
52 static void MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16, LPMMTIME mmt32)
54 mmt16->wType = mmt32->wType;
55 /* layout of rest is the same for 32/16 */
56 memcpy(&(mmt32->u), &(mmt16->u), sizeof(mmt16->u));
59 static void MMSYSTEM_MMTIME16to32(LPMMTIME mmt32, LPMMTIME16 mmt16)
61 mmt32->wType = mmt16->wType;
62 /* layout of rest is the same for 32/16,
63 * Note: mmt16->u is 2 bytes smaller than mmt32->u
65 memcpy(&(mmt16->u), &(mmt32->u), sizeof(mmt16->u));
68 static HANDLE PlaySound_hThread = 0;
69 static HANDLE PlaySound_hPlayEvent = 0;
70 static HANDLE PlaySound_hReadyEvent = 0;
71 static HANDLE PlaySound_hMiddleEvent = 0;
72 static BOOL PlaySound_Result = FALSE;
73 static int PlaySound_Stop = FALSE;
74 static int PlaySound_Playing = FALSE;
76 static LPCSTR PlaySound_pszSound = NULL;
77 static HMODULE PlaySound_hmod = 0;
78 static DWORD PlaySound_fdwSound = 0;
79 static int PlaySound_Loop = FALSE;
80 static int PlaySound_SearchMode = 0; /* 1 - sndPlaySound search order
81 2 - PlaySound order */
83 static HMMIO16 get_mmioFromFile(LPCSTR lpszName)
85 return mmioOpen16((LPSTR)lpszName, NULL,
86 MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
89 static HMMIO16 get_mmioFromProfile(UINT uFlags, LPCSTR lpszName)
95 TRACE(mmsys, "searching in SystemSound List !\n");
96 GetProfileStringA("Sounds", (LPSTR)lpszName, "", str, sizeof(str));
97 if (strlen(str) == 0) {
98 if (uFlags & SND_NODEFAULT) return 0;
99 GetProfileStringA("Sounds", "Default", "", str, sizeof(str));
100 if (strlen(str) == 0) return 0;
102 if ((ptr = (LPSTR)strchr(str, ',')) != NULL) *ptr = '\0';
103 hmmio = get_mmioFromFile(str);
105 WARN(mmsys, "can't find SystemSound='%s' !\n", str);
111 static BOOL16 WINAPI proc_PlaySound(LPCSTR lpszSoundName, UINT uFlags)
117 TRACE(mmsys, "SoundName='%s' uFlags=%04X !\n", lpszSoundName, uFlags);
118 if (lpszSoundName == NULL) {
119 TRACE(mmsys, "Stop !\n");
122 if (uFlags & SND_MEMORY) {
124 memset(&mminfo, 0, sizeof(mminfo));
125 mminfo.fccIOProc = FOURCC_MEM;
126 mminfo.pchBuffer = (LPSTR)lpszSoundName;
127 mminfo.cchBuffer = -1;
128 TRACE(mmsys, "Memory sound %p\n", lpszSoundName);
129 hmmio = mmioOpen16(NULL, &mminfo, MMIO_READ);
132 if (uFlags & SND_ALIAS)
133 if ((hmmio=get_mmioFromProfile(uFlags, lpszSoundName)) == 0)
136 if (uFlags & SND_FILENAME)
137 if ((hmmio=get_mmioFromFile(lpszSoundName)) == 0) return FALSE;
139 if (PlaySound_SearchMode == 1) {
140 PlaySound_SearchMode = 0;
141 if ((hmmio=get_mmioFromFile(lpszSoundName)) == 0)
142 if ((hmmio=get_mmioFromProfile(uFlags, lpszSoundName)) == 0)
146 if (PlaySound_SearchMode == 2) {
147 PlaySound_SearchMode = 0;
148 if ((hmmio=get_mmioFromProfile(uFlags | SND_NODEFAULT, lpszSoundName)) == 0)
149 if ((hmmio=get_mmioFromFile(lpszSoundName)) == 0)
150 if ((hmmio=get_mmioFromProfile(uFlags, lpszSoundName)) == 0) return FALSE;
154 if (mmioDescend(hmmio, &ckMainRIFF, NULL, 0) == 0)
156 TRACE(mmsys, "ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n",
157 (LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType,
160 if ((ckMainRIFF.ckid == FOURCC_RIFF) &&
161 (ckMainRIFF.fccType == mmioFOURCC('W', 'A', 'V', 'E'))) {
164 mmckInfo.ckid = mmioFOURCC('f', 'm', 't', ' ');
166 if (mmioDescend(hmmio, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) == 0) {
167 PCMWAVEFORMAT pcmWaveFormat;
169 TRACE(mmsys, "Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX \n",
170 (LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType, mmckInfo.cksize);
172 if (mmioRead(hmmio, (HPSTR)&pcmWaveFormat,
173 (long) sizeof(PCMWAVEFORMAT)) == (long) sizeof(PCMWAVEFORMAT)) {
174 TRACE(mmsys, "wFormatTag=%04X !\n", pcmWaveFormat.wf.wFormatTag);
175 TRACE(mmsys, "nChannels=%d \n", pcmWaveFormat.wf.nChannels);
176 TRACE(mmsys, "nSamplesPerSec=%ld\n", pcmWaveFormat.wf.nSamplesPerSec);
177 TRACE(mmsys, "nAvgBytesPerSec=%ld\n", pcmWaveFormat.wf.nAvgBytesPerSec);
178 TRACE(mmsys, "nBlockAlign=%d \n", pcmWaveFormat.wf.nBlockAlign);
179 TRACE(mmsys, "wBitsPerSample=%u !\n", pcmWaveFormat.wBitsPerSample);
181 mmckInfo.ckid = mmioFOURCC('d', 'a', 't', 'a');
182 if (mmioDescend(hmmio, &mmckInfo, &ckMainRIFF, MMIO_FINDCHUNK) == 0) {
183 WAVEOPENDESC waveDesc;
186 TRACE(mmsys, "Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX\n",
187 (LPSTR)&mmckInfo.ckid, (LPSTR)&mmckInfo.fccType, mmckInfo.cksize);
189 pcmWaveFormat.wf.nAvgBytesPerSec = pcmWaveFormat.wf.nSamplesPerSec *
190 pcmWaveFormat.wf.nBlockAlign;
192 waveDesc.lpFormat = (LPWAVEFORMAT)&pcmWaveFormat;
194 dwRet = wodMessage(0, WODM_OPEN, 0, (DWORD)&waveDesc, CALLBACK_NULL);
195 if (dwRet == MMSYSERR_NOERROR) {
198 INT count, bufsize, left = mmckInfo.cksize;
201 hData = GlobalAlloc16(GMEM_MOVEABLE, bufsize);
202 waveHdr.lpData = (LPSTR)GlobalLock16(hData);
203 waveHdr.dwBufferLength = bufsize;
205 waveHdr.dwFlags = 0L;
206 waveHdr.dwLoops = 0L;
208 dwRet = wodMessage(0, WODM_PREPARE, 0, (DWORD)&waveHdr, sizeof(WAVEHDR));
209 if (dwRet == MMSYSERR_NOERROR) {
211 if (PlaySound_Stop) {
212 PlaySound_Stop = FALSE;
213 PlaySound_Loop = FALSE;
216 if (bufsize > left) bufsize = left;
217 count = mmioRead(hmmio, waveHdr.lpData,bufsize);
218 if (count < 1) break;
220 waveHdr.dwBufferLength = count;
221 /* waveHdr.dwBytesRecorded = count; */
222 /* FIXME: doesn't expect async ops */
223 wodMessage(0, WODM_WRITE, 0, (DWORD)&waveHdr, sizeof(WAVEHDR));
225 wodMessage(0, WODM_UNPREPARE, 0, (DWORD)&waveHdr, sizeof(WAVEHDR));
226 wodMessage(0, WODM_CLOSE, 0, 0L, 0L);
230 WARN(mmsys, "can't prepare WaveOut device !\n");
232 GlobalUnlock16(hData);
239 } while (PlaySound_Loop);
241 if (hmmio != 0) mmioClose(hmmio, 0);
245 static DWORD WINAPI PlaySound_Thread(LPVOID arg)
250 PlaySound_Playing = FALSE;
251 SetEvent(PlaySound_hReadyEvent);
252 res = WaitForSingleObject(PlaySound_hPlayEvent, INFINITE);
253 ResetEvent(PlaySound_hReadyEvent);
254 SetEvent(PlaySound_hMiddleEvent);
255 if (res == WAIT_FAILED) ExitThread(2);
256 if (res != WAIT_OBJECT_0) continue;
257 PlaySound_Playing = TRUE;
259 if ((PlaySound_fdwSound & SND_RESOURCE) == SND_RESOURCE) {
264 if ((hRES = FindResourceA(PlaySound_hmod, PlaySound_pszSound, "WAVE")) == 0) {
265 PlaySound_Result = FALSE;
268 if ((hGLOB = LoadResource(PlaySound_hmod, hRES)) == 0) {
269 PlaySound_Result = FALSE;
272 if ((ptr = LockResource(hGLOB)) == NULL) {
274 PlaySound_Result = FALSE;
277 PlaySound_Result = proc_PlaySound(ptr,
278 ((UINT16)PlaySound_fdwSound ^ SND_RESOURCE) | SND_MEMORY);
282 PlaySound_Result=proc_PlaySound(PlaySound_pszSound, (UINT16)PlaySound_fdwSound);
286 /**************************************************************************
287 * PlaySoundA [WINMM.1]
289 BOOL WINAPI PlaySoundA(LPCSTR pszSound, HMODULE hmod, DWORD fdwSound)
291 static LPSTR StrDup = NULL;
293 TRACE(mmsys, "pszSound='%p' hmod=%04X fdwSound=%08lX\n",
294 pszSound, hmod, fdwSound);
296 if (PlaySound_hThread == 0) { /* This is the first time they called us */
298 if ((PlaySound_hReadyEvent = CreateEventA(NULL, TRUE, FALSE, NULL)) == 0)
300 if ((PlaySound_hMiddleEvent = CreateEventA(NULL, FALSE, FALSE, NULL)) == 0)
302 if ((PlaySound_hPlayEvent = CreateEventA(NULL, FALSE, FALSE, NULL)) == 0)
304 if ((PlaySound_hThread = CreateThread(NULL, 0, PlaySound_Thread, 0, 0, &id)) == 0)
308 /* FIXME? I see no difference between SND_WAIT and SND_NOSTOP ! */
309 if ((fdwSound & (SND_NOWAIT | SND_NOSTOP)) && PlaySound_Playing)
312 /* Trying to stop if playing */
313 if (PlaySound_Playing) PlaySound_Stop = TRUE;
315 /* Waiting playing thread to get ready. I think 10 secs is ok & if not then leave*/
316 if (WaitForSingleObject(PlaySound_hReadyEvent, 1000*10) != WAIT_OBJECT_0)
319 if (!pszSound || (fdwSound & SND_PURGE))
320 return FALSE; /* We stoped playing so leaving */
322 if (PlaySound_SearchMode != 1) PlaySound_SearchMode = 2;
323 if (!(fdwSound & SND_ASYNC)) {
324 if (fdwSound & SND_LOOP)
326 PlaySound_pszSound = pszSound;
327 PlaySound_hmod = hmod;
328 PlaySound_fdwSound = fdwSound;
329 PlaySound_Result = FALSE;
330 SetEvent(PlaySound_hPlayEvent);
331 if (WaitForSingleObject(PlaySound_hMiddleEvent, INFINITE) != WAIT_OBJECT_0)
333 if (WaitForSingleObject(PlaySound_hReadyEvent, INFINITE) != WAIT_OBJECT_0)
335 return PlaySound_Result;
337 PlaySound_hmod = hmod;
338 PlaySound_fdwSound = fdwSound;
339 PlaySound_Result = FALSE;
341 HeapFree(GetProcessHeap(), 0, StrDup);
344 if (!((fdwSound & SND_MEMORY) || ((fdwSound & SND_RESOURCE) &&
345 !((DWORD)pszSound >> 16)) || !pszSound)) {
346 StrDup = HEAP_strdupA(GetProcessHeap(), 0,pszSound);
347 PlaySound_pszSound = StrDup;
348 } else PlaySound_pszSound = pszSound;
349 PlaySound_Loop = fdwSound & SND_LOOP;
350 SetEvent(PlaySound_hPlayEvent);
351 ResetEvent(PlaySound_hMiddleEvent);
357 /**************************************************************************
358 * PlaySoundW [WINMM.18]
360 BOOL WINAPI PlaySoundW(LPCWSTR pszSound, HMODULE hmod, DWORD fdwSound)
365 if (!((fdwSound & SND_MEMORY) || ((fdwSound & SND_RESOURCE) &&
366 !((DWORD)pszSound >> 16)) || !pszSound)) {
367 pszSoundA = HEAP_strdupWtoA(GetProcessHeap(), 0,pszSound);
368 bSound = PlaySoundA(pszSoundA, hmod, fdwSound);
369 HeapFree(GetProcessHeap(), 0,pszSoundA);
371 bSound = PlaySoundA((LPCSTR)pszSound, hmod, fdwSound);
376 /**************************************************************************
377 * sndPlaySoundA [MMSYSTEM.2][WINMM135]
379 BOOL16 WINAPI sndPlaySoundA(LPCSTR lpszSoundName, UINT16 uFlags)
381 PlaySound_SearchMode = 1;
382 return PlaySoundA(lpszSoundName, 0, uFlags);
385 /**************************************************************************
386 * sndPlaySoundW [WINMM.136]
388 BOOL16 WINAPI sndPlaySoundW(LPCWSTR lpszSoundName, UINT16 uFlags)
390 PlaySound_SearchMode = 1;
391 return PlaySoundW(lpszSoundName, 0, uFlags);
394 /**************************************************************************
395 * mmsystemGetVersion [WINMM.134]
397 UINT WINAPI mmsystemGetVersion()
399 return mmsystemGetVersion16();
402 /**************************************************************************
403 * mmsystemGetVersion [MMSYSTEM.5]
404 * return value borrowed from Win95 winmm.dll ;)
406 UINT16 WINAPI mmsystemGetVersion16()
408 TRACE(mmsys, "3.10 (Win95?)\n");
412 /**************************************************************************
413 * DriverProc [MMSYSTEM.6]
415 LRESULT WINAPI DriverProc16(DWORD dwDevID, HDRVR16 hDrv, WORD wMsg,
416 DWORD dwParam1, DWORD dwParam2)
418 return DrvDefDriverProc(dwDevID, hDrv, wMsg, dwParam1, dwParam2);
421 /**************************************************************************
422 * DriverCallback [MMSYSTEM.31]
424 BOOL16 WINAPI DriverCallback16(DWORD dwCallBack, UINT16 uFlags, HANDLE16 hDev,
425 WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
427 TRACE(mmsys, "(%08lX, %04X, %04X, %04X, %08lX, %08lX, %08lX); !\n",
428 dwCallBack, uFlags, hDev, wMsg, dwUser, dwParam1, dwParam2);
430 switch (uFlags & DCB_TYPEMASK) {
432 TRACE(mmsys, "CALLBACK_NULL !\n");
435 TRACE(mmsys, "CALLBACK_WINDOW = %04lX handle = %04X!\n",
437 if (!IsWindow(dwCallBack) || USER_HEAP_LIN_ADDR(hDev) == NULL)
440 PostMessageA((HWND16)dwCallBack, wMsg, hDev, dwParam1);
443 TRACE(mmsys, "CALLBACK_TASK !\n");
446 TRACE(mmsys, "CALLBACK_FUNCTION !\n");
447 Callbacks->CallDriverCallback((FARPROC16)dwCallBack,
449 dwParam1, dwParam2 );
452 TRACE(mmsys, "CALLBACK_FUNCTION !\n");
453 ((LPDRVCALLBACK)dwCallBack)(hDev, wMsg, dwUser,
454 dwParam1, dwParam2 );
457 WARN(mmsys, "Unknown callback type\n");
463 /**************************************************************************
464 * Mixer devices. New to Win95
466 /**************************************************************************
467 * find out the real mixer ID depending on hmix (depends on dwFlags)
468 * FIXME: also fix dwInstance passing to mixMessage
470 static UINT _get_mixerID_from_handle(HMIXEROBJ hmix, DWORD dwFlags)
472 /* FIXME: Check dwFlags for MIXER_OBJECTF_xxxx entries and modify hmix
473 * accordingly. For now we always use mixerdevice 0.
478 /**************************************************************************
479 * mixerGetNumDevs [WINMM.108]
481 UINT WINAPI mixerGetNumDevs()
483 return mixerGetNumDevs16();
486 /**************************************************************************
489 UINT16 WINAPI mixerGetNumDevs16()
491 UINT16 count = mixMessage(0, MXDM_GETNUMDEVS, 0L, 0L, 0L);
493 TRACE(mmaux,"mixerGetNumDevs returns %d\n",count);
497 /**************************************************************************
498 * mixerGetDevCapsW [WINMM.102]
500 UINT WINAPI mixerGetDevCapsW(UINT devid, LPMIXERCAPSW mixcaps, UINT size)
503 UINT ret = mixerGetDevCaps16(devid, &mic16, sizeof(mic16));
505 mixcaps->wMid = mic16.wMid;
506 mixcaps->wPid = mic16.wPid;
507 mixcaps->vDriverVersion = mic16.vDriverVersion;
508 lstrcpyAtoW(mixcaps->szPname, mic16.szPname);
509 mixcaps->fdwSupport = mic16.fdwSupport;
510 mixcaps->cDestinations = mic16.cDestinations;
514 /**************************************************************************
515 * mixerGetDevCaps [WINMM.101]
517 UINT WINAPI mixerGetDevCapsA(UINT devid, LPMIXERCAPSA mixcaps, UINT size)
520 UINT ret = mixerGetDevCaps16(devid, &mic16, sizeof(mic16));
522 mixcaps->wMid = mic16.wMid;
523 mixcaps->wPid = mic16.wPid;
524 mixcaps->vDriverVersion = mic16.vDriverVersion;
525 strcpy(mixcaps->szPname, mic16.szPname);
526 mixcaps->fdwSupport = mic16.fdwSupport;
527 mixcaps->cDestinations = mic16.cDestinations;
531 /**************************************************************************
534 UINT16 WINAPI mixerGetDevCaps16(UINT16 devid, LPMIXERCAPS16 mixcaps, UINT16 size)
536 FIXME(mmsys,"should this be a fixme?\n");
537 return mixMessage(devid, MXDM_GETDEVCAPS, 0L, (DWORD)mixcaps, (DWORD)size);
540 /**************************************************************************
541 * mixerOpen [WINMM.110]
543 UINT WINAPI mixerOpen(LPHMIXER lphmix, UINT uDeviceID, DWORD dwCallback,
544 DWORD dwInstance, DWORD fdwOpen)
549 FIXME(mmsys,"(%p,%d,%08lx,%08lx,%08lx): semi stub?\n",
550 lphmix,uDeviceID, dwCallback, dwInstance, fdwOpen);
551 ret = mixerOpen16(&hmix16,uDeviceID, dwCallback, dwInstance,fdwOpen);
552 if (lphmix) *lphmix = hmix16;
556 /**************************************************************************
559 UINT16 WINAPI mixerOpen16(LPHMIXER16 lphmix, UINT16 uDeviceID, DWORD dwCallback,
560 DWORD dwInstance, DWORD fdwOpen)
563 LPMIXEROPENDESC lpmod;
564 BOOL mapperflag = (uDeviceID==0);
567 TRACE(mmsys,"(%p,%d,%08lx,%08lx,%08lx)\n",
568 lphmix,uDeviceID, dwCallback, dwInstance, fdwOpen);
569 hmix = USER_HEAP_ALLOC(sizeof(MIXEROPENDESC));
570 if (lphmix) *lphmix = hmix;
571 lpmod = (LPMIXEROPENDESC)USER_HEAP_LIN_ADDR(hmix);
573 lpmod->dwCallback = dwCallback;
574 lpmod->dwInstance = dwInstance;
575 if (uDeviceID >= MAXMIXERDRIVERS)
577 while (uDeviceID < MAXMIXERDRIVERS) {
578 dwRet=mixMessage(uDeviceID, MXDM_OPEN, dwInstance, (DWORD)lpmod, fdwOpen);
579 if (dwRet == MMSYSERR_NOERROR) break;
580 if (!mapperflag) break;
583 lpmod->uDeviceID = uDeviceID;
587 /**************************************************************************
588 * mixerClose [WINMM.98]
590 UINT WINAPI mixerClose(HMIXER hmix)
592 return mixerClose16(hmix);
595 /**************************************************************************
598 UINT16 WINAPI mixerClose16(HMIXER16 hmix)
600 LPMIXEROPENDESC lpmod;
602 FIXME(mmsys,"(%04x): semi-stub?\n", hmix);
603 lpmod = (LPMIXEROPENDESC)USER_HEAP_LIN_ADDR(hmix);
604 return mixMessage(lpmod->uDeviceID, MXDM_CLOSE, lpmod->dwInstance, 0L, 0L);
607 /**************************************************************************
608 * mixerGetID [WINMM.103]
610 UINT WINAPI mixerGetID(HMIXEROBJ hmix, LPUINT lpid, DWORD fdwID)
613 UINT ret = mixerGetID16(hmix, &xid, fdwID);
615 if (lpid) *lpid = xid;
619 /**************************************************************************
622 UINT16 WINAPI mixerGetID16(HMIXEROBJ16 hmix, LPUINT16 lpid, DWORD fdwID)
624 FIXME(mmsys,"(%04x): semi-stub\n",hmix);
626 *lpid = _get_mixerID_from_handle(hmix,fdwID);
627 return MMSYSERR_NOERROR; /* FIXME: many error possibilities */
630 /**************************************************************************
631 * mixerGetControlDetailsA [WINMM.99]
633 UINT WINAPI mixerGetControlDetailsA(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd, DWORD fdwDetails)
635 FIXME(mmsys,"(%04x,%p,%08lx): stub!\n", hmix, lpmcd, fdwDetails);
636 return MMSYSERR_NOTENABLED;
639 /**************************************************************************
640 * mixerGetControlDetailsW [WINMM.100]
642 UINT WINAPI mixerGetControlDetailsW(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd, DWORD fdwDetails)
644 FIXME(mmsys,"(%04x,%p,%08lx): stub!\n", hmix, lpmcd, fdwDetails);
645 return MMSYSERR_NOTENABLED;
648 /**************************************************************************
649 * mixerGetControlDetails [MMSYSTEM.808]
651 UINT16 WINAPI mixerGetControlDetails16(HMIXEROBJ16 hmix, LPMIXERCONTROLDETAILS16 lpmcd, DWORD fdwDetails)
653 FIXME(mmsys,"(%04x,%p,%08lx): stub!\n", hmix, lpmcd, fdwDetails);
654 return MMSYSERR_NOTENABLED;
657 /**************************************************************************
658 * mixerGetLineControlsA [WINMM.104]
660 UINT WINAPI mixerGetLineControlsA(HMIXEROBJ hmix, LPMIXERLINECONTROLSA lpmlc, DWORD fdwControls)
662 FIXME(mmsys,"(%04x,%p,%08lx): stub!\n", hmix, lpmlc, fdwControls);
663 return MMSYSERR_NOTENABLED;
666 /**************************************************************************
667 * mixerGetLineControlsW [WINMM.105]
669 UINT WINAPI mixerGetLineControlsW(HMIXEROBJ hmix, LPMIXERLINECONTROLSW lpmlc, DWORD fdwControls)
671 FIXME(mmsys,"(%04x,%p,%08lx): stub!\n", hmix, lpmlc, fdwControls);
672 return MMSYSERR_NOTENABLED;
675 /**************************************************************************
676 * mixerGetLineControls [MMSYSTEM.807]
678 UINT16 WINAPI mixerGetLineControls16(HMIXEROBJ16 hmix, LPMIXERLINECONTROLS16 lpmlc, DWORD fdwControls)
680 FIXME(mmsys,"(%04x,%p,%08lx): stub!\n", hmix, lpmlc, fdwControls);
681 return MMSYSERR_NOTENABLED;
684 /**************************************************************************
685 * mixerGetLineInfoA [WINMM.106]
687 UINT WINAPI mixerGetLineInfoA(HMIXEROBJ hmix, LPMIXERLINEA lpml, DWORD fdwInfo)
692 TRACE(mmsys, "(%04x,%p,%08lx)\n", hmix, lpml, fdwInfo);
694 if (lpml == NULL || lpml->cbStruct != sizeof(*lpml))
695 return MMSYSERR_INVALPARAM;
697 ml16.cbStruct = sizeof(ml16);
698 ml16.dwDestination = lpml->dwDestination;
699 ml16.dwSource = lpml->dwSource;
700 ml16.dwLineID = lpml->dwLineID;
701 ml16.dwUser = lpml->dwUser;
702 ml16.dwComponentType = lpml->dwComponentType;
703 ml16.cChannels = lpml->cChannels;
704 ml16.cConnections = lpml->cConnections;
705 ml16.cControls = lpml->cControls;
707 ret = mixerGetLineInfo16(hmix, &ml16, fdwInfo);
709 lpml->dwSource = ml16.dwSource;
710 lpml->dwLineID = ml16.dwLineID;
711 lpml->fdwLine = ml16.fdwLine;
712 lpml->dwUser = ml16.dwUser;
713 lpml->dwComponentType = ml16.dwComponentType;
714 lpml->cChannels = ml16.cChannels;
715 lpml->cConnections = ml16.cConnections;
716 lpml->cControls = ml16.cControls;
717 strcpy(lpml->szShortName, ml16.szShortName);
718 strcpy(lpml->szName, ml16.szName);
719 lpml->Target.dwType = ml16.Target.dwType;
720 lpml->Target.dwDeviceID = ml16.Target.dwDeviceID;
721 lpml->Target.wMid = ml16.Target.wMid;
722 lpml->Target.wPid = ml16.Target.wPid;
723 lpml->Target.vDriverVersion = ml16.Target.vDriverVersion;
724 strcpy(lpml->Target.szPname, ml16.Target.szPname);
728 /**************************************************************************
729 * mixerGetLineInfoW [WINMM.107]
731 UINT WINAPI mixerGetLineInfoW(HMIXEROBJ hmix, LPMIXERLINEW lpml, DWORD fdwInfo)
736 TRACE(mmsys,"(%04x,%p,%08lx)\n", hmix, lpml, fdwInfo);
738 if (lpml == NULL || lpml->cbStruct != sizeof(*lpml))
739 return MMSYSERR_INVALPARAM;
741 ml16.cbStruct = sizeof(ml16);
742 ml16.dwDestination = lpml->dwDestination;
743 ml16.dwSource = lpml->dwSource;
744 ml16.dwLineID = lpml->dwLineID;
745 ml16.dwUser = lpml->dwUser;
746 ml16.dwComponentType = lpml->dwComponentType;
747 ml16.cChannels = lpml->cChannels;
748 ml16.cConnections = lpml->cConnections;
749 ml16.cControls = lpml->cControls;
751 ret = mixerGetLineInfo16(hmix, &ml16, fdwInfo);
753 lpml->dwSource = ml16.dwSource;
754 lpml->dwLineID = ml16.dwLineID;
755 lpml->fdwLine = ml16.fdwLine;
756 lpml->dwUser = ml16.dwUser;
757 lpml->dwComponentType = ml16.dwComponentType;
758 lpml->cChannels = ml16.cChannels;
759 lpml->cConnections = ml16.cConnections;
760 lpml->cControls = ml16.cControls;
761 lstrcpyAtoW(lpml->szShortName, ml16.szShortName);
762 lstrcpyAtoW(lpml->szName, ml16.szName);
763 lpml->Target.dwType = ml16.Target.dwType;
764 lpml->Target.dwDeviceID = ml16.Target.dwDeviceID;
765 lpml->Target.wMid = ml16.Target.wMid;
766 lpml->Target.wPid = ml16.Target.wPid;
767 lpml->Target.vDriverVersion = ml16.Target.vDriverVersion;
768 /*lstrcpyAtoW(lpml->Target.szPname, ml16.Target.szPname);*/
772 /**************************************************************************
773 * mixerGetLineInfo [MMSYSTEM.805]
775 UINT16 WINAPI mixerGetLineInfo16(HMIXEROBJ16 hmix, LPMIXERLINE16 lpml, DWORD fdwInfo)
777 UINT16 devid = _get_mixerID_from_handle(hmix, fdwInfo);
779 FIXME(mmsys, "(%04x, %p[line %08lx], %08lx)\n",
780 hmix, lpml, lpml->dwDestination, fdwInfo);
781 return mixMessage(devid, MXDM_GETLINEINFO, 0, (DWORD)lpml, fdwInfo);
784 /**************************************************************************
785 * mixerSetControlDetails [WINMM.111]
787 UINT WINAPI mixerSetControlDetails(HMIXEROBJ hmix, LPMIXERCONTROLDETAILS lpmcd, DWORD fdwDetails)
789 FIXME(mmsys,"(%04x,%p,%08lx): stub!\n", hmix, lpmcd, fdwDetails);
790 return MMSYSERR_NOTENABLED;
793 /**************************************************************************
794 * mixerSetControlDetails [MMSYSTEM.809]
796 UINT16 WINAPI mixerSetControlDetails16(HMIXEROBJ16 hmix, LPMIXERCONTROLDETAILS16 lpmcd, DWORD fdwDetails)
798 FIXME(mmsys,"(%04x,%p,%08lx): stub!\n", hmix, lpmcd, fdwDetails);
799 return MMSYSERR_NOTENABLED;
802 /**************************************************************************
803 * mixerMessage [WINMM.109]
805 UINT WINAPI mixerMessage(HMIXER hmix, UINT uMsg, DWORD dwParam1, DWORD dwParam2)
807 LPMIXEROPENDESC lpmod;
810 lpmod = (LPMIXEROPENDESC)USER_HEAP_LIN_ADDR(hmix);
812 uDeviceID = lpmod->uDeviceID;
815 FIXME(mmsys,"(%04lx,%d,%08lx,%08lx): semi-stub?\n",
816 (DWORD)hmix,uMsg, dwParam1, dwParam2);
817 return mixMessage(uDeviceID,uMsg, 0L, dwParam1, dwParam2);
820 /**************************************************************************
821 * mixerMessage [MMSYSTEM.804]
823 UINT16 WINAPI mixerMessage16(HMIXER16 hmix, UINT16 uMsg, DWORD dwParam1, DWORD dwParam2)
825 LPMIXEROPENDESC lpmod;
828 lpmod = (LPMIXEROPENDESC)USER_HEAP_LIN_ADDR(hmix);
829 uDeviceID = (lpmod) ? lpmod->uDeviceID : 0;
830 FIXME(mmsys,"(%04x,%d,%08lx,%08lx) - semi-stub?\n",
831 hmix,uMsg, dwParam1, dwParam2);
832 return mixMessage(uDeviceID,uMsg, 0L, dwParam1, dwParam2);
835 /**************************************************************************
836 * auxGetNumDevs [WINMM.22]
838 UINT WINAPI auxGetNumDevs()
840 return auxGetNumDevs16();
843 /**************************************************************************
844 * auxGetNumDevs [MMSYSTEM.350]
846 UINT16 WINAPI auxGetNumDevs16()
851 count = auxMessage(0, AUXDM_GETNUMDEVS, 0L, 0L, 0L);
852 TRACE(mmsys, "=> %u\n", count);
856 /**************************************************************************
857 * auxGetDevCaps [WINMM.20]
859 UINT WINAPI auxGetDevCapsW(UINT uDeviceID, LPAUXCAPSW lpCaps, UINT uSize)
862 UINT ret = auxGetDevCaps16(uDeviceID, &ac16, sizeof(ac16));
864 lpCaps->wMid = ac16.wMid;
865 lpCaps->wPid = ac16.wPid;
866 lpCaps->vDriverVersion = ac16.vDriverVersion;
867 lstrcpyAtoW(lpCaps->szPname,ac16.szPname);
868 lpCaps->wTechnology = ac16.wTechnology;
869 lpCaps->dwSupport = ac16.dwSupport;
873 /**************************************************************************
874 * auxGetDevCaps [WINMM.21]
876 UINT WINAPI auxGetDevCapsA(UINT uDeviceID, LPAUXCAPSA lpCaps, UINT uSize)
879 UINT ret = auxGetDevCaps16(uDeviceID, &ac16, sizeof(ac16));
881 lpCaps->wMid = ac16.wMid;
882 lpCaps->wPid = ac16.wPid;
883 lpCaps->vDriverVersion = ac16.vDriverVersion;
884 strcpy(lpCaps->szPname,ac16.szPname);
885 lpCaps->wTechnology = ac16.wTechnology;
886 lpCaps->dwSupport = ac16.dwSupport;
890 /**************************************************************************
891 * auxGetDevCaps [MMSYSTEM.351]
893 UINT16 WINAPI auxGetDevCaps16(UINT16 uDeviceID, LPAUXCAPS16 lpCaps, UINT16 uSize)
895 TRACE(mmsys, "(%04X, %p, %d) !\n", uDeviceID, lpCaps, uSize);
897 return auxMessage(uDeviceID, AUXDM_GETDEVCAPS,
898 0L, (DWORD)lpCaps, (DWORD)uSize);
901 /**************************************************************************
902 * auxGetVolume [WINM.23]
904 UINT WINAPI auxGetVolume(UINT uDeviceID, DWORD* lpdwVolume)
906 return auxGetVolume16(uDeviceID, lpdwVolume);
909 /**************************************************************************
910 * auxGetVolume [MMSYSTEM.352]
912 UINT16 WINAPI auxGetVolume16(UINT16 uDeviceID, DWORD* lpdwVolume)
914 TRACE(mmsys, "(%04X, %p) !\n", uDeviceID, lpdwVolume);
916 return auxMessage(uDeviceID, AUXDM_GETVOLUME, 0L, (DWORD)lpdwVolume, 0L);
919 /**************************************************************************
920 * auxSetVolume [WINMM.25]
922 UINT WINAPI auxSetVolume(UINT uDeviceID, DWORD dwVolume)
924 return auxSetVolume16(uDeviceID, dwVolume);
927 /**************************************************************************
928 * auxSetVolume [MMSYSTEM.353]
930 UINT16 WINAPI auxSetVolume16(UINT16 uDeviceID, DWORD dwVolume)
932 TRACE(mmsys, "(%04X, %08lX) !\n", uDeviceID, dwVolume);
934 return auxMessage(uDeviceID, AUXDM_SETVOLUME, 0L, dwVolume, 0L);
937 /**************************************************************************
938 * auxOutMessage [MMSYSTEM.354]
940 DWORD WINAPI auxOutMessage(UINT uDeviceID, UINT uMessage, DWORD dw1, DWORD dw2)
943 case AUXDM_GETNUMDEVS:
944 case AUXDM_GETVOLUME:
945 case AUXDM_SETVOLUME:
946 /* no argument conversion needed */
948 case AUXDM_GETDEVCAPS:
949 return auxGetDevCapsA(uDeviceID, (LPAUXCAPSA)dw1, dw2);
951 ERR(mmsys,"(%04x,%04x,%08lx,%08lx): unhandled message\n",
952 uDeviceID,uMessage, dw1, dw2);
955 return auxMessage(uDeviceID,uMessage, 0L, dw1, dw2);
958 /**************************************************************************
959 * auxOutMessage [MMSYSTEM.354]
961 DWORD WINAPI auxOutMessage16(UINT16 uDeviceID, UINT16 uMessage, DWORD dw1, DWORD dw2)
963 TRACE(mmsys, "(%04X, %04X, %08lX, %08lX)\n", uDeviceID, uMessage, dw1, dw2);
966 case AUXDM_GETNUMDEVS:
967 case AUXDM_SETVOLUME:
968 /* no argument conversion needed */
970 case AUXDM_GETVOLUME:
971 return auxGetVolume16(uDeviceID, (LPDWORD)PTR_SEG_TO_LIN(dw1));
972 case AUXDM_GETDEVCAPS:
973 return auxGetDevCaps16(uDeviceID, (LPAUXCAPS16)PTR_SEG_TO_LIN(dw1), dw2);
975 ERR(mmsys,"(%04x,%04x,%08lx,%08lx): unhandled message\n",
976 uDeviceID,uMessage, dw1, dw2);
979 return auxMessage(uDeviceID, uMessage, 0L, dw1, dw2);
982 /**************************************************************************
983 * mciGetErrorStringW [WINMM.46]
985 BOOL WINAPI mciGetErrorStringW(DWORD wError, LPWSTR lpstrBuffer, UINT uLength)
987 LPSTR bufstr = HeapAlloc(GetProcessHeap(), 0,uLength);
988 BOOL ret = mciGetErrorStringA(wError, bufstr, uLength);
990 lstrcpyAtoW(lpstrBuffer, bufstr);
991 HeapFree(GetProcessHeap(), 0, bufstr);
995 /**************************************************************************
996 * mciGetErrorStringA [WINMM.45]
998 BOOL WINAPI mciGetErrorStringA(DWORD wError, LPSTR lpstrBuffer, UINT uLength)
1000 return mciGetErrorString16(wError, lpstrBuffer,uLength);
1003 /**************************************************************************
1004 * mciGetErrorString [MMSYSTEM.706]
1006 BOOL16 WINAPI mciGetErrorString16(DWORD wError, LPSTR lpstrBuffer, UINT16 uLength)
1010 TRACE(mmsys, "(%08lX, %p, %d);\n", wError, lpstrBuffer, uLength);
1012 if ((lpstrBuffer == NULL) || (uLength < 1))
1014 lpstrBuffer[0] = '\0';
1018 msgptr = "The specified command has been executed.";
1020 case MCIERR_INVALID_DEVICE_ID:
1021 msgptr = "Invalid MCI device ID. Use the ID returned when opening the MCI device.";
1023 case MCIERR_UNRECOGNIZED_KEYWORD:
1024 msgptr = "The driver cannot recognize the specified command parameter.";
1026 case MCIERR_UNRECOGNIZED_COMMAND:
1027 msgptr = "The driver cannot recognize the specified command.";
1029 case MCIERR_HARDWARE:
1030 msgptr = "There is a problem with your media device. Make sure it is working correctly or contact the device manufacturer.";
1032 case MCIERR_INVALID_DEVICE_NAME:
1033 msgptr = "The specified device is not open or is not recognized by MCI.";
1035 case MCIERR_OUT_OF_MEMORY:
1036 msgptr = "Not enough memory available for this task. \nQuit one or more applications to increase available memory, and then try again.";
1038 case MCIERR_DEVICE_OPEN:
1039 msgptr = "The device name is already being used as an alias by this application. Use a unique alias.";
1041 case MCIERR_CANNOT_LOAD_DRIVER:
1042 msgptr = "There is an undetectable problem in loading the specified device driver.";
1044 case MCIERR_MISSING_COMMAND_STRING:
1045 msgptr = "No command was specified.";
1047 case MCIERR_PARAM_OVERFLOW:
1048 msgptr = "The output string was to large to fit in the return buffer. Increase the size of the buffer.";
1050 case MCIERR_MISSING_STRING_ARGUMENT:
1051 msgptr = "The specified command requires a character-string parameter. Please provide one.";
1053 case MCIERR_BAD_INTEGER:
1054 msgptr = "The specified integer is invalid for this command.";
1056 case MCIERR_PARSER_INTERNAL:
1057 msgptr = "The device driver returned an invalid return type. Check with the device manufacturer about obtaining a new driver.";
1059 case MCIERR_DRIVER_INTERNAL:
1060 msgptr = "There is a problem with the device driver. Check with the device manufacturer about obtaining a new driver.";
1062 case MCIERR_MISSING_PARAMETER:
1063 msgptr = "The specified command requires a parameter. Please supply one.";
1065 case MCIERR_UNSUPPORTED_FUNCTION:
1066 msgptr = "The MCI device you are using does not support the specified command.";
1068 case MCIERR_FILE_NOT_FOUND:
1069 msgptr = "Cannot find the specified file. Make sure the path and filename are correct.";
1071 case MCIERR_DEVICE_NOT_READY:
1072 msgptr = "The device driver is not ready.";
1074 case MCIERR_INTERNAL:
1075 msgptr = "A problem occurred in initializing MCI. Try restarting Windows.";
1078 msgptr = "There is a problem with the device driver. The driver has closed. Cannot access error.";
1080 case MCIERR_CANNOT_USE_ALL:
1081 msgptr = "Cannot use 'all' as the device name with the specified command.";
1083 case MCIERR_MULTIPLE:
1084 msgptr = "Errors occurred in more than one device. Specify each command and device separately to determine which devices caused the error";
1086 case MCIERR_EXTENSION_NOT_FOUND:
1087 msgptr = "Cannot determine the device type from the given filename extension.";
1089 case MCIERR_OUTOFRANGE:
1090 msgptr = "The specified parameter is out of range for the specified command.";
1092 case MCIERR_FLAGS_NOT_COMPATIBLE:
1093 msgptr = "The specified parameters cannot be used together.";
1095 case MCIERR_FILE_NOT_SAVED:
1096 msgptr = "Cannot save the specified file. Make sure you have enough disk space or are still connected to the network.";
1098 case MCIERR_DEVICE_TYPE_REQUIRED:
1099 msgptr = "Cannot find the specified device. Make sure it is installed or that the device name is spelled correctly.";
1101 case MCIERR_DEVICE_LOCKED:
1102 msgptr = "The specified device is now being closed. Wait a few seconds, and then try again.";
1104 case MCIERR_DUPLICATE_ALIAS:
1105 msgptr = "The specified alias is already being used in this application. Use a unique alias.";
1107 case MCIERR_BAD_CONSTANT:
1108 msgptr = "The specified parameter is invalid for this command.";
1110 case MCIERR_MUST_USE_SHAREABLE:
1111 msgptr = "The device driver is already in use. To share it, use the 'shareable' parameter with each 'open' command.";
1113 case MCIERR_MISSING_DEVICE_NAME:
1114 msgptr = "The specified command requires an alias, file, driver, or device name. Please supply one.";
1116 case MCIERR_BAD_TIME_FORMAT:
1117 msgptr = "The specified value for the time format is invalid. Refer to the MCI documentation for valid formats.";
1119 case MCIERR_NO_CLOSING_QUOTE:
1120 msgptr = "A closing double-quotation mark is missing from the parameter value. Please supply one.";
1122 case MCIERR_DUPLICATE_FLAGS:
1123 msgptr = "A parameter or value was specified twice. Only specify it once.";
1125 case MCIERR_INVALID_FILE:
1126 msgptr = "The specified file cannot be played on the specified MCI device. The file may be corrupt, or not in the correct format.";
1128 case MCIERR_NULL_PARAMETER_BLOCK:
1129 msgptr = "A null parameter block was passed to MCI.";
1131 case MCIERR_UNNAMED_RESOURCE:
1132 msgptr = "Cannot save an unnamed file. Supply a filename.";
1134 case MCIERR_NEW_REQUIRES_ALIAS:
1135 msgptr = "You must specify an alias when using the 'new' parameter.";
1137 case MCIERR_NOTIFY_ON_AUTO_OPEN:
1138 msgptr = "Cannot use the 'notify' flag with auto-opened devices.";
1140 case MCIERR_NO_ELEMENT_ALLOWED:
1141 msgptr = "Cannot use a filename with the specified device.";
1143 case MCIERR_NONAPPLICABLE_FUNCTION:
1144 msgptr = "Cannot carry out the commands in the order specified. Correct the command sequence, and then try again.";
1146 case MCIERR_ILLEGAL_FOR_AUTO_OPEN:
1147 msgptr = "Cannot carry out the specified command on an auto-opened device. Wait until the device is closed, and then try again.";
1149 case MCIERR_FILENAME_REQUIRED:
1150 msgptr = "The filename is invalid. Make sure the filename is not longer than 8 characters, followed by a period and an extension.";
1152 case MCIERR_EXTRA_CHARACTERS:
1153 msgptr = "Cannot specify extra characters after a string enclosed in quotation marks.";
1155 case MCIERR_DEVICE_NOT_INSTALLED:
1156 msgptr = "The specified device is not installed on the system. Use the Drivers option in Control Panel to install the device.";
1159 msgptr = "Cannot access the specified file or MCI device. Try changing directories or restarting your computer.";
1162 msgptr = "Cannot access the specified file or MCI device because the application cannot change directories.";
1164 case MCIERR_SET_DRIVE:
1165 msgptr = "Cannot access specified file or MCI device because the application cannot change drives.";
1167 case MCIERR_DEVICE_LENGTH:
1168 msgptr = "Specify a device or driver name that is less than 79 characters.";
1170 case MCIERR_DEVICE_ORD_LENGTH:
1171 msgptr = "Specify a device or driver name that is less than 69 characters.";
1173 case MCIERR_NO_INTEGER:
1174 msgptr = "The specified command requires an integer parameter. Please provide one.";
1176 case MCIERR_WAVE_OUTPUTSINUSE:
1177 msgptr = "All wave devices that can play files in the current format are in use. Wait until a wave device is free, and then try again.";
1179 case MCIERR_WAVE_SETOUTPUTINUSE:
1180 msgptr = "Cannot set the current wave device for play back because it is in use. Wait until the device is free, and then try again.";
1182 case MCIERR_WAVE_INPUTSINUSE:
1183 msgptr = "All wave devices that can record files in the current format are in use. Wait until a wave device is free, and then try again.";
1185 case MCIERR_WAVE_SETINPUTINUSE:
1186 msgptr = "Cannot set the current wave device for recording because it is in use. Wait until the device is free, and then try again.";
1188 case MCIERR_WAVE_OUTPUTUNSPECIFIED:
1189 msgptr = "Any compatible waveform playback device may be used.";
1191 case MCIERR_WAVE_INPUTUNSPECIFIED:
1192 msgptr = "Any compatible waveform recording device may be used.";
1194 case MCIERR_WAVE_OUTPUTSUNSUITABLE:
1195 msgptr = "No wave device that can play files in the current format is installed. Use the Drivers option to install the wave device.";
1197 case MCIERR_WAVE_SETOUTPUTUNSUITABLE:
1198 msgptr = "The device you are trying to play to cannot recognize the current file format.";
1200 case MCIERR_WAVE_INPUTSUNSUITABLE:
1201 msgptr = "No wave device that can record files in the current format is installed. Use the Drivers option to install the wave device.";
1203 case MCIERR_WAVE_SETINPUTUNSUITABLE:
1204 msgptr = "The device you are trying to record from cannot recognize the current file format.";
1206 case MCIERR_NO_WINDOW:
1207 msgptr = "There is no display window.";
1209 case MCIERR_CREATEWINDOW:
1210 msgptr = "Could not create or use window.";
1212 case MCIERR_FILE_READ:
1213 msgptr = "Cannot read the specified file. Make sure the file is still present, or check your disk or network connection.";
1215 case MCIERR_FILE_WRITE:
1216 msgptr = "Cannot write to the specified file. Make sure you have enough disk space or are still connected to the network.";
1218 case MCIERR_SEQ_DIV_INCOMPATIBLE:
1219 msgptr = "The time formats of the \"song pointer\" and SMPTE are mutually exclusive. You can't use them together.";
1221 case MCIERR_SEQ_NOMIDIPRESENT:
1222 msgptr = "The system has no installed MIDI devices. Use the Drivers option from the Control Panel to install a MIDI driver.";
1224 case MCIERR_SEQ_PORT_INUSE:
1225 msgptr = "The specified MIDI port is already in use. Wait until it is free; the try again.";
1227 case MCIERR_SEQ_PORT_MAPNODEVICE:
1228 msgptr = "The current MIDI Mapper setup refers to a MIDI device that is not installed on the system. Use the MIDI Mapper option from the Control Panel to edit the setup.";
1230 case MCIERR_SEQ_PORT_MISCERROR:
1231 msgptr = "An error occurred with the specified port.";
1233 case MCIERR_SEQ_PORT_NONEXISTENT:
1234 msgptr = "The specified MIDI device is not installed on the system. Use the Drivers option from the Control Panel to install a MIDI device.";
1236 case MCIERR_SEQ_PORTUNSPECIFIED:
1237 msgptr = "The system doesnot have a current MIDI port specified.";
1239 case MCIERR_SEQ_TIMER:
1240 msgptr = "All multimedia timers are being used by other applications. Quit one of these applications; then, try again.";
1245 msg# 514 : videodisc
1250 msg# 519 : animation
1251 msg# 520 : digitalvideo
1253 msg# 522 : waveaudio
1254 msg# 523 : sequencer
1255 msg# 524 : not ready
1258 msg# 527 : recording
1264 msg# 533 : milliseconds
1271 msg# 540 : smpte 30 drop
1277 msgptr = "Unknown MCI Error !\n";
1280 lstrcpynA(lpstrBuffer, msgptr, uLength);
1281 TRACE(mmsys, "msg = %s;\n", msgptr);
1285 /**************************************************************************
1286 * mciDriverNotify [MMSYSTEM.711]
1288 BOOL16 WINAPI mciDriverNotify16(HWND16 hWndCallBack, UINT16 wDevID, UINT16 wStatus)
1290 TRACE(mmsys, "(%04X, %04x, %04X)\n", hWndCallBack, wDevID, wStatus);
1292 if (!IsWindow(hWndCallBack)) {
1293 WARN(mmsys, "bad hWnd for call back\n");
1296 TRACE(mmsys, "before PostMessage\n");
1297 PostMessageA(hWndCallBack, MM_MCINOTIFY, wStatus, wDevID);
1301 /**************************************************************************
1302 * mciDriverNotify [WINMM.36]
1304 BOOL WINAPI mciDriverNotify(HWND hWndCallBack, UINT wDevID, UINT wStatus)
1306 FIXME(mmsys, "(%08X, %04x, %04X)\n", hWndCallBack, wDevID, wStatus);
1308 if (!IsWindow(hWndCallBack)) {
1309 WARN(mmsys, "bad hWnd for call back\n");
1312 TRACE(mmsys, "before PostMessage\n");
1313 PostMessageA(hWndCallBack, MM_MCINOTIFY, wStatus, wDevID);
1317 /**************************************************************************
1318 * mciGetDriverData [MMSYSTEM.708]
1320 DWORD WINAPI mciGetDriverData16(HDRVR16 hDrv)
1322 return mciGetDriverData(hDrv);
1325 /**************************************************************************
1326 * mciGetDriverData [WINMM.44]
1328 DWORD WINAPI mciGetDriverData(HDRVR hDrv)
1330 TRACE(mmsys,"(%04x)\n", hDrv);
1331 if (!MCI_DevIDValid(hDrv) || MCI_GetDrv(hDrv)->modp.wType == 0) {
1332 WARN(mmsys, "Bad hDrv\n");
1336 return MCI_GetDrv(hDrv)->dwPrivate;
1339 /**************************************************************************
1340 * mciSetDriverData [MMSYSTEM.707]
1342 BOOL16 WINAPI mciSetDriverData16(HDRVR16 hDrv, DWORD data)
1344 return mciSetDriverData(hDrv, data);
1347 /**************************************************************************
1348 * mciSetDriverData [WINMM.53]
1350 BOOL WINAPI mciSetDriverData(HDRVR hDrv, DWORD data)
1352 TRACE(mmsys,"(%04x,%08lx)\n", hDrv, data);
1353 if (!MCI_DevIDValid(hDrv) || MCI_GetDrv(hDrv)->modp.wType == 0) {
1354 WARN(mmsys, "Bad hDrv\n");
1358 MCI_GetDrv(hDrv)->dwPrivate = data;
1362 /**************************************************************************
1363 * mciLoadCommandResource [MMSYSTEM.705]
1365 UINT16 WINAPI mciLoadCommandResource16(HANDLE16 hinst, LPCSTR resname, UINT16 type)
1375 static UINT16 mcidevtype = 0;
1377 FIXME(mmsys,"(%04x,%s,%d): stub!\n", hinst, resname, type);
1378 if (!lstrcmpiA(resname,"core")) {
1379 FIXME(mmsys, "(...,\"core\",...), have to use internal tables... (not there yet)\n");
1382 /* if file exists "resname.mci", then load resource "resname" from it
1383 * otherwise directly from driver
1385 strcpy(buf,resname);
1387 if (OpenFile(buf, &ofs,OF_EXIST) != HFILE_ERROR) {
1388 xhinst = LoadLibrary16(buf);
1391 } /* else use passed hinst */
1392 segstr = SEGPTR_STRDUP(resname);
1393 hrsrc = FindResource16(hinst, SEGPTR_GET(segstr), type);
1394 SEGPTR_FREE(segstr);
1396 WARN(mmsys,"no special commandlist found in resource\n");
1397 return MCI_NO_COMMAND_TABLE;
1399 hmem = LoadResource16(hinst, hrsrc);
1401 WARN(mmsys,"couldn't load resource??\n");
1402 return MCI_NO_COMMAND_TABLE;
1404 xmem = WIN16_LockResource16(hmem);
1406 WARN(mmsys,"couldn't lock resource??\n");
1407 FreeResource16(hmem);
1408 return MCI_NO_COMMAND_TABLE;
1410 lmem = PTR_SEG_TO_LIN(xmem);
1411 TRACE(mmsys, "first resource entry is %s\n", (char*)lmem);
1412 /* parse resource, register stuff, return unique id */
1413 return ++mcidevtype;
1416 /**************************************************************************
1417 * mciFreeCommandResource [MMSYSTEM.713]
1419 BOOL16 WINAPI mciFreeCommandResource16(UINT16 uTable)
1421 FIXME(mci, "(%04x) stub\n", uTable);
1425 /**************************************************************************
1426 * mciFreeCommandResource [WINMM.39]
1428 BOOL WINAPI mciFreeCommandResource(UINT uTable)
1430 FIXME(mci, "(%08x) stub\n", uTable);
1434 /**************************************************************************
1435 * mciLoadCommandResource [WINMM.48]
1437 UINT WINAPI mciLoadCommandResource(HANDLE hinst, LPCWSTR resname, UINT type)
1439 FIXME(mci, "(%04x,%s,%d): stub!\n", hinst, debugstr_w(resname), type);
1443 /**************************************************************************
1444 * mciSendCommandA [WINMM.49]
1446 DWORD WINAPI mciSendCommandA(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2)
1450 TRACE(mci, "(%08x,%s,%08lx,%08lx)\n", wDevID, MCI_CommandToString(wMsg), dwParam1, dwParam2);
1454 dwRet = MCI_Open(dwParam1, (LPMCI_OPEN_PARMSA)dwParam2);
1457 dwRet = MCI_Close(wDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
1460 dwRet = MCI_SysInfo(wDevID, dwParam1, (LPMCI_SYSINFO_PARMSA)dwParam2);
1463 if (wDevID == MCI_ALL_DEVICE_ID) {
1464 FIXME(mci, "unhandled MCI_ALL_DEVICE_ID\n");
1465 dwRet = MCIERR_CANNOT_USE_ALL;
1467 dwRet = MCI_SendCommand(wDevID, wMsg, dwParam1, dwParam2);
1471 dwRet = MCI_CleanUp(dwRet, wMsg, dwParam2, TRUE);
1472 TRACE(mci, "=> %08ld\n", dwRet);
1476 /**************************************************************************
1477 * mciSendCommandW [WINMM.50]
1479 DWORD WINAPI mciSendCommandW(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2)
1481 return 0x1; /* !ok */
1484 /**************************************************************************
1485 * mciSendCommand [MMSYSTEM.701]
1487 DWORD WINAPI mciSendCommand16(UINT16 wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2)
1489 DWORD dwRet = MCIERR_UNRECOGNIZED_COMMAND;
1491 TRACE(mmsys, "(%04X, %s, %08lX, %08lX)\n",
1492 wDevID, MCI_CommandToString(wMsg), dwParam1, dwParam2);
1496 if (MCI_MapMsg16To32A(MCI_GetDrv(wDevID)->modp.wType, wMsg, &dwParam2) >= 0) {
1497 dwRet = MCI_Open(dwParam1, (LPMCI_OPEN_PARMSA)dwParam2);
1498 MCI_UnMapMsg16To32A(MCI_GetDrv(wDevID)->modp.wType, wMsg, dwParam2);
1502 if (wDevID == MCI_ALL_DEVICE_ID) {
1503 FIXME(mci, "unhandled MCI_ALL_DEVICE_ID\n");
1504 dwRet = MCIERR_CANNOT_USE_ALL;
1505 } else if (!MCI_DevIDValid(wDevID)) {
1506 dwRet = MCIERR_INVALID_DEVICE_ID;
1507 } else if (MCI_MapMsg16To32A(MCI_GetDrv(wDevID)->modp.wType, wMsg, &dwParam2) >= 0) {
1508 dwRet = MCI_Close(wDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
1509 MCI_UnMapMsg16To32A(MCI_GetDrv(wDevID)->modp.wType, wMsg, dwParam2);
1513 if (MCI_MapMsg16To32A(0, wDevID, &dwParam2) >= 0) {
1514 dwRet = MCI_SysInfo(wDevID, dwParam1, (LPMCI_SYSINFO_PARMSA)dwParam2);
1515 MCI_UnMapMsg16To32A(0, wDevID, dwParam2);
1518 /* FIXME: it seems that MCI_BREAK and MCI_SOUND need the same handling */
1520 if (wDevID == MCI_ALL_DEVICE_ID) {
1521 FIXME(mci, "unhandled MCI_ALL_DEVICE_ID\n");
1522 dwRet = MCIERR_CANNOT_USE_ALL;
1523 } else if (!MCI_DevIDValid(wDevID)) {
1524 dwRet = MCIERR_INVALID_DEVICE_ID;
1528 switch (DRIVER_GetType(MCI_GetDrv(wDevID)->hDrv)) {
1529 case WINE_DI_TYPE_16:
1530 dwRet = SendDriverMessage16(MCI_GetDrv(wDevID)->hDrv, wMsg, dwParam1, dwParam2);
1532 case WINE_DI_TYPE_32:
1533 switch (res = MCI_MapMsg16To32A(MCI_GetDrv(wDevID)->modp.wType, wMsg, &dwParam2)) {
1535 TRACE(mci, "Not handled yet (%s)\n", MCI_CommandToString(wMsg));
1536 dwRet = MCIERR_DRIVER_INTERNAL;
1539 TRACE(mci, "Problem mapping msg=%s from 16 to 32a\n", MCI_CommandToString(wMsg));
1540 dwRet = MCIERR_OUT_OF_MEMORY;
1544 dwRet = MCI_SendCommand(wDevID, wMsg, dwParam1, dwParam2);
1546 MCI_UnMapMsg16To32A(MCI_GetDrv(wDevID)->modp.wType, wMsg, dwParam2);
1551 WARN(mmsys, "Unknown driver type=%u\n", DRIVER_GetType(MCI_GetDrv(wDevID)->hDrv));
1552 dwRet = MCIERR_DRIVER_INTERNAL;
1556 dwRet = MCI_CleanUp(dwRet, wMsg, dwParam2, FALSE);
1557 TRACE(mmsys, "=> %ld\n", dwRet);
1561 /**************************************************************************
1562 * mciGetDeviceID [MMSYSTEM.703]
1564 UINT16 WINAPI mciGetDeviceID16(LPCSTR lpstrName)
1567 TRACE(mmsys, "(\"%s\")\n", lpstrName);
1572 if (!lstrcmpiA(lpstrName, "ALL"))
1573 return MCI_ALL_DEVICE_ID;
1575 for (wDevID = MCI_FirstDevID(); MCI_DevIDValid(wDevID); wDevID = MCI_NextDevID(wDevID)) {
1576 if (MCI_GetDrv(wDevID)->modp.wType) {
1577 FIXME(mmsys, "This is wrong for compound devices\n");
1578 /* FIXME: for compound devices, lpstrName is matched against
1579 * the name of the file, not the name of the device...
1581 if (MCI_GetOpenDrv(wDevID)->lpstrDeviceType &&
1582 strcmp(MCI_GetOpenDrv(wDevID)->lpstrDeviceType, lpstrName) == 0)
1585 if (MCI_GetOpenDrv(wDevID)->lpstrAlias &&
1586 strcmp(MCI_GetOpenDrv(wDevID)->lpstrAlias, lpstrName) == 0)
1594 /**************************************************************************
1595 * mciGetDeviceIDA [WINMM.41]
1597 UINT WINAPI mciGetDeviceIDA(LPCSTR lpstrName)
1599 return mciGetDeviceID16(lpstrName);
1602 /**************************************************************************
1603 * mciGetDeviceIDW [WINMM.43]
1605 UINT WINAPI mciGetDeviceIDW(LPCWSTR lpwstrName)
1610 lpstrName = HEAP_strdupWtoA(GetProcessHeap(), 0, lpwstrName);
1611 ret = mciGetDeviceID16(lpstrName);
1612 HeapFree(GetProcessHeap(), 0, lpstrName);
1616 /**************************************************************************
1617 * mciSetYieldProc [MMSYSTEM.714]
1619 BOOL16 WINAPI mciSetYieldProc16(UINT16 uDeviceID,
1620 YIELDPROC fpYieldProc, DWORD dwYieldData)
1622 FIXME(mci, "(%u, %p, %08lx) stub\n", uDeviceID, fpYieldProc, dwYieldData);
1626 /**************************************************************************
1627 * mciSetYieldProc [WINMM.54]
1629 BOOL WINAPI mciSetYieldProc(UINT uDeviceID,
1630 YIELDPROC fpYieldProc, DWORD dwYieldData)
1632 FIXME(mci, "(%u, %p, %08lx) stub\n", uDeviceID, fpYieldProc, dwYieldData);
1636 /**************************************************************************
1637 * mciGetDeviceIDFromElementID [MMSYSTEM.715]
1639 UINT16 WINAPI mciGetDeviceIDFromElementID16(DWORD dwElementID, LPCSTR lpstrType)
1641 FIXME(mci, "(%lu, %s) stub\n", dwElementID, lpstrType);
1645 /**************************************************************************
1646 * mciGetDeviceIDFromElementIDW [WINMM.42]
1648 UINT WINAPI mciGetDeviceIDFromElementIDW(DWORD dwElementID, LPCWSTR lpstrType)
1650 /* FIXME: that's rather strange, there is no
1651 * mciGetDeviceIDFromElementID32A in winmm.spec
1653 FIXME(mci, "(%lu, %p) stub\n", dwElementID, lpstrType);
1657 /**************************************************************************
1658 * mciGetYieldProc [MMSYSTEM.716]
1660 YIELDPROC WINAPI mciGetYieldProc16(UINT16 uDeviceID, DWORD* lpdwYieldData)
1662 FIXME(mci, "(%u, %p) stub\n", uDeviceID, lpdwYieldData);
1666 /**************************************************************************
1667 * mciGetYieldProc [WINMM.47]
1669 YIELDPROC WINAPI mciGetYieldProc(UINT uDeviceID, DWORD* lpdwYieldData)
1671 FIXME(mci, "(%u, %p) stub\n", uDeviceID, lpdwYieldData);
1675 /**************************************************************************
1676 * mciGetCreatorTask [MMSYSTEM.717]
1678 HTASK16 WINAPI mciGetCreatorTask16(UINT16 uDeviceID)
1680 FIXME(mci, "(%u) stub\n", uDeviceID);
1684 /**************************************************************************
1685 * mciGetCreatorTask [WINMM.40]
1687 HTASK WINAPI mciGetCreatorTask(UINT uDeviceID)
1689 FIXME(mci, "(%u) stub\n", uDeviceID);
1693 /**************************************************************************
1694 * mciDriverYield [MMSYSTEM.710]
1696 UINT16 WINAPI mciDriverYield16(HANDLE16 hnd)
1698 FIXME(mmsys,"(%04x): stub!\n", hnd);
1702 /**************************************************************************
1703 * mciDriverYield [WINMM.37]
1705 UINT WINAPI mciDriverYield(HANDLE hnd)
1707 FIXME(mmsys,"(%04x): stub!\n", hnd);
1711 /**************************************************************************
1712 * midiOutGetNumDevs [WINMM.80]
1714 UINT WINAPI midiOutGetNumDevs(void)
1716 return midiOutGetNumDevs16();
1719 /**************************************************************************
1720 * midiOutGetNumDevs [MMSYSTEM.201]
1722 UINT16 WINAPI midiOutGetNumDevs16(void)
1724 UINT16 count = modMessage(0, MODM_GETNUMDEVS, 0L, 0L, 0L);
1726 TRACE(mmsys, "returns %u\n", count);
1730 /**************************************************************************
1731 * midiOutGetDevCapsW [WINMM.76]
1733 UINT WINAPI midiOutGetDevCapsW(UINT uDeviceID, LPMIDIOUTCAPSW lpCaps, UINT uSize)
1735 MIDIOUTCAPS16 moc16;
1738 ret = midiOutGetDevCaps16(uDeviceID, &moc16, sizeof(moc16));
1739 lpCaps->wMid = moc16.wMid;
1740 lpCaps->wPid = moc16.wPid;
1741 lpCaps->vDriverVersion = moc16.vDriverVersion;
1742 lstrcpyAtoW(lpCaps->szPname, moc16.szPname);
1743 lpCaps->wTechnology = moc16.wTechnology;
1744 lpCaps->wVoices = moc16.wVoices;
1745 lpCaps->wNotes = moc16.wNotes;
1746 lpCaps->wChannelMask = moc16.wChannelMask;
1747 lpCaps->dwSupport = moc16.dwSupport;
1751 /**************************************************************************
1752 * midiOutGetDevCapsA [WINMM.75]
1754 UINT WINAPI midiOutGetDevCapsA(UINT uDeviceID, LPMIDIOUTCAPSA lpCaps, UINT uSize)
1756 MIDIOUTCAPS16 moc16;
1759 ret = midiOutGetDevCaps16(uDeviceID, &moc16, sizeof(moc16));
1760 lpCaps->wMid = moc16.wMid;
1761 lpCaps->wPid = moc16.wPid;
1762 lpCaps->vDriverVersion = moc16.vDriverVersion;
1763 strcpy(lpCaps->szPname, moc16.szPname);
1764 lpCaps->wTechnology = moc16.wTechnology;
1765 lpCaps->wVoices = moc16.wVoices;
1766 lpCaps->wNotes = moc16.wNotes;
1767 lpCaps->wChannelMask = moc16.wChannelMask;
1768 lpCaps->dwSupport = moc16.dwSupport;
1772 /**************************************************************************
1773 * midiOutGetDevCaps [MMSYSTEM.202]
1775 UINT16 WINAPI midiOutGetDevCaps16(UINT16 uDeviceID, LPMIDIOUTCAPS16 lpCaps, UINT16 uSize)
1777 TRACE(mmsys, "midiOutGetDevCaps\n");
1778 return modMessage(uDeviceID, MODM_GETDEVCAPS, 0, (DWORD)lpCaps,uSize);
1781 /**************************************************************************
1782 * midiOutGetErrorTextA [WINMM.77]
1784 UINT WINAPI midiOutGetErrorTextA(UINT uError, LPSTR lpText, UINT uSize)
1786 TRACE(mmsys, "midiOutGetErrorText\n");
1787 return midiGetErrorText(uError, lpText, uSize);
1790 /**************************************************************************
1791 * midiOutGetErrorTextW [WINMM.78]
1793 UINT WINAPI midiOutGetErrorTextW(UINT uError, LPWSTR lpText, UINT uSize)
1795 LPSTR xstr = HeapAlloc(GetProcessHeap(), 0,uSize);
1798 TRACE(mmsys, "midiOutGetErrorText\n");
1799 ret = midiGetErrorText(uError, xstr, uSize);
1800 lstrcpyAtoW(lpText,xstr);
1801 HeapFree(GetProcessHeap(), 0,xstr);
1805 /**************************************************************************
1806 * midiOutGetErrorText [MMSYSTEM.203]
1808 UINT16 WINAPI midiOutGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
1810 TRACE(mmsys, "midiOutGetErrorText\n");
1811 return midiGetErrorText(uError, lpText, uSize);
1814 /**************************************************************************
1815 * midiGetErrorText [internal]
1817 UINT16 WINAPI midiGetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize)
1820 if ((lpText == NULL) || (uSize < 1)) return(FALSE);
1823 case MIDIERR_UNPREPARED:
1824 msgptr = "The MIDI header was not prepared. Use the Prepare function to prepare the header, and then try again.";
1826 case MIDIERR_STILLPLAYING:
1827 msgptr = "Cannot perform this operation while media data is still playing. Reset the device, or wait until the data is finished playing.";
1830 msgptr = "A MIDI map was not found. There may be a problem with the driver, or the MIDIMAP.CFG file may be corrupt or missing.";
1832 case MIDIERR_NOTREADY:
1833 msgptr = "The port is transmitting data to the device. Wait until the data has been transmitted, and then try again.";
1835 case MIDIERR_NODEVICE:
1836 msgptr = "The current MIDI Mapper setup refers to a MIDI device that is not installed on the system. Use MIDI Mapper to edit the setup.";
1838 case MIDIERR_INVALIDSETUP:
1839 msgptr = "The current MIDI setup is damaged. Copy the original MIDIMAP.CFG file to the Windows SYSTEM directory, and then try again.";
1842 msg# 336 : Cannot use the song-pointer time format and the SMPTE time-format together.
1843 msg# 337 : The specified MIDI device is already in use. Wait until it is free, and then try again.
1844 msg# 338 : The specified MIDI device is not installed on the system. Use the Drivers option in Control Panel to install the driver.
1845 msg# 339 : The current MIDI Mapper setup refers to a MIDI device that is not installed on the system. Use MIDI Mapper to edit the setup.
1846 msg# 340 : An error occurred using the specified port.
1847 msg# 341 : All multimedia timers are being used by other applications. Quit one of these applications, and then try again.
1848 msg# 342 : There is no current MIDI port.
1849 msg# 343 : There are no MIDI devices installed on the system. Use the Drivers option in Control Panel to install the driver.
1852 msgptr = "Unknown MIDI Error !\n";
1855 lstrcpynA(lpText, msgptr, uSize);
1859 /**************************************************************************
1860 * midiOutOpen [WINM.84]
1862 UINT WINAPI midiOutOpen(HMIDIOUT* lphMidiOut, UINT uDeviceID,
1863 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
1868 ret = midiOutOpen16(&hmo16,uDeviceID, dwCallback, dwInstance,
1869 CALLBACK32CONV(dwFlags));
1870 if (lphMidiOut) *lphMidiOut = hmo16;
1874 /**************************************************************************
1875 * midiOutOpen [MMSYSTEM.204]
1877 UINT16 WINAPI midiOutOpen16(HMIDIOUT16* lphMidiOut, UINT16 uDeviceID,
1878 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
1881 LPMIDIOPENDESC lpDesc;
1883 BOOL bMapperFlg = FALSE;
1885 if (lphMidiOut != NULL) *lphMidiOut = 0;
1886 TRACE(mmsys, "(%p, %d, %08lX, %08lX, %08lX);\n",
1887 lphMidiOut, uDeviceID, dwCallback, dwInstance, dwFlags);
1888 if (uDeviceID == (UINT16)MIDI_MAPPER) {
1889 TRACE(mmsys, "MIDI_MAPPER mode requested !\n");
1893 hMidiOut = USER_HEAP_ALLOC(sizeof(MIDIOPENDESC));
1894 if (lphMidiOut != NULL)
1895 *lphMidiOut = hMidiOut;
1896 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1898 return MMSYSERR_NOMEM;
1899 lpDesc->hMidi = hMidiOut;
1900 lpDesc->dwCallback = dwCallback;
1901 lpDesc->dwInstance = dwInstance;
1903 while (uDeviceID < MAXMIDIDRIVERS) {
1904 dwRet = modMessage(uDeviceID, MODM_OPEN,
1905 lpDesc->dwInstance, (DWORD)lpDesc, dwFlags);
1906 if (dwRet == MMSYSERR_NOERROR) break;
1907 if (!bMapperFlg) break;
1909 TRACE(mmsys, "MIDI_MAPPER mode ! try next driver...\n");
1911 lpDesc->wDevID = uDeviceID;
1915 /**************************************************************************
1916 * midiOutClose [WINMM.74]
1918 UINT WINAPI midiOutClose(HMIDIOUT hMidiOut)
1920 return midiOutClose16(hMidiOut);
1923 /**************************************************************************
1924 * midiOutClose [MMSYSTEM.205]
1926 UINT16 WINAPI midiOutClose16(HMIDIOUT16 hMidiOut)
1928 LPMIDIOPENDESC lpDesc;
1930 TRACE(mmsys, "(%04X)\n", hMidiOut);
1932 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1933 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1934 return modMessage(lpDesc->wDevID, MODM_CLOSE, lpDesc->dwInstance, 0L, 0L);
1937 /**************************************************************************
1938 * midiOutPrepareHeader [WINMM.85]
1940 UINT WINAPI midiOutPrepareHeader(HMIDIOUT hMidiOut,
1941 MIDIHDR16* lpMidiOutHdr, UINT uSize)
1943 LPMIDIOPENDESC lpDesc;
1945 TRACE(mmsys, "(%04X, %p, %d)\n", hMidiOut, lpMidiOutHdr, uSize);
1947 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1948 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1949 lpMidiOutHdr->reserved = (DWORD)lpMidiOutHdr->lpData;
1950 return modMessage(lpDesc->wDevID, MODM_PREPARE, lpDesc->dwInstance,
1951 (DWORD)lpMidiOutHdr, (DWORD)uSize);
1954 /**************************************************************************
1955 * midiOutPrepareHeader [MMSYSTEM.206]
1957 UINT16 WINAPI midiOutPrepareHeader16(HMIDIOUT16 hMidiOut,
1958 MIDIHDR16* lpMidiOutHdr, UINT16 uSize)
1960 LPMIDIOPENDESC lpDesc;
1962 TRACE(mmsys, "(%04X, %p, %d)\n", hMidiOut, lpMidiOutHdr, uSize);
1964 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1965 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1966 lpMidiOutHdr->reserved = (DWORD)PTR_SEG_TO_LIN(lpMidiOutHdr->lpData);
1967 return modMessage(lpDesc->wDevID, MODM_PREPARE, lpDesc->dwInstance,
1968 (DWORD)lpMidiOutHdr, (DWORD)uSize);
1971 /**************************************************************************
1972 * midiOutUnprepareHeader [WINMM.89]
1974 UINT WINAPI midiOutUnprepareHeader(HMIDIOUT hMidiOut,
1975 MIDIHDR16* lpMidiOutHdr, UINT uSize)
1977 return midiOutUnprepareHeader16(hMidiOut, lpMidiOutHdr,uSize);
1980 /**************************************************************************
1981 * midiOutUnprepareHeader [MMSYSTEM.207]
1983 UINT16 WINAPI midiOutUnprepareHeader16(HMIDIOUT16 hMidiOut,
1984 MIDIHDR16* lpMidiOutHdr, UINT16 uSize)
1986 LPMIDIOPENDESC lpDesc;
1988 TRACE(mmsys, "(%04X, %p, %d)\n", hMidiOut, lpMidiOutHdr, uSize);
1990 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
1991 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
1992 return modMessage(lpDesc->wDevID, MODM_UNPREPARE, lpDesc->dwInstance,
1993 (DWORD)lpMidiOutHdr, (DWORD)uSize);
1996 /**************************************************************************
1997 * midiOutShortMsg [WINMM.88]
1999 UINT WINAPI midiOutShortMsg(HMIDIOUT hMidiOut, DWORD dwMsg)
2001 return midiOutShortMsg16(hMidiOut, dwMsg);
2004 /**************************************************************************
2005 * midiOutShortMsg [MMSYSTEM.208]
2007 UINT16 WINAPI midiOutShortMsg16(HMIDIOUT16 hMidiOut, DWORD dwMsg)
2009 LPMIDIOPENDESC lpDesc;
2011 TRACE(mmsys, "(%04X, %08lX)\n", hMidiOut, dwMsg);
2013 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
2014 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2015 return modMessage(lpDesc->wDevID, MODM_DATA, lpDesc->dwInstance, dwMsg, 0L);
2018 /**************************************************************************
2019 * midiOutLongMsg [WINMM.82]
2021 UINT WINAPI midiOutLongMsg(HMIDIOUT hMidiOut,
2022 MIDIHDR16* lpMidiOutHdr, UINT uSize)
2024 return midiOutLongMsg16(hMidiOut, lpMidiOutHdr,uSize);
2027 /**************************************************************************
2028 * midiOutLongMsg [MMSYSTEM.209]
2030 UINT16 WINAPI midiOutLongMsg16(HMIDIOUT16 hMidiOut,
2031 MIDIHDR16* lpMidiOutHdr, UINT16 uSize)
2033 LPMIDIOPENDESC lpDesc;
2035 TRACE(mmsys, "(%04X, %p, %d)\n", hMidiOut, lpMidiOutHdr, uSize);
2037 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
2038 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2039 return modMessage(lpDesc->wDevID, MODM_LONGDATA, lpDesc->dwInstance,
2040 (DWORD)lpMidiOutHdr, (DWORD)uSize);
2043 /**************************************************************************
2044 * midiOutReset [WINMM.86]
2046 UINT WINAPI midiOutReset(HMIDIOUT hMidiOut)
2048 return midiOutReset16(hMidiOut);
2051 /**************************************************************************
2052 * midiOutReset [MMSYSTEM.210]
2054 UINT16 WINAPI midiOutReset16(HMIDIOUT16 hMidiOut)
2056 LPMIDIOPENDESC lpDesc;
2058 TRACE(mmsys, "(%04X)\n", hMidiOut);
2060 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
2061 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2062 return modMessage(lpDesc->wDevID, MODM_RESET, lpDesc->dwInstance, 0L, 0L);
2065 /**************************************************************************
2066 * midiOutGetVolume [WINM.81]
2068 UINT WINAPI midiOutGetVolume(UINT uDeviceID, DWORD* lpdwVolume)
2070 return midiOutGetVolume16(uDeviceID, lpdwVolume);
2073 /**************************************************************************
2074 * midiOutGetVolume [MMSYSTEM.211]
2076 UINT16 WINAPI midiOutGetVolume16(UINT16 uDeviceID, DWORD* lpdwVolume)
2078 TRACE(mmsys, "(%04X, %p);\n", uDeviceID, lpdwVolume);
2079 return modMessage(uDeviceID, MODM_GETVOLUME, 0L, (DWORD)lpdwVolume, 0L);
2082 /**************************************************************************
2083 * midiOutSetVolume [WINMM.87]
2085 UINT WINAPI midiOutSetVolume(UINT uDeviceID, DWORD dwVolume)
2087 return midiOutSetVolume16(uDeviceID, dwVolume);
2090 /**************************************************************************
2091 * midiOutSetVolume [MMSYSTEM.212]
2093 UINT16 WINAPI midiOutSetVolume16(UINT16 uDeviceID, DWORD dwVolume)
2095 TRACE(mmsys, "(%04X, %08lX);\n", uDeviceID, dwVolume);
2096 return modMessage(uDeviceID, MODM_SETVOLUME, 0L, dwVolume, 0L);
2099 /**************************************************************************
2100 * midiOutCachePatches [WINMM.73]
2102 UINT WINAPI midiOutCachePatches(HMIDIOUT hMidiOut, UINT uBank,
2103 WORD* lpwPatchArray, UINT uFlags)
2105 return midiOutCachePatches16(hMidiOut,uBank, lpwPatchArray,uFlags);
2108 /**************************************************************************
2109 * midiOutCachePatches [MMSYSTEM.213]
2111 UINT16 WINAPI midiOutCachePatches16(HMIDIOUT16 hMidiOut, UINT16 uBank,
2112 WORD* lpwPatchArray, UINT16 uFlags)
2114 /* not really necessary to support this */
2115 FIXME(mmsys, "not supported yet\n");
2116 return MMSYSERR_NOTSUPPORTED;
2119 /**************************************************************************
2120 * midiOutCacheDrumPatches [WINMM.72]
2122 UINT WINAPI midiOutCacheDrumPatches(HMIDIOUT hMidiOut, UINT uPatch,
2123 WORD* lpwKeyArray, UINT uFlags)
2125 return midiOutCacheDrumPatches16(hMidiOut,uPatch, lpwKeyArray,uFlags);
2128 /**************************************************************************
2129 * midiOutCacheDrumPatches [MMSYSTEM.214]
2131 UINT16 WINAPI midiOutCacheDrumPatches16(HMIDIOUT16 hMidiOut, UINT16 uPatch,
2132 WORD* lpwKeyArray, UINT16 uFlags)
2134 FIXME(mmsys, "not supported yet\n");
2135 return MMSYSERR_NOTSUPPORTED;
2138 /**************************************************************************
2139 * midiOutGetID [WINMM.79]
2141 UINT WINAPI midiOutGetID(HMIDIOUT hMidiOut, UINT* lpuDeviceID)
2146 ret = midiOutGetID16(hMidiOut, &xid);
2151 /**************************************************************************
2152 * midiOutGetID [MMSYSTEM.215]
2154 UINT16 WINAPI midiOutGetID16(HMIDIOUT16 hMidiOut, UINT16* lpuDeviceID)
2156 TRACE(mmsys, "midiOutGetID\n");
2160 /**************************************************************************
2161 * midiOutMessage [WINMM.83]
2163 DWORD WINAPI midiOutMessage(HMIDIOUT hMidiOut, UINT uMessage,
2164 DWORD dwParam1, DWORD dwParam2)
2166 LPMIDIOPENDESC lpDesc;
2168 TRACE(mmsys, "(%04X, %04X, %08lX, %08lX)\n",
2169 hMidiOut, uMessage, dwParam1, dwParam2);
2170 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
2171 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2174 FIXME(mmsys,"can't handle MODM_OPEN!\n");
2176 case MODM_GETDEVCAPS:
2177 return midiOutGetDevCapsA(hMidiOut, (LPMIDIOUTCAPSA)dwParam1, dwParam2);
2178 case MODM_GETNUMDEVS:
2181 case MODM_GETVOLUME:
2182 case MODM_SETVOLUME:
2185 case MODM_UNPREPARE:
2186 /* no argument conversion needed */
2189 ERR(mmsys,"(%04x,%04x,%08lx,%08lx): unhandled message\n",
2190 hMidiOut,uMessage, dwParam1, dwParam2);
2193 return modMessage(lpDesc->wDevID, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
2196 /**************************************************************************
2197 * midiOutMessage [MMSYSTEM.216]
2199 DWORD WINAPI midiOutMessage16(HMIDIOUT16 hMidiOut, UINT16 uMessage,
2200 DWORD dwParam1, DWORD dwParam2)
2202 LPMIDIOPENDESC lpDesc;
2204 TRACE(mmsys, "(%04X, %04X, %08lX, %08lX)\n",
2205 hMidiOut, uMessage, dwParam1, dwParam2);
2206 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiOut);
2207 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2210 FIXME(mmsys,"can't handle MODM_OPEN!\n");
2212 case MODM_GETNUMDEVS:
2215 case MODM_SETVOLUME:
2216 /* no argument conversion needed */
2218 case MODM_GETVOLUME:
2219 return midiOutGetVolume16(hMidiOut, (LPDWORD)PTR_SEG_TO_LIN(dwParam1));
2221 return midiOutLongMsg16(hMidiOut, (LPMIDIHDR16)PTR_SEG_TO_LIN(dwParam1), dwParam2);
2223 return midiOutPrepareHeader16(hMidiOut, (LPMIDIHDR16)PTR_SEG_TO_LIN(dwParam1), dwParam2);
2224 case MODM_UNPREPARE:
2225 return midiOutUnprepareHeader16(hMidiOut, (LPMIDIHDR16)PTR_SEG_TO_LIN(dwParam1), dwParam2);
2227 ERR(mmsys,"(%04x,%04x,%08lx,%08lx): unhandled message\n",
2228 hMidiOut,uMessage, dwParam1, dwParam2);
2231 return modMessage(lpDesc->wDevID, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
2234 /**************************************************************************
2235 * midiInGetNumDevs [WINMM.64]
2237 UINT WINAPI midiInGetNumDevs(void)
2239 return midiInGetNumDevs16();
2242 /**************************************************************************
2243 * midiInGetNumDevs [MMSYSTEM.301]
2245 UINT16 WINAPI midiInGetNumDevs16(void)
2248 TRACE(mmsys, "midiInGetNumDevs\n");
2249 count += midMessage(0, MIDM_GETNUMDEVS, 0L, 0L, 0L);
2250 TRACE(mmsys, "midiInGetNumDevs return %u \n", count);
2254 /**************************************************************************
2255 * midiInGetDevCaps [WINMM.60]
2257 UINT WINAPI midiInGetDevCapsW(UINT uDeviceID, LPMIDIINCAPSW lpCaps, UINT uSize)
2260 UINT ret = midiInGetDevCaps16(uDeviceID, &mic16,uSize);
2262 lpCaps->wMid = mic16.wMid;
2263 lpCaps->wPid = mic16.wPid;
2264 lpCaps->vDriverVersion = mic16.vDriverVersion;
2265 lstrcpyAtoW(lpCaps->szPname, mic16.szPname);
2266 lpCaps->dwSupport = mic16.dwSupport;
2270 /**************************************************************************
2271 * midiInGetDevCaps [WINMM.59]
2273 UINT WINAPI midiInGetDevCapsA(UINT uDeviceID, LPMIDIINCAPSA lpCaps, UINT uSize)
2276 UINT ret = midiInGetDevCaps16(uDeviceID, &mic16,uSize);
2278 lpCaps->wMid = mic16.wMid;
2279 lpCaps->wPid = mic16.wPid;
2280 lpCaps->vDriverVersion = mic16.vDriverVersion;
2281 strcpy(lpCaps->szPname, mic16.szPname);
2282 lpCaps->dwSupport = mic16.dwSupport;
2286 /**************************************************************************
2287 * midiInGetDevCaps [MMSYSTEM.302]
2289 UINT16 WINAPI midiInGetDevCaps16(UINT16 uDeviceID,
2290 LPMIDIINCAPS16 lpCaps, UINT16 uSize)
2292 TRACE(mmsys, "midiInGetDevCaps\n");
2293 return midMessage(uDeviceID, MIDM_GETDEVCAPS, 0, (DWORD)lpCaps, uSize);
2296 /**************************************************************************
2297 * midiInGetErrorText [WINMM.62]
2299 UINT WINAPI midiInGetErrorTextW(UINT uError, LPWSTR lpText, UINT uSize)
2301 LPSTR xstr = HeapAlloc(GetProcessHeap(), 0,uSize);
2302 UINT ret = midiInGetErrorText16(uError,xstr,uSize);
2303 lstrcpyAtoW(lpText,xstr);
2304 HeapFree(GetProcessHeap(), 0,xstr);
2308 /**************************************************************************
2309 * midiInGetErrorText [WINMM.61]
2311 UINT WINAPI midiInGetErrorTextA(UINT uError, LPSTR lpText, UINT uSize)
2313 return midiInGetErrorText16(uError, lpText,uSize);
2316 /**************************************************************************
2317 * midiInGetErrorText [MMSYSTEM.303]
2319 UINT16 WINAPI midiInGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
2321 TRACE(mmsys, "midiInGetErrorText\n");
2322 return (midiGetErrorText(uError, lpText, uSize));
2325 /**************************************************************************
2326 * midiInOpen [WINMM.66]
2328 UINT WINAPI midiInOpen(HMIDIIN* lphMidiIn, UINT uDeviceID,
2329 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
2332 UINT ret = midiInOpen16(&xhmid16,uDeviceID, dwCallback, dwInstance,
2333 CALLBACK32CONV(dwFlags));
2335 *lphMidiIn = xhmid16;
2339 /**************************************************************************
2340 * midiInOpen [MMSYSTEM.304]
2342 UINT16 WINAPI midiInOpen16(HMIDIIN16* lphMidiIn, UINT16 uDeviceID,
2343 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
2346 LPMIDIOPENDESC lpDesc;
2348 BOOL bMapperFlg = FALSE;
2350 if (lphMidiIn != NULL)
2352 TRACE(mmsys, "(%p, %d, %08lX, %08lX, %08lX);\n",
2353 lphMidiIn, uDeviceID, dwCallback, dwInstance, dwFlags);
2354 if (uDeviceID == (UINT16)MIDI_MAPPER) {
2355 TRACE(mmsys, "MIDI_MAPPER mode requested !\n");
2359 hMidiIn = USER_HEAP_ALLOC(sizeof(MIDIOPENDESC));
2360 if (lphMidiIn != NULL)
2361 *lphMidiIn = hMidiIn;
2362 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2364 return MMSYSERR_NOMEM;
2365 lpDesc->hMidi = hMidiIn;
2366 lpDesc->dwCallback = dwCallback;
2367 lpDesc->dwInstance = dwInstance;
2369 while (uDeviceID < MAXMIDIDRIVERS) {
2370 dwRet = midMessage(uDeviceID, MIDM_OPEN,
2371 lpDesc->dwInstance, (DWORD)lpDesc, dwFlags);
2372 if (dwRet == MMSYSERR_NOERROR)
2377 TRACE(mmsys, "MIDI_MAPPER mode ! try next driver...\n");
2379 lpDesc->wDevID = uDeviceID;
2383 /**************************************************************************
2384 * midiInClose [WINMM.58]
2386 UINT WINAPI midiInClose(HMIDIIN hMidiIn)
2388 return midiInClose16(hMidiIn);
2391 /**************************************************************************
2392 * midiInClose [MMSYSTEM.305]
2394 UINT16 WINAPI midiInClose16(HMIDIIN16 hMidiIn)
2396 LPMIDIOPENDESC lpDesc;
2397 TRACE(mmsys, "(%04X)\n", hMidiIn);
2398 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2399 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2400 return midMessage(lpDesc->wDevID, MIDM_CLOSE, lpDesc->dwInstance, 0L, 0L);
2403 /**************************************************************************
2404 * midiInPrepareHeader [WINMM.67]
2406 UINT WINAPI midiInPrepareHeader(HMIDIIN hMidiIn,
2407 MIDIHDR16* lpMidiInHdr, UINT uSize)
2409 LPMIDIOPENDESC lpDesc;
2411 TRACE(mmsys, "(%04X, %p, %d)\n",
2412 hMidiIn, lpMidiInHdr, uSize);
2413 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2414 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2415 lpMidiInHdr->reserved = (DWORD)lpMidiInHdr->lpData;
2416 return midMessage(lpDesc->wDevID, MIDM_PREPARE, lpDesc->dwInstance,
2417 (DWORD)lpMidiInHdr, (DWORD)uSize);
2420 /**************************************************************************
2421 * midiInPrepareHeader [MMSYSTEM.306]
2423 UINT16 WINAPI midiInPrepareHeader16(HMIDIIN16 hMidiIn,
2424 MIDIHDR16* lpMidiInHdr, UINT16 uSize)
2426 LPMIDIOPENDESC lpDesc;
2428 TRACE(mmsys, "(%04X, %p, %d)\n",
2429 hMidiIn, lpMidiInHdr, uSize);
2430 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2431 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2432 lpMidiInHdr->reserved = (DWORD)PTR_SEG_TO_LIN(lpMidiInHdr->lpData);
2433 return midMessage(lpDesc->wDevID, MIDM_PREPARE, lpDesc->dwInstance,
2434 (DWORD)lpMidiInHdr, (DWORD)uSize);
2437 /**************************************************************************
2438 * midiInUnprepareHeader [WINMM.71]
2440 UINT WINAPI midiInUnprepareHeader(HMIDIIN hMidiIn,
2441 MIDIHDR16* lpMidiInHdr, UINT uSize)
2443 return midiInUnprepareHeader16(hMidiIn, lpMidiInHdr,uSize);
2446 /**************************************************************************
2447 * midiInUnprepareHeader [MMSYSTEM.307]
2449 UINT16 WINAPI midiInUnprepareHeader16(HMIDIIN16 hMidiIn,
2450 MIDIHDR16* lpMidiInHdr, UINT16 uSize)
2452 LPMIDIOPENDESC lpDesc;
2453 TRACE(mmsys, "(%04X, %p, %d)\n",
2454 hMidiIn, lpMidiInHdr, uSize);
2455 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2456 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2457 return midMessage(lpDesc->wDevID, MIDM_UNPREPARE, lpDesc->dwInstance,
2458 (DWORD)lpMidiInHdr, (DWORD)uSize);
2461 /**************************************************************************
2462 * midiInAddBuffer [WINMM.57]
2464 UINT WINAPI midiInAddBuffer(HMIDIIN hMidiIn,
2465 MIDIHDR16* lpMidiInHdr, UINT uSize)
2467 return midiInAddBuffer16(hMidiIn, lpMidiInHdr,uSize);
2470 /**************************************************************************
2471 * midiInAddBuffer [MMSYSTEM.308]
2473 UINT16 WINAPI midiInAddBuffer16(HMIDIIN16 hMidiIn,
2474 MIDIHDR16* lpMidiInHdr, UINT16 uSize)
2476 TRACE(mmsys, "midiInAddBuffer\n");
2480 /**************************************************************************
2481 * midiInStart [WINMM.69]
2483 UINT WINAPI midiInStart(HMIDIIN hMidiIn)
2485 return midiInStart16(hMidiIn);
2488 /**************************************************************************
2489 * midiInStart [MMSYSTEM.309]
2491 UINT16 WINAPI midiInStart16(HMIDIIN16 hMidiIn)
2493 LPMIDIOPENDESC lpDesc;
2495 TRACE(mmsys, "(%04X)\n", hMidiIn);
2496 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2498 return MMSYSERR_INVALHANDLE;
2499 return midMessage(lpDesc->wDevID, MIDM_START, lpDesc->dwInstance, 0L, 0L);
2502 /**************************************************************************
2503 * midiInStop [WINMM.70]
2505 UINT WINAPI midiInStop(HMIDIIN hMidiIn)
2507 return midiInStop16(hMidiIn);
2510 /**************************************************************************
2511 * midiInStop [MMSYSTEM.310]
2513 UINT16 WINAPI midiInStop16(HMIDIIN16 hMidiIn)
2515 LPMIDIOPENDESC lpDesc;
2517 TRACE(mmsys, "(%04X)\n", hMidiIn);
2518 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2520 return MMSYSERR_INVALHANDLE;
2521 return midMessage(lpDesc->wDevID, MIDM_STOP, lpDesc->dwInstance, 0L, 0L);
2524 /**************************************************************************
2525 * midiInReset [WINMM.68]
2527 UINT WINAPI midiInReset(HMIDIIN hMidiIn)
2529 return midiInReset16(hMidiIn);
2532 /**************************************************************************
2533 * midiInReset [MMSYSTEM.311]
2535 UINT16 WINAPI midiInReset16(HMIDIIN16 hMidiIn)
2537 LPMIDIOPENDESC lpDesc;
2539 TRACE(mmsys, "(%04X)\n", hMidiIn);
2540 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2542 return MMSYSERR_INVALHANDLE;
2543 return midMessage(lpDesc->wDevID, MIDM_RESET, lpDesc->dwInstance, 0L, 0L);
2546 /**************************************************************************
2547 * midiInGetID [WINMM.63]
2549 UINT WINAPI midiInGetID(HMIDIIN hMidiIn, UINT* lpuDeviceID)
2551 LPMIDIOPENDESC lpDesc;
2553 TRACE(mmsys, "(%04X, %p)\n", hMidiIn, lpuDeviceID);
2554 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2556 return MMSYSERR_INVALHANDLE;
2557 if (lpuDeviceID == NULL)
2558 return MMSYSERR_INVALPARAM;
2559 *lpuDeviceID = lpDesc->wDevID;
2561 return MMSYSERR_NOERROR;
2564 /**************************************************************************
2565 * midiInGetID [MMSYSTEM.312]
2567 UINT16 WINAPI midiInGetID16(HMIDIIN16 hMidiIn, UINT16* lpuDeviceID)
2569 LPMIDIOPENDESC lpDesc;
2571 TRACE(mmsys, "(%04X, %p)\n", hMidiIn, lpuDeviceID);
2572 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2574 return MMSYSERR_INVALHANDLE;
2575 if (lpuDeviceID == NULL)
2576 return MMSYSERR_INVALPARAM;
2577 *lpuDeviceID = lpDesc->wDevID;
2579 return MMSYSERR_NOERROR;
2582 /**************************************************************************
2583 * midiInMessage [WINMM.65]
2585 DWORD WINAPI midiInMessage(HMIDIIN hMidiIn, UINT uMessage,
2586 DWORD dwParam1, DWORD dwParam2)
2588 LPMIDIOPENDESC lpDesc;
2590 TRACE(mmsys, "(%04X, %04X, %08lX, %08lX)\n",
2591 hMidiIn, uMessage, dwParam1, dwParam2);
2592 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2594 return MMSYSERR_INVALHANDLE;
2598 FIXME(mmsys,"can't handle MIDM_OPEN!\n");
2600 case MIDM_GETDEVCAPS:
2601 return midiInGetDevCapsA(hMidiIn, (LPMIDIINCAPSA)dwParam1, dwParam2);
2602 case MIDM_GETNUMDEVS:
2607 /* no argument conversion needed */
2610 return midiInPrepareHeader(hMidiIn, (LPMIDIHDR16)dwParam1, dwParam2);
2611 case MIDM_UNPREPARE:
2612 return midiInUnprepareHeader(hMidiIn, (LPMIDIHDR16)dwParam1, dwParam2);
2613 case MIDM_ADDBUFFER:
2614 return midiInAddBuffer(hMidiIn, (LPMIDIHDR16)dwParam1, dwParam2);
2616 ERR(mmsys,"(%04x,%04x,%08lx,%08lx): unhandled message\n",
2617 hMidiIn,uMessage, dwParam1, dwParam2);
2620 return midMessage(0, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
2623 /**************************************************************************
2624 * midiInMessage [MMSYSTEM.313]
2626 DWORD WINAPI midiInMessage16(HMIDIIN16 hMidiIn, UINT16 uMessage,
2627 DWORD dwParam1, DWORD dwParam2)
2629 LPMIDIOPENDESC lpDesc;
2631 TRACE(mmsys, "(%04X, %04X, %08lX, %08lX)\n", hMidiIn, uMessage, dwParam1, dwParam2);
2633 lpDesc = (LPMIDIOPENDESC) USER_HEAP_LIN_ADDR(hMidiIn);
2634 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
2637 WARN(mmsys,"can't handle MIDM_OPEN!\n");
2639 case MIDM_GETDEVCAPS:
2640 return midiInGetDevCaps16(hMidiIn, (LPMIDIINCAPS16)PTR_SEG_TO_LIN(dwParam1), dwParam2);
2641 case MIDM_GETNUMDEVS:
2646 /* no argument conversion needed */
2649 return midiInPrepareHeader16(hMidiIn, (LPMIDIHDR16)PTR_SEG_TO_LIN(dwParam1), dwParam2);
2650 case MIDM_UNPREPARE:
2651 return midiInUnprepareHeader16(hMidiIn, (LPMIDIHDR16)PTR_SEG_TO_LIN(dwParam1), dwParam2);
2652 case MIDM_ADDBUFFER:
2653 return midiInAddBuffer16(hMidiIn, (LPMIDIHDR16)PTR_SEG_TO_LIN(dwParam1), dwParam2);
2655 ERR(mmsys,"(%04x,%04x,%08lx,%08lx): unhandled message\n",
2656 hMidiIn,uMessage, dwParam1, dwParam2);
2659 return midMessage(0, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
2662 #define MIDI_STREAM_MAGIC 0xC9080F17
2672 LPMIDIHDR lpMidiHdr;
2675 /**************************************************************************
2676 * MMSYSTEM_MidiStreamPlayer [internal]
2678 static void WINE_UNUSED MMSYSTEM_MidiStreamPlayer(WINE_MIDIStream* ms)
2680 /* FIXME: should I sleep a bit when there is no pending lpMidiHdr ?
2681 * => provide a better synchronization system
2682 * midiStreamPause/midiStreamRestart should freeze/thaw this thread
2683 * global resource should guard access to ms->lpMidiHdr list, or
2684 * use a MB to send new LPMIDIHDR
2685 * an empty ms->lpMidiHdr list should freeze this thread
2688 if (ms->dwStatus && ms->lpMidiHdr) {
2689 LPMIDIEVENT me = (LPMIDIEVENT)(ms->lpMidiHdr->lpData + ms->lpMidiHdr->dwOffset);
2691 FIXME(mmsys, "Should wait for current time to be in sync with me->dwDeltaTime\n");
2693 if (me->dwEvent & MEVT_F_CALLBACK) {
2694 WARN(mmsys, "Should generate callback when encountering F_CALLBACK flagged midi events...\n");
2696 switch (MEVT_EVENTTYPE(me->dwEvent)) {
2698 /* do nothing, skip bytes */
2701 WARN(mmsys, "NIY: sending Sysex Event");
2706 midiOutShortMsg(ms->hDevice, MEVT_EVENTPARM(me->dwEvent));
2709 ms->dwTempo = MEVT_EVENTPARM(me->dwEvent);
2714 ms->lpMidiHdr->dwOffset += sizeof(MIDIEVENT);
2715 if (me->dwEvent & MEVT_F_LONG) {
2716 ms->lpMidiHdr->dwOffset += MEVT_EVENTPARM(me->dwEvent);
2718 if (ms->lpMidiHdr->dwOffset >= ms->lpMidiHdr->dwBufferLength) {
2719 ms->lpMidiHdr->dwFlags |= MHDR_DONE;
2720 ms->lpMidiHdr->dwFlags &= ~MHDR_INQUEUE;
2721 ms->lpMidiHdr = (LPMIDIHDR)ms->lpMidiHdr->lpNext;
2722 WARN(mmsys, "Should generate callback when done with MIDIHDR...\n");
2724 FIXME(mmsys, "Should accordingly update ms->dwMS with me->dwDeltaTime\n");
2729 /**************************************************************************
2730 * midiStreamClose [WINMM.90]
2732 MMRESULT WINAPI midiStreamClose(HMIDISTRM hms)
2734 WINE_MIDIStream* ms;
2736 TRACE(midi, "(%08x)!\n", hms);
2738 ms = (WINE_MIDIStream*)hms;
2739 if (!ms || ms->dwMagic != MIDI_STREAM_MAGIC)
2740 return MMSYSERR_INVALHANDLE;
2744 return MMSYSERR_NOTSUPPORTED;
2747 /**************************************************************************
2748 * midiStreamOpen [WINMM.91]
2750 MMRESULT WINAPI midiStreamOpen(HMIDISTRM* phms, LPUINT lpuDeviceID,
2751 DWORD cMidi, DWORD dwCallback,
2752 DWORD dwInstance, DWORD fdwOpen)
2754 WINE_MIDIStream* ms;
2756 TRACE(midi, "(%p,%p,%ld, 0x%08lx, 0x%08lx, 0x%08lx), stub!\n",
2757 phms, lpuDeviceID,cMidi, dwCallback, dwInstance, fdwOpen);
2759 if (cMidi != 1 || phms == NULL || lpuDeviceID == NULL)
2760 return MMSYSERR_INVALPARAM;
2762 ms = malloc(sizeof(WINE_MIDIStream));
2763 *phms = (HMIDISTRM)ms;
2764 ms->dwMagic = MIDI_STREAM_MAGIC;
2765 ms->dwTempo = 50000; /* FIXME */
2766 ms->dwTimeDiv = 1; /* FIXME */
2770 /* FIXME is this correct ? */
2772 /* FIXME is this correct ? */
2773 return midiOutOpen(&(ms->hDevice), *lpuDeviceID, dwCallback, dwInstance, fdwOpen);
2776 /**************************************************************************
2777 * midiStreamOut [WINMM.92]
2779 MMRESULT WINAPI midiStreamOut(HMIDISTRM hms, LPMIDIHDR16 lpMidiHdr, UINT cbMidiHdr)
2781 FIXME(midi, "(%08x, %p, %u) stub!\n", hms, lpMidiHdr, cbMidiHdr);
2782 return MMSYSERR_NOTSUPPORTED;
2785 /**************************************************************************
2786 * midiStreamPause [WINMM.93]
2788 MMRESULT WINAPI midiStreamPause(HMIDISTRM hms)
2790 WINE_MIDIStream* ms;
2792 TRACE(midi, "(%08x)!\n", hms);
2794 ms = (WINE_MIDIStream*)hms;
2795 if (!ms || ms->dwMagic != MIDI_STREAM_MAGIC)
2796 return MMSYSERR_INVALHANDLE;
2799 return MMSYSERR_NOERROR;
2802 /**************************************************************************
2803 * midiStreamPosition [WINMM.94]
2805 MMRESULT WINAPI midiStreamPosition(HMIDISTRM hms, LPMMTIME lpMMT, UINT cbmmt)
2807 WINE_MIDIStream* ms;
2808 DWORD ret = MMSYSERR_NOERROR;
2810 FIXME(midi, "(%08x, %p, %u) stub!\n", hms, lpMMT, cbmmt);
2812 ms = (WINE_MIDIStream*)hms;
2814 if (!ms || ms->dwMagic != MIDI_STREAM_MAGIC) {
2815 ret = MMSYSERR_INVALHANDLE;
2816 } else if (lpMMT == NULL || cbmmt != sizeof(MMTIME)) {
2817 ret = MMSYSERR_INVALPARAM;
2819 switch (lpMMT->wType) {
2821 lpMMT->u.ms = ms->dwMS;
2824 lpMMT->wType = TIME_MS;
2825 ret = MMSYSERR_INVALPARAM;
2831 /**************************************************************************
2832 * midiStreamProperty [WINMM.95]
2834 MMRESULT WINAPI midiStreamProperty(HMIDISTRM hms, LPBYTE lpPropData, DWORD dwProperty)
2836 WINE_MIDIStream* ms = (WINE_MIDIStream*)hms;
2837 MMRESULT ret = MMSYSERR_NOERROR;
2839 TRACE(midi, "(%08x, %p, %lx)\n", hms, lpPropData, dwProperty);
2841 if (!ms || ms->dwMagic != MIDI_STREAM_MAGIC) {
2842 ret = MMSYSERR_INVALHANDLE;
2843 } else if ((dwProperty & (MIDIPROP_GET|MIDIPROP_SET)) == 0) {
2844 return MMSYSERR_INVALPARAM;
2845 } else if (dwProperty & MIDIPROP_TEMPO) {
2846 MIDIPROPTEMPO* mpt = (MIDIPROPTEMPO*)lpPropData;
2848 if (sizeof(MIDIPROPTEMPO) != mpt->cbStruct) {
2849 ret = MMSYSERR_INVALPARAM;
2850 } else if (dwProperty & MIDIPROP_GET) {
2851 ms->dwTempo = mpt->dwTempo;
2852 } else if (dwProperty & MIDIPROP_SET) {
2853 mpt->dwTempo = ms->dwTempo;
2855 } else if (dwProperty & MIDIPROP_TIMEDIV) {
2856 MIDIPROPTIMEDIV* mptd = (MIDIPROPTIMEDIV*)lpPropData;
2858 if (sizeof(MIDIPROPTIMEDIV) != mptd->cbStruct) {
2859 ret = MMSYSERR_INVALPARAM;
2860 } else if (dwProperty & MIDIPROP_GET) {
2861 ms->dwTimeDiv = mptd->dwTimeDiv;
2862 } else if (dwProperty & MIDIPROP_SET) {
2863 mptd->dwTimeDiv = ms->dwTimeDiv;
2866 ret = MMSYSERR_INVALPARAM;
2872 /**************************************************************************
2873 * midiStreamRestart [WINMM.96]
2875 MMRESULT WINAPI midiStreamRestart(HMIDISTRM hms)
2877 WINE_MIDIStream* ms;
2879 TRACE(midi, "(%08x)!\n", hms);
2881 ms = (WINE_MIDIStream*)hms;
2882 if (!ms || ms->dwMagic != MIDI_STREAM_MAGIC)
2883 return MMSYSERR_INVALHANDLE;
2886 return MMSYSERR_NOERROR;
2889 /**************************************************************************
2890 * midiStreamStop [WINMM.97]
2892 MMRESULT WINAPI midiStreamStop(HMIDISTRM hms)
2894 FIXME(midi, "(%08x stub!)\n", hms);
2895 return MMSYSERR_NOTSUPPORTED;
2898 /**************************************************************************
2899 * midiStreamClose [MMSYSTEM.252]
2901 MMRESULT16 WINAPI midiStreamClose16(HMIDISTRM16 hms)
2903 return midiStreamClose(hms);
2906 /**************************************************************************
2907 * midiStreamOpen [MMSYSTEM.251]
2909 MMRESULT16 WINAPI midiStreamOpen16(HMIDISTRM16* phms, LPUINT16 devid,
2910 DWORD cMidi, DWORD dwCallback,
2911 DWORD dwInstance, DWORD fdwOpen)
2917 if (!phms || !devid)
2918 return MMSYSERR_INVALPARAM;
2920 ret = midiStreamOpen(&hms32, &devid32, cMidi, dwCallback, dwInstance, fdwOpen);
2926 /**************************************************************************
2927 * midiStreamOut [MMSYSTEM.254]
2929 MMRESULT16 WINAPI midiStreamOut16(HMIDISTRM16 hms, LPMIDIHDR16 lpMidiHdr, UINT16 cbMidiHdr)
2931 return midiStreamOut(hms, lpMidiHdr, cbMidiHdr);
2934 /**************************************************************************
2935 * midiStreamPause [MMSYSTEM.255]
2937 MMRESULT16 WINAPI midiStreamPause16(HMIDISTRM16 hms)
2939 return midiStreamPause(hms);
2942 /**************************************************************************
2943 * midiStreamPosition [MMSYSTEM.253]
2945 MMRESULT16 WINAPI midiStreamPosition16(HMIDISTRM16 hms, LPMMTIME16 lpmmt, UINT16 cbmmt)
2951 return MMSYSERR_INVALPARAM;
2952 MMSYSTEM_MMTIME16to32(&mmt32, lpmmt);
2953 ret = midiStreamPosition(hms, &mmt32, cbmmt);
2954 MMSYSTEM_MMTIME32to16(lpmmt, &mmt32);
2958 /**************************************************************************
2959 * midiStreamProperty [MMSYSTEM.250]
2961 MMRESULT16 WINAPI midiStreamProperty16(HMIDISTRM16 hms, LPBYTE lpPropData, DWORD dwProperty)
2963 return midiStreamProperty(hms, lpPropData, dwProperty);
2966 /**************************************************************************
2967 * midiStreamRestart [MMSYSTEM.256]
2969 MMRESULT16 WINAPI midiStreamRestart16(HMIDISTRM16 hms)
2971 return midiStreamRestart(hms);
2974 /**************************************************************************
2975 * midiStreamStop [MMSYSTEM.257]
2977 MMRESULT16 WINAPI midiStreamStop16(HMIDISTRM16 hms)
2979 return midiStreamStop(hms);
2982 /**************************************************************************
2983 * waveOutGetNumDevs [MMSYSTEM.401]
2985 UINT WINAPI waveOutGetNumDevs()
2987 return waveOutGetNumDevs16();
2990 /**************************************************************************
2991 * waveOutGetNumDevs [WINMM.167]
2993 UINT16 WINAPI waveOutGetNumDevs16()
2996 TRACE(mmsys, "waveOutGetNumDevs\n");
2997 /* FIXME: I'm not sure MCI_FirstDevID() is correct */
2998 count += wodMessage(MCI_FirstDevID(), WODM_GETNUMDEVS, 0L, 0L, 0L);
2999 TRACE(mmsys, "waveOutGetNumDevs return %u \n", count);
3003 /**************************************************************************
3004 * waveOutGetDevCaps [MMSYSTEM.402]
3006 UINT16 WINAPI waveOutGetDevCaps16(UINT16 uDeviceID, LPWAVEOUTCAPS16 lpCaps,
3009 if (uDeviceID > waveOutGetNumDevs16() - 1) return MMSYSERR_BADDEVICEID;
3010 if (uDeviceID == (UINT16)WAVE_MAPPER) return MMSYSERR_BADDEVICEID; /* FIXME: do we have a wave mapper ? */
3011 TRACE(mmsys, "waveOutGetDevCaps\n");
3012 return wodMessage(uDeviceID, WODM_GETDEVCAPS, 0L, (DWORD)lpCaps, uSize);
3015 /**************************************************************************
3016 * waveOutGetDevCapsA [WINMM.162]
3018 UINT WINAPI waveOutGetDevCapsA(UINT uDeviceID, LPWAVEOUTCAPSA lpCaps,
3021 WAVEOUTCAPS16 woc16;
3022 UINT16 ret = waveOutGetDevCaps16(uDeviceID, &woc16, sizeof(woc16));
3024 lpCaps->wMid = woc16.wMid;
3025 lpCaps->wPid = woc16.wPid;
3026 lpCaps->vDriverVersion = woc16.vDriverVersion;
3027 strcpy(lpCaps->szPname, woc16.szPname);
3028 lpCaps->dwFormats = woc16.dwFormats;
3029 lpCaps->wChannels = woc16.wChannels;
3030 lpCaps->dwSupport = woc16.dwSupport;
3034 /**************************************************************************
3035 * waveOutGetDevCapsW [WINMM.163]
3037 UINT WINAPI waveOutGetDevCapsW(UINT uDeviceID, LPWAVEOUTCAPSW lpCaps,
3040 WAVEOUTCAPS16 woc16;
3041 UINT ret = waveOutGetDevCaps16(uDeviceID, &woc16, sizeof(woc16));
3043 lpCaps->wMid = woc16.wMid;
3044 lpCaps->wPid = woc16.wPid;
3045 lpCaps->vDriverVersion = woc16.vDriverVersion;
3046 lstrcpyAtoW(lpCaps->szPname, woc16.szPname);
3047 lpCaps->dwFormats = woc16.dwFormats;
3048 lpCaps->wChannels = woc16.wChannels;
3049 lpCaps->dwSupport = woc16.dwSupport;
3053 /**************************************************************************
3054 * waveOutGetErrorText [MMSYSTEM.403]
3056 UINT16 WINAPI waveOutGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
3058 TRACE(mmsys, "waveOutGetErrorText\n");
3059 return(waveGetErrorText(uError, lpText, uSize));
3062 /**************************************************************************
3063 * waveOutGetErrorTextA [WINMM.164]
3065 UINT WINAPI waveOutGetErrorTextA(UINT uError, LPSTR lpText, UINT uSize)
3067 return(waveOutGetErrorText16(uError, lpText, uSize));
3070 /**************************************************************************
3071 * waveOutGetErrorTextW [WINMM.165]
3073 UINT WINAPI waveOutGetErrorTextW(UINT uError, LPWSTR lpText, UINT uSize)
3075 LPSTR xstr = HeapAlloc(GetProcessHeap(), 0,uSize);
3076 UINT ret = waveOutGetErrorTextA(uError, xstr, uSize);
3078 lstrcpyAtoW(lpText,xstr);
3079 HeapFree(GetProcessHeap(), 0,xstr);
3083 /**************************************************************************
3084 * waveGetErrorText [internal]
3086 static UINT16 waveGetErrorText(UINT16 uError, LPSTR lpText, UINT16 uSize)
3089 TRACE(mmsys, "(%04X, %p, %d);\n",
3090 uError, lpText, uSize);
3091 if ((lpText == NULL) || (uSize < 1)) return(FALSE);
3094 case MMSYSERR_NOERROR:
3095 msgptr = "The specified command was carried out.";
3097 case MMSYSERR_ERROR:
3098 msgptr = "Undefined external error.";
3100 case MMSYSERR_BADDEVICEID:
3101 msgptr = "A device ID has been used that is out of range for your system.";
3103 case MMSYSERR_NOTENABLED:
3104 msgptr = "The driver was not enabled.";
3106 case MMSYSERR_ALLOCATED:
3107 msgptr = "The specified device is already in use. Wait until it is free, and then try again.";
3109 case MMSYSERR_INVALHANDLE:
3110 msgptr = "The specified device handle is invalid.";
3112 case MMSYSERR_NODRIVER:
3113 msgptr = "There is no driver installed on your system !\n";
3115 case MMSYSERR_NOMEM:
3116 msgptr = "Not enough memory available for this task. Quit one or more applications to increase available memory, and then try again.";
3118 case MMSYSERR_NOTSUPPORTED:
3119 msgptr = "This function is not supported. Use the Capabilities function to determine which functions and messages the driver supports.";
3121 case MMSYSERR_BADERRNUM:
3122 msgptr = "An error number was specified that is not defined in the system.";
3124 case MMSYSERR_INVALFLAG:
3125 msgptr = "An invalid flag was passed to a system function.";
3127 case MMSYSERR_INVALPARAM:
3128 msgptr = "An invalid parameter was passed to a system function.";
3130 case WAVERR_BADFORMAT:
3131 msgptr = "The specified format is not supported or cannot be translated. Use the Capabilities function to determine the supported formats";
3133 case WAVERR_STILLPLAYING:
3134 msgptr = "Cannot perform this operation while media data is still playing. Reset the device, or wait until the data is finished playing.";
3136 case WAVERR_UNPREPARED:
3137 msgptr = "The wave header was not prepared. Use the Prepare function to prepare the header, and then try again.";
3140 msgptr = "Cannot open the device without using the WAVE_ALLOWSYNC flag. Use the flag, and then try again.";
3143 msgptr = "Unknown MMSYSTEM Error !\n";
3146 lstrcpynA(lpText, msgptr, uSize);
3150 /**************************************************************************
3151 * waveOutOpen [WINMM.173]
3152 * All the args/structs have the same layout as the win16 equivalents
3154 UINT WINAPI waveOutOpen(HWAVEOUT* lphWaveOut, UINT uDeviceID,
3155 const LPWAVEFORMATEX lpFormat, DWORD dwCallback,
3156 DWORD dwInstance, DWORD dwFlags)
3159 UINT ret = waveOutOpen16(&hwo16,uDeviceID, lpFormat, dwCallback, dwInstance,
3160 CALLBACK32CONV(dwFlags));
3162 if (lphWaveOut) *lphWaveOut=hwo16;
3166 /**************************************************************************
3167 * waveOutOpen [MMSYSTEM.404]
3169 UINT16 WINAPI waveOutOpen16(HWAVEOUT16* lphWaveOut, UINT16 uDeviceID,
3170 const LPWAVEFORMATEX lpFormat, DWORD dwCallback,
3171 DWORD dwInstance, DWORD dwFlags)
3173 HWAVEOUT16 hWaveOut;
3174 LPWAVEOPENDESC lpDesc;
3176 BOOL bMapperFlg = FALSE;
3178 TRACE(mmsys, "(%p, %d, %p, %08lX, %08lX, %08lX);\n",
3179 lphWaveOut, uDeviceID, lpFormat, dwCallback, dwInstance, dwFlags);
3180 if (dwFlags & WAVE_FORMAT_QUERY)
3181 TRACE(mmsys, "WAVE_FORMAT_QUERY requested !\n");
3182 if (uDeviceID == (UINT16)WAVE_MAPPER) {
3183 TRACE(mmsys, "WAVE_MAPPER mode requested !\n");
3187 if (lpFormat == NULL) return WAVERR_BADFORMAT;
3189 hWaveOut = USER_HEAP_ALLOC(sizeof(WAVEOPENDESC));
3190 if (lphWaveOut != NULL) *lphWaveOut = hWaveOut;
3191 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3192 if (lpDesc == NULL) return MMSYSERR_NOMEM;
3193 lpDesc->hWave = hWaveOut;
3194 lpDesc->lpFormat = (LPWAVEFORMAT)lpFormat; /* should the struct be copied iso pointer? */
3195 lpDesc->dwCallBack = dwCallback;
3196 lpDesc->dwInstance = dwInstance;
3197 if (uDeviceID >= MAXWAVEDRIVERS)
3199 while (uDeviceID < MAXWAVEDRIVERS) {
3200 dwRet = wodMessage(uDeviceID, WODM_OPEN,
3201 lpDesc->dwInstance, (DWORD)lpDesc, dwFlags);
3202 if (dwRet == MMSYSERR_NOERROR) break;
3203 if (!bMapperFlg) break;
3205 TRACE(mmsys, "WAVE_MAPPER mode ! try next driver...\n");
3207 lpDesc->uDeviceID = uDeviceID; /* save physical Device ID */
3208 if (dwFlags & WAVE_FORMAT_QUERY) {
3209 TRACE(mmsys, "End of WAVE_FORMAT_QUERY !\n");
3210 dwRet = waveOutClose(hWaveOut);
3215 /**************************************************************************
3216 * waveOutClose [WINMM.161]
3218 UINT WINAPI waveOutClose(HWAVEOUT hWaveOut)
3220 return waveOutClose16(hWaveOut);
3223 /**************************************************************************
3224 * waveOutClose [MMSYSTEM.405]
3226 UINT16 WINAPI waveOutClose16(HWAVEOUT16 hWaveOut)
3228 LPWAVEOPENDESC lpDesc;
3230 TRACE(mmsys, "(%04X)\n", hWaveOut);
3232 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3233 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3234 return wodMessage(lpDesc->uDeviceID, WODM_CLOSE, lpDesc->dwInstance, 0L, 0L);
3237 /**************************************************************************
3238 * waveOutPrepareHeader [WINMM.175]
3240 UINT WINAPI waveOutPrepareHeader(HWAVEOUT hWaveOut,
3241 WAVEHDR* lpWaveOutHdr, UINT uSize)
3243 LPWAVEOPENDESC lpDesc;
3245 TRACE(mmsys, "(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
3247 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3248 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3249 lpWaveOutHdr->reserved = (DWORD)lpWaveOutHdr->lpData;
3250 return wodMessage(lpDesc->uDeviceID, WODM_PREPARE, lpDesc->dwInstance,
3251 (DWORD)lpWaveOutHdr,uSize);
3254 /**************************************************************************
3255 * waveOutPrepareHeader [MMSYSTEM.406]
3257 UINT16 WINAPI waveOutPrepareHeader16(HWAVEOUT16 hWaveOut,
3258 WAVEHDR* lpWaveOutHdr, UINT16 uSize)
3260 LPWAVEOPENDESC lpDesc;
3263 TRACE(mmsys, "(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
3265 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3266 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3267 lpWaveOutHdr->reserved = (DWORD)lpWaveOutHdr->lpData;
3268 lpWaveOutHdr->lpData = PTR_SEG_TO_LIN(lpWaveOutHdr->lpData);
3269 ret = wodMessage(lpDesc->uDeviceID, WODM_PREPARE, lpDesc->dwInstance,
3270 (DWORD)lpWaveOutHdr,uSize);
3271 lpWaveOutHdr->lpData = lpWaveOutHdr->lpData;
3275 /**************************************************************************
3276 * waveOutUnprepareHeader [WINMM.181]
3278 UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut,
3279 WAVEHDR* lpWaveOutHdr, UINT uSize)
3281 LPWAVEOPENDESC lpDesc;
3283 TRACE(mmsys, "(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
3285 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3286 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3287 lpWaveOutHdr->reserved = (DWORD)lpWaveOutHdr->lpData;
3288 return wodMessage(lpDesc->uDeviceID, WODM_UNPREPARE, lpDesc->dwInstance,
3289 (DWORD)lpWaveOutHdr, uSize);
3292 /**************************************************************************
3293 * waveOutUnprepareHeader [MMSYSTEM.407]
3295 UINT16 WINAPI waveOutUnprepareHeader16(HWAVEOUT16 hWaveOut,
3296 WAVEHDR* lpWaveOutHdr, UINT16 uSize)
3298 LPWAVEOPENDESC lpDesc;
3301 TRACE(mmsys, "(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
3303 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3304 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3305 lpWaveOutHdr->reserved = (DWORD)lpWaveOutHdr->lpData;
3306 lpWaveOutHdr->lpData = PTR_SEG_TO_LIN(lpWaveOutHdr->lpData);
3307 ret = wodMessage(lpDesc->uDeviceID, WODM_UNPREPARE, lpDesc->dwInstance,
3308 (DWORD)lpWaveOutHdr, uSize);
3309 lpWaveOutHdr->lpData = (LPBYTE)lpWaveOutHdr->reserved;
3313 /**************************************************************************
3314 * waveOutWrite [MMSYSTEM.408]
3316 UINT WINAPI waveOutWrite(HWAVEOUT hWaveOut, WAVEHDR* lpWaveOutHdr,
3319 LPWAVEOPENDESC lpDesc;
3321 TRACE(mmsys, "(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
3323 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3324 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3325 lpWaveOutHdr->reserved = (DWORD)lpWaveOutHdr->lpData;
3326 return wodMessage(lpDesc->uDeviceID, WODM_WRITE, lpDesc->dwInstance, (DWORD)lpWaveOutHdr, uSize);
3329 /**************************************************************************
3330 * waveOutWrite [MMSYSTEM.408]
3332 UINT16 WINAPI waveOutWrite16(HWAVEOUT16 hWaveOut, WAVEHDR * lpWaveOutHdr,
3335 LPWAVEOPENDESC lpDesc;
3338 TRACE(mmsys, "(%04X, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
3340 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3341 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3342 lpWaveOutHdr->reserved =(DWORD)lpWaveOutHdr->lpData;/*save original ptr*/
3343 lpWaveOutHdr->lpData = PTR_SEG_TO_LIN(lpWaveOutHdr->lpData);
3344 ret = wodMessage(lpDesc->uDeviceID, WODM_WRITE, lpDesc->dwInstance, (DWORD)lpWaveOutHdr, uSize);
3345 lpWaveOutHdr->lpData = (LPBYTE)lpWaveOutHdr->reserved;
3349 /**************************************************************************
3350 * waveOutPause [WINMM.174]
3352 UINT WINAPI waveOutPause(HWAVEOUT hWaveOut)
3354 return waveOutPause16(hWaveOut);
3357 /**************************************************************************
3358 * waveOutPause [MMSYSTEM.409]
3360 UINT16 WINAPI waveOutPause16(HWAVEOUT16 hWaveOut)
3362 LPWAVEOPENDESC lpDesc;
3364 TRACE(mmsys, "(%04X)\n", hWaveOut);
3366 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3367 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3368 return wodMessage(lpDesc->uDeviceID, WODM_PAUSE, lpDesc->dwInstance, 0L, 0L);
3371 /**************************************************************************
3372 * waveOutRestart [WINMM.177]
3374 UINT WINAPI waveOutRestart(HWAVEOUT hWaveOut)
3376 return waveOutRestart16(hWaveOut);
3379 /**************************************************************************
3380 * waveOutRestart [MMSYSTEM.410]
3382 UINT16 WINAPI waveOutRestart16(HWAVEOUT16 hWaveOut)
3384 LPWAVEOPENDESC lpDesc;
3386 TRACE(mmsys, "(%04X)\n", hWaveOut);
3388 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3389 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3390 return wodMessage(lpDesc->uDeviceID, WODM_RESTART, lpDesc->dwInstance, 0L, 0L);
3393 /**************************************************************************
3394 * waveOutReset [WINMM.176]
3396 UINT WINAPI waveOutReset(HWAVEOUT hWaveOut)
3398 return waveOutReset16(hWaveOut);
3401 /**************************************************************************
3402 * waveOutReset [MMSYSTEM.411]
3404 UINT16 WINAPI waveOutReset16(HWAVEOUT16 hWaveOut)
3406 LPWAVEOPENDESC lpDesc;
3408 TRACE(mmsys, "(%04X)\n", hWaveOut);
3410 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3411 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3412 return wodMessage(lpDesc->uDeviceID, WODM_RESET, lpDesc->dwInstance, 0L, 0L);
3415 /**************************************************************************
3416 * waveOutGetPosition [WINMM.170]
3418 UINT WINAPI waveOutGetPosition(HWAVEOUT hWaveOut, LPMMTIME lpTime,
3424 mmt16.wType = lpTime->wType;
3425 ret = waveOutGetPosition16(hWaveOut, &mmt16, sizeof(mmt16));
3426 MMSYSTEM_MMTIME16to32(lpTime, &mmt16);
3430 /**************************************************************************
3431 * waveOutGetPosition [MMSYSTEM.412]
3433 UINT16 WINAPI waveOutGetPosition16(HWAVEOUT16 hWaveOut, LPMMTIME16 lpTime,
3436 LPWAVEOPENDESC lpDesc;
3437 TRACE(mmsys, "(%04X, %p, %u);\n", hWaveOut, lpTime, uSize);
3438 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3439 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3440 return wodMessage(lpDesc->uDeviceID, WODM_GETPOS, lpDesc->dwInstance,
3441 (DWORD)lpTime, (DWORD)uSize);
3444 #define WAVEOUT_SHORTCUT_1(xx,XX,atype) \
3445 UINT WINAPI waveOut##xx(HWAVEOUT hWaveOut, atype x) \
3447 return waveOut##xx##16(hWaveOut,x); \
3449 UINT16 WINAPI waveOut##xx##16(HWAVEOUT16 hWaveOut, atype x) \
3451 LPWAVEOPENDESC lpDesc; \
3452 TRACE(mmsys, "(%04X, %08lx);\n", hWaveOut, (DWORD)x); \
3453 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut); \
3454 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE; \
3455 return wodMessage(lpDesc->uDeviceID, WODM_##XX, \
3456 lpDesc->dwInstance, (DWORD)x, 0L); \
3459 WAVEOUT_SHORTCUT_1(GetPitch,GETPITCH, DWORD*)
3460 WAVEOUT_SHORTCUT_1(SetPitch,SETPITCH, DWORD)
3461 WAVEOUT_SHORTCUT_1(GetPlaybackRate,GETPLAYBACKRATE, DWORD*)
3462 WAVEOUT_SHORTCUT_1(SetPlaybackRate,SETPLAYBACKRATE, DWORD)
3464 #define WAVEOUT_SHORTCUT_2(xx,XX,atype) \
3465 UINT WINAPI waveOut##xx(UINT devid, atype x) \
3467 return waveOut##xx##16(devid,x); \
3469 UINT16 WINAPI waveOut##xx##16(UINT16 devid, atype x) \
3471 TRACE(mmsys, "(%04X, %08lx);\n", devid, (DWORD)x); \
3472 return wodMessage(devid, WODM_##XX, 0L, (DWORD)x, 0L); \
3475 WAVEOUT_SHORTCUT_2(GetVolume,GETVOLUME, DWORD*)
3476 WAVEOUT_SHORTCUT_2(SetVolume,SETVOLUME, DWORD)
3478 /**************************************************************************
3479 * waveOutBreakLoop [MMSYSTEM.419]
3481 UINT WINAPI waveOutBreakLoop(HWAVEOUT hWaveOut)
3483 return waveOutBreakLoop16(hWaveOut);
3486 /**************************************************************************
3487 * waveOutBreakLoop [MMSYSTEM.419]
3489 UINT16 WINAPI waveOutBreakLoop16(HWAVEOUT16 hWaveOut)
3491 TRACE(mmsys, "(%04X)\n", hWaveOut);
3492 return MMSYSERR_INVALHANDLE;
3495 /**************************************************************************
3496 * waveOutGetID [MMSYSTEM.420]
3498 UINT WINAPI waveOutGetID(HWAVEOUT hWaveOut, UINT* lpuDeviceID)
3500 LPWAVEOPENDESC lpDesc;
3502 TRACE(mmsys, "(%04X, %p);\n", hWaveOut, lpuDeviceID);
3504 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3505 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3506 if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
3507 *lpuDeviceID = lpDesc->uDeviceID;
3511 /**************************************************************************
3512 * waveOutGetID [MMSYSTEM.420]
3514 UINT16 WINAPI waveOutGetID16(HWAVEOUT16 hWaveOut, UINT16* lpuDeviceID)
3516 LPWAVEOPENDESC lpDesc;
3518 TRACE(mmsys, "(%04X, %p);\n", hWaveOut, lpuDeviceID);
3520 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3521 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3522 if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
3523 *lpuDeviceID = lpDesc->uDeviceID;
3527 /**************************************************************************
3528 * waveOutMessage [MMSYSTEM.421]
3530 DWORD WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage,
3531 DWORD dwParam1, DWORD dwParam2)
3533 LPWAVEOPENDESC lpDesc;
3535 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3536 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3538 case WODM_GETNUMDEVS:
3540 case WODM_GETVOLUME:
3542 case WODM_GETPLAYBACKRATE:
3543 case WODM_SETVOLUME:
3545 case WODM_SETPLAYBACKRATE:
3549 case WODM_UNPREPARE:
3552 /* no argument conversion needed */
3555 return waveOutWrite(hWaveOut, (LPWAVEHDR)dwParam1, dwParam2);
3556 case WODM_GETDEVCAPS:
3557 /* FIXME: UNICODE/ANSI? */
3558 return waveOutGetDevCapsA(hWaveOut, (LPWAVEOUTCAPSA)dwParam1, dwParam2);
3560 FIXME(mmsys,"can't handle WODM_OPEN, please report.\n");
3563 ERR(mmsys,"(0x%04x, 0x%04x,%08lx,%08lx): unhandled message\n",
3564 hWaveOut,uMessage, dwParam1, dwParam2);
3567 return wodMessage(lpDesc->uDeviceID, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
3570 /**************************************************************************
3571 * waveOutMessage [MMSYSTEM.421]
3573 DWORD WINAPI waveOutMessage16(HWAVEOUT16 hWaveOut, UINT16 uMessage,
3574 DWORD dwParam1, DWORD dwParam2)
3576 LPWAVEOPENDESC lpDesc;
3578 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
3579 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3581 case WODM_GETNUMDEVS:
3582 case WODM_SETVOLUME:
3584 case WODM_SETPLAYBACKRATE:
3589 /* no argument conversion needed */
3592 return waveOutGetPosition16(hWaveOut, (LPMMTIME16)PTR_SEG_TO_LIN(dwParam1), dwParam2);
3593 case WODM_GETVOLUME:
3594 return waveOutGetVolume16(hWaveOut, (LPDWORD)PTR_SEG_TO_LIN(dwParam1));
3596 return waveOutGetPitch16(hWaveOut, (LPDWORD)PTR_SEG_TO_LIN(dwParam1));
3597 case WODM_GETPLAYBACKRATE:
3598 return waveOutGetPlaybackRate16(hWaveOut, (LPDWORD)PTR_SEG_TO_LIN(dwParam1));
3599 case WODM_GETDEVCAPS:
3600 return waveOutGetDevCaps16(hWaveOut, (LPWAVEOUTCAPS16)PTR_SEG_TO_LIN(dwParam1), dwParam2);
3602 return waveOutPrepareHeader16(hWaveOut, (LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1), dwParam2);
3603 case WODM_UNPREPARE:
3604 return waveOutUnprepareHeader16(hWaveOut, (LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1), dwParam2);
3606 return waveOutWrite16(hWaveOut, (LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1), dwParam2);
3608 FIXME(mmsys,"can't handle WODM_OPEN, please report.\n");
3611 ERR(mmsys,"(0x%04x, 0x%04x,%08lx,%08lx): unhandled message\n",
3612 hWaveOut,uMessage, dwParam1, dwParam2);
3614 return wodMessage(lpDesc->uDeviceID, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
3617 /**************************************************************************
3618 * waveInGetNumDevs [WINMM.151]
3620 UINT WINAPI waveInGetNumDevs()
3622 return waveInGetNumDevs16();
3625 /**************************************************************************
3626 * waveInGetNumDevs [MMSYSTEM.501]
3628 UINT16 WINAPI waveInGetNumDevs16()
3632 TRACE(mmsys, "waveInGetNumDevs\n");
3633 count += widMessage(0, WIDM_GETNUMDEVS, 0L, 0L, 0L);
3634 TRACE(mmsys, "waveInGetNumDevs return %u \n", count);
3638 /**************************************************************************
3639 * waveInGetDevCapsA [WINMM.147]
3641 UINT WINAPI waveInGetDevCapsW(UINT uDeviceID, LPWAVEINCAPSW lpCaps, UINT uSize)
3644 UINT ret = waveInGetDevCaps16(uDeviceID, &wic16,uSize);
3646 lpCaps->wMid = wic16.wMid;
3647 lpCaps->wPid = wic16.wPid;
3648 lpCaps->vDriverVersion = wic16.vDriverVersion;
3649 lstrcpyAtoW(lpCaps->szPname, wic16.szPname);
3650 lpCaps->dwFormats = wic16.dwFormats;
3651 lpCaps->wChannels = wic16.wChannels;
3656 /**************************************************************************
3657 * waveInGetDevCapsA [WINMM.146]
3659 UINT WINAPI waveInGetDevCapsA(UINT uDeviceID, LPWAVEINCAPSA lpCaps, UINT uSize)
3662 UINT ret = waveInGetDevCaps16(uDeviceID, &wic16,uSize);
3664 lpCaps->wMid = wic16.wMid;
3665 lpCaps->wPid = wic16.wPid;
3666 lpCaps->vDriverVersion = wic16.vDriverVersion;
3667 strcpy(lpCaps->szPname, wic16.szPname);
3668 lpCaps->dwFormats = wic16.dwFormats;
3669 lpCaps->wChannels = wic16.wChannels;
3673 /**************************************************************************
3674 * waveInGetDevCaps [MMSYSTEM.502]
3676 UINT16 WINAPI waveInGetDevCaps16(UINT16 uDeviceID, LPWAVEINCAPS16 lpCaps, UINT16 uSize)
3678 TRACE(mmsys, "waveInGetDevCaps\n");
3680 return widMessage(uDeviceID, WIDM_GETDEVCAPS, 0L, (DWORD)lpCaps, uSize);
3683 /**************************************************************************
3684 * waveInGetErrorTextA [WINMM.148]
3686 UINT WINAPI waveInGetErrorTextA(UINT uError, LPSTR lpText, UINT uSize)
3688 TRACE(mmsys, "waveInGetErrorText\n");
3689 return(waveGetErrorText(uError, lpText, uSize));
3692 /**************************************************************************
3693 * waveInGetErrorTextW [WINMM.149]
3695 UINT WINAPI waveInGetErrorTextW(UINT uError, LPWSTR lpText, UINT uSize)
3697 LPSTR txt = HeapAlloc(GetProcessHeap(), 0,uSize);
3698 UINT ret = waveGetErrorText(uError, txt, uSize);
3700 lstrcpyAtoW(lpText, txt);
3701 HeapFree(GetProcessHeap(), 0, txt);
3705 /**************************************************************************
3706 * waveInGetErrorText [MMSYSTEM.503]
3708 UINT16 WINAPI waveInGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
3710 TRACE(mmsys, "waveInGetErrorText\n");
3711 return(waveGetErrorText(uError, lpText, uSize));
3714 /**************************************************************************
3715 * waveInOpen [WINMM.154]
3717 UINT WINAPI waveInOpen(HWAVEIN* lphWaveIn, UINT uDeviceID,
3718 const LPWAVEFORMAT lpFormat, DWORD dwCallback,
3719 DWORD dwInstance, DWORD dwFlags)
3722 UINT ret = waveInOpen16(&hwin16,uDeviceID, lpFormat, dwCallback, dwInstance,
3723 CALLBACK32CONV(dwFlags));
3724 if (lphWaveIn) *lphWaveIn = hwin16;
3728 /**************************************************************************
3729 * waveInOpen [MMSYSTEM.504]
3731 UINT16 WINAPI waveInOpen16(HWAVEIN16* lphWaveIn, UINT16 uDeviceID,
3732 const LPWAVEFORMAT lpFormat, DWORD dwCallback,
3733 DWORD dwInstance, DWORD dwFlags)
3736 LPWAVEOPENDESC lpDesc;
3738 BOOL bMapperFlg = FALSE;
3740 TRACE(mmsys, "(%p, %d, %p, %08lX, %08lX, %08lX);\n",
3741 lphWaveIn, uDeviceID, lpFormat, dwCallback, dwInstance, dwFlags);
3742 if (dwFlags & WAVE_FORMAT_QUERY)
3743 TRACE(mmsys, "WAVE_FORMAT_QUERY requested !\n");
3744 if (uDeviceID == (UINT16)WAVE_MAPPER) {
3745 TRACE(mmsys, "WAVE_MAPPER mode requested !\n");
3749 if (lpFormat == NULL) return WAVERR_BADFORMAT;
3750 hWaveIn = USER_HEAP_ALLOC(sizeof(WAVEOPENDESC));
3751 if (lphWaveIn != NULL) *lphWaveIn = hWaveIn;
3752 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3753 if (lpDesc == NULL) return MMSYSERR_NOMEM;
3754 lpDesc->hWave = hWaveIn;
3755 lpDesc->lpFormat = lpFormat;
3756 lpDesc->dwCallBack = dwCallback;
3757 lpDesc->dwInstance = dwInstance;
3758 while (uDeviceID < MAXWAVEDRIVERS) {
3759 dwRet = widMessage(uDeviceID, WIDM_OPEN,
3760 lpDesc->dwInstance, (DWORD)lpDesc, 0L);
3761 if (dwRet == MMSYSERR_NOERROR) break;
3762 if (!bMapperFlg) break;
3764 TRACE(mmsys, "WAVE_MAPPER mode ! try next driver...\n");
3766 lpDesc->uDeviceID = uDeviceID;
3767 if (dwFlags & WAVE_FORMAT_QUERY) {
3768 TRACE(mmsys, "End of WAVE_FORMAT_QUERY !\n");
3769 dwRet = waveInClose16(hWaveIn);
3774 /**************************************************************************
3775 * waveInClose [WINMM.145]
3777 UINT WINAPI waveInClose(HWAVEIN hWaveIn)
3779 return waveInClose16(hWaveIn);
3782 /**************************************************************************
3783 * waveInClose [MMSYSTEM.505]
3785 UINT16 WINAPI waveInClose16(HWAVEIN16 hWaveIn)
3787 LPWAVEOPENDESC lpDesc;
3789 TRACE(mmsys, "(%04X)\n", hWaveIn);
3790 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3791 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3792 return widMessage(lpDesc->uDeviceID, WIDM_CLOSE, lpDesc->dwInstance, 0L, 0L);
3795 /**************************************************************************
3796 * waveInPrepareHeader [WINMM.155]
3798 UINT WINAPI waveInPrepareHeader(HWAVEIN hWaveIn,
3799 WAVEHDR* lpWaveInHdr, UINT uSize)
3801 LPWAVEOPENDESC lpDesc;
3803 TRACE(mmsys, "(%04X, %p, %u);\n",
3804 hWaveIn, lpWaveInHdr, uSize);
3805 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3806 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3807 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
3808 lpWaveInHdr = lpWaveInHdr;
3809 lpWaveInHdr->lpNext = NULL;
3810 lpWaveInHdr->dwBytesRecorded = 0;
3811 TRACE(mmsys, "lpData=%p size=%lu \n",
3812 lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
3813 return widMessage(lpDesc->uDeviceID, WIDM_PREPARE, lpDesc->dwInstance,
3814 (DWORD)lpWaveInHdr, uSize);
3817 /**************************************************************************
3818 * waveInPrepareHeader [MMSYSTEM.506]
3820 UINT16 WINAPI waveInPrepareHeader16(HWAVEIN16 hWaveIn,
3821 WAVEHDR* lpWaveInHdr, UINT16 uSize)
3823 LPWAVEOPENDESC lpDesc;
3824 LPBYTE saveddata = lpWaveInHdr->lpData;
3827 TRACE(mmsys, "(%04X, %p, %u);\n",
3828 hWaveIn, lpWaveInHdr, uSize);
3829 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3830 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3831 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
3832 lpWaveInHdr = lpWaveInHdr;
3833 lpWaveInHdr->lpNext = NULL;
3834 lpWaveInHdr->dwBytesRecorded = 0;
3836 TRACE(mmsys, "lpData=%p size=%lu \n",
3837 lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
3838 lpWaveInHdr->lpData = PTR_SEG_TO_LIN(lpWaveInHdr->lpData);
3839 ret = widMessage(lpDesc->uDeviceID, WIDM_PREPARE, lpDesc->dwInstance,
3840 (DWORD)lpWaveInHdr,uSize);
3841 lpWaveInHdr->lpData = saveddata;
3845 /**************************************************************************
3846 * waveInUnprepareHeader [WINMM.159]
3848 UINT WINAPI waveInUnprepareHeader(HWAVEIN hWaveIn,
3849 WAVEHDR* lpWaveInHdr, UINT uSize)
3851 LPWAVEOPENDESC lpDesc;
3853 TRACE(mmsys, "(%04X, %p, %u);\n",
3854 hWaveIn, lpWaveInHdr, uSize);
3855 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3856 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3857 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
3858 /*USER_HEAP_FREE(HIWORD((DWORD)lpWaveInHdr->lpData)); FIXME */
3859 lpWaveInHdr->lpData = NULL;
3860 lpWaveInHdr->lpNext = NULL;
3861 return widMessage(lpDesc->uDeviceID, WIDM_UNPREPARE, lpDesc->dwInstance,
3862 (DWORD)lpWaveInHdr, uSize);
3865 /**************************************************************************
3866 * waveInUnprepareHeader [MMSYSTEM.507]
3868 UINT16 WINAPI waveInUnprepareHeader16(HWAVEIN16 hWaveIn,
3869 WAVEHDR* lpWaveInHdr, UINT16 uSize)
3871 LPWAVEOPENDESC lpDesc;
3873 TRACE(mmsys, "(%04X, %p, %u);\n",
3874 hWaveIn, lpWaveInHdr, uSize);
3875 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3876 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3877 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
3878 /*USER_HEAP_FREE(HIWORD((DWORD)lpWaveInHdr->lpData)); FIXME */
3879 lpWaveInHdr->lpData = NULL;
3880 lpWaveInHdr->lpNext = NULL;
3881 return widMessage(lpDesc->uDeviceID, WIDM_UNPREPARE, lpDesc->dwInstance,
3882 (DWORD)lpWaveInHdr, uSize);
3885 /**************************************************************************
3886 * waveInAddBuffer [WINMM.144]
3888 UINT WINAPI waveInAddBuffer(HWAVEIN hWaveIn,
3889 WAVEHDR* lpWaveInHdr, UINT uSize)
3891 LPWAVEOPENDESC lpDesc;
3893 TRACE(mmsys, "(%04X, %p, %u);\n", hWaveIn, lpWaveInHdr, uSize);
3894 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3895 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3896 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
3897 lpWaveInHdr->lpNext = NULL;
3898 lpWaveInHdr->dwBytesRecorded = 0;
3899 TRACE(mmsys, "lpData=%p size=%lu \n",
3900 lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
3901 return widMessage(lpDesc->uDeviceID, WIDM_ADDBUFFER, lpDesc->dwInstance,
3902 (DWORD)lpWaveInHdr, uSize);
3906 /**************************************************************************
3907 * waveInAddBuffer [MMSYSTEM.508]
3909 UINT16 WINAPI waveInAddBuffer16(HWAVEIN16 hWaveIn,
3910 WAVEHDR* lpWaveInHdr, UINT16 uSize)
3912 LPWAVEOPENDESC lpDesc;
3915 TRACE(mmsys, "(%04X, %p, %u);\n", hWaveIn, lpWaveInHdr, uSize);
3916 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3917 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3918 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
3919 lpWaveInHdr->lpNext = NULL;
3920 lpWaveInHdr->dwBytesRecorded = 0;
3921 lpWaveInHdr->lpData = PTR_SEG_TO_LIN(lpWaveInHdr->lpData);
3922 TRACE(mmsys, "lpData=%p size=%lu \n",
3923 lpWaveInHdr->lpData, lpWaveInHdr->dwBufferLength);
3924 ret = widMessage(lpDesc->uDeviceID, WIDM_ADDBUFFER, lpDesc->dwInstance,
3925 (DWORD)lpWaveInHdr, uSize);
3926 /*lpWaveInHdr->lpData = saveddata;*/
3930 /**************************************************************************
3931 * waveInStart [WINMM.157]
3933 UINT WINAPI waveInStart(HWAVEIN hWaveIn)
3935 return waveInStart16(hWaveIn);
3938 /**************************************************************************
3939 * waveInStart [MMSYSTEM.509]
3941 UINT16 WINAPI waveInStart16(HWAVEIN16 hWaveIn)
3943 LPWAVEOPENDESC lpDesc;
3945 TRACE(mmsys, "(%04X)\n", hWaveIn);
3946 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3947 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3948 return widMessage(lpDesc->uDeviceID, WIDM_START, lpDesc->dwInstance, 0, 0);
3951 /**************************************************************************
3952 * waveInStop [WINMM.158]
3954 UINT WINAPI waveInStop(HWAVEIN hWaveIn)
3956 return waveInStop16(hWaveIn);
3959 /**************************************************************************
3960 * waveInStop [MMSYSTEM.510]
3962 UINT16 WINAPI waveInStop16(HWAVEIN16 hWaveIn)
3964 LPWAVEOPENDESC lpDesc;
3966 TRACE(mmsys, "(%04X)\n", hWaveIn);
3967 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3968 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3969 return widMessage(lpDesc->uDeviceID, WIDM_STOP, lpDesc->dwInstance, 0L, 0L);
3972 /**************************************************************************
3973 * waveInReset [WINMM.156]
3975 UINT WINAPI waveInReset(HWAVEIN hWaveIn)
3977 return waveInReset16(hWaveIn);
3980 /**************************************************************************
3981 * waveInReset [MMSYSTEM.511]
3983 UINT16 WINAPI waveInReset16(HWAVEIN16 hWaveIn)
3985 LPWAVEOPENDESC lpDesc;
3987 TRACE(mmsys, "(%04X)\n", hWaveIn);
3988 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
3989 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
3990 return widMessage(lpDesc->uDeviceID, WIDM_RESET, lpDesc->dwInstance, 0, 0);
3993 /**************************************************************************
3994 * waveInGetPosition [WINMM.152]
3996 UINT WINAPI waveInGetPosition(HWAVEIN hWaveIn, LPMMTIME lpTime,
4002 mmt16.wType = lpTime->wType;
4003 ret = waveInGetPosition16(hWaveIn, &mmt16,uSize);
4005 MMSYSTEM_MMTIME16to32(lpTime, &mmt16);
4009 /**************************************************************************
4010 * waveInGetPosition [MMSYSTEM.512]
4012 UINT16 WINAPI waveInGetPosition16(HWAVEIN16 hWaveIn, LPMMTIME16 lpTime,
4015 LPWAVEOPENDESC lpDesc;
4017 TRACE(mmsys, "(%04X, %p, %u);\n", hWaveIn, lpTime, uSize);
4018 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
4019 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
4020 return widMessage(lpDesc->uDeviceID, WIDM_GETPOS, lpDesc->dwInstance,
4021 (DWORD)lpTime, (DWORD)uSize);
4024 /**************************************************************************
4025 * waveInGetID [WINMM.150]
4027 UINT WINAPI waveInGetID(HWAVEIN hWaveIn, UINT* lpuDeviceID)
4029 LPWAVEOPENDESC lpDesc;
4031 TRACE(mmsys, "waveInGetID\n");
4032 if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
4033 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
4034 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
4035 *lpuDeviceID = lpDesc->uDeviceID;
4039 /**************************************************************************
4040 * waveInGetID [MMSYSTEM.513]
4042 UINT16 WINAPI waveInGetID16(HWAVEIN16 hWaveIn, UINT16* lpuDeviceID)
4044 LPWAVEOPENDESC lpDesc;
4046 TRACE(mmsys, "waveInGetID\n");
4047 if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
4048 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
4049 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
4050 *lpuDeviceID = lpDesc->uDeviceID;
4054 /**************************************************************************
4055 * waveInMessage [WINMM.153]
4057 DWORD WINAPI waveInMessage(HWAVEIN hWaveIn, UINT uMessage,
4058 DWORD dwParam1, DWORD dwParam2)
4060 LPWAVEOPENDESC lpDesc;
4062 FIXME(mmsys, "(%04X, %04X, %08lX, %08lX)\n",
4063 hWaveIn, uMessage, dwParam1, dwParam2);
4064 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
4065 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
4068 FIXME(mmsys, "cannot handle WIDM_OPEN, please report.\n");
4070 case WIDM_GETNUMDEVS:
4077 case WIDM_UNPREPARE:
4078 case WIDM_ADDBUFFER:
4080 /* no argument conversion needed */
4082 case WIDM_GETDEVCAPS:
4083 /*FIXME: ANSI/UNICODE */
4084 return waveInGetDevCapsA(hWaveIn, (LPWAVEINCAPSA)dwParam1, dwParam2);
4086 ERR(mmsys,"(%04x,%04x,%08lx,%08lx): unhandled message\n",
4087 hWaveIn,uMessage, dwParam1, dwParam2);
4090 return widMessage(lpDesc->uDeviceID, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
4093 /**************************************************************************
4094 * waveInMessage [MMSYSTEM.514]
4096 DWORD WINAPI waveInMessage16(HWAVEIN16 hWaveIn, UINT16 uMessage,
4097 DWORD dwParam1, DWORD dwParam2)
4099 LPWAVEOPENDESC lpDesc;
4101 FIXME(mmsys, "(%04X, %04X, %08lX, %08lX)\n",
4102 hWaveIn, uMessage, dwParam1, dwParam2);
4103 lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveIn);
4104 if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
4107 FIXME(mmsys,"cannot handle WIDM_OPEN, please report.\n");
4109 case WIDM_GETNUMDEVS:
4115 /* no argument conversion needed */
4117 case WIDM_GETDEVCAPS:
4118 return waveInGetDevCaps16(hWaveIn, (LPWAVEINCAPS16)PTR_SEG_TO_LIN(dwParam1), dwParam2);
4120 return waveInGetPosition16(hWaveIn, (LPMMTIME16)PTR_SEG_TO_LIN(dwParam1), dwParam2);
4122 return waveInPrepareHeader16(hWaveIn, (LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1), dwParam2);
4123 case WIDM_UNPREPARE:
4124 return waveInUnprepareHeader16(hWaveIn, (LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1), dwParam2);
4125 case WIDM_ADDBUFFER:
4126 return waveInAddBuffer16(hWaveIn, (LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1), dwParam2);
4128 ERR(mmsys,"(%04x,%04x,%08lx,%08lx): unhandled message\n",
4129 hWaveIn,uMessage, dwParam1, dwParam2);
4132 return widMessage(lpDesc->uDeviceID, uMessage, lpDesc->dwInstance, dwParam1, dwParam2);
4135 /**************************************************************************
4136 * DrvOpen [MMSYSTEM.1100]
4138 HDRVR16 WINAPI DrvOpen(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
4140 TRACE(mmsys,"('%s','%s',%08lX);\n", lpDriverName, lpSectionName, lParam);
4142 return OpenDriver16(lpDriverName, lpSectionName, lParam);
4145 /**************************************************************************
4146 * DrvClose [MMSYSTEM.1101]
4148 LRESULT WINAPI DrvClose(HDRVR16 hDrv, LPARAM lParam1, LPARAM lParam2)
4150 TRACE(mmsys, "(%04X, %08lX, %08lX);\n", hDrv, lParam1, lParam2);
4152 return CloseDriver16(hDrv, lParam1, lParam2);
4155 /**************************************************************************
4156 * DrvSendMessage [MMSYSTEM.1102]
4158 LRESULT WINAPI DrvSendMessage(HDRVR16 hDrv, WORD msg, LPARAM lParam1,
4161 /* DWORD dwDriverID = 0; */
4163 FIXME(mmsys, "(%04X, %04X, %08lX, %08lX);\n", hDrv, msg, lParam1, lParam2);
4164 return MMSYSERR_NOTENABLED;
4165 /* FIXME: wrong ... */
4166 /* should known the mapping between hDrv and wDevIDs */
4167 /* MCICDAUDIO_DriverProc16(dwDriverID, hDrv, msg, lParam1, lParam2); */
4170 /**************************************************************************
4171 * DrvGetModuleHandle [MMSYSTEM.1103]
4173 HANDLE16 WINAPI DrvGetModuleHandle16(HDRVR16 hDrv)
4175 return GetDriverModuleHandle16(hDrv);
4178 /**************************************************************************
4179 * DrvDefDriverProc [MMSYSTEM.1104]
4181 LRESULT WINAPI DrvDefDriverProc(DWORD dwDriverID, HDRVR16 hDrv, WORD wMsg,
4182 DWORD dwParam1, DWORD dwParam2)
4184 /* FIXME : any mapping from 32 to 16 bit structure ? */
4185 return DefDriverProc16(dwDriverID, hDrv, wMsg, dwParam1, dwParam2);
4188 /**************************************************************************
4189 * DefDriverProc [WINMM.5]
4191 LRESULT WINAPI DefDriverProc(DWORD dwDriverIdentifier, HDRVR hDrv,
4192 UINT Msg, LPARAM lParam1, LPARAM lParam2)
4208 /**************************************************************************
4209 * mmThreadCreate [MMSYSTEM.1120]
4211 LRESULT WINAPI mmThreadCreate16(LPVOID x1, LPWORD x2, DWORD x3, DWORD x4)
4213 FIXME(mmsys,"(%p,%p,%08lx,%08lx): stub!\n",x1,x2,x3,x4);
4218 /**************************************************************************
4219 * mmThreadGetTask [MMSYSTEM.1125]
4221 LRESULT WINAPI mmThreadGetTask16(WORD hnd)
4223 FIXME(mmsys,"(%04x): stub!\n", hnd);
4224 return GetCurrentTask();
4227 /**************************************************************************
4228 * mmThreadSignal [MMSYSTEM.1121]
4230 LRESULT WINAPI mmThreadSignal16(WORD hnd)
4232 FIXME(mmsys,"(%04x): stub!\n", hnd);
4236 /**************************************************************************
4237 * mmTaskCreate [MMSYSTEM.900]
4239 HINSTANCE16 WINAPI mmTaskCreate16(LPWORD lphnd,HINSTANCE16 *hMmTask, DWORD x2)
4241 DWORD showCmd = 0x40002;
4245 HINSTANCE16 ret, handle;
4247 TRACE(mmsys,"(%p,%p,%08lx);\n", lphnd, hMmTask,x2);
4248 cmdline = (LPSTR)HeapAlloc(GetProcessHeap(), 0, 0x0d);
4250 (DWORD)cmdline[1] = (DWORD)lphnd;
4251 (DWORD)cmdline[5] = x2;
4252 (DWORD)cmdline[9] = 0;
4254 sel1 = SELECTOR_AllocBlock(cmdline, 0x0d, SEGMENT_DATA, FALSE, FALSE);
4255 sel2 = SELECTOR_AllocBlock(&showCmd, sizeof(showCmd),
4256 SEGMENT_DATA, FALSE, FALSE);
4258 lp = (LOADPARAMS16 *)HeapAlloc(GetProcessHeap(), 0, sizeof(LOADPARAMS16));
4259 lp->hEnvironment = 0;
4260 lp->cmdLine = PTR_SEG_OFF_TO_SEGPTR(sel1, 0);
4261 lp->showCmd = PTR_SEG_OFF_TO_SEGPTR(sel2, 0);
4264 ret = LoadModule16("c:\\windows\\mmtask.tsk", lp);
4277 *(HINSTANCE16 *)PTR_SEG_TO_LIN(hMmTask) = handle;
4279 UnMapLS(PTR_SEG_OFF_TO_SEGPTR(sel2, 0));
4280 UnMapLS(PTR_SEG_OFF_TO_SEGPTR(sel1, 0));
4282 HeapFree(GetProcessHeap(), 0, lp);
4283 HeapFree(GetProcessHeap(), 0, cmdline);
4288 /**************************************************************************
4289 * mmTaskSignal [MMSYSTEM.903]
4291 LRESULT WINAPI mmTaskSignal16(HTASK16 ht)
4293 TRACE(mmsys,"(%04x);\n", ht);
4294 return PostAppMessageA(ht, WM_USER, 0, 0);