1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
6 * Copyright 1993 Martin Ayotte
7 * 1998-2002 Eric Pouech
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 * 99/4 added mmTask and mmThread functions support
29 /* FIXME: I think there are some segmented vs. linear pointer weirdnesses
30 * and long term pointers to 16 bit space in here
38 #include "wine/mmsystem16.h"
39 #include "wine/winuser16.h"
43 #include "wine/debug.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(mmsys);
47 /**************************************************************************
48 * DllEntryPoint (MMSYSTEM.2046)
50 * MMSYSTEM DLL entry point
53 BOOL WINAPI MMSYSTEM_LibMain(DWORD fdwReason, HINSTANCE hinstDLL, WORD ds,
54 WORD wHeapSize, DWORD dwReserved1, WORD wReserved2)
57 LPWINE_MM_IDATA iData;
59 TRACE("0x%x 0x%lx\n", hinstDLL, fdwReason);
62 case DLL_PROCESS_ATTACH:
63 /* need to load WinMM in order to:
64 * - initiate correctly shared variables (MULTIMEDIA_Init())
65 * - create correctly the per process WINE_MM_IDATA chunk
67 hndl = LoadLibraryA("WINMM.DLL");
70 ERR("Could not load sibling WinMM.dll\n");
73 iData = MULTIMEDIA_GetIData();
74 iData->hWinMM16Instance = hinstDLL;
75 iData->h16Module32 = hndl;
77 case DLL_PROCESS_DETACH:
78 iData = MULTIMEDIA_GetIData();
79 FreeLibrary(iData->h16Module32);
81 case DLL_THREAD_ATTACH:
82 case DLL_THREAD_DETACH:
88 /**************************************************************************
89 * MMSYSTEM_WEP [MMSYSTEM.1]
91 int WINAPI MMSYSTEM_WEP(HINSTANCE16 hInstance, WORD wDataSeg,
92 WORD cbHeapSize, LPSTR lpCmdLine)
94 FIXME("STUB: Unloading MMSystem DLL ... hInst=%04X \n", hInstance);
98 /**************************************************************************
99 * PlaySound [MMSYSTEM.3]
101 BOOL16 WINAPI PlaySound16(LPCSTR pszSound, HMODULE16 hmod, DWORD fdwSound)
106 ReleaseThunkLock(&lc);
107 retv = PlaySoundA(pszSound, hmod, fdwSound);
108 RestoreThunkLock(lc);
113 /**************************************************************************
114 * sndPlaySound [MMSYSTEM.2]
116 BOOL16 WINAPI sndPlaySound16(LPCSTR lpszSoundName, UINT16 uFlags)
121 ReleaseThunkLock(&lc);
122 retv = sndPlaySoundA(lpszSoundName, uFlags);
123 RestoreThunkLock(lc);
128 /**************************************************************************
129 * mmsystemGetVersion [MMSYSTEM.5]
132 UINT16 WINAPI mmsystemGetVersion16(void)
134 return mmsystemGetVersion();
137 /**************************************************************************
138 * DriverCallback [MMSYSTEM.31]
140 BOOL16 WINAPI DriverCallback16(DWORD dwCallBack, UINT16 uFlags, HDRVR16 hDev,
141 WORD wMsg, DWORD dwUser, DWORD dwParam1,
144 return DriverCallback(dwCallBack, uFlags, HDRVR_32(hDev), wMsg, dwUser, dwParam1, dwParam2);
147 /**************************************************************************
148 * Mixer devices. New to Win95
151 /**************************************************************************
152 * mixerGetNumDevs [MMSYSTEM.800]
154 UINT16 WINAPI mixerGetNumDevs16(void)
156 return MMDRV_GetNum(MMDRV_MIXER);
159 /**************************************************************************
160 * mixerGetDevCaps [MMSYSTEM.801]
162 UINT16 WINAPI mixerGetDevCaps16(UINT16 devid, LPMIXERCAPS16 mixcaps,
166 UINT ret = mixerGetDevCapsA(devid, &micA, sizeof(micA));
168 if (ret == MMSYSERR_NOERROR) {
169 mixcaps->wMid = micA.wMid;
170 mixcaps->wPid = micA.wPid;
171 mixcaps->vDriverVersion = micA.vDriverVersion;
172 strcpy(mixcaps->szPname, micA.szPname);
173 mixcaps->fdwSupport = micA.fdwSupport;
174 mixcaps->cDestinations = micA.cDestinations;
179 /**************************************************************************
180 * mixerOpen [MMSYSTEM.802]
182 UINT16 WINAPI mixerOpen16(LPHMIXER16 lphmix, UINT16 uDeviceID, DWORD dwCallback,
183 DWORD dwInstance, DWORD fdwOpen)
188 ret = MMSYSTEM_mixerOpen(&hmix, uDeviceID,
189 dwCallback, dwInstance, fdwOpen, FALSE);
190 if (lphmix) *lphmix = HMIXER_16(hmix);
194 /**************************************************************************
195 * mixerClose [MMSYSTEM.803]
197 UINT16 WINAPI mixerClose16(HMIXER16 hMix)
199 return mixerClose(HMIXER_32(hMix));
202 /**************************************************************************
203 * mixerGetID (MMSYSTEM.806)
205 UINT16 WINAPI mixerGetID16(HMIXEROBJ16 hmix, LPUINT16 lpid, DWORD fdwID)
208 UINT ret = mixerGetID(HMIXEROBJ_32(hmix), &xid, fdwID);
215 /**************************************************************************
216 * mixerGetControlDetails [MMSYSTEM.808]
218 UINT16 WINAPI mixerGetControlDetails16(HMIXEROBJ16 hmix,
219 LPMIXERCONTROLDETAILS16 lpmcd,
222 DWORD ret = MMSYSERR_NOTENABLED;
225 TRACE("(%04x, %p, %08lx)\n", hmix, lpmcd, fdwDetails);
227 if (lpmcd == NULL || lpmcd->cbStruct != sizeof(*lpmcd))
228 return MMSYSERR_INVALPARAM;
230 sppaDetails = (SEGPTR)lpmcd->paDetails;
231 lpmcd->paDetails = MapSL(sppaDetails);
232 ret = mixerGetControlDetailsA(HMIXEROBJ_32(hmix),
233 (LPMIXERCONTROLDETAILS)lpmcd, fdwDetails);
234 lpmcd->paDetails = (LPVOID)sppaDetails;
239 /**************************************************************************
240 * mixerGetLineControls [MMSYSTEM.807]
242 UINT16 WINAPI mixerGetLineControls16(HMIXEROBJ16 hmix,
243 LPMIXERLINECONTROLS16 lpmlc16,
246 MIXERLINECONTROLSA mlcA;
249 LPMIXERCONTROL16 lpmc16;
251 TRACE("(%04x, %p, %08lx)\n", hmix, lpmlc16, fdwControls);
253 if (lpmlc16 == NULL || lpmlc16->cbStruct != sizeof(*lpmlc16) ||
254 lpmlc16->cbmxctrl != sizeof(MIXERCONTROL16))
255 return MMSYSERR_INVALPARAM;
257 mlcA.cbStruct = sizeof(mlcA);
258 mlcA.dwLineID = lpmlc16->dwLineID;
259 mlcA.u.dwControlID = lpmlc16->u.dwControlID;
260 mlcA.u.dwControlType = lpmlc16->u.dwControlType;
261 mlcA.cControls = lpmlc16->cControls;
262 mlcA.cbmxctrl = sizeof(MIXERCONTROLA);
263 mlcA.pamxctrl = HeapAlloc(GetProcessHeap(), 0,
264 mlcA.cControls * mlcA.cbmxctrl);
266 ret = mixerGetLineControlsA(HMIXEROBJ_32(hmix), &mlcA, fdwControls);
268 if (ret == MMSYSERR_NOERROR) {
269 lpmlc16->dwLineID = mlcA.dwLineID;
270 lpmlc16->u.dwControlID = mlcA.u.dwControlID;
271 lpmlc16->u.dwControlType = mlcA.u.dwControlType;
272 lpmlc16->cControls = mlcA.cControls;
274 lpmc16 = MapSL(lpmlc16->pamxctrl);
276 for (i = 0; i < mlcA.cControls; i++) {
277 lpmc16[i].cbStruct = sizeof(MIXERCONTROL16);
278 lpmc16[i].dwControlID = mlcA.pamxctrl[i].dwControlID;
279 lpmc16[i].dwControlType = mlcA.pamxctrl[i].dwControlType;
280 lpmc16[i].fdwControl = mlcA.pamxctrl[i].fdwControl;
281 lpmc16[i].cMultipleItems = mlcA.pamxctrl[i].cMultipleItems;
282 strcpy(lpmc16[i].szShortName, mlcA.pamxctrl[i].szShortName);
283 strcpy(lpmc16[i].szName, mlcA.pamxctrl[i].szName);
284 /* sizeof(lpmc16[i].Bounds) == sizeof(mlcA.pamxctrl[i].Bounds) */
285 memcpy(&lpmc16[i].Bounds, &mlcA.pamxctrl[i].Bounds,
286 sizeof(mlcA.pamxctrl[i].Bounds));
287 /* sizeof(lpmc16[i].Metrics) == sizeof(mlcA.pamxctrl[i].Metrics) */
288 memcpy(&lpmc16[i].Metrics, &mlcA.pamxctrl[i].Metrics,
289 sizeof(mlcA.pamxctrl[i].Metrics));
293 HeapFree(GetProcessHeap(), 0, mlcA.pamxctrl);
298 /**************************************************************************
299 * mixerGetLineInfo [MMSYSTEM.805]
301 UINT16 WINAPI mixerGetLineInfo16(HMIXEROBJ16 hmix, LPMIXERLINE16 lpmli16,
307 TRACE("(%04x, %p, %08lx)\n", hmix, lpmli16, fdwInfo);
309 if (lpmli16 == NULL || lpmli16->cbStruct != sizeof(*lpmli16))
310 return MMSYSERR_INVALPARAM;
312 mliA.cbStruct = sizeof(mliA);
313 switch (fdwInfo & MIXER_GETLINEINFOF_QUERYMASK) {
314 case MIXER_GETLINEINFOF_COMPONENTTYPE:
315 mliA.dwComponentType = lpmli16->dwComponentType;
317 case MIXER_GETLINEINFOF_DESTINATION:
318 mliA.dwDestination = lpmli16->dwDestination;
320 case MIXER_GETLINEINFOF_LINEID:
321 mliA.dwLineID = lpmli16->dwLineID;
323 case MIXER_GETLINEINFOF_SOURCE:
324 mliA.dwDestination = lpmli16->dwDestination;
325 mliA.dwSource = lpmli16->dwSource;
327 case MIXER_GETLINEINFOF_TARGETTYPE:
328 mliA.Target.dwType = lpmli16->Target.dwType;
329 mliA.Target.wMid = lpmli16->Target.wMid;
330 mliA.Target.wPid = lpmli16->Target.wPid;
331 mliA.Target.vDriverVersion = lpmli16->Target.vDriverVersion;
332 strcpy(mliA.Target.szPname, lpmli16->Target.szPname);
335 FIXME("Unsupported fdwControls=0x%08lx\n", fdwInfo);
338 ret = mixerGetLineInfoA(HMIXEROBJ_32(hmix), &mliA, fdwInfo);
340 lpmli16->dwDestination = mliA.dwDestination;
341 lpmli16->dwSource = mliA.dwSource;
342 lpmli16->dwLineID = mliA.dwLineID;
343 lpmli16->fdwLine = mliA.fdwLine;
344 lpmli16->dwUser = mliA.dwUser;
345 lpmli16->dwComponentType = mliA.dwComponentType;
346 lpmli16->cChannels = mliA.cChannels;
347 lpmli16->cConnections = mliA.cConnections;
348 lpmli16->cControls = mliA.cControls;
349 strcpy(lpmli16->szShortName, mliA.szShortName);
350 strcpy(lpmli16->szName, mliA.szName);
351 lpmli16->Target.dwType = mliA.Target.dwType;
352 lpmli16->Target.dwDeviceID = mliA.Target.dwDeviceID;
353 lpmli16->Target.wMid = mliA.Target.wMid;
354 lpmli16->Target.wPid = mliA.Target.wPid;
355 lpmli16->Target.vDriverVersion = mliA.Target.vDriverVersion;
356 strcpy(lpmli16->Target.szPname, mliA.Target.szPname);
361 /**************************************************************************
362 * mixerSetControlDetails [MMSYSTEM.809]
364 UINT16 WINAPI mixerSetControlDetails16(HMIXEROBJ16 hmix,
365 LPMIXERCONTROLDETAILS16 lpmcd,
368 TRACE("(%04x, %p, %08lx)\n", hmix, lpmcd, fdwDetails);
369 return MMSYSERR_NOTENABLED;
372 /**************************************************************************
373 * mixerMessage [MMSYSTEM.804]
375 DWORD WINAPI mixerMessage16(HMIXER16 hmix, UINT16 uMsg, DWORD dwParam1,
378 return mixerMessage(HMIXER_32(hmix), uMsg, dwParam1, dwParam2);
381 /**************************************************************************
382 * auxGetNumDevs [MMSYSTEM.350]
384 UINT16 WINAPI auxGetNumDevs16(void)
386 return MMDRV_GetNum(MMDRV_AUX);
389 /**************************************************************************
390 * auxGetDevCaps [MMSYSTEM.351]
392 UINT16 WINAPI auxGetDevCaps16(UINT16 uDeviceID, LPAUXCAPS16 lpCaps, UINT16 uSize)
396 TRACE("(%04X, %p, %d) !\n", uDeviceID, lpCaps, uSize);
398 if ((wmld = MMDRV_Get(uDeviceID, MMDRV_AUX, TRUE)) == NULL)
399 return MMSYSERR_INVALHANDLE;
400 return MMDRV_Message(wmld, AUXDM_GETDEVCAPS, (DWORD)lpCaps, uSize, TRUE);
403 /**************************************************************************
404 * auxGetVolume [MMSYSTEM.352]
406 UINT16 WINAPI auxGetVolume16(UINT16 uDeviceID, LPDWORD lpdwVolume)
410 TRACE("(%04X, %p) !\n", uDeviceID, lpdwVolume);
412 if ((wmld = MMDRV_Get(uDeviceID, MMDRV_AUX, TRUE)) == NULL)
413 return MMSYSERR_INVALHANDLE;
414 return MMDRV_Message(wmld, AUXDM_GETVOLUME, (DWORD)lpdwVolume, 0L, TRUE);
417 /**************************************************************************
418 * auxSetVolume [MMSYSTEM.353]
420 UINT16 WINAPI auxSetVolume16(UINT16 uDeviceID, DWORD dwVolume)
424 TRACE("(%04X, %lu) !\n", uDeviceID, dwVolume);
426 if ((wmld = MMDRV_Get(uDeviceID, MMDRV_AUX, TRUE)) == NULL)
427 return MMSYSERR_INVALHANDLE;
428 return MMDRV_Message(wmld, AUXDM_SETVOLUME, dwVolume, 0L, TRUE);
431 /**************************************************************************
432 * auxOutMessage [MMSYSTEM.354]
434 DWORD WINAPI auxOutMessage16(UINT16 uDeviceID, UINT16 uMessage, DWORD dw1, DWORD dw2)
438 TRACE("(%04X, %04X, %08lX, %08lX)\n", uDeviceID, uMessage, dw1, dw2);
441 case AUXDM_GETNUMDEVS:
442 case AUXDM_SETVOLUME:
443 /* no argument conversion needed */
445 case AUXDM_GETVOLUME:
446 return auxGetVolume16(uDeviceID, MapSL(dw1));
447 case AUXDM_GETDEVCAPS:
448 return auxGetDevCaps16(uDeviceID, MapSL(dw1), dw2);
450 TRACE("(%04x, %04x, %08lx, %08lx): unhandled message\n",
451 uDeviceID, uMessage, dw1, dw2);
454 if ((wmld = MMDRV_Get(uDeviceID, MMDRV_AUX, TRUE)) == NULL)
455 return MMSYSERR_INVALHANDLE;
457 return MMDRV_Message(wmld, uMessage, dw1, dw2, TRUE);
460 /**************************************************************************
461 * mciGetErrorString [MMSYSTEM.706]
463 BOOL16 WINAPI mciGetErrorString16(DWORD wError, LPSTR lpstrBuffer, UINT16 uLength)
465 return mciGetErrorStringA(wError, lpstrBuffer, uLength);
468 /**************************************************************************
469 * mciDriverNotify [MMSYSTEM.711]
471 BOOL16 WINAPI mciDriverNotify16(HWND16 hWndCallBack, UINT16 wDevID, UINT16 wStatus)
473 TRACE("(%04X, %04x, %04X)\n", hWndCallBack, wDevID, wStatus);
475 return PostMessageA(HWND_32(hWndCallBack), MM_MCINOTIFY, wStatus, wDevID);
478 /**************************************************************************
479 * mciGetDriverData [MMSYSTEM.708]
481 DWORD WINAPI mciGetDriverData16(UINT16 uDeviceID)
483 return mciGetDriverData(uDeviceID);
486 /**************************************************************************
487 * mciSetDriverData [MMSYSTEM.707]
489 BOOL16 WINAPI mciSetDriverData16(UINT16 uDeviceID, DWORD data)
491 return mciSetDriverData(uDeviceID, data);
494 /**************************************************************************
495 * mciSendCommand [MMSYSTEM.701]
497 DWORD WINAPI mciSendCommand16(UINT16 wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2)
501 TRACE("(%04X, %s, %08lX, %08lX)\n",
502 wDevID, MCI_MessageToString(wMsg), dwParam1, dwParam2);
504 dwRet = MCI_SendCommand(wDevID, wMsg, dwParam1, dwParam2, FALSE);
505 dwRet = MCI_CleanUp(dwRet, wMsg, dwParam2, FALSE);
506 TRACE("=> %ld\n", dwRet);
510 /**************************************************************************
511 * mciGetDeviceID [MMSYSTEM.703]
513 UINT16 WINAPI mciGetDeviceID16(LPCSTR lpstrName)
515 TRACE("(\"%s\")\n", lpstrName);
517 return MCI_GetDriverFromString(lpstrName);
520 /**************************************************************************
521 * mciSetYieldProc [MMSYSTEM.714]
523 BOOL16 WINAPI mciSetYieldProc16(UINT16 uDeviceID, YIELDPROC16 fpYieldProc, DWORD dwYieldData)
525 LPWINE_MCIDRIVER wmd;
527 TRACE("(%u, %p, %08lx)\n", uDeviceID, fpYieldProc, dwYieldData);
529 if (!(wmd = MCI_GetDriver(uDeviceID))) {
530 WARN("Bad uDeviceID\n");
534 wmd->lpfnYieldProc = (YIELDPROC)fpYieldProc;
535 wmd->dwYieldData = dwYieldData;
541 /**************************************************************************
542 * mciGetDeviceIDFromElementID [MMSYSTEM.715]
544 UINT16 WINAPI mciGetDeviceIDFromElementID16(DWORD dwElementID, LPCSTR lpstrType)
546 FIXME("(%lu, %s) stub\n", dwElementID, lpstrType);
550 /**************************************************************************
551 * mciGetYieldProc [MMSYSTEM.716]
553 YIELDPROC16 WINAPI mciGetYieldProc16(UINT16 uDeviceID, DWORD* lpdwYieldData)
555 LPWINE_MCIDRIVER wmd;
557 TRACE("(%u, %p)\n", uDeviceID, lpdwYieldData);
559 if (!(wmd = MCI_GetDriver(uDeviceID))) {
560 WARN("Bad uDeviceID\n");
563 if (!wmd->lpfnYieldProc) {
564 WARN("No proc set\n");
568 WARN("Proc is 32 bit\n");
571 return (YIELDPROC16)wmd->lpfnYieldProc;
574 /**************************************************************************
575 * mciGetCreatorTask [MMSYSTEM.717]
577 HTASK16 WINAPI mciGetCreatorTask16(UINT16 uDeviceID)
579 LPWINE_MCIDRIVER wmd;
582 if ((wmd = MCI_GetDriver(uDeviceID))) ret = wmd->hCreatorTask;
584 TRACE("(%u) => %04x\n", uDeviceID, ret);
588 /**************************************************************************
589 * mciDriverYield [MMSYSTEM.710]
591 UINT16 WINAPI mciDriverYield16(UINT16 uDeviceID)
593 LPWINE_MCIDRIVER wmd;
596 /* TRACE("(%04x)\n", uDeviceID); */
598 if (!(wmd = MCI_GetDriver(uDeviceID)) || !wmd->lpfnYieldProc || wmd->bIs32) {
601 ret = wmd->lpfnYieldProc(uDeviceID, wmd->dwYieldData);
607 /**************************************************************************
608 * midiOutGetNumDevs [MMSYSTEM.201]
610 UINT16 WINAPI midiOutGetNumDevs16(void)
612 return MMDRV_GetNum(MMDRV_MIDIOUT);
615 /**************************************************************************
616 * midiOutGetDevCaps [MMSYSTEM.202]
618 UINT16 WINAPI midiOutGetDevCaps16(UINT16 uDeviceID, LPMIDIOUTCAPS16 lpCaps,
624 if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
626 dwRet = midiOutGetDevCapsA(uDeviceID, &capsA, sizeof(capsA));
627 if (dwRet == MMSYSERR_NOERROR) {
628 lpCaps->wMid = capsA.wMid;
629 lpCaps->wPid = capsA.wPid;
630 lpCaps->vDriverVersion = capsA.vDriverVersion;
631 strcpy(lpCaps->szPname, capsA.szPname);
632 lpCaps->wTechnology = capsA.wTechnology;
633 lpCaps->wVoices = capsA.wVoices;
634 lpCaps->wNotes = capsA.wNotes;
635 lpCaps->wChannelMask = capsA.wChannelMask;
636 lpCaps->dwSupport = capsA.dwSupport;
641 /**************************************************************************
642 * midiOutGetErrorText [MMSYSTEM.203]
644 UINT16 WINAPI midiOutGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
646 return midiOutGetErrorTextA(uError, lpText, uSize);
649 /**************************************************************************
650 * midiOutOpen [MMSYSTEM.204]
652 UINT16 WINAPI midiOutOpen16(HMIDIOUT16* lphMidiOut, UINT16 uDeviceID,
653 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
658 ret = MMSYSTEM_midiOutOpen(&hmo, uDeviceID, dwCallback, dwInstance,
661 if (lphMidiOut != NULL) *lphMidiOut = HMIDIOUT_16(hmo);
665 /**************************************************************************
666 * midiOutClose [MMSYSTEM.205]
668 UINT16 WINAPI midiOutClose16(HMIDIOUT16 hMidiOut)
670 return midiOutClose(HMIDIOUT_32(hMidiOut));
673 /**************************************************************************
674 * midiOutPrepareHeader [MMSYSTEM.206]
676 UINT16 WINAPI midiOutPrepareHeader16(HMIDIOUT16 hMidiOut, /* [in] */
677 SEGPTR lpsegMidiOutHdr, /* [???] */
678 UINT16 uSize) /* [in] */
682 TRACE("(%04X, %08lx, %d)\n", hMidiOut, lpsegMidiOutHdr, uSize);
684 if ((wmld = MMDRV_Get(HMIDIOUT_32(hMidiOut), MMDRV_MIDIOUT, FALSE)) == NULL)
685 return MMSYSERR_INVALHANDLE;
687 return MMDRV_Message(wmld, MODM_PREPARE, lpsegMidiOutHdr, uSize, FALSE);
690 /**************************************************************************
691 * midiOutUnprepareHeader [MMSYSTEM.207]
693 UINT16 WINAPI midiOutUnprepareHeader16(HMIDIOUT16 hMidiOut, /* [in] */
694 SEGPTR lpsegMidiOutHdr, /* [???] */
695 UINT16 uSize) /* [in] */
698 LPMIDIHDR16 lpMidiOutHdr = MapSL(lpsegMidiOutHdr);
700 TRACE("(%04X, %08lx, %d)\n", hMidiOut, lpsegMidiOutHdr, uSize);
702 if (!(lpMidiOutHdr->dwFlags & MHDR_PREPARED)) {
703 return MMSYSERR_NOERROR;
706 if ((wmld = MMDRV_Get(HMIDIOUT_32(hMidiOut), MMDRV_MIDIOUT, FALSE)) == NULL)
707 return MMSYSERR_INVALHANDLE;
709 return MMDRV_Message(wmld, MODM_UNPREPARE, (DWORD)lpsegMidiOutHdr, uSize, FALSE);
712 /**************************************************************************
713 * midiOutShortMsg [MMSYSTEM.208]
715 UINT16 WINAPI midiOutShortMsg16(HMIDIOUT16 hMidiOut, DWORD dwMsg)
717 return midiOutShortMsg(HMIDIOUT_32(hMidiOut), dwMsg);
720 /**************************************************************************
721 * midiOutLongMsg [MMSYSTEM.209]
723 UINT16 WINAPI midiOutLongMsg16(HMIDIOUT16 hMidiOut, /* [in] */
724 LPMIDIHDR16 lpsegMidiOutHdr, /* [???] NOTE: SEGPTR */
725 UINT16 uSize) /* [in] */
729 TRACE("(%04X, %p, %d)\n", hMidiOut, lpsegMidiOutHdr, uSize);
731 if ((wmld = MMDRV_Get(HMIDIOUT_32(hMidiOut), MMDRV_MIDIOUT, FALSE)) == NULL)
732 return MMSYSERR_INVALHANDLE;
734 return MMDRV_Message(wmld, MODM_LONGDATA, (DWORD)lpsegMidiOutHdr, uSize, FALSE);
737 /**************************************************************************
738 * midiOutReset [MMSYSTEM.210]
740 UINT16 WINAPI midiOutReset16(HMIDIOUT16 hMidiOut)
742 return midiOutReset(HMIDIOUT_32(hMidiOut));
745 /**************************************************************************
746 * midiOutGetVolume [MMSYSTEM.211]
748 UINT16 WINAPI midiOutGetVolume16(UINT16 uDeviceID, DWORD* lpdwVolume)
750 return midiOutGetVolume(uDeviceID, lpdwVolume);
753 /**************************************************************************
754 * midiOutSetVolume [MMSYSTEM.212]
756 UINT16 WINAPI midiOutSetVolume16(UINT16 uDeviceID, DWORD dwVolume)
758 return midiOutSetVolume(uDeviceID, dwVolume);
761 /**************************************************************************
762 * midiOutCachePatches [MMSYSTEM.213]
764 UINT16 WINAPI midiOutCachePatches16(HMIDIOUT16 hMidiOut, UINT16 uBank,
765 WORD* lpwPatchArray, UINT16 uFlags)
767 return midiOutCachePatches(HMIDIOUT_32(hMidiOut), uBank, lpwPatchArray,
771 /**************************************************************************
772 * midiOutCacheDrumPatches [MMSYSTEM.214]
774 UINT16 WINAPI midiOutCacheDrumPatches16(HMIDIOUT16 hMidiOut, UINT16 uPatch,
775 WORD* lpwKeyArray, UINT16 uFlags)
777 return midiOutCacheDrumPatches(HMIDIOUT_32(hMidiOut), uPatch, lpwKeyArray, uFlags);
780 /**************************************************************************
781 * midiOutGetID [MMSYSTEM.215]
783 UINT16 WINAPI midiOutGetID16(HMIDIOUT16 hMidiOut, UINT16* lpuDeviceID)
787 TRACE("(%04X, %p)\n", hMidiOut, lpuDeviceID);
789 if (lpuDeviceID == NULL) return MMSYSERR_INVALPARAM;
790 if ((wmld = MMDRV_Get(HMIDIOUT_32(hMidiOut), MMDRV_MIDIOUT, FALSE)) == NULL)
791 return MMSYSERR_INVALHANDLE;
793 *lpuDeviceID = wmld->uDeviceID;
794 return MMSYSERR_NOERROR;
797 /**************************************************************************
798 * midiOutMessage [MMSYSTEM.216]
800 DWORD WINAPI midiOutMessage16(HMIDIOUT16 hMidiOut, UINT16 uMessage,
801 DWORD dwParam1, DWORD dwParam2)
805 TRACE("(%04X, %04X, %08lX, %08lX)\n", hMidiOut, uMessage, dwParam1, dwParam2);
807 if ((wmld = MMDRV_Get(HMIDIOUT_32(hMidiOut), MMDRV_MIDIOUT, FALSE)) == NULL)
808 return MMSYSERR_INVALHANDLE;
813 FIXME("can't handle OPEN or CLOSE message!\n");
814 return MMSYSERR_NOTSUPPORTED;
817 return midiOutGetVolume16(hMidiOut, MapSL(dwParam1));
819 return midiOutLongMsg16(hMidiOut, MapSL(dwParam1), dwParam2);
821 /* lpMidiOutHdr is still a segmented pointer for this function */
822 return midiOutPrepareHeader16(hMidiOut, dwParam1, dwParam2);
824 return midiOutUnprepareHeader16(hMidiOut, dwParam1, dwParam2);
826 return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2, TRUE);
829 /**************************************************************************
830 * midiInGetNumDevs [MMSYSTEM.301]
832 UINT16 WINAPI midiInGetNumDevs16(void)
834 return MMDRV_GetNum(MMDRV_MIDIIN);
837 /**************************************************************************
838 * midiInGetDevCaps [MMSYSTEM.302]
840 UINT16 WINAPI midiInGetDevCaps16(UINT16 uDeviceID, LPMIDIINCAPS16 lpCaps,
844 UINT ret = midiInGetDevCapsA(uDeviceID, &micA, uSize);
846 if (ret == MMSYSERR_NOERROR) {
847 lpCaps->wMid = micA.wMid;
848 lpCaps->wPid = micA.wPid;
849 lpCaps->vDriverVersion = micA.vDriverVersion;
850 strcpy(lpCaps->szPname, micA.szPname);
851 lpCaps->dwSupport = micA.dwSupport;
857 /**************************************************************************
858 * midiInGetErrorText [MMSYSTEM.303]
860 UINT16 WINAPI midiInGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
862 return midiInGetErrorTextA(uError, lpText, uSize);
865 /**************************************************************************
866 * midiInOpen [MMSYSTEM.304]
868 UINT16 WINAPI midiInOpen16(HMIDIIN16* lphMidiIn, UINT16 uDeviceID,
869 DWORD dwCallback, DWORD dwInstance, DWORD dwFlags)
874 ret = MMSYSTEM_midiInOpen(&xhmid, uDeviceID, dwCallback, dwInstance,
877 if (lphMidiIn) *lphMidiIn = HMIDIIN_16(xhmid);
881 /**************************************************************************
882 * midiInClose [MMSYSTEM.305]
884 UINT16 WINAPI midiInClose16(HMIDIIN16 hMidiIn)
886 return midiInClose(HMIDIIN_32(hMidiIn));
889 /**************************************************************************
890 * midiInPrepareHeader [MMSYSTEM.306]
892 UINT16 WINAPI midiInPrepareHeader16(HMIDIIN16 hMidiIn, /* [in] */
893 SEGPTR lpsegMidiInHdr, /* [???] */
894 UINT16 uSize) /* [in] */
898 TRACE("(%04X, %08lx, %d)\n", hMidiIn, lpsegMidiInHdr, uSize);
900 if ((wmld = MMDRV_Get(HMIDIIN_32(hMidiIn), MMDRV_MIDIIN, FALSE)) == NULL)
901 return MMSYSERR_INVALHANDLE;
903 return MMDRV_Message(wmld, MIDM_PREPARE, (DWORD)lpsegMidiInHdr, uSize, FALSE);
906 /**************************************************************************
907 * midiInUnprepareHeader [MMSYSTEM.307]
909 UINT16 WINAPI midiInUnprepareHeader16(HMIDIIN16 hMidiIn, /* [in] */
910 SEGPTR lpsegMidiInHdr, /* [???] */
911 UINT16 uSize) /* [in] */
914 LPMIDIHDR16 lpMidiInHdr = MapSL(lpsegMidiInHdr);
916 TRACE("(%04X, %08lx, %d)\n", hMidiIn, lpsegMidiInHdr, uSize);
918 if (!(lpMidiInHdr->dwFlags & MHDR_PREPARED)) {
919 return MMSYSERR_NOERROR;
922 if ((wmld = MMDRV_Get(HMIDIIN_32(hMidiIn), MMDRV_MIDIIN, FALSE)) == NULL)
923 return MMSYSERR_INVALHANDLE;
925 return MMDRV_Message(wmld, MIDM_UNPREPARE, (DWORD)lpsegMidiInHdr, uSize, FALSE);
928 /**************************************************************************
929 * midiInAddBuffer [MMSYSTEM.308]
931 UINT16 WINAPI midiInAddBuffer16(HMIDIIN16 hMidiIn, /* [in] */
932 MIDIHDR16* lpsegMidiInHdr, /* [???] NOTE: SEGPTR */
933 UINT16 uSize) /* [in] */
937 TRACE("(%04X, %p, %d)\n", hMidiIn, lpsegMidiInHdr, uSize);
939 if ((wmld = MMDRV_Get(HMIDIIN_32(hMidiIn), MMDRV_MIDIIN, FALSE)) == NULL)
940 return MMSYSERR_INVALHANDLE;
942 return MMDRV_Message(wmld, MIDM_ADDBUFFER, (DWORD)lpsegMidiInHdr, uSize, FALSE);
945 /**************************************************************************
946 * midiInStart [MMSYSTEM.309]
948 UINT16 WINAPI midiInStart16(HMIDIIN16 hMidiIn)
950 return midiInStart(HMIDIIN_32(hMidiIn));
953 /**************************************************************************
954 * midiInStop [MMSYSTEM.310]
956 UINT16 WINAPI midiInStop16(HMIDIIN16 hMidiIn)
958 return midiInStop(HMIDIIN_32(hMidiIn));
961 /**************************************************************************
962 * midiInReset [MMSYSTEM.311]
964 UINT16 WINAPI midiInReset16(HMIDIIN16 hMidiIn)
966 return midiInReset(HMIDIIN_32(hMidiIn));
969 /**************************************************************************
970 * midiInGetID [MMSYSTEM.312]
972 UINT16 WINAPI midiInGetID16(HMIDIIN16 hMidiIn, UINT16* lpuDeviceID)
976 TRACE("(%04X, %p)\n", hMidiIn, lpuDeviceID);
978 if (lpuDeviceID == NULL) return MMSYSERR_INVALPARAM;
980 if ((wmld = MMDRV_Get(HMIDIIN_32(hMidiIn), MMDRV_MIDIIN, TRUE)) == NULL)
981 return MMSYSERR_INVALHANDLE;
983 *lpuDeviceID = wmld->uDeviceID;
985 return MMSYSERR_NOERROR;
988 /**************************************************************************
989 * midiInMessage [MMSYSTEM.313]
991 DWORD WINAPI midiInMessage16(HMIDIIN16 hMidiIn, UINT16 uMessage,
992 DWORD dwParam1, DWORD dwParam2)
996 TRACE("(%04X, %04X, %08lX, %08lX)\n", hMidiIn, uMessage, dwParam1, dwParam2);
1001 FIXME("can't handle OPEN or CLOSE message!\n");
1002 return MMSYSERR_NOTSUPPORTED;
1004 case MIDM_GETDEVCAPS:
1005 return midiInGetDevCaps16(hMidiIn, MapSL(dwParam1), dwParam2);
1007 return midiInPrepareHeader16(hMidiIn, dwParam1, dwParam2);
1008 case MIDM_UNPREPARE:
1009 return midiInUnprepareHeader16(hMidiIn, dwParam1, dwParam2);
1010 case MIDM_ADDBUFFER:
1011 return midiInAddBuffer16(hMidiIn, MapSL(dwParam1), dwParam2);
1014 if ((wmld = MMDRV_Get(HMIDIIN_32(hMidiIn), MMDRV_MIDIIN, FALSE)) == NULL)
1015 return MMSYSERR_INVALHANDLE;
1017 return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2, FALSE);
1020 /**************************************************************************
1021 * midiStreamClose [MMSYSTEM.252]
1023 MMRESULT16 WINAPI midiStreamClose16(HMIDISTRM16 hMidiStrm)
1025 return midiStreamClose(HMIDISTRM_32(hMidiStrm));
1028 /**************************************************************************
1029 * midiStreamOpen [MMSYSTEM.251]
1031 MMRESULT16 WINAPI midiStreamOpen16(HMIDISTRM16* phMidiStrm, LPUINT16 devid,
1032 DWORD cMidi, DWORD dwCallback,
1033 DWORD dwInstance, DWORD fdwOpen)
1035 HMIDISTRM hMidiStrm32;
1039 if (!phMidiStrm || !devid)
1040 return MMSYSERR_INVALPARAM;
1042 ret = MMSYSTEM_MidiStream_Open(&hMidiStrm32, &devid32, cMidi, dwCallback,
1043 dwInstance, fdwOpen, FALSE);
1044 *phMidiStrm = HMIDISTRM_16(hMidiStrm32);
1049 /**************************************************************************
1050 * midiStreamOut [MMSYSTEM.254]
1052 MMRESULT16 WINAPI midiStreamOut16(HMIDISTRM16 hMidiStrm, LPMIDIHDR16 lpMidiHdr, UINT16 cbMidiHdr)
1054 return midiStreamOut(HMIDISTRM_32(hMidiStrm), (LPMIDIHDR)lpMidiHdr,
1058 /**************************************************************************
1059 * midiStreamPause [MMSYSTEM.255]
1061 MMRESULT16 WINAPI midiStreamPause16(HMIDISTRM16 hMidiStrm)
1063 return midiStreamPause(HMIDISTRM_32(hMidiStrm));
1066 /**************************************************************************
1067 * midiStreamPosition [MMSYSTEM.253]
1069 MMRESULT16 WINAPI midiStreamPosition16(HMIDISTRM16 hMidiStrm, LPMMTIME16 lpmmt16, UINT16 cbmmt)
1075 return MMSYSERR_INVALPARAM;
1076 MMSYSTEM_MMTIME16to32(&mmt32, lpmmt16);
1077 ret = midiStreamPosition(HMIDISTRM_32(hMidiStrm), &mmt32, sizeof(MMTIME));
1078 MMSYSTEM_MMTIME32to16(lpmmt16, &mmt32);
1082 /**************************************************************************
1083 * midiStreamProperty [MMSYSTEM.250]
1085 MMRESULT16 WINAPI midiStreamProperty16(HMIDISTRM16 hMidiStrm, LPBYTE lpPropData, DWORD dwProperty)
1087 return midiStreamProperty(HMIDISTRM_32(hMidiStrm), lpPropData, dwProperty);
1090 /**************************************************************************
1091 * midiStreamRestart [MMSYSTEM.256]
1093 MMRESULT16 WINAPI midiStreamRestart16(HMIDISTRM16 hMidiStrm)
1095 return midiStreamRestart(HMIDISTRM_32(hMidiStrm));
1098 /**************************************************************************
1099 * midiStreamStop [MMSYSTEM.257]
1101 MMRESULT16 WINAPI midiStreamStop16(HMIDISTRM16 hMidiStrm)
1103 return midiStreamStop(HMIDISTRM_32(hMidiStrm));
1106 /**************************************************************************
1107 * waveOutGetNumDevs [MMSYSTEM.401]
1109 UINT16 WINAPI waveOutGetNumDevs16(void)
1111 return MMDRV_GetNum(MMDRV_WAVEOUT);
1114 /**************************************************************************
1115 * waveOutGetDevCaps [MMSYSTEM.402]
1117 UINT16 WINAPI waveOutGetDevCaps16(UINT16 uDeviceID,
1118 LPWAVEOUTCAPS16 lpCaps, UINT16 uSize)
1123 TRACE("(%u %p %u)!\n", uDeviceID, lpCaps, uSize);
1124 if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
1126 ret = waveOutGetDevCapsA(uDeviceID, &wocA, sizeof(wocA));
1128 if (ret == MMSYSERR_NOERROR) {
1129 lpCaps->wMid = wocA.wMid;
1130 lpCaps->wPid = wocA.wPid;
1131 lpCaps->vDriverVersion = wocA.vDriverVersion;
1132 strcpy(lpCaps->szPname, wocA.szPname);
1133 lpCaps->dwFormats = wocA.dwFormats;
1134 lpCaps->wChannels = wocA.wChannels;
1135 lpCaps->dwSupport = wocA.dwSupport;
1140 /**************************************************************************
1141 * waveOutGetErrorText [MMSYSTEM.403]
1143 UINT16 WINAPI waveOutGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
1145 return waveOutGetErrorTextA(uError, lpText, uSize);
1148 /**************************************************************************
1149 * waveOutOpen [MMSYSTEM.404]
1151 UINT16 WINAPI waveOutOpen16(HWAVEOUT16* lphWaveOut, UINT16 uDeviceID,
1152 const LPWAVEFORMATEX lpFormat, DWORD dwCallback,
1153 DWORD dwInstance, DWORD dwFlags)
1158 /* since layout of WAVEFORMATEX is the same for 16/32 bits, we directly
1159 * call the 32 bit version
1160 * however, we need to promote correctly the wave mapper id
1161 * (0xFFFFFFFF and not 0x0000FFFF)
1163 ret = MMSYSTEM_waveOpen(&hWaveOut, (uDeviceID == (UINT16)-1) ? (UINT)-1 : uDeviceID,
1164 MMDRV_WAVEOUT, lpFormat, dwCallback, dwInstance, dwFlags, FALSE);
1166 if (lphWaveOut != NULL) *lphWaveOut = HWAVEOUT_16(hWaveOut);
1170 /**************************************************************************
1171 * waveOutClose [MMSYSTEM.405]
1173 UINT16 WINAPI waveOutClose16(HWAVEOUT16 hWaveOut)
1178 ReleaseThunkLock(&level);
1179 ret = waveOutClose(HWAVEOUT_32(hWaveOut));
1180 RestoreThunkLock(level);
1184 /**************************************************************************
1185 * waveOutPrepareHeader [MMSYSTEM.406]
1187 UINT16 WINAPI waveOutPrepareHeader16(HWAVEOUT16 hWaveOut, /* [in] */
1188 SEGPTR lpsegWaveOutHdr, /* [???] */
1189 UINT16 uSize) /* [in] */
1192 LPWAVEHDR lpWaveOutHdr = MapSL(lpsegWaveOutHdr);
1194 TRACE("(%04X, %08lx, %u);\n", hWaveOut, lpsegWaveOutHdr, uSize);
1196 if (lpWaveOutHdr == NULL) return MMSYSERR_INVALPARAM;
1198 if ((wmld = MMDRV_Get(HWAVEOUT_32(hWaveOut), MMDRV_WAVEOUT, FALSE)) == NULL)
1199 return MMSYSERR_INVALHANDLE;
1201 return MMDRV_Message(wmld, WODM_PREPARE, (DWORD)lpsegWaveOutHdr, uSize, FALSE);
1204 /**************************************************************************
1205 * waveOutUnprepareHeader [MMSYSTEM.407]
1207 UINT16 WINAPI waveOutUnprepareHeader16(HWAVEOUT16 hWaveOut, /* [in] */
1208 SEGPTR lpsegWaveOutHdr, /* [???] */
1209 UINT16 uSize) /* [in] */
1212 LPWAVEHDR lpWaveOutHdr = MapSL(lpsegWaveOutHdr);
1214 TRACE("(%04X, %08lx, %u);\n", hWaveOut, lpsegWaveOutHdr, uSize);
1216 if (!(lpWaveOutHdr->dwFlags & WHDR_PREPARED)) {
1217 return MMSYSERR_NOERROR;
1220 if ((wmld = MMDRV_Get(HWAVEOUT_32(hWaveOut), MMDRV_WAVEOUT, FALSE)) == NULL)
1221 return MMSYSERR_INVALHANDLE;
1223 return MMDRV_Message(wmld, WODM_UNPREPARE, (DWORD)lpsegWaveOutHdr, uSize, FALSE);
1226 /**************************************************************************
1227 * waveOutWrite [MMSYSTEM.408]
1229 UINT16 WINAPI waveOutWrite16(HWAVEOUT16 hWaveOut, /* [in] */
1230 LPWAVEHDR lpsegWaveOutHdr, /* [???] NOTE: SEGPTR */
1231 UINT16 uSize) /* [in] */
1235 TRACE("(%04X, %p, %u);\n", hWaveOut, lpsegWaveOutHdr, uSize);
1237 if ((wmld = MMDRV_Get(HWAVEOUT_32(hWaveOut), MMDRV_WAVEOUT, FALSE)) == NULL)
1238 return MMSYSERR_INVALHANDLE;
1240 return MMDRV_Message(wmld, WODM_WRITE, (DWORD)lpsegWaveOutHdr, uSize, FALSE);
1243 /**************************************************************************
1244 * waveOutBreakLoop [MMSYSTEM.419]
1246 UINT16 WINAPI waveOutBreakLoop16(HWAVEOUT16 hWaveOut16)
1251 ReleaseThunkLock(&level);
1252 ret = waveOutBreakLoop(HWAVEOUT_32(hWaveOut16));
1253 RestoreThunkLock(level);
1257 /**************************************************************************
1258 * waveOutPause [MMSYSTEM.409]
1260 UINT16 WINAPI waveOutPause16(HWAVEOUT16 hWaveOut16)
1265 ReleaseThunkLock(&level);
1266 ret = waveOutPause(HWAVEOUT_32(hWaveOut16));
1267 RestoreThunkLock(level);
1271 /**************************************************************************
1272 * waveOutReset [MMSYSTEM.411]
1274 UINT16 WINAPI waveOutReset16(HWAVEOUT16 hWaveOut16)
1279 ReleaseThunkLock(&level);
1280 ret = waveOutReset(HWAVEOUT_32(hWaveOut16));
1281 RestoreThunkLock(level);
1285 /**************************************************************************
1286 * waveOutRestart [MMSYSTEM.410]
1288 UINT16 WINAPI waveOutRestart16(HWAVEOUT16 hWaveOut16)
1293 ReleaseThunkLock(&level);
1294 ret = waveOutRestart(HWAVEOUT_32(hWaveOut16));
1295 RestoreThunkLock(level);
1299 /**************************************************************************
1300 * waveOutGetPosition [MMSYSTEM.412]
1302 UINT16 WINAPI waveOutGetPosition16(HWAVEOUT16 hWaveOut, LPMMTIME16 lpTime,
1308 mmt.wType = lpTime->wType;
1309 ret = waveOutGetPosition(HWAVEOUT_32(hWaveOut), &mmt, sizeof(mmt));
1310 MMSYSTEM_MMTIME32to16(lpTime, &mmt);
1314 /**************************************************************************
1315 * waveOutGetPitch [MMSYSTEM.413]
1317 UINT16 WINAPI waveOutGetPitch16(HWAVEOUT16 hWaveOut16, LPDWORD lpdw)
1319 return waveOutGetPitch(HWAVEOUT_32(hWaveOut16), lpdw);
1322 /**************************************************************************
1323 * waveOutSetPitch [MMSYSTEM.414]
1325 UINT16 WINAPI waveOutSetPitch16(HWAVEOUT16 hWaveOut16, DWORD dw)
1327 return waveOutSetPitch(HWAVEOUT_32(hWaveOut16), dw);
1330 /**************************************************************************
1331 * waveOutGetPlaybackRate [MMSYSTEM.417]
1333 UINT16 WINAPI waveOutGetPlaybackRate16(HWAVEOUT16 hWaveOut16, LPDWORD lpdw)
1335 return waveOutGetPlaybackRate(HWAVEOUT_32(hWaveOut16), lpdw);
1338 /**************************************************************************
1339 * waveOutSetPlaybackRate [MMSYSTEM.418]
1341 UINT16 WINAPI waveOutSetPlaybackRate16(HWAVEOUT16 hWaveOut16, DWORD dw)
1343 return waveOutSetPlaybackRate(HWAVEOUT_32(hWaveOut16), dw);
1346 /**************************************************************************
1347 * waveOutGetVolume [MMSYSTEM.415]
1349 UINT16 WINAPI waveOutGetVolume16(UINT16 devid, LPDWORD lpdw)
1351 return waveOutGetVolume(devid, lpdw);
1354 /**************************************************************************
1355 * waveOutSetVolume [MMSYSTEM.416]
1357 UINT16 WINAPI waveOutSetVolume16(UINT16 devid, DWORD dw)
1359 return waveOutSetVolume(devid, dw);
1362 /**************************************************************************
1363 * waveOutGetID [MMSYSTEM.420]
1365 UINT16 WINAPI waveOutGetID16(HWAVEOUT16 hWaveOut, UINT16* lpuDeviceID)
1369 TRACE("(%04X, %p);\n", hWaveOut, lpuDeviceID);
1371 if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
1373 if ((wmld = MMDRV_Get(HWAVEOUT_32(hWaveOut), MMDRV_WAVEOUT, FALSE)) == NULL)
1374 return MMSYSERR_INVALHANDLE;
1376 *lpuDeviceID = wmld->uDeviceID;
1380 /**************************************************************************
1381 * waveOutMessage [MMSYSTEM.421]
1383 DWORD WINAPI waveOutMessage16(HWAVEOUT16 hWaveOut, UINT16 uMessage,
1384 DWORD dwParam1, DWORD dwParam2)
1388 TRACE("(%04x, %u, %ld, %ld)\n", hWaveOut, uMessage, dwParam1, dwParam2);
1390 if ((wmld = MMDRV_Get(HWAVEOUT_32(hWaveOut), MMDRV_WAVEOUT, FALSE)) == NULL) {
1391 if ((wmld = MMDRV_Get(HWAVEOUT_32(hWaveOut), MMDRV_WAVEOUT, TRUE)) != NULL) {
1392 return MMDRV_PhysicalFeatures(wmld, uMessage, dwParam1, dwParam2);
1394 return MMSYSERR_INVALHANDLE;
1398 if (uMessage < DRVM_IOCTL || (uMessage >= DRVM_IOCTL_LAST && uMessage < DRVM_MAPPER))
1399 return MMSYSERR_INVALPARAM;
1401 return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2, FALSE);
1404 /**************************************************************************
1405 * waveInGetNumDevs [MMSYSTEM.501]
1407 UINT16 WINAPI waveInGetNumDevs16(void)
1409 return MMDRV_GetNum(MMDRV_WAVEIN);
1412 /**************************************************************************
1413 * waveInGetDevCaps [MMSYSTEM.502]
1415 UINT16 WINAPI waveInGetDevCaps16(UINT16 uDeviceID, LPWAVEINCAPS16 lpCaps,
1419 UINT ret = waveInGetDevCapsA(uDeviceID, &wicA, sizeof(wicA));
1421 if (lpCaps == NULL) return MMSYSERR_INVALPARAM;
1423 if (ret == MMSYSERR_NOERROR) {
1424 lpCaps->wMid = wicA.wMid;
1425 lpCaps->wPid = wicA.wPid;
1426 lpCaps->vDriverVersion = wicA.vDriverVersion;
1427 strcpy(lpCaps->szPname, wicA.szPname);
1428 lpCaps->dwFormats = wicA.dwFormats;
1429 lpCaps->wChannels = wicA.wChannels;
1434 /**************************************************************************
1435 * waveInGetErrorText [MMSYSTEM.503]
1437 UINT16 WINAPI waveInGetErrorText16(UINT16 uError, LPSTR lpText, UINT16 uSize)
1439 return waveInGetErrorTextA(uError, lpText, uSize);
1442 /**************************************************************************
1443 * waveInOpen [MMSYSTEM.504]
1445 UINT16 WINAPI waveInOpen16(HWAVEIN16* lphWaveIn, UINT16 uDeviceID,
1446 const LPWAVEFORMATEX lpFormat, DWORD dwCallback,
1447 DWORD dwInstance, DWORD dwFlags)
1452 /* since layout of WAVEFORMATEX is the same for 16/32 bits, we directly
1453 * call the 32 bit version
1454 * however, we need to promote correctly the wave mapper id
1455 * (0xFFFFFFFF and not 0x0000FFFF)
1457 ret = MMSYSTEM_waveOpen(&hWaveIn, (uDeviceID == (UINT16)-1) ? (UINT)-1 : uDeviceID,
1458 MMDRV_WAVEIN, lpFormat, dwCallback, dwInstance, dwFlags, FALSE);
1460 if (lphWaveIn != NULL) *lphWaveIn = HWAVEIN_16(hWaveIn);
1464 /**************************************************************************
1465 * waveInClose [MMSYSTEM.505]
1467 UINT16 WINAPI waveInClose16(HWAVEIN16 hWaveIn)
1472 ReleaseThunkLock(&level);
1473 ret = waveInClose(HWAVEIN_32(hWaveIn));
1474 RestoreThunkLock(level);
1478 /**************************************************************************
1479 * waveInPrepareHeader [MMSYSTEM.506]
1481 UINT16 WINAPI waveInPrepareHeader16(HWAVEIN16 hWaveIn, /* [in] */
1482 SEGPTR lpsegWaveInHdr, /* [???] */
1483 UINT16 uSize) /* [in] */
1486 LPWAVEHDR lpWaveInHdr = MapSL(lpsegWaveInHdr);
1489 TRACE("(%04X, %p, %u);\n", hWaveIn, lpWaveInHdr, uSize);
1491 if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
1492 if ((wmld = MMDRV_Get(HWAVEIN_32(hWaveIn), MMDRV_WAVEIN, FALSE)) == NULL)
1493 return MMSYSERR_INVALHANDLE;
1495 lpWaveInHdr->dwBytesRecorded = 0;
1497 ret = MMDRV_Message(wmld, WIDM_PREPARE, (DWORD)lpsegWaveInHdr, uSize, FALSE);
1501 /**************************************************************************
1502 * waveInUnprepareHeader [MMSYSTEM.507]
1504 UINT16 WINAPI waveInUnprepareHeader16(HWAVEIN16 hWaveIn, /* [in] */
1505 SEGPTR lpsegWaveInHdr, /* [???] */
1506 UINT16 uSize) /* [in] */
1509 LPWAVEHDR lpWaveInHdr = MapSL(lpsegWaveInHdr);
1511 TRACE("(%04X, %08lx, %u);\n", hWaveIn, lpsegWaveInHdr, uSize);
1513 if (lpWaveInHdr == NULL) return MMSYSERR_INVALPARAM;
1515 if (!(lpWaveInHdr->dwFlags & WHDR_PREPARED)) {
1516 return MMSYSERR_NOERROR;
1519 if ((wmld = MMDRV_Get(HWAVEIN_32(hWaveIn), MMDRV_WAVEIN, FALSE)) == NULL)
1520 return MMSYSERR_INVALHANDLE;
1522 return MMDRV_Message(wmld, WIDM_UNPREPARE, (DWORD)lpsegWaveInHdr, uSize, FALSE);
1525 /**************************************************************************
1526 * waveInAddBuffer [MMSYSTEM.508]
1528 UINT16 WINAPI waveInAddBuffer16(HWAVEIN16 hWaveIn, /* [in] */
1529 WAVEHDR* lpsegWaveInHdr, /* [???] NOTE: SEGPTR */
1530 UINT16 uSize) /* [in] */
1534 TRACE("(%04X, %p, %u);\n", hWaveIn, lpsegWaveInHdr, uSize);
1536 if (lpsegWaveInHdr == NULL) return MMSYSERR_INVALPARAM;
1537 if ((wmld = MMDRV_Get(HWAVEIN_32(hWaveIn), MMDRV_WAVEIN, FALSE)) == NULL)
1538 return MMSYSERR_INVALHANDLE;
1540 return MMDRV_Message(wmld, WIDM_ADDBUFFER, (DWORD)lpsegWaveInHdr, uSize, FALSE);
1543 /**************************************************************************
1544 * waveInReset [MMSYSTEM.511]
1546 UINT16 WINAPI waveInReset16(HWAVEIN16 hWaveIn16)
1551 ReleaseThunkLock(&level);
1552 ret = waveInReset(HWAVEIN_32(hWaveIn16));
1553 RestoreThunkLock(level);
1557 /**************************************************************************
1558 * waveInStart [MMSYSTEM.509]
1560 UINT16 WINAPI waveInStart16(HWAVEIN16 hWaveIn16)
1565 ReleaseThunkLock(&level);
1566 ret = waveInStart(HWAVEIN_32(hWaveIn16));
1567 RestoreThunkLock(level);
1571 /**************************************************************************
1572 * waveInStop [MMSYSTEM.510]
1574 UINT16 WINAPI waveInStop16(HWAVEIN16 hWaveIn16)
1579 ReleaseThunkLock(&level);
1580 ret = waveInStop(HWAVEIN_32(hWaveIn16));
1581 RestoreThunkLock(level);
1585 /**************************************************************************
1586 * waveInGetPosition [MMSYSTEM.512]
1588 UINT16 WINAPI waveInGetPosition16(HWAVEIN16 hWaveIn, LPMMTIME16 lpTime,
1594 mmt.wType = lpTime->wType;
1595 ret = waveInGetPosition(HWAVEIN_32(hWaveIn), &mmt, sizeof(mmt));
1596 MMSYSTEM_MMTIME32to16(lpTime, &mmt);
1600 /**************************************************************************
1601 * waveInGetID [MMSYSTEM.513]
1603 UINT16 WINAPI waveInGetID16(HWAVEIN16 hWaveIn, UINT16* lpuDeviceID)
1607 TRACE("(%04X, %p);\n", hWaveIn, lpuDeviceID);
1609 if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
1611 if ((wmld = MMDRV_Get(HWAVEIN_32(hWaveIn), MMDRV_WAVEIN, FALSE)) == NULL)
1612 return MMSYSERR_INVALHANDLE;
1614 *lpuDeviceID = wmld->uDeviceID;
1615 return MMSYSERR_NOERROR;
1618 /**************************************************************************
1619 * waveInMessage [MMSYSTEM.514]
1621 DWORD WINAPI waveInMessage16(HWAVEIN16 hWaveIn, UINT16 uMessage,
1622 DWORD dwParam1, DWORD dwParam2)
1626 TRACE("(%04x, %u, %ld, %ld)\n", hWaveIn, uMessage, dwParam1, dwParam2);
1629 if (uMessage < DRVM_IOCTL || (uMessage >= DRVM_IOCTL_LAST && uMessage < DRVM_MAPPER))
1630 return MMSYSERR_INVALPARAM;
1632 if ((wmld = MMDRV_Get(HWAVEIN_32(hWaveIn), MMDRV_WAVEIN, FALSE)) == NULL)
1633 return MMSYSERR_INVALHANDLE;
1635 return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2, TRUE);
1638 /*#define USE_MM_TSK_WINE*/
1640 /**************************************************************************
1641 * mmTaskCreate [MMSYSTEM.900]
1643 * Creates a 16 bit MM task. It's entry point is lpFunc, and it should be
1644 * called upon creation with dwPmt as parameter.
1646 HINSTANCE16 WINAPI mmTaskCreate16(SEGPTR spProc, HINSTANCE16 *lphMmTask, DWORD dwPmt)
1651 DWORD showCmd = 0x40002;
1654 TRACE("(%08lx, %p, %08lx);\n", spProc, lphMmTask, dwPmt);
1655 /* This to work requires NE modules to be started with a binary command line
1656 * which is not currently the case. A patch exists but has never been committed.
1657 * A workaround would be to integrate code for mmtask.tsk into Wine, but
1658 * this requires tremendous work (starting with patching tools/build to
1659 * create NE executables (and not only DLLs) for builtins modules.
1662 FIXME("This is currently broken. It will fail\n");
1665 *(LPDWORD)(cmdline + 1) = (DWORD)spProc;
1666 *(LPDWORD)(cmdline + 5) = dwPmt;
1667 *(LPDWORD)(cmdline + 9) = 0;
1669 lp.hEnvironment = 0;
1670 lp.cmdLine = MapLS(cmdline);
1671 lp.showCmd = MapLS(&showCmd);
1674 #ifndef USE_MM_TSK_WINE
1675 handle = LoadModule16("c:\\windows\\system\\mmtask.tsk", &lp);
1677 handle = LoadModule16("mmtask.tsk", &lp);
1680 ret = (handle) ? 1 : 2;
1686 *lphMmTask = handle;
1688 UnMapLS( lp.cmdLine );
1689 UnMapLS( lp.showCmd );
1690 TRACE("=> 0x%04x/%d\n", handle, ret);
1694 #ifdef USE_MM_TSK_WINE
1695 /* C equivalent to mmtask.tsk binary content */
1696 void mmTaskEntryPoint16(LPSTR cmdLine, WORD di, WORD si)
1698 int len = cmdLine[0x80];
1701 void (*fpProc)(DWORD) = MapSL(*((DWORD*)(cmdLine + 1)));
1702 DWORD dwPmt = *((DWORD*)(cmdLine + 5));
1705 InitTask16(); /* FIXME: pmts / from context ? */
1708 if (SetMessageQueue16(0x40)) {
1710 if (HIWORD(fpProc)) {
1712 /* EPP StackEnter16(); */
1724 /**************************************************************************
1725 * mmTaskBlock [MMSYSTEM.902]
1727 void WINAPI mmTaskBlock16(HINSTANCE16 WINE_UNUSED hInst)
1732 GetMessageA(&msg, 0, 0, 0);
1734 TranslateMessage(&msg);
1735 DispatchMessageA(&msg);
1737 } while (msg.message < 0x3A0);
1740 /**************************************************************************
1741 * mmTaskSignal [MMSYSTEM.903]
1743 LRESULT WINAPI mmTaskSignal16(HTASK16 ht)
1745 TRACE("(%04x);\n", ht);
1746 return PostAppMessage16(ht, WM_USER, 0, 0);
1749 /**************************************************************************
1750 * mmGetCurrentTask [MMSYSTEM.904]
1752 HTASK16 WINAPI mmGetCurrentTask16(void)
1754 return GetCurrentTask();
1757 /**************************************************************************
1758 * mmTaskYield [MMSYSTEM.905]
1760 void WINAPI mmTaskYield16(void)
1764 if (PeekMessageA(&msg, 0, 0, 0, 0)) {
1769 extern DWORD WINAPI GetProcessFlags(DWORD);
1771 /**************************************************************************
1772 * mmThreadCreate [MMSYSTEM.1120]
1775 * Creates a MM thread, calling fpThreadAddr(dwPmt).
1777 * bit.0 set means create a 16 bit task instead of thread calling a 16 bit proc
1778 * bit.1 set means to open a VxD for this thread (unsupported)
1780 LRESULT WINAPI mmThreadCreate16(FARPROC16 fpThreadAddr, LPHANDLE lpHndl, DWORD dwPmt, DWORD dwFlags)
1785 TRACE("(%p, %p, %08lx, %08lx)!\n", fpThreadAddr, lpHndl, dwPmt, dwFlags);
1787 hndl = GlobalAlloc16(sizeof(WINE_MMTHREAD), GMEM_SHARE|GMEM_ZEROINIT);
1792 WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
1795 /* force mmtask routines even if mmthread is required */
1796 /* this will work only if the patch about binary cmd line and NE tasks
1802 lpMMThd->dwSignature = WINE_MMTHREAD_CREATED;
1803 lpMMThd->dwCounter = 0;
1804 lpMMThd->hThread = 0;
1805 lpMMThd->dwThreadID = 0;
1806 lpMMThd->fpThread = fpThreadAddr;
1807 lpMMThd->dwThreadPmt = dwPmt;
1808 lpMMThd->dwSignalCount = 0;
1809 lpMMThd->hEvent = 0;
1811 lpMMThd->dwStatus = 0;
1812 lpMMThd->dwFlags = dwFlags;
1815 if ((dwFlags & 1) == 0 && (GetProcessFlags(GetCurrentThreadId()) & 8) == 0) {
1816 lpMMThd->hEvent = CreateEventA(0, 0, 1, 0);
1818 TRACE("Let's go crazy... trying new MM thread. lpMMThd=%p\n", lpMMThd);
1819 if (lpMMThd->dwFlags & 2) {
1820 /* as long as we don't support MM VxD in wine, we don't need
1821 * to care about this flag
1823 /* FIXME("Don't know how to properly open VxD handles\n"); */
1824 /* lpMMThd->hVxD = OpenVxDHandle(lpMMThd->hEvent); */
1827 lpMMThd->hThread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)WINE_mmThreadEntryPoint,
1828 (LPVOID)(DWORD)hndl, CREATE_SUSPENDED, &lpMMThd->dwThreadID);
1829 if (lpMMThd->hThread == 0) {
1830 WARN("Couldn't create thread\n");
1831 /* clean-up(VxDhandle...); devicedirectio... */
1832 if (lpMMThd->hEvent != 0)
1833 CloseHandle(lpMMThd->hEvent);
1836 TRACE("Got a nice thread hndl=0x%04x id=0x%08lx\n", lpMMThd->hThread, lpMMThd->dwThreadID);
1840 /* get WINE_mmThreadEntryPoint()
1841 * 2047 is its ordinal in mmsystem.spec
1843 FARPROC16 fp = GetProcAddress16(GetModuleHandle16("MMSYSTEM"), (LPCSTR)2047);
1845 TRACE("farproc seg=0x%08lx lin=%p\n", (DWORD)fp, MapSL((SEGPTR)fp));
1847 ret = (fp == 0) ? 2 : mmTaskCreate16((DWORD)fp, 0, hndl);
1851 if (lpMMThd->hThread && !ResumeThread(lpMMThd->hThread))
1852 WARN("Couldn't resume thread\n");
1854 while (lpMMThd->dwStatus != 0x10) { /* test also HIWORD of dwStatus */
1868 TRACE("ok => %ld\n", ret);
1872 /**************************************************************************
1873 * mmThreadSignal [MMSYSTEM.1121]
1875 void WINAPI mmThreadSignal16(HANDLE16 hndl)
1877 TRACE("(%04x)!\n", hndl);
1880 WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
1882 lpMMThd->dwCounter++;
1883 if (lpMMThd->hThread != 0) {
1884 InterlockedIncrement(&lpMMThd->dwSignalCount);
1885 SetEvent(lpMMThd->hEvent);
1887 mmTaskSignal16(lpMMThd->hTask);
1889 lpMMThd->dwCounter--;
1893 static void MMSYSTEM_ThreadBlock(WINE_MMTHREAD* lpMMThd)
1898 if (lpMMThd->dwThreadID != GetCurrentThreadId())
1899 ERR("Not called by thread itself\n");
1902 ResetEvent(lpMMThd->hEvent);
1903 if (InterlockedDecrement(&lpMMThd->dwSignalCount) >= 0)
1905 InterlockedIncrement(&lpMMThd->dwSignalCount);
1909 ret = MsgWaitForMultipleObjects(1, &lpMMThd->hEvent, FALSE, INFINITE, QS_ALLINPUT);
1911 case WAIT_OBJECT_0: /* Event */
1914 case WAIT_OBJECT_0 + 1: /* Msg */
1916 if (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) {
1917 TranslateMessage(&msg);
1918 DispatchMessageA(&msg);
1922 WARN("S2.x unsupported ret val 0x%08lx\n", ret);
1928 /**************************************************************************
1929 * mmThreadBlock [MMSYSTEM.1122]
1931 void WINAPI mmThreadBlock16(HANDLE16 hndl)
1933 TRACE("(%04x)!\n", hndl);
1936 WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
1938 if (lpMMThd->hThread != 0) {
1941 ReleaseThunkLock(&lc);
1942 MMSYSTEM_ThreadBlock(lpMMThd);
1943 RestoreThunkLock(lc);
1945 mmTaskBlock16(lpMMThd->hTask);
1951 /**************************************************************************
1952 * mmThreadIsCurrent [MMSYSTEM.1123]
1954 BOOL16 WINAPI mmThreadIsCurrent16(HANDLE16 hndl)
1958 TRACE("(%04x)!\n", hndl);
1960 if (hndl && mmThreadIsValid16(hndl)) {
1961 WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
1962 ret = (GetCurrentThreadId() == lpMMThd->dwThreadID);
1964 TRACE("=> %d\n", ret);
1968 /**************************************************************************
1969 * mmThreadIsValid [MMSYSTEM.1124]
1971 BOOL16 WINAPI mmThreadIsValid16(HANDLE16 hndl)
1975 TRACE("(%04x)!\n", hndl);
1978 WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
1980 if (!IsBadWritePtr(lpMMThd, sizeof(WINE_MMTHREAD)) &&
1981 lpMMThd->dwSignature == WINE_MMTHREAD_CREATED &&
1982 IsTask16(lpMMThd->hTask)) {
1983 lpMMThd->dwCounter++;
1984 if (lpMMThd->hThread != 0) {
1986 if (GetExitCodeThread(lpMMThd->hThread, &dwThreadRet) &&
1987 dwThreadRet == STATUS_PENDING) {
1993 lpMMThd->dwCounter--;
1996 TRACE("=> %d\n", ret);
2000 /**************************************************************************
2001 * mmThreadGetTask [MMSYSTEM.1125]
2003 HANDLE16 WINAPI mmThreadGetTask16(HANDLE16 hndl)
2007 TRACE("(%04x)\n", hndl);
2009 if (mmThreadIsValid16(hndl)) {
2010 WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
2011 ret = lpMMThd->hTask;
2016 /* ### start build ### */
2017 extern LONG CALLBACK MMSYSTEM_CallTo16_long_l (FARPROC16,LONG);
2018 /* ### stop build ### */
2020 /**************************************************************************
2021 * __wine_mmThreadEntryPoint (MMSYSTEM.2047)
2023 void WINAPI WINE_mmThreadEntryPoint(DWORD _pmt)
2025 HANDLE16 hndl = (HANDLE16)_pmt;
2026 WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
2028 TRACE("(%04x %p)\n", hndl, lpMMThd);
2030 lpMMThd->hTask = LOWORD(GetCurrentTask());
2031 TRACE("[10-%08x] setting hTask to 0x%08x\n", lpMMThd->hThread, lpMMThd->hTask);
2032 lpMMThd->dwStatus = 0x10;
2033 MMSYSTEM_ThreadBlock(lpMMThd);
2034 TRACE("[20-%08x]\n", lpMMThd->hThread);
2035 lpMMThd->dwStatus = 0x20;
2036 if (lpMMThd->fpThread) {
2037 MMSYSTEM_CallTo16_long_l(lpMMThd->fpThread, lpMMThd->dwThreadPmt);
2039 lpMMThd->dwStatus = 0x30;
2040 TRACE("[30-%08x]\n", lpMMThd->hThread);
2041 while (lpMMThd->dwCounter) {
2043 /* K32WOWYield16();*/
2045 TRACE("[XX-%08x]\n", lpMMThd->hThread);
2047 lpMMThd->dwSignature = WINE_MMTHREAD_DELETED;
2048 /* close lpMMThread->hVxD directIO */
2049 if (lpMMThd->hEvent)
2050 CloseHandle(lpMMThd->hEvent);
2055 typedef BOOL16 (WINAPI *MMCPLCALLBACK)(HWND, LPCSTR, LPCSTR, LPCSTR);
2057 /**************************************************************************
2058 * mmShowMMCPLPropertySheet [MMSYSTEM.1150]
2060 BOOL16 WINAPI mmShowMMCPLPropertySheet16(HWND hWnd, LPCSTR lpStrDevice,
2061 LPCSTR lpStrTab, LPCSTR lpStrTitle)
2066 TRACE("(%04x \"%s\" \"%s\" \"%s\")\n", hWnd, lpStrDevice, lpStrTab, lpStrTitle);
2068 hndl = LoadLibraryA("MMSYS.CPL");
2070 MMCPLCALLBACK fp = (MMCPLCALLBACK)GetProcAddress(hndl, "ShowMMCPLPropertySheet");
2073 ReleaseThunkLock(&lc);
2074 ret = (fp)(hWnd, lpStrDevice, lpStrTab, lpStrTitle);
2075 RestoreThunkLock(lc);
2083 /**************************************************************************
2084 * StackEnter [MMSYSTEM.32]
2086 void WINAPI StackEnter16(void)
2089 /* mmsystem.dll from Win 95 does only this: so does Wine */
2094 /**************************************************************************
2095 * StackLeave [MMSYSTEM.33]
2097 void WINAPI StackLeave16(void)
2100 /* mmsystem.dll from Win 95 does only this: so does Wine */
2105 /**************************************************************************
2106 * WMMMidiRunOnce [MMSYSTEM.8]
2108 void WINAPI WMMMidiRunOnce16(void)
2110 FIXME("(), stub!\n");
2113 /**************************************************************************
2114 * OutputDebugStr [MMSYSTEM.30]
2116 void WINAPI OutputDebugStr16(
2117 LPCSTR str) /* [in] The message to be logged and given to the debugger. */
2119 OutputDebugStringA( str );
2122 /**************************************************************************
2123 * DrvOpen [MMSYSTEM.1100]
2125 HDRVR16 WINAPI DrvOpen16(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
2127 return OpenDriver16(lpDriverName, lpSectionName, lParam);
2130 /**************************************************************************
2131 * DrvClose [MMSYSTEM.1101]
2133 LRESULT WINAPI DrvClose16(HDRVR16 hDrv, LPARAM lParam1, LPARAM lParam2)
2135 return CloseDriver16(hDrv, lParam1, lParam2);
2138 /**************************************************************************
2139 * DrvSendMessage [MMSYSTEM.1102]
2141 LRESULT WINAPI DrvSendMessage16(HDRVR16 hDrv, WORD msg, LPARAM lParam1,
2144 return SendDriverMessage16(hDrv, msg, lParam1, lParam2);
2147 /**************************************************************************
2148 * DrvGetModuleHandle [MMSYSTEM.1103]
2150 HANDLE16 WINAPI DrvGetModuleHandle16(HDRVR16 hDrv)
2152 return GetDriverModuleHandle16(hDrv);
2155 /**************************************************************************
2156 * DrvDefDriverProc [MMSYSTEM.1104]
2158 LRESULT WINAPI DrvDefDriverProc16(DWORD dwDriverID, HDRVR16 hDrv, WORD wMsg,
2159 DWORD dwParam1, DWORD dwParam2)
2161 return DefDriverProc16(dwDriverID, hDrv, wMsg, dwParam1, dwParam2);
2164 /**************************************************************************
2165 * DriverProc [MMSYSTEM.6]
2167 LRESULT WINAPI DriverProc16(DWORD dwDevID, HDRVR16 hDrv, WORD wMsg,
2168 DWORD dwParam1, DWORD dwParam2)
2170 TRACE("dwDevID=%08lx hDrv=%04x wMsg=%04x dwParam1=%08lx dwParam2=%08lx\n",
2171 dwDevID, hDrv, wMsg, dwParam1, dwParam2);
2173 return DrvDefDriverProc16(dwDevID, hDrv, wMsg, dwParam1, dwParam2);
2176 /**************************************************************************
2177 * timeGetSystemTime [MMSYSTEM.601]
2179 MMRESULT16 WINAPI timeGetSystemTime16(LPMMTIME16 lpTime, UINT16 wSize)
2181 TRACE("(%p, %u);\n", lpTime, wSize);
2183 if (wSize >= sizeof(*lpTime)) {
2184 lpTime->wType = TIME_MS;
2185 lpTime->u.ms = TIME_MMTimeStart()->mmSysTimeMS;
2187 TRACE("=> %lu\n", lpTime->u.ms);
2193 /**************************************************************************
2194 * timeSetEvent [MMSYSTEM.602]
2196 MMRESULT16 WINAPI timeSetEvent16(UINT16 wDelay, UINT16 wResol, LPTIMECALLBACK16 lpFunc,
2197 DWORD dwUser, UINT16 wFlags)
2199 if (wFlags & WINE_TIMER_IS32)
2200 WARN("Unknown windows flag... wine internally used.. ooch\n");
2202 return timeSetEventInternal(wDelay, wResol, (FARPROC16)lpFunc,
2203 dwUser, wFlags & ~WINE_TIMER_IS32);
2206 /**************************************************************************
2207 * timeKillEvent [MMSYSTEM.603]
2209 MMRESULT16 WINAPI timeKillEvent16(UINT16 wID)
2211 return timeKillEvent(wID);
2214 /**************************************************************************
2215 * timeGetDevCaps [MMSYSTEM.604]
2217 MMRESULT16 WINAPI timeGetDevCaps16(LPTIMECAPS16 lpCaps, UINT16 wSize)
2222 TRACE("(%p, %u) !\n", lpCaps, wSize);
2224 ret = timeGetDevCaps(&caps, sizeof(caps));
2225 lpCaps->wPeriodMin = caps.wPeriodMin;
2226 lpCaps->wPeriodMax = caps.wPeriodMax;
2230 /**************************************************************************
2231 * timeBeginPeriod [MMSYSTEM.605]
2233 MMRESULT16 WINAPI timeBeginPeriod16(UINT16 wPeriod)
2235 TRACE("(%u) !\n", wPeriod);
2237 return timeBeginPeriod(wPeriod);
2240 /**************************************************************************
2241 * timeEndPeriod [MMSYSTEM.606]
2243 MMRESULT16 WINAPI timeEndPeriod16(UINT16 wPeriod)
2245 TRACE("(%u) !\n", wPeriod);
2247 return timeEndPeriod(wPeriod);
2250 /**************************************************************************
2251 * mciSendString [MMSYSTEM.702]
2253 DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrRet,
2254 UINT16 uRetLen, HWND16 hwndCallback)
2256 return mciSendStringA(lpstrCommand, lpstrRet, uRetLen, HWND_32(hwndCallback));
2259 /**************************************************************************
2260 * mciLoadCommandResource [MMSYSTEM.705]
2262 UINT16 WINAPI mciLoadCommandResource16(HANDLE16 hInst, LPCSTR resname, UINT16 type)
2264 LPCWSTR ptr = HEAP_strdupAtoW(GetProcessHeap(), 0, resname);
2265 UINT ret = mciLoadCommandResource(hInst, ptr, type);
2266 HeapFree(GetProcessHeap(), 0, (LPWSTR)ptr);
2270 /**************************************************************************
2271 * mciFreeCommandResource [MMSYSTEM.713]
2273 BOOL16 WINAPI mciFreeCommandResource16(UINT16 uTable)
2275 TRACE("(%04x)!\n", uTable);
2277 return mciFreeCommandResource(uTable);