1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
6 * Copyright 1993 Martin Ayotte
7 * 1998-2003 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 * 99/4 added mmTask and mmThread functions support
32 #define NONAMELESSUNION
33 #define NONAMELESSSTRUCT
41 #include "wine/winuser16.h"
44 #include "wine/debug.h"
46 WINE_DEFAULT_DEBUG_CHANNEL(mmsys
);
48 static WINE_MMTHREAD
* WINMM_GetmmThread(HANDLE16
);
49 static LPWINE_DRIVER
DRIVER_OpenDriver16(LPCWSTR
, LPCWSTR
, LPARAM
);
50 static LRESULT
DRIVER_CloseDriver16(HDRVR16
, LPARAM
, LPARAM
);
51 static LRESULT
DRIVER_SendMessage16(HDRVR16
, UINT
, LPARAM
, LPARAM
);
52 static LRESULT
MMIO_Callback16(SEGPTR
, LPMMIOINFO
, UINT
, LPARAM
, LPARAM
);
54 /* ###################################################
56 * ###################################################
59 /**************************************************************************
60 * DllEntryPoint (MMSYSTEM.4)
62 * MMSYSTEM DLL entry point
65 BOOL WINAPI
MMSYSTEM_LibMain(DWORD fdwReason
, HINSTANCE hinstDLL
, WORD ds
,
66 WORD wHeapSize
, DWORD dwReserved1
, WORD wReserved2
)
68 TRACE("%p 0x%x\n", hinstDLL
, fdwReason
);
71 case DLL_PROCESS_ATTACH
:
72 /* need to load WinMM in order to:
73 * - initiate correctly shared variables (WINMM_Init())
75 if (!GetModuleHandleA("WINMM.DLL"))
77 ERR("Could not load sibling WinMM.dll\n");
80 /* hook in our 16 bit function pointers */
81 pFnGetMMThread16
= WINMM_GetmmThread
;
82 pFnOpenDriver16
= DRIVER_OpenDriver16
;
83 pFnCloseDriver16
= DRIVER_CloseDriver16
;
84 pFnSendMessage16
= DRIVER_SendMessage16
;
85 pFnMmioCallback16
= MMIO_Callback16
;
86 pFnReleaseThunkLock
= ReleaseThunkLock
;
87 pFnRestoreThunkLock
= RestoreThunkLock
;
90 case DLL_PROCESS_DETACH
:
91 pFnGetMMThread16
= NULL
;
92 pFnOpenDriver16
= NULL
;
93 pFnCloseDriver16
= NULL
;
94 pFnSendMessage16
= NULL
;
95 pFnMmioCallback16
= NULL
;
96 pFnReleaseThunkLock
= NULL
;
97 pFnRestoreThunkLock
= NULL
;
98 /* FIXME: add equivalent for MMDRV_Init16() */
100 case DLL_THREAD_ATTACH
:
101 case DLL_THREAD_DETACH
:
107 /**************************************************************************
110 int WINAPI
MMSYSTEM_WEP(HINSTANCE16 hInstance
, WORD wDataSeg
,
111 WORD cbHeapSize
, LPSTR lpCmdLine
)
113 TRACE("STUB: Unloading MMSystem DLL ... hInst=%04X\n", hInstance
);
117 /* ###################################################
119 * ###################################################
122 /**************************************************************************
123 * PlaySound [MMSYSTEM.3]
125 BOOL16 WINAPI
PlaySound16(LPCSTR pszSound
, HMODULE16 hmod
, DWORD fdwSound
)
130 if ((fdwSound
& SND_RESOURCE
) == SND_RESOURCE
)
135 if (!(res
= FindResource16( hmod
, pszSound
, "WAVE" ))) return FALSE
;
136 if (!(handle
= LoadResource16( hmod
, res
))) return FALSE
;
137 pszSound
= LockResource16(handle
);
138 fdwSound
= (fdwSound
& ~SND_RESOURCE
) | SND_MEMORY
;
139 /* FIXME: FreeResource16 */
142 ReleaseThunkLock(&lc
);
143 retv
= PlaySoundA(pszSound
, 0, fdwSound
);
144 RestoreThunkLock(lc
);
149 /**************************************************************************
150 * sndPlaySound [MMSYSTEM.2]
152 BOOL16 WINAPI
sndPlaySound16(LPCSTR lpszSoundName
, UINT16 uFlags
)
157 ReleaseThunkLock(&lc
);
158 retv
= sndPlaySoundA(lpszSoundName
, uFlags
);
159 RestoreThunkLock(lc
);
164 /* ###################################################
166 * ###################################################
169 /**************************************************************************
170 * mmsystemGetVersion [MMSYSTEM.5]
173 UINT16 WINAPI
mmsystemGetVersion16(void)
175 return mmsystemGetVersion();
178 /**************************************************************************
179 * DriverCallback [MMSYSTEM.31]
181 BOOL16 WINAPI
DriverCallback16(DWORD dwCallBack
, UINT16 uFlags
, HDRVR16 hDev
,
182 WORD wMsg
, DWORD dwUser
, DWORD dwParam1
,
185 return DriverCallback(dwCallBack
, uFlags
, HDRVR_32(hDev
), wMsg
, dwUser
, dwParam1
, dwParam2
);
188 /**************************************************************************
189 * OutputDebugStr [MMSYSTEM.30]
191 void WINAPI
OutputDebugStr16(LPCSTR str
)
193 OutputDebugStringA( str
);
197 /* ###################################################
199 * ###################################################
202 /**************************************************************************
203 * Mixer devices. New to Win95
206 /**************************************************************************
207 * mixerGetNumDevs [MMSYSTEM.800]
209 UINT16 WINAPI
mixerGetNumDevs16(void)
211 return MMDRV_GetNum(MMDRV_MIXER
);
214 /**************************************************************************
215 * mixerGetDevCaps [MMSYSTEM.801]
217 UINT16 WINAPI
mixerGetDevCaps16(UINT16 uDeviceID
, LPMIXERCAPS16 lpCaps
,
223 if (lpCaps
== NULL
) return MMSYSERR_INVALPARAM
;
225 ret
= mixerGetDevCapsA(uDeviceID
, &micA
, sizeof(micA
));
226 if (ret
== MMSYSERR_NOERROR
) {
228 mic16
.wMid
= micA
.wMid
;
229 mic16
.wPid
= micA
.wPid
;
230 mic16
.vDriverVersion
= micA
.vDriverVersion
;
231 strcpy(mic16
.szPname
, micA
.szPname
);
232 mic16
.fdwSupport
= micA
.fdwSupport
;
233 mic16
.cDestinations
= micA
.cDestinations
;
234 memcpy(lpCaps
, &mic16
, min(uSize
, sizeof(mic16
)));
239 /**************************************************************************
240 * mixerOpen [MMSYSTEM.802]
242 UINT16 WINAPI
mixerOpen16(LPHMIXER16 lphmix
, UINT16 uDeviceID
, DWORD dwCallback
,
243 DWORD dwInstance
, DWORD fdwOpen
)
248 ret
= MIXER_Open(&hmix
, uDeviceID
, dwCallback
, dwInstance
, fdwOpen
, FALSE
);
249 if (lphmix
) *lphmix
= HMIXER_16(hmix
);
253 /**************************************************************************
254 * mixerClose [MMSYSTEM.803]
256 UINT16 WINAPI
mixerClose16(HMIXER16 hMix
)
258 return mixerClose(HMIXER_32(hMix
));
261 /**************************************************************************
262 * mixerGetID (MMSYSTEM.806)
264 UINT16 WINAPI
mixerGetID16(HMIXEROBJ16 hmix
, LPUINT16 lpid
, DWORD fdwID
)
267 UINT ret
= mixerGetID(HMIXEROBJ_32(hmix
), &xid
, fdwID
);
274 /**************************************************************************
275 * mixerGetControlDetails [MMSYSTEM.808]
277 UINT16 WINAPI
mixerGetControlDetails16(HMIXEROBJ16 hmix
,
278 LPMIXERCONTROLDETAILS16 lpmcd
,
281 DWORD ret
= MMSYSERR_NOTENABLED
;
284 TRACE("(%04x, %p, %08x)\n", hmix
, lpmcd
, fdwDetails
);
286 if (lpmcd
== NULL
|| lpmcd
->cbStruct
!= sizeof(*lpmcd
))
287 return MMSYSERR_INVALPARAM
;
289 sppaDetails
= (SEGPTR
)lpmcd
->paDetails
;
290 lpmcd
->paDetails
= MapSL(sppaDetails
);
291 ret
= mixerGetControlDetailsA(HMIXEROBJ_32(hmix
),
292 (LPMIXERCONTROLDETAILS
)lpmcd
, fdwDetails
);
293 lpmcd
->paDetails
= (LPVOID
)sppaDetails
;
298 /**************************************************************************
299 * mixerGetLineControls [MMSYSTEM.807]
301 UINT16 WINAPI
mixerGetLineControls16(HMIXEROBJ16 hmix
,
302 LPMIXERLINECONTROLS16 lpmlc16
,
305 MIXERLINECONTROLSA mlcA
;
308 LPMIXERCONTROL16 lpmc16
;
310 TRACE("(%04x, %p, %08x)\n", hmix
, lpmlc16
, fdwControls
);
312 if (lpmlc16
== NULL
|| lpmlc16
->cbStruct
!= sizeof(*lpmlc16
) ||
313 lpmlc16
->cbmxctrl
!= sizeof(MIXERCONTROL16
))
314 return MMSYSERR_INVALPARAM
;
316 mlcA
.cbStruct
= sizeof(mlcA
);
317 mlcA
.dwLineID
= lpmlc16
->dwLineID
;
318 mlcA
.u
.dwControlID
= lpmlc16
->u
.dwControlID
;
319 mlcA
.u
.dwControlType
= lpmlc16
->u
.dwControlType
;
320 mlcA
.cControls
= lpmlc16
->cControls
;
321 mlcA
.cbmxctrl
= sizeof(MIXERCONTROLA
);
322 mlcA
.pamxctrl
= HeapAlloc(GetProcessHeap(), 0,
323 mlcA
.cControls
* mlcA
.cbmxctrl
);
325 ret
= mixerGetLineControlsA(HMIXEROBJ_32(hmix
), &mlcA
, fdwControls
);
327 if (ret
== MMSYSERR_NOERROR
) {
328 lpmlc16
->dwLineID
= mlcA
.dwLineID
;
329 lpmlc16
->u
.dwControlID
= mlcA
.u
.dwControlID
;
330 lpmlc16
->u
.dwControlType
= mlcA
.u
.dwControlType
;
331 lpmlc16
->cControls
= mlcA
.cControls
;
333 lpmc16
= MapSL(lpmlc16
->pamxctrl
);
335 for (i
= 0; i
< mlcA
.cControls
; i
++) {
336 lpmc16
[i
].cbStruct
= sizeof(MIXERCONTROL16
);
337 lpmc16
[i
].dwControlID
= mlcA
.pamxctrl
[i
].dwControlID
;
338 lpmc16
[i
].dwControlType
= mlcA
.pamxctrl
[i
].dwControlType
;
339 lpmc16
[i
].fdwControl
= mlcA
.pamxctrl
[i
].fdwControl
;
340 lpmc16
[i
].cMultipleItems
= mlcA
.pamxctrl
[i
].cMultipleItems
;
341 strcpy(lpmc16
[i
].szShortName
, mlcA
.pamxctrl
[i
].szShortName
);
342 strcpy(lpmc16
[i
].szName
, mlcA
.pamxctrl
[i
].szName
);
343 /* sizeof(lpmc16[i].Bounds) == sizeof(mlcA.pamxctrl[i].Bounds) */
344 memcpy(&lpmc16
[i
].Bounds
, &mlcA
.pamxctrl
[i
].Bounds
,
345 sizeof(mlcA
.pamxctrl
[i
].Bounds
));
346 /* sizeof(lpmc16[i].Metrics) == sizeof(mlcA.pamxctrl[i].Metrics) */
347 memcpy(&lpmc16
[i
].Metrics
, &mlcA
.pamxctrl
[i
].Metrics
,
348 sizeof(mlcA
.pamxctrl
[i
].Metrics
));
352 HeapFree(GetProcessHeap(), 0, mlcA
.pamxctrl
);
357 /**************************************************************************
358 * mixerGetLineInfo [MMSYSTEM.805]
360 UINT16 WINAPI
mixerGetLineInfo16(HMIXEROBJ16 hmix
, LPMIXERLINE16 lpmli16
,
366 TRACE("(%04x, %p, %08x)\n", hmix
, lpmli16
, fdwInfo
);
368 if (lpmli16
== NULL
|| lpmli16
->cbStruct
!= sizeof(*lpmli16
))
369 return MMSYSERR_INVALPARAM
;
371 mliA
.cbStruct
= sizeof(mliA
);
372 switch (fdwInfo
& MIXER_GETLINEINFOF_QUERYMASK
) {
373 case MIXER_GETLINEINFOF_COMPONENTTYPE
:
374 mliA
.dwComponentType
= lpmli16
->dwComponentType
;
376 case MIXER_GETLINEINFOF_DESTINATION
:
377 mliA
.dwDestination
= lpmli16
->dwDestination
;
379 case MIXER_GETLINEINFOF_LINEID
:
380 mliA
.dwLineID
= lpmli16
->dwLineID
;
382 case MIXER_GETLINEINFOF_SOURCE
:
383 mliA
.dwDestination
= lpmli16
->dwDestination
;
384 mliA
.dwSource
= lpmli16
->dwSource
;
386 case MIXER_GETLINEINFOF_TARGETTYPE
:
387 mliA
.Target
.dwType
= lpmli16
->Target
.dwType
;
388 mliA
.Target
.wMid
= lpmli16
->Target
.wMid
;
389 mliA
.Target
.wPid
= lpmli16
->Target
.wPid
;
390 mliA
.Target
.vDriverVersion
= lpmli16
->Target
.vDriverVersion
;
391 strcpy(mliA
.Target
.szPname
, lpmli16
->Target
.szPname
);
394 FIXME("Unsupported fdwControls=0x%08x\n", fdwInfo
);
397 ret
= mixerGetLineInfoA(HMIXEROBJ_32(hmix
), &mliA
, fdwInfo
);
399 lpmli16
->dwDestination
= mliA
.dwDestination
;
400 lpmli16
->dwSource
= mliA
.dwSource
;
401 lpmli16
->dwLineID
= mliA
.dwLineID
;
402 lpmli16
->fdwLine
= mliA
.fdwLine
;
403 lpmli16
->dwUser
= mliA
.dwUser
;
404 lpmli16
->dwComponentType
= mliA
.dwComponentType
;
405 lpmli16
->cChannels
= mliA
.cChannels
;
406 lpmli16
->cConnections
= mliA
.cConnections
;
407 lpmli16
->cControls
= mliA
.cControls
;
408 strcpy(lpmli16
->szShortName
, mliA
.szShortName
);
409 strcpy(lpmli16
->szName
, mliA
.szName
);
410 lpmli16
->Target
.dwType
= mliA
.Target
.dwType
;
411 lpmli16
->Target
.dwDeviceID
= mliA
.Target
.dwDeviceID
;
412 lpmli16
->Target
.wMid
= mliA
.Target
.wMid
;
413 lpmli16
->Target
.wPid
= mliA
.Target
.wPid
;
414 lpmli16
->Target
.vDriverVersion
= mliA
.Target
.vDriverVersion
;
415 strcpy(lpmli16
->Target
.szPname
, mliA
.Target
.szPname
);
420 /**************************************************************************
421 * mixerSetControlDetails [MMSYSTEM.809]
423 UINT16 WINAPI
mixerSetControlDetails16(HMIXEROBJ16 hmix
,
424 LPMIXERCONTROLDETAILS16 lpmcd
,
427 TRACE("(%04x, %p, %08x)\n", hmix
, lpmcd
, fdwDetails
);
428 return MMSYSERR_NOTENABLED
;
431 /**************************************************************************
432 * mixerMessage [MMSYSTEM.804]
434 DWORD WINAPI
mixerMessage16(HMIXER16 hmix
, UINT16 uMsg
, DWORD dwParam1
,
437 return mixerMessage(HMIXER_32(hmix
), uMsg
, dwParam1
, dwParam2
);
440 /**************************************************************************
441 * auxGetNumDevs [MMSYSTEM.350]
443 UINT16 WINAPI
auxGetNumDevs16(void)
445 return MMDRV_GetNum(MMDRV_AUX
);
448 /* ###################################################
450 * ###################################################
453 /**************************************************************************
454 * auxGetDevCaps [MMSYSTEM.351]
456 UINT16 WINAPI
auxGetDevCaps16(UINT16 uDeviceID
, LPAUXCAPS16 lpCaps
, UINT16 uSize
)
461 if (lpCaps
== NULL
) return MMSYSERR_INVALPARAM
;
463 ret
= auxGetDevCapsA(uDeviceID
, &acA
, sizeof(acA
));
464 if (ret
== MMSYSERR_NOERROR
) {
466 ac16
.wMid
= acA
.wMid
;
467 ac16
.wPid
= acA
.wPid
;
468 ac16
.vDriverVersion
= acA
.vDriverVersion
;
469 strcpy(ac16
.szPname
, acA
.szPname
);
470 ac16
.wTechnology
= acA
.wTechnology
;
471 ac16
.dwSupport
= acA
.dwSupport
;
472 memcpy(lpCaps
, &ac16
, min(uSize
, sizeof(ac16
)));
477 /**************************************************************************
478 * auxGetVolume [MMSYSTEM.352]
480 UINT16 WINAPI
auxGetVolume16(UINT16 uDeviceID
, LPDWORD lpdwVolume
)
484 TRACE("(%04X, %p) !\n", uDeviceID
, lpdwVolume
);
486 if ((wmld
= MMDRV_Get((HANDLE
)(ULONG_PTR
)uDeviceID
, MMDRV_AUX
, TRUE
)) == NULL
)
487 return MMSYSERR_INVALHANDLE
;
488 return MMDRV_Message(wmld
, AUXDM_GETVOLUME
, (DWORD_PTR
)lpdwVolume
, 0L, TRUE
);
491 /**************************************************************************
492 * auxSetVolume [MMSYSTEM.353]
494 UINT16 WINAPI
auxSetVolume16(UINT16 uDeviceID
, DWORD dwVolume
)
498 TRACE("(%04X, %u) !\n", uDeviceID
, dwVolume
);
500 if ((wmld
= MMDRV_Get((HANDLE
)(ULONG_PTR
)uDeviceID
, MMDRV_AUX
, TRUE
)) == NULL
)
501 return MMSYSERR_INVALHANDLE
;
502 return MMDRV_Message(wmld
, AUXDM_SETVOLUME
, dwVolume
, 0L, TRUE
);
505 /**************************************************************************
506 * auxOutMessage [MMSYSTEM.354]
508 DWORD WINAPI
auxOutMessage16(UINT16 uDeviceID
, UINT16 uMessage
, DWORD dw1
, DWORD dw2
)
512 TRACE("(%04X, %04X, %08X, %08X)\n", uDeviceID
, uMessage
, dw1
, dw2
);
515 case AUXDM_GETNUMDEVS
:
516 case AUXDM_SETVOLUME
:
517 /* no argument conversion needed */
519 case AUXDM_GETVOLUME
:
520 return auxGetVolume16(uDeviceID
, MapSL(dw1
));
521 case AUXDM_GETDEVCAPS
:
522 return auxGetDevCaps16(uDeviceID
, MapSL(dw1
), dw2
);
524 TRACE("(%04x, %04x, %08x, %08x): unhandled message\n",
525 uDeviceID
, uMessage
, dw1
, dw2
);
528 if ((wmld
= MMDRV_Get((HANDLE
)(ULONG_PTR
)uDeviceID
, MMDRV_AUX
, TRUE
)) == NULL
)
529 return MMSYSERR_INVALHANDLE
;
531 return MMDRV_Message(wmld
, uMessage
, dw1
, dw2
, TRUE
);
534 /* ###################################################
536 * ###################################################
539 /**************************************************************************
540 * mciGetErrorString [MMSYSTEM.706]
542 BOOL16 WINAPI
mciGetErrorString16(DWORD wError
, LPSTR lpstrBuffer
, UINT16 uLength
)
544 return mciGetErrorStringA(wError
, lpstrBuffer
, uLength
);
547 /**************************************************************************
548 * mciDriverNotify [MMSYSTEM.711]
550 BOOL16 WINAPI
mciDriverNotify16(HWND16 hWndCallBack
, UINT16 wDevID
, UINT16 wStatus
)
552 TRACE("(%04X, %04x, %04X)\n", hWndCallBack
, wDevID
, wStatus
);
554 return PostMessageA(HWND_32(hWndCallBack
), MM_MCINOTIFY
, wStatus
, wDevID
);
557 /**************************************************************************
558 * mciGetDriverData [MMSYSTEM.708]
560 DWORD WINAPI
mciGetDriverData16(UINT16 uDeviceID
)
562 return mciGetDriverData(uDeviceID
);
565 /**************************************************************************
566 * mciSetDriverData [MMSYSTEM.707]
568 BOOL16 WINAPI
mciSetDriverData16(UINT16 uDeviceID
, DWORD data
)
570 return mciSetDriverData(uDeviceID
, data
);
573 /**************************************************************************
574 * mciSendCommand [MMSYSTEM.701]
576 DWORD WINAPI
mciSendCommand16(UINT16 wDevID
, UINT16 wMsg
, DWORD dwParam1
, DWORD dwParam2
)
580 TRACE("(%04X, %s, %08X, %08X)\n",
581 wDevID
, MCI_MessageToString(wMsg
), dwParam1
, dwParam2
);
583 dwRet
= MCI_SendCommand(wDevID
, wMsg
, dwParam1
, dwParam2
, FALSE
);
584 dwRet
= MCI_CleanUp(dwRet
, wMsg
, (DWORD
)MapSL(dwParam2
));
585 TRACE("=> %d\n", dwRet
);
589 /**************************************************************************
590 * mciGetDeviceID [MMSYSTEM.703]
592 UINT16 WINAPI
mciGetDeviceID16(LPCSTR lpstrName
)
594 TRACE("(\"%s\")\n", lpstrName
);
596 return mciGetDeviceIDA(lpstrName
);
599 /**************************************************************************
600 * mciSetYieldProc [MMSYSTEM.714]
602 BOOL16 WINAPI
mciSetYieldProc16(UINT16 uDeviceID
, YIELDPROC16 fpYieldProc
, DWORD dwYieldData
)
604 LPWINE_MCIDRIVER wmd
;
606 TRACE("(%u, %p, %08x)\n", uDeviceID
, fpYieldProc
, dwYieldData
);
608 if (!(wmd
= MCI_GetDriver(uDeviceID
))) {
609 WARN("Bad uDeviceID\n");
613 wmd
->lpfnYieldProc
= (YIELDPROC
)fpYieldProc
;
614 wmd
->dwYieldData
= dwYieldData
;
620 /**************************************************************************
621 * mciGetDeviceIDFromElementID [MMSYSTEM.715]
623 UINT16 WINAPI
mciGetDeviceIDFromElementID16(DWORD dwElementID
, LPCSTR lpstrType
)
625 FIXME("(%u, %s) stub\n", dwElementID
, lpstrType
);
629 /**************************************************************************
630 * mciGetYieldProc [MMSYSTEM.716]
632 YIELDPROC16 WINAPI
mciGetYieldProc16(UINT16 uDeviceID
, DWORD
* lpdwYieldData
)
634 LPWINE_MCIDRIVER wmd
;
636 TRACE("(%u, %p)\n", uDeviceID
, lpdwYieldData
);
638 if (!(wmd
= MCI_GetDriver(uDeviceID
))) {
639 WARN("Bad uDeviceID\n");
642 if (!wmd
->lpfnYieldProc
) {
643 WARN("No proc set\n");
647 WARN("Proc is 32 bit\n");
650 return (YIELDPROC16
)wmd
->lpfnYieldProc
;
653 /**************************************************************************
654 * mciGetCreatorTask [MMSYSTEM.717]
656 HTASK16 WINAPI
mciGetCreatorTask16(UINT16 uDeviceID
)
658 LPWINE_MCIDRIVER wmd
;
661 if ((wmd
= MCI_GetDriver(uDeviceID
)))
662 ret
= HTASK_16(wmd
->CreatorThread
);
664 TRACE("(%u) => %04x\n", uDeviceID
, ret
);
668 /**************************************************************************
669 * mciDriverYield [MMSYSTEM.710]
671 UINT16 WINAPI
mciDriverYield16(UINT16 uDeviceID
)
673 LPWINE_MCIDRIVER wmd
;
676 /* TRACE("(%04x)\n", uDeviceID); */
678 if (!(wmd
= MCI_GetDriver(uDeviceID
)) || !wmd
->lpfnYieldProc
|| wmd
->bIs32
) {
681 ret
= wmd
->lpfnYieldProc(uDeviceID
, wmd
->dwYieldData
);
687 /* ###################################################
689 * ###################################################
692 /**************************************************************************
693 * midiOutGetNumDevs [MMSYSTEM.201]
695 UINT16 WINAPI
midiOutGetNumDevs16(void)
697 return MMDRV_GetNum(MMDRV_MIDIOUT
);
700 /**************************************************************************
701 * midiOutGetDevCaps [MMSYSTEM.202]
703 UINT16 WINAPI
midiOutGetDevCaps16(UINT16 uDeviceID
, LPMIDIOUTCAPS16 lpCaps
,
709 if (lpCaps
== NULL
) return MMSYSERR_INVALPARAM
;
711 ret
= midiOutGetDevCapsA(uDeviceID
, &mocA
, sizeof(mocA
));
712 if (ret
== MMSYSERR_NOERROR
) {
714 moc16
.wMid
= mocA
.wMid
;
715 moc16
.wPid
= mocA
.wPid
;
716 moc16
.vDriverVersion
= mocA
.vDriverVersion
;
717 strcpy(moc16
.szPname
, mocA
.szPname
);
718 moc16
.wTechnology
= mocA
.wTechnology
;
719 moc16
.wVoices
= mocA
.wVoices
;
720 moc16
.wNotes
= mocA
.wNotes
;
721 moc16
.wChannelMask
= mocA
.wChannelMask
;
722 moc16
.dwSupport
= mocA
.dwSupport
;
723 memcpy(lpCaps
, &moc16
, min(uSize
, sizeof(moc16
)));
728 /**************************************************************************
729 * midiOutGetErrorText [MMSYSTEM.203]
730 * midiInGetErrorText [MMSYSTEM.303]
732 UINT16 WINAPI
midiOutGetErrorText16(UINT16 uError
, LPSTR lpText
, UINT16 uSize
)
734 return midiOutGetErrorTextA(uError
, lpText
, uSize
);
737 /**************************************************************************
738 * midiOutOpen [MMSYSTEM.204]
740 UINT16 WINAPI
midiOutOpen16(HMIDIOUT16
* lphMidiOut
, UINT16 uDeviceID
,
741 DWORD dwCallback
, DWORD dwInstance
, DWORD dwFlags
)
746 ret
= MIDI_OutOpen(&hmo
, uDeviceID
, dwCallback
, dwInstance
, dwFlags
, FALSE
);
748 if (lphMidiOut
!= NULL
) *lphMidiOut
= HMIDIOUT_16(hmo
);
752 /**************************************************************************
753 * midiOutClose [MMSYSTEM.205]
755 UINT16 WINAPI
midiOutClose16(HMIDIOUT16 hMidiOut
)
757 return midiOutClose(HMIDIOUT_32(hMidiOut
));
760 /**************************************************************************
761 * midiOutPrepareHeader [MMSYSTEM.206]
763 UINT16 WINAPI
midiOutPrepareHeader16(HMIDIOUT16 hMidiOut
, /* [in] */
764 SEGPTR lpsegMidiOutHdr
, /* [???] */
765 UINT16 uSize
) /* [in] */
769 TRACE("(%04X, %08x, %d)\n", hMidiOut
, lpsegMidiOutHdr
, uSize
);
771 if ((wmld
= MMDRV_Get(HMIDIOUT_32(hMidiOut
), MMDRV_MIDIOUT
, FALSE
)) == NULL
)
772 return MMSYSERR_INVALHANDLE
;
774 return MMDRV_Message(wmld
, MODM_PREPARE
, lpsegMidiOutHdr
, uSize
, FALSE
);
777 /**************************************************************************
778 * midiOutUnprepareHeader [MMSYSTEM.207]
780 UINT16 WINAPI
midiOutUnprepareHeader16(HMIDIOUT16 hMidiOut
, /* [in] */
781 SEGPTR lpsegMidiOutHdr
, /* [???] */
782 UINT16 uSize
) /* [in] */
785 LPMIDIHDR16 lpMidiOutHdr
= MapSL(lpsegMidiOutHdr
);
787 TRACE("(%04X, %08x, %d)\n", hMidiOut
, lpsegMidiOutHdr
, uSize
);
789 if (!(lpMidiOutHdr
->dwFlags
& MHDR_PREPARED
)) {
790 return MMSYSERR_NOERROR
;
793 if ((wmld
= MMDRV_Get(HMIDIOUT_32(hMidiOut
), MMDRV_MIDIOUT
, FALSE
)) == NULL
)
794 return MMSYSERR_INVALHANDLE
;
796 return MMDRV_Message(wmld
, MODM_UNPREPARE
, lpsegMidiOutHdr
, uSize
, FALSE
);
799 /**************************************************************************
800 * midiOutShortMsg [MMSYSTEM.208]
802 UINT16 WINAPI
midiOutShortMsg16(HMIDIOUT16 hMidiOut
, DWORD dwMsg
)
804 return midiOutShortMsg(HMIDIOUT_32(hMidiOut
), dwMsg
);
807 /**************************************************************************
808 * midiOutLongMsg [MMSYSTEM.209]
810 UINT16 WINAPI
midiOutLongMsg16(HMIDIOUT16 hMidiOut
, /* [in] */
811 LPMIDIHDR16 lpsegMidiOutHdr
, /* [???] NOTE: SEGPTR */
812 UINT16 uSize
) /* [in] */
816 TRACE("(%04X, %p, %d)\n", hMidiOut
, lpsegMidiOutHdr
, uSize
);
818 if ((wmld
= MMDRV_Get(HMIDIOUT_32(hMidiOut
), MMDRV_MIDIOUT
, FALSE
)) == NULL
)
819 return MMSYSERR_INVALHANDLE
;
821 return MMDRV_Message(wmld
, MODM_LONGDATA
, (DWORD_PTR
)lpsegMidiOutHdr
, uSize
, FALSE
);
824 /**************************************************************************
825 * midiOutReset [MMSYSTEM.210]
827 UINT16 WINAPI
midiOutReset16(HMIDIOUT16 hMidiOut
)
829 return midiOutReset(HMIDIOUT_32(hMidiOut
));
832 /**************************************************************************
833 * midiOutGetVolume [MMSYSTEM.211]
835 UINT16 WINAPI
midiOutGetVolume16(UINT16 uDeviceID
, DWORD
* lpdwVolume
)
837 return midiOutGetVolume(HMIDIOUT_32(uDeviceID
), lpdwVolume
);
840 /**************************************************************************
841 * midiOutSetVolume [MMSYSTEM.212]
843 UINT16 WINAPI
midiOutSetVolume16(UINT16 uDeviceID
, DWORD dwVolume
)
845 return midiOutSetVolume(HMIDIOUT_32(uDeviceID
), dwVolume
);
848 /**************************************************************************
849 * midiOutCachePatches [MMSYSTEM.213]
851 UINT16 WINAPI
midiOutCachePatches16(HMIDIOUT16 hMidiOut
, UINT16 uBank
,
852 WORD
* lpwPatchArray
, UINT16 uFlags
)
854 return midiOutCachePatches(HMIDIOUT_32(hMidiOut
), uBank
, lpwPatchArray
,
858 /**************************************************************************
859 * midiOutCacheDrumPatches [MMSYSTEM.214]
861 UINT16 WINAPI
midiOutCacheDrumPatches16(HMIDIOUT16 hMidiOut
, UINT16 uPatch
,
862 WORD
* lpwKeyArray
, UINT16 uFlags
)
864 return midiOutCacheDrumPatches(HMIDIOUT_32(hMidiOut
), uPatch
, lpwKeyArray
, uFlags
);
867 /**************************************************************************
868 * midiOutGetID [MMSYSTEM.215]
870 UINT16 WINAPI
midiOutGetID16(HMIDIOUT16 hMidiOut
, UINT16
* lpuDeviceID
)
874 TRACE("(%04X, %p)\n", hMidiOut
, lpuDeviceID
);
876 if (lpuDeviceID
== NULL
) return MMSYSERR_INVALPARAM
;
877 if ((wmld
= MMDRV_Get(HMIDIOUT_32(hMidiOut
), MMDRV_MIDIOUT
, FALSE
)) == NULL
)
878 return MMSYSERR_INVALHANDLE
;
880 *lpuDeviceID
= wmld
->uDeviceID
;
881 return MMSYSERR_NOERROR
;
884 /**************************************************************************
885 * midiOutMessage [MMSYSTEM.216]
887 DWORD WINAPI
midiOutMessage16(HMIDIOUT16 hMidiOut
, UINT16 uMessage
,
888 DWORD dwParam1
, DWORD dwParam2
)
892 TRACE("(%04X, %04X, %08X, %08X)\n", hMidiOut
, uMessage
, dwParam1
, dwParam2
);
894 if ((wmld
= MMDRV_Get(HMIDIOUT_32(hMidiOut
), MMDRV_MIDIOUT
, FALSE
)) == NULL
)
895 return MMSYSERR_INVALHANDLE
;
900 FIXME("can't handle OPEN or CLOSE message!\n");
901 return MMSYSERR_NOTSUPPORTED
;
904 return midiOutGetVolume16(hMidiOut
, MapSL(dwParam1
));
906 return midiOutLongMsg16(hMidiOut
, MapSL(dwParam1
), dwParam2
);
908 /* lpMidiOutHdr is still a segmented pointer for this function */
909 return midiOutPrepareHeader16(hMidiOut
, dwParam1
, dwParam2
);
911 return midiOutUnprepareHeader16(hMidiOut
, dwParam1
, dwParam2
);
913 return MMDRV_Message(wmld
, uMessage
, dwParam1
, dwParam2
, TRUE
);
916 /**************************************************************************
917 * midiInGetNumDevs [MMSYSTEM.301]
919 UINT16 WINAPI
midiInGetNumDevs16(void)
921 return MMDRV_GetNum(MMDRV_MIDIIN
);
924 /**************************************************************************
925 * midiInGetDevCaps [MMSYSTEM.302]
927 UINT16 WINAPI
midiInGetDevCaps16(UINT16 uDeviceID
, LPMIDIINCAPS16 lpCaps
,
933 if (lpCaps
== NULL
) return MMSYSERR_INVALPARAM
;
935 ret
= midiInGetDevCapsA(uDeviceID
, &micA
, uSize
);
936 if (ret
== MMSYSERR_NOERROR
) {
938 mic16
.wMid
= micA
.wMid
;
939 mic16
.wPid
= micA
.wPid
;
940 mic16
.vDriverVersion
= micA
.vDriverVersion
;
941 strcpy(mic16
.szPname
, micA
.szPname
);
942 mic16
.dwSupport
= micA
.dwSupport
;
943 memcpy(lpCaps
, &mic16
, min(uSize
, sizeof(mic16
)));
948 /**************************************************************************
949 * midiInOpen [MMSYSTEM.304]
951 UINT16 WINAPI
midiInOpen16(HMIDIIN16
* lphMidiIn
, UINT16 uDeviceID
,
952 DWORD dwCallback
, DWORD dwInstance
, DWORD dwFlags
)
957 ret
= MIDI_InOpen(&xhmid
, uDeviceID
, dwCallback
, dwInstance
, dwFlags
, FALSE
);
959 if (lphMidiIn
) *lphMidiIn
= HMIDIIN_16(xhmid
);
963 /**************************************************************************
964 * midiInClose [MMSYSTEM.305]
966 UINT16 WINAPI
midiInClose16(HMIDIIN16 hMidiIn
)
968 return midiInClose(HMIDIIN_32(hMidiIn
));
971 /**************************************************************************
972 * midiInPrepareHeader [MMSYSTEM.306]
974 UINT16 WINAPI
midiInPrepareHeader16(HMIDIIN16 hMidiIn
, /* [in] */
975 SEGPTR lpsegMidiInHdr
, /* [???] */
976 UINT16 uSize
) /* [in] */
980 TRACE("(%04X, %08x, %d)\n", hMidiIn
, lpsegMidiInHdr
, uSize
);
982 if ((wmld
= MMDRV_Get(HMIDIIN_32(hMidiIn
), MMDRV_MIDIIN
, FALSE
)) == NULL
)
983 return MMSYSERR_INVALHANDLE
;
985 return MMDRV_Message(wmld
, MIDM_PREPARE
, lpsegMidiInHdr
, uSize
, FALSE
);
988 /**************************************************************************
989 * midiInUnprepareHeader [MMSYSTEM.307]
991 UINT16 WINAPI
midiInUnprepareHeader16(HMIDIIN16 hMidiIn
, /* [in] */
992 SEGPTR lpsegMidiInHdr
, /* [???] */
993 UINT16 uSize
) /* [in] */
996 LPMIDIHDR16 lpMidiInHdr
= MapSL(lpsegMidiInHdr
);
998 TRACE("(%04X, %08x, %d)\n", hMidiIn
, lpsegMidiInHdr
, uSize
);
1000 if (!(lpMidiInHdr
->dwFlags
& MHDR_PREPARED
)) {
1001 return MMSYSERR_NOERROR
;
1004 if ((wmld
= MMDRV_Get(HMIDIIN_32(hMidiIn
), MMDRV_MIDIIN
, FALSE
)) == NULL
)
1005 return MMSYSERR_INVALHANDLE
;
1007 return MMDRV_Message(wmld
, MIDM_UNPREPARE
, lpsegMidiInHdr
, uSize
, FALSE
);
1010 /**************************************************************************
1011 * midiInAddBuffer [MMSYSTEM.308]
1013 UINT16 WINAPI
midiInAddBuffer16(HMIDIIN16 hMidiIn
, /* [in] */
1014 MIDIHDR16
* lpsegMidiInHdr
, /* [???] NOTE: SEGPTR */
1015 UINT16 uSize
) /* [in] */
1019 TRACE("(%04X, %p, %d)\n", hMidiIn
, lpsegMidiInHdr
, uSize
);
1021 if ((wmld
= MMDRV_Get(HMIDIIN_32(hMidiIn
), MMDRV_MIDIIN
, FALSE
)) == NULL
)
1022 return MMSYSERR_INVALHANDLE
;
1024 return MMDRV_Message(wmld
, MIDM_ADDBUFFER
, (DWORD_PTR
)lpsegMidiInHdr
, uSize
, FALSE
);
1027 /**************************************************************************
1028 * midiInStart [MMSYSTEM.309]
1030 UINT16 WINAPI
midiInStart16(HMIDIIN16 hMidiIn
)
1032 return midiInStart(HMIDIIN_32(hMidiIn
));
1035 /**************************************************************************
1036 * midiInStop [MMSYSTEM.310]
1038 UINT16 WINAPI
midiInStop16(HMIDIIN16 hMidiIn
)
1040 return midiInStop(HMIDIIN_32(hMidiIn
));
1043 /**************************************************************************
1044 * midiInReset [MMSYSTEM.311]
1046 UINT16 WINAPI
midiInReset16(HMIDIIN16 hMidiIn
)
1048 return midiInReset(HMIDIIN_32(hMidiIn
));
1051 /**************************************************************************
1052 * midiInGetID [MMSYSTEM.312]
1054 UINT16 WINAPI
midiInGetID16(HMIDIIN16 hMidiIn
, UINT16
* lpuDeviceID
)
1058 TRACE("(%04X, %p)\n", hMidiIn
, lpuDeviceID
);
1060 if (lpuDeviceID
== NULL
) return MMSYSERR_INVALPARAM
;
1062 if ((wmld
= MMDRV_Get(HMIDIIN_32(hMidiIn
), MMDRV_MIDIIN
, TRUE
)) == NULL
)
1063 return MMSYSERR_INVALHANDLE
;
1065 *lpuDeviceID
= wmld
->uDeviceID
;
1067 return MMSYSERR_NOERROR
;
1070 /**************************************************************************
1071 * midiInMessage [MMSYSTEM.313]
1073 DWORD WINAPI
midiInMessage16(HMIDIIN16 hMidiIn
, UINT16 uMessage
,
1074 DWORD dwParam1
, DWORD dwParam2
)
1078 TRACE("(%04X, %04X, %08X, %08X)\n", hMidiIn
, uMessage
, dwParam1
, dwParam2
);
1083 FIXME("can't handle OPEN or CLOSE message!\n");
1084 return MMSYSERR_NOTSUPPORTED
;
1086 case MIDM_GETDEVCAPS
:
1087 return midiInGetDevCaps16(hMidiIn
, MapSL(dwParam1
), dwParam2
);
1089 return midiInPrepareHeader16(hMidiIn
, dwParam1
, dwParam2
);
1090 case MIDM_UNPREPARE
:
1091 return midiInUnprepareHeader16(hMidiIn
, dwParam1
, dwParam2
);
1092 case MIDM_ADDBUFFER
:
1093 return midiInAddBuffer16(hMidiIn
, MapSL(dwParam1
), dwParam2
);
1096 if ((wmld
= MMDRV_Get(HMIDIIN_32(hMidiIn
), MMDRV_MIDIIN
, FALSE
)) == NULL
)
1097 return MMSYSERR_INVALHANDLE
;
1099 return MMDRV_Message(wmld
, uMessage
, dwParam1
, dwParam2
, FALSE
);
1102 /**************************************************************************
1103 * midiStreamClose [MMSYSTEM.252]
1105 MMRESULT16 WINAPI
midiStreamClose16(HMIDISTRM16 hMidiStrm
)
1107 return midiStreamClose(HMIDISTRM_32(hMidiStrm
));
1110 /**************************************************************************
1111 * midiStreamOpen [MMSYSTEM.251]
1113 MMRESULT16 WINAPI
midiStreamOpen16(HMIDISTRM16
* phMidiStrm
, LPUINT16 devid
,
1114 DWORD cMidi
, DWORD dwCallback
,
1115 DWORD dwInstance
, DWORD fdwOpen
)
1117 HMIDISTRM hMidiStrm32
;
1121 if (!phMidiStrm
|| !devid
)
1122 return MMSYSERR_INVALPARAM
;
1124 ret
= MIDI_StreamOpen(&hMidiStrm32
, &devid32
, cMidi
, dwCallback
,
1125 dwInstance
, fdwOpen
, FALSE
);
1126 *phMidiStrm
= HMIDISTRM_16(hMidiStrm32
);
1131 /**************************************************************************
1132 * midiStreamOut [MMSYSTEM.254]
1134 MMRESULT16 WINAPI
midiStreamOut16(HMIDISTRM16 hMidiStrm
, LPMIDIHDR16 lpMidiHdr
, UINT16 cbMidiHdr
)
1136 return midiStreamOut(HMIDISTRM_32(hMidiStrm
), (LPMIDIHDR
)lpMidiHdr
,
1140 /**************************************************************************
1141 * midiStreamPause [MMSYSTEM.255]
1143 MMRESULT16 WINAPI
midiStreamPause16(HMIDISTRM16 hMidiStrm
)
1145 return midiStreamPause(HMIDISTRM_32(hMidiStrm
));
1148 /**************************************************************************
1149 * midiStreamPosition [MMSYSTEM.253]
1151 MMRESULT16 WINAPI
midiStreamPosition16(HMIDISTRM16 hMidiStrm
, LPMMTIME16 lpmmt16
, UINT16 cbmmt
)
1157 return MMSYSERR_INVALPARAM
;
1158 MMSYSTEM_MMTIME16to32(&mmt32
, lpmmt16
);
1159 ret
= midiStreamPosition(HMIDISTRM_32(hMidiStrm
), &mmt32
, sizeof(MMTIME
));
1160 MMSYSTEM_MMTIME32to16(lpmmt16
, &mmt32
);
1164 /**************************************************************************
1165 * midiStreamProperty [MMSYSTEM.250]
1167 MMRESULT16 WINAPI
midiStreamProperty16(HMIDISTRM16 hMidiStrm
, LPBYTE lpPropData
, DWORD dwProperty
)
1169 return midiStreamProperty(HMIDISTRM_32(hMidiStrm
), lpPropData
, dwProperty
);
1172 /**************************************************************************
1173 * midiStreamRestart [MMSYSTEM.256]
1175 MMRESULT16 WINAPI
midiStreamRestart16(HMIDISTRM16 hMidiStrm
)
1177 return midiStreamRestart(HMIDISTRM_32(hMidiStrm
));
1180 /**************************************************************************
1181 * midiStreamStop [MMSYSTEM.257]
1183 MMRESULT16 WINAPI
midiStreamStop16(HMIDISTRM16 hMidiStrm
)
1185 return midiStreamStop(HMIDISTRM_32(hMidiStrm
));
1188 /* ###################################################
1190 * ###################################################
1193 /**************************************************************************
1194 * waveOutGetNumDevs [MMSYSTEM.401]
1196 UINT16 WINAPI
waveOutGetNumDevs16(void)
1198 return MMDRV_GetNum(MMDRV_WAVEOUT
);
1201 /**************************************************************************
1202 * waveOutGetDevCaps [MMSYSTEM.402]
1204 UINT16 WINAPI
waveOutGetDevCaps16(UINT16 uDeviceID
,
1205 LPWAVEOUTCAPS16 lpCaps
, UINT16 uSize
)
1209 TRACE("(%u %p %u)!\n", uDeviceID
, lpCaps
, uSize
);
1211 if (lpCaps
== NULL
) return MMSYSERR_INVALPARAM
;
1213 ret
= waveOutGetDevCapsA(uDeviceID
, &wocA
, sizeof(wocA
));
1214 if (ret
== MMSYSERR_NOERROR
) {
1215 WAVEOUTCAPS16 woc16
;
1216 woc16
.wMid
= wocA
.wMid
;
1217 woc16
.wPid
= wocA
.wPid
;
1218 woc16
.vDriverVersion
= wocA
.vDriverVersion
;
1219 strcpy(woc16
.szPname
, wocA
.szPname
);
1220 woc16
.dwFormats
= wocA
.dwFormats
;
1221 woc16
.wChannels
= wocA
.wChannels
;
1222 woc16
.dwSupport
= wocA
.dwSupport
;
1223 memcpy(lpCaps
, &woc16
, min(uSize
, sizeof(woc16
)));
1228 /**************************************************************************
1229 * waveOutGetErrorText [MMSYSTEM.403]
1230 * waveInGetErrorText [MMSYSTEM.503]
1232 UINT16 WINAPI
waveOutGetErrorText16(UINT16 uError
, LPSTR lpText
, UINT16 uSize
)
1234 return waveOutGetErrorTextA(uError
, lpText
, uSize
);
1237 /**************************************************************************
1238 * waveOutOpen [MMSYSTEM.404]
1240 UINT16 WINAPI
waveOutOpen16(HWAVEOUT16
* lphWaveOut
, UINT16 uDeviceID
,
1241 LPCWAVEFORMATEX lpFormat
, DWORD dwCallback
,
1242 DWORD dwInstance
, DWORD dwFlags
)
1247 /* since layout of WAVEFORMATEX is the same for 16/32 bits, we directly
1248 * call the 32 bit version
1249 * however, we need to promote correctly the wave mapper id
1250 * (0xFFFFFFFF and not 0x0000FFFF)
1252 ret
= WAVE_Open(&hWaveOut
, (uDeviceID
== (UINT16
)-1) ? (UINT
)-1 : uDeviceID
,
1253 MMDRV_WAVEOUT
, lpFormat
, dwCallback
, dwInstance
, dwFlags
, FALSE
);
1255 if (lphWaveOut
!= NULL
) *lphWaveOut
= HWAVEOUT_16(hWaveOut
);
1259 /**************************************************************************
1260 * waveOutClose [MMSYSTEM.405]
1262 UINT16 WINAPI
waveOutClose16(HWAVEOUT16 hWaveOut
)
1267 ReleaseThunkLock(&level
);
1268 ret
= waveOutClose(HWAVEOUT_32(hWaveOut
));
1269 RestoreThunkLock(level
);
1273 /**************************************************************************
1274 * waveOutPrepareHeader [MMSYSTEM.406]
1276 UINT16 WINAPI
waveOutPrepareHeader16(HWAVEOUT16 hWaveOut
, /* [in] */
1277 SEGPTR lpsegWaveOutHdr
, /* [???] */
1278 UINT16 uSize
) /* [in] */
1281 LPWAVEHDR lpWaveOutHdr
= MapSL(lpsegWaveOutHdr
);
1283 TRACE("(%04X, %08x, %u);\n", hWaveOut
, lpsegWaveOutHdr
, uSize
);
1285 if (lpWaveOutHdr
== NULL
) return MMSYSERR_INVALPARAM
;
1287 if ((wmld
= MMDRV_Get(HWAVEOUT_32(hWaveOut
), MMDRV_WAVEOUT
, FALSE
)) == NULL
)
1288 return MMSYSERR_INVALHANDLE
;
1290 return MMDRV_Message(wmld
, WODM_PREPARE
, lpsegWaveOutHdr
, uSize
, FALSE
);
1293 /**************************************************************************
1294 * waveOutUnprepareHeader [MMSYSTEM.407]
1296 UINT16 WINAPI
waveOutUnprepareHeader16(HWAVEOUT16 hWaveOut
, /* [in] */
1297 SEGPTR lpsegWaveOutHdr
, /* [???] */
1298 UINT16 uSize
) /* [in] */
1301 LPWAVEHDR lpWaveOutHdr
= MapSL(lpsegWaveOutHdr
);
1303 TRACE("(%04X, %08x, %u);\n", hWaveOut
, lpsegWaveOutHdr
, uSize
);
1305 if (!(lpWaveOutHdr
->dwFlags
& WHDR_PREPARED
)) {
1306 return MMSYSERR_NOERROR
;
1309 if ((wmld
= MMDRV_Get(HWAVEOUT_32(hWaveOut
), MMDRV_WAVEOUT
, FALSE
)) == NULL
)
1310 return MMSYSERR_INVALHANDLE
;
1312 return MMDRV_Message(wmld
, WODM_UNPREPARE
, lpsegWaveOutHdr
, uSize
, FALSE
);
1315 /**************************************************************************
1316 * waveOutWrite [MMSYSTEM.408]
1318 UINT16 WINAPI
waveOutWrite16(HWAVEOUT16 hWaveOut
, /* [in] */
1319 LPWAVEHDR lpsegWaveOutHdr
, /* [???] NOTE: SEGPTR */
1320 UINT16 uSize
) /* [in] */
1324 TRACE("(%04X, %p, %u);\n", hWaveOut
, lpsegWaveOutHdr
, uSize
);
1326 if ((wmld
= MMDRV_Get(HWAVEOUT_32(hWaveOut
), MMDRV_WAVEOUT
, FALSE
)) == NULL
)
1327 return MMSYSERR_INVALHANDLE
;
1329 return MMDRV_Message(wmld
, WODM_WRITE
, (DWORD_PTR
)lpsegWaveOutHdr
, uSize
, FALSE
);
1332 /**************************************************************************
1333 * waveOutBreakLoop [MMSYSTEM.419]
1335 UINT16 WINAPI
waveOutBreakLoop16(HWAVEOUT16 hWaveOut16
)
1340 ReleaseThunkLock(&level
);
1341 ret
= waveOutBreakLoop(HWAVEOUT_32(hWaveOut16
));
1342 RestoreThunkLock(level
);
1346 /**************************************************************************
1347 * waveOutPause [MMSYSTEM.409]
1349 UINT16 WINAPI
waveOutPause16(HWAVEOUT16 hWaveOut16
)
1354 ReleaseThunkLock(&level
);
1355 ret
= waveOutPause(HWAVEOUT_32(hWaveOut16
));
1356 RestoreThunkLock(level
);
1360 /**************************************************************************
1361 * waveOutReset [MMSYSTEM.411]
1363 UINT16 WINAPI
waveOutReset16(HWAVEOUT16 hWaveOut16
)
1368 ReleaseThunkLock(&level
);
1369 ret
= waveOutReset(HWAVEOUT_32(hWaveOut16
));
1370 RestoreThunkLock(level
);
1374 /**************************************************************************
1375 * waveOutRestart [MMSYSTEM.410]
1377 UINT16 WINAPI
waveOutRestart16(HWAVEOUT16 hWaveOut16
)
1382 ReleaseThunkLock(&level
);
1383 ret
= waveOutRestart(HWAVEOUT_32(hWaveOut16
));
1384 RestoreThunkLock(level
);
1388 /**************************************************************************
1389 * waveOutGetPosition [MMSYSTEM.412]
1391 UINT16 WINAPI
waveOutGetPosition16(HWAVEOUT16 hWaveOut
, LPMMTIME16 lpTime
,
1397 mmt
.wType
= lpTime
->wType
;
1398 ret
= waveOutGetPosition(HWAVEOUT_32(hWaveOut
), &mmt
, sizeof(mmt
));
1399 MMSYSTEM_MMTIME32to16(lpTime
, &mmt
);
1403 /**************************************************************************
1404 * waveOutGetPitch [MMSYSTEM.413]
1406 UINT16 WINAPI
waveOutGetPitch16(HWAVEOUT16 hWaveOut16
, LPDWORD lpdw
)
1408 return waveOutGetPitch(HWAVEOUT_32(hWaveOut16
), lpdw
);
1411 /**************************************************************************
1412 * waveOutSetPitch [MMSYSTEM.414]
1414 UINT16 WINAPI
waveOutSetPitch16(HWAVEOUT16 hWaveOut16
, DWORD dw
)
1416 return waveOutSetPitch(HWAVEOUT_32(hWaveOut16
), dw
);
1419 /**************************************************************************
1420 * waveOutGetPlaybackRate [MMSYSTEM.417]
1422 UINT16 WINAPI
waveOutGetPlaybackRate16(HWAVEOUT16 hWaveOut16
, LPDWORD lpdw
)
1424 return waveOutGetPlaybackRate(HWAVEOUT_32(hWaveOut16
), lpdw
);
1427 /**************************************************************************
1428 * waveOutSetPlaybackRate [MMSYSTEM.418]
1430 UINT16 WINAPI
waveOutSetPlaybackRate16(HWAVEOUT16 hWaveOut16
, DWORD dw
)
1432 return waveOutSetPlaybackRate(HWAVEOUT_32(hWaveOut16
), dw
);
1435 /**************************************************************************
1436 * waveOutGetVolume [MMSYSTEM.415]
1438 UINT16 WINAPI
waveOutGetVolume16(UINT16 devid
, LPDWORD lpdw
)
1440 return waveOutGetVolume(HWAVEOUT_32(devid
), lpdw
);
1443 /**************************************************************************
1444 * waveOutSetVolume [MMSYSTEM.416]
1446 UINT16 WINAPI
waveOutSetVolume16(UINT16 devid
, DWORD dw
)
1448 return waveOutSetVolume(HWAVEOUT_32(devid
), dw
);
1451 /**************************************************************************
1452 * waveOutGetID [MMSYSTEM.420]
1454 UINT16 WINAPI
waveOutGetID16(HWAVEOUT16 hWaveOut
, UINT16
* lpuDeviceID
)
1458 TRACE("(%04X, %p);\n", hWaveOut
, lpuDeviceID
);
1460 if (lpuDeviceID
== NULL
) return MMSYSERR_INVALHANDLE
;
1462 if ((wmld
= MMDRV_Get(HWAVEOUT_32(hWaveOut
), MMDRV_WAVEOUT
, FALSE
)) == NULL
)
1463 return MMSYSERR_INVALHANDLE
;
1465 *lpuDeviceID
= wmld
->uDeviceID
;
1469 /**************************************************************************
1470 * waveOutMessage [MMSYSTEM.421]
1472 DWORD WINAPI
waveOutMessage16(HWAVEOUT16 hWaveOut
, UINT16 uMessage
,
1473 DWORD dwParam1
, DWORD dwParam2
)
1477 TRACE("(%04x, %u, %d, %d)\n", hWaveOut
, uMessage
, dwParam1
, dwParam2
);
1479 if ((wmld
= MMDRV_Get(HWAVEOUT_32(hWaveOut
), MMDRV_WAVEOUT
, FALSE
)) == NULL
) {
1480 if ((wmld
= MMDRV_Get(HWAVEOUT_32(hWaveOut
), MMDRV_WAVEOUT
, TRUE
)) != NULL
) {
1481 if (uMessage
== DRV_QUERYDRVENTRY
|| uMessage
== DRV_QUERYDEVNODE
)
1482 dwParam1
= (DWORD
)MapSL(dwParam1
);
1483 return MMDRV_PhysicalFeatures(wmld
, uMessage
, dwParam1
, dwParam2
);
1485 return MMSYSERR_INVALHANDLE
;
1489 if (uMessage
< DRVM_IOCTL
|| (uMessage
>= DRVM_IOCTL_LAST
&& uMessage
< DRVM_MAPPER
))
1490 return MMSYSERR_INVALPARAM
;
1492 return MMDRV_Message(wmld
, uMessage
, dwParam1
, dwParam2
, FALSE
);
1495 /**************************************************************************
1496 * waveInGetNumDevs [MMSYSTEM.501]
1498 UINT16 WINAPI
waveInGetNumDevs16(void)
1500 return MMDRV_GetNum(MMDRV_WAVEIN
);
1503 /**************************************************************************
1504 * waveInGetDevCaps [MMSYSTEM.502]
1506 UINT16 WINAPI
waveInGetDevCaps16(UINT16 uDeviceID
, LPWAVEINCAPS16 lpCaps
,
1512 if (lpCaps
== NULL
) return MMSYSERR_INVALPARAM
;
1514 ret
= waveInGetDevCapsA(uDeviceID
, &wicA
, sizeof(wicA
));
1515 if (ret
== MMSYSERR_NOERROR
) {
1517 wic16
.wMid
= wicA
.wMid
;
1518 wic16
.wPid
= wicA
.wPid
;
1519 wic16
.vDriverVersion
= wicA
.vDriverVersion
;
1520 strcpy(wic16
.szPname
, wicA
.szPname
);
1521 wic16
.dwFormats
= wicA
.dwFormats
;
1522 wic16
.wChannels
= wicA
.wChannels
;
1523 memcpy(lpCaps
, &wic16
, min(uSize
, sizeof(wic16
)));
1528 /**************************************************************************
1529 * waveInOpen [MMSYSTEM.504]
1531 UINT16 WINAPI
waveInOpen16(HWAVEIN16
* lphWaveIn
, UINT16 uDeviceID
,
1532 LPCWAVEFORMATEX lpFormat
, DWORD dwCallback
,
1533 DWORD dwInstance
, DWORD dwFlags
)
1538 /* since layout of WAVEFORMATEX is the same for 16/32 bits, we directly
1539 * call the 32 bit version
1540 * however, we need to promote correctly the wave mapper id
1541 * (0xFFFFFFFF and not 0x0000FFFF)
1543 ret
= WAVE_Open(&hWaveIn
, (uDeviceID
== (UINT16
)-1) ? (UINT
)-1 : uDeviceID
,
1544 MMDRV_WAVEIN
, lpFormat
, dwCallback
, dwInstance
, dwFlags
, FALSE
);
1546 if (lphWaveIn
!= NULL
) *lphWaveIn
= HWAVEIN_16(hWaveIn
);
1550 /**************************************************************************
1551 * waveInClose [MMSYSTEM.505]
1553 UINT16 WINAPI
waveInClose16(HWAVEIN16 hWaveIn
)
1558 ReleaseThunkLock(&level
);
1559 ret
= waveInClose(HWAVEIN_32(hWaveIn
));
1560 RestoreThunkLock(level
);
1564 /**************************************************************************
1565 * waveInPrepareHeader [MMSYSTEM.506]
1567 UINT16 WINAPI
waveInPrepareHeader16(HWAVEIN16 hWaveIn
, /* [in] */
1568 SEGPTR lpsegWaveInHdr
, /* [???] */
1569 UINT16 uSize
) /* [in] */
1572 LPWAVEHDR lpWaveInHdr
= MapSL(lpsegWaveInHdr
);
1575 TRACE("(%04X, %p, %u);\n", hWaveIn
, lpWaveInHdr
, uSize
);
1577 if (lpWaveInHdr
== NULL
) return MMSYSERR_INVALHANDLE
;
1578 if ((wmld
= MMDRV_Get(HWAVEIN_32(hWaveIn
), MMDRV_WAVEIN
, FALSE
)) == NULL
)
1579 return MMSYSERR_INVALHANDLE
;
1581 lpWaveInHdr
->dwBytesRecorded
= 0;
1583 ret
= MMDRV_Message(wmld
, WIDM_PREPARE
, lpsegWaveInHdr
, uSize
, FALSE
);
1587 /**************************************************************************
1588 * waveInUnprepareHeader [MMSYSTEM.507]
1590 UINT16 WINAPI
waveInUnprepareHeader16(HWAVEIN16 hWaveIn
, /* [in] */
1591 SEGPTR lpsegWaveInHdr
, /* [???] */
1592 UINT16 uSize
) /* [in] */
1595 LPWAVEHDR lpWaveInHdr
= MapSL(lpsegWaveInHdr
);
1597 TRACE("(%04X, %08x, %u);\n", hWaveIn
, lpsegWaveInHdr
, uSize
);
1599 if (lpWaveInHdr
== NULL
) return MMSYSERR_INVALPARAM
;
1601 if (!(lpWaveInHdr
->dwFlags
& WHDR_PREPARED
)) {
1602 return MMSYSERR_NOERROR
;
1605 if ((wmld
= MMDRV_Get(HWAVEIN_32(hWaveIn
), MMDRV_WAVEIN
, FALSE
)) == NULL
)
1606 return MMSYSERR_INVALHANDLE
;
1608 return MMDRV_Message(wmld
, WIDM_UNPREPARE
, lpsegWaveInHdr
, uSize
, FALSE
);
1611 /**************************************************************************
1612 * waveInAddBuffer [MMSYSTEM.508]
1614 UINT16 WINAPI
waveInAddBuffer16(HWAVEIN16 hWaveIn
, /* [in] */
1615 WAVEHDR
* lpsegWaveInHdr
, /* [???] NOTE: SEGPTR */
1616 UINT16 uSize
) /* [in] */
1620 TRACE("(%04X, %p, %u);\n", hWaveIn
, lpsegWaveInHdr
, uSize
);
1622 if (lpsegWaveInHdr
== NULL
) return MMSYSERR_INVALPARAM
;
1623 if ((wmld
= MMDRV_Get(HWAVEIN_32(hWaveIn
), MMDRV_WAVEIN
, FALSE
)) == NULL
)
1624 return MMSYSERR_INVALHANDLE
;
1626 return MMDRV_Message(wmld
, WIDM_ADDBUFFER
, (DWORD_PTR
)lpsegWaveInHdr
, uSize
, FALSE
);
1629 /**************************************************************************
1630 * waveInReset [MMSYSTEM.511]
1632 UINT16 WINAPI
waveInReset16(HWAVEIN16 hWaveIn16
)
1637 ReleaseThunkLock(&level
);
1638 ret
= waveInReset(HWAVEIN_32(hWaveIn16
));
1639 RestoreThunkLock(level
);
1643 /**************************************************************************
1644 * waveInStart [MMSYSTEM.509]
1646 UINT16 WINAPI
waveInStart16(HWAVEIN16 hWaveIn16
)
1651 ReleaseThunkLock(&level
);
1652 ret
= waveInStart(HWAVEIN_32(hWaveIn16
));
1653 RestoreThunkLock(level
);
1657 /**************************************************************************
1658 * waveInStop [MMSYSTEM.510]
1660 UINT16 WINAPI
waveInStop16(HWAVEIN16 hWaveIn16
)
1665 ReleaseThunkLock(&level
);
1666 ret
= waveInStop(HWAVEIN_32(hWaveIn16
));
1667 RestoreThunkLock(level
);
1671 /**************************************************************************
1672 * waveInGetPosition [MMSYSTEM.512]
1674 UINT16 WINAPI
waveInGetPosition16(HWAVEIN16 hWaveIn
, LPMMTIME16 lpTime
,
1680 mmt
.wType
= lpTime
->wType
;
1681 ret
= waveInGetPosition(HWAVEIN_32(hWaveIn
), &mmt
, sizeof(mmt
));
1682 MMSYSTEM_MMTIME32to16(lpTime
, &mmt
);
1686 /**************************************************************************
1687 * waveInGetID [MMSYSTEM.513]
1689 UINT16 WINAPI
waveInGetID16(HWAVEIN16 hWaveIn
, UINT16
* lpuDeviceID
)
1693 TRACE("(%04X, %p);\n", hWaveIn
, lpuDeviceID
);
1695 if (lpuDeviceID
== NULL
) return MMSYSERR_INVALHANDLE
;
1697 if ((wmld
= MMDRV_Get(HWAVEIN_32(hWaveIn
), MMDRV_WAVEIN
, FALSE
)) == NULL
)
1698 return MMSYSERR_INVALHANDLE
;
1700 *lpuDeviceID
= wmld
->uDeviceID
;
1701 return MMSYSERR_NOERROR
;
1704 /**************************************************************************
1705 * waveInMessage [MMSYSTEM.514]
1707 DWORD WINAPI
waveInMessage16(HWAVEIN16 hWaveIn
, UINT16 uMessage
,
1708 DWORD dwParam1
, DWORD dwParam2
)
1712 TRACE("(%04x, %u, %d, %d)\n", hWaveIn
, uMessage
, dwParam1
, dwParam2
);
1714 if ((wmld
= MMDRV_Get(HWAVEIN_32(hWaveIn
), MMDRV_WAVEIN
, FALSE
)) == NULL
) {
1715 if ((wmld
= MMDRV_Get(HWAVEIN_32(hWaveIn
), MMDRV_WAVEIN
, TRUE
)) != NULL
) {
1716 if (uMessage
== DRV_QUERYDRVENTRY
|| uMessage
== DRV_QUERYDEVNODE
)
1717 dwParam1
= (DWORD
)MapSL(dwParam1
);
1718 return MMDRV_PhysicalFeatures(wmld
, uMessage
, dwParam1
, dwParam2
);
1720 return MMSYSERR_INVALHANDLE
;
1724 if (uMessage
< DRVM_IOCTL
|| (uMessage
>= DRVM_IOCTL_LAST
&& uMessage
< DRVM_MAPPER
))
1725 return MMSYSERR_INVALPARAM
;
1727 return MMDRV_Message(wmld
, uMessage
, dwParam1
, dwParam2
, FALSE
);
1730 /* ###################################################
1732 * ###################################################
1735 /*#define USE_MM_TSK_WINE*/
1737 /**************************************************************************
1738 * mmTaskCreate [MMSYSTEM.900]
1740 * Creates a 16 bit MM task. It's entry point is lpFunc, and it should be
1741 * called upon creation with dwPmt as parameter.
1743 HINSTANCE16 WINAPI
mmTaskCreate16(SEGPTR spProc
, HINSTANCE16
*lphMmTask
, DWORD dwPmt
)
1748 DWORD showCmd
= 0x40002;
1751 TRACE("(%08x, %p, %08x);\n", spProc
, lphMmTask
, dwPmt
);
1752 /* This to work requires NE modules to be started with a binary command line
1753 * which is not currently the case. A patch exists but has never been committed.
1754 * A workaround would be to integrate code for mmtask.tsk into Wine, but
1755 * this requires tremendous work (starting with patching tools/build to
1756 * create NE executables (and not only DLLs) for builtins modules.
1759 FIXME("This is currently broken. It will fail\n");
1762 *(LPDWORD
)(cmdline
+ 1) = (DWORD
)spProc
;
1763 *(LPDWORD
)(cmdline
+ 5) = dwPmt
;
1764 *(LPDWORD
)(cmdline
+ 9) = 0;
1766 lp
.hEnvironment
= 0;
1767 lp
.cmdLine
= MapLS(cmdline
);
1768 lp
.showCmd
= MapLS(&showCmd
);
1771 #ifndef USE_MM_TSK_WINE
1772 handle
= LoadModule16("c:\\windows\\system\\mmtask.tsk", &lp
);
1774 handle
= LoadModule16("mmtask.tsk", &lp
);
1777 ret
= (handle
) ? 1 : 2;
1783 *lphMmTask
= handle
;
1785 UnMapLS( lp
.cmdLine
);
1786 UnMapLS( lp
.showCmd
);
1787 TRACE("=> 0x%04x/%d\n", handle
, ret
);
1791 #ifdef USE_MM_TSK_WINE
1792 /* C equivalent to mmtask.tsk binary content */
1793 void mmTaskEntryPoint16(LPSTR cmdLine
, WORD di
, WORD si
)
1795 int len
= cmdLine
[0x80];
1798 void (*fpProc
)(DWORD
) = MapSL(*((DWORD
*)(cmdLine
+ 1)));
1799 DWORD dwPmt
= *((DWORD
*)(cmdLine
+ 5));
1802 InitTask16(); /* FIXME: pmts / from context ? */
1805 if (SetMessageQueue16(0x40)) {
1807 if (HIWORD(fpProc
)) {
1809 /* EPP StackEnter16(); */
1821 /**************************************************************************
1822 * mmTaskBlock [MMSYSTEM.902]
1824 void WINAPI
mmTaskBlock16(HINSTANCE16 hInst
)
1829 GetMessageA(&msg
, 0, 0, 0);
1831 TranslateMessage(&msg
);
1832 DispatchMessageA(&msg
);
1834 } while (msg
.message
< 0x3A0);
1837 /**************************************************************************
1838 * mmTaskSignal [MMSYSTEM.903]
1840 LRESULT WINAPI
mmTaskSignal16(HTASK16 ht
)
1842 TRACE("(%04x);\n", ht
);
1843 return PostThreadMessageW( HTASK_32(ht
), WM_USER
, 0, 0 );
1846 /**************************************************************************
1847 * mmGetCurrentTask [MMSYSTEM.904]
1849 HTASK16 WINAPI
mmGetCurrentTask16(void)
1851 return GetCurrentTask();
1854 /**************************************************************************
1855 * mmTaskYield [MMSYSTEM.905]
1857 void WINAPI
mmTaskYield16(void)
1861 if (PeekMessageA(&msg
, 0, 0, 0, 0)) {
1866 extern DWORD WINAPI
GetProcessFlags(DWORD
);
1868 /******************************************************************
1873 static WINE_MMTHREAD
* WINMM_GetmmThread(HANDLE16 h
)
1875 return (WINE_MMTHREAD
*)MapSL( MAKESEGPTR(h
, 0) );
1878 DWORD WINAPI
WINE_mmThreadEntryPoint(LPVOID
);
1880 /**************************************************************************
1881 * mmThreadCreate [MMSYSTEM.1120]
1884 * Creates a MM thread, calling fpThreadAddr(dwPmt).
1886 * bit.0 set means create a 16 bit task instead of thread calling a 16 bit proc
1887 * bit.1 set means to open a VxD for this thread (unsupported)
1889 LRESULT WINAPI
mmThreadCreate16(FARPROC16 fpThreadAddr
, LPHANDLE16 lpHndl
, DWORD dwPmt
, DWORD dwFlags
)
1894 TRACE("(%p, %p, %08x, %08x)!\n", fpThreadAddr
, lpHndl
, dwPmt
, dwFlags
);
1896 hndl
= GlobalAlloc16(sizeof(WINE_MMTHREAD
), GMEM_SHARE
|GMEM_ZEROINIT
);
1901 WINE_MMTHREAD
* lpMMThd
= WINMM_GetmmThread(hndl
);
1904 /* force mmtask routines even if mmthread is required */
1905 /* this will work only if the patch about binary cmd line and NE tasks
1911 lpMMThd
->dwSignature
= WINE_MMTHREAD_CREATED
;
1912 lpMMThd
->dwCounter
= 0;
1913 lpMMThd
->hThread
= 0;
1914 lpMMThd
->dwThreadID
= 0;
1915 lpMMThd
->fpThread
= (DWORD
)fpThreadAddr
;
1916 lpMMThd
->dwThreadPmt
= dwPmt
;
1917 lpMMThd
->dwSignalCount
= 0;
1918 lpMMThd
->hEvent
= 0;
1920 lpMMThd
->dwStatus
= 0;
1921 lpMMThd
->dwFlags
= dwFlags
;
1924 if ((dwFlags
& 1) == 0 && (GetProcessFlags(GetCurrentThreadId()) & 8) == 0) {
1925 lpMMThd
->hEvent
= CreateEventW(NULL
, FALSE
, TRUE
, NULL
);
1927 TRACE("Let's go crazy... trying new MM thread. lpMMThd=%p\n", lpMMThd
);
1928 if (lpMMThd
->dwFlags
& 2) {
1929 /* as long as we don't support MM VxD in wine, we don't need
1930 * to care about this flag
1932 /* FIXME("Don't know how to properly open VxD handles\n"); */
1933 /* lpMMThd->hVxD = OpenVxDHandle(lpMMThd->hEvent); */
1936 lpMMThd
->hThread
= CreateThread(0, 0, WINE_mmThreadEntryPoint
,
1937 (LPVOID
)(DWORD_PTR
)hndl
, CREATE_SUSPENDED
, &lpMMThd
->dwThreadID
);
1938 if (lpMMThd
->hThread
== 0) {
1939 WARN("Couldn't create thread\n");
1940 /* clean-up(VxDhandle...); devicedirectio... */
1941 if (lpMMThd
->hEvent
!= 0)
1942 CloseHandle(lpMMThd
->hEvent
);
1945 SetThreadPriority(lpMMThd
->hThread
, THREAD_PRIORITY_TIME_CRITICAL
);
1946 TRACE("Got a nice thread hndl=%p id=0x%08x\n", lpMMThd
->hThread
, lpMMThd
->dwThreadID
);
1950 /* get WINE_mmThreadEntryPoint()
1951 * 2047 is its ordinal in mmsystem.spec
1953 FARPROC16 fp
= GetProcAddress16(GetModuleHandle16("MMSYSTEM"), (LPCSTR
)2047);
1955 TRACE("farproc seg=0x%p lin=%p\n", fp
, MapSL((SEGPTR
)fp
));
1957 ret
= (fp
== 0) ? 2 : mmTaskCreate16((DWORD
)fp
, 0, hndl
);
1961 if (lpMMThd
->hThread
&& !ResumeThread(lpMMThd
->hThread
))
1962 WARN("Couldn't resume thread\n");
1964 while (lpMMThd
->dwStatus
!= 0x10) { /* test also HIWORD of dwStatus */
1978 TRACE("ok => %ld\n", ret
);
1982 /**************************************************************************
1983 * mmThreadSignal [MMSYSTEM.1121]
1985 void WINAPI
mmThreadSignal16(HANDLE16 hndl
)
1987 TRACE("(%04x)!\n", hndl
);
1990 WINE_MMTHREAD
* lpMMThd
= WINMM_GetmmThread(hndl
);
1992 lpMMThd
->dwCounter
++;
1993 if (lpMMThd
->hThread
!= 0) {
1994 InterlockedIncrement(&lpMMThd
->dwSignalCount
);
1995 SetEvent(lpMMThd
->hEvent
);
1997 mmTaskSignal16(lpMMThd
->hTask
);
1999 lpMMThd
->dwCounter
--;
2003 static void MMSYSTEM_ThreadBlock(WINE_MMTHREAD
* lpMMThd
)
2008 if (lpMMThd
->dwThreadID
!= GetCurrentThreadId())
2009 ERR("Not called by thread itself\n");
2012 ResetEvent(lpMMThd
->hEvent
);
2013 if (InterlockedDecrement(&lpMMThd
->dwSignalCount
) >= 0)
2015 InterlockedIncrement(&lpMMThd
->dwSignalCount
);
2019 ret
= MsgWaitForMultipleObjects(1, &lpMMThd
->hEvent
, FALSE
, INFINITE
, QS_ALLINPUT
);
2021 case WAIT_OBJECT_0
: /* Event */
2024 case WAIT_OBJECT_0
+ 1: /* Msg */
2026 if (PeekMessageA(&msg
, 0, 0, 0, PM_REMOVE
)) {
2027 TranslateMessage(&msg
);
2028 DispatchMessageA(&msg
);
2032 WARN("S2.x unsupported ret val 0x%08x\n", ret
);
2038 /**************************************************************************
2039 * mmThreadBlock [MMSYSTEM.1122]
2041 void WINAPI
mmThreadBlock16(HANDLE16 hndl
)
2043 TRACE("(%04x)!\n", hndl
);
2046 WINE_MMTHREAD
* lpMMThd
= WINMM_GetmmThread(hndl
);
2048 if (lpMMThd
->hThread
!= 0) {
2051 ReleaseThunkLock(&lc
);
2052 MMSYSTEM_ThreadBlock(lpMMThd
);
2053 RestoreThunkLock(lc
);
2055 mmTaskBlock16(lpMMThd
->hTask
);
2061 /**************************************************************************
2062 * mmThreadIsCurrent [MMSYSTEM.1123]
2064 BOOL16 WINAPI
mmThreadIsCurrent16(HANDLE16 hndl
)
2068 TRACE("(%04x)!\n", hndl
);
2070 if (hndl
&& mmThreadIsValid16(hndl
)) {
2071 WINE_MMTHREAD
* lpMMThd
= WINMM_GetmmThread(hndl
);
2072 ret
= (GetCurrentThreadId() == lpMMThd
->dwThreadID
);
2074 TRACE("=> %d\n", ret
);
2078 /**************************************************************************
2079 * mmThreadIsValid [MMSYSTEM.1124]
2081 BOOL16 WINAPI
mmThreadIsValid16(HANDLE16 hndl
)
2085 TRACE("(%04x)!\n", hndl
);
2088 WINE_MMTHREAD
* lpMMThd
= WINMM_GetmmThread(hndl
);
2090 if (!IsBadWritePtr(lpMMThd
, sizeof(WINE_MMTHREAD
)) &&
2091 lpMMThd
->dwSignature
== WINE_MMTHREAD_CREATED
&&
2092 IsTask16(lpMMThd
->hTask
)) {
2093 lpMMThd
->dwCounter
++;
2094 if (lpMMThd
->hThread
!= 0) {
2096 if (GetExitCodeThread(lpMMThd
->hThread
, &dwThreadRet
) &&
2097 dwThreadRet
== STATUS_PENDING
) {
2103 lpMMThd
->dwCounter
--;
2106 TRACE("=> %d\n", ret
);
2110 /**************************************************************************
2111 * mmThreadGetTask [MMSYSTEM.1125]
2113 HANDLE16 WINAPI
mmThreadGetTask16(HANDLE16 hndl
)
2117 TRACE("(%04x)\n", hndl
);
2119 if (mmThreadIsValid16(hndl
)) {
2120 WINE_MMTHREAD
* lpMMThd
= WINMM_GetmmThread(hndl
);
2121 ret
= lpMMThd
->hTask
;
2126 /**************************************************************************
2127 * __wine_mmThreadEntryPoint (MMSYSTEM.2047)
2129 DWORD WINAPI
WINE_mmThreadEntryPoint(LPVOID p
)
2131 HANDLE16 hndl
= (HANDLE16
)(DWORD_PTR
)p
;
2132 WINE_MMTHREAD
* lpMMThd
= WINMM_GetmmThread(hndl
);
2134 TRACE("(%04x %p)\n", hndl
, lpMMThd
);
2136 lpMMThd
->hTask
= LOWORD(GetCurrentTask());
2137 TRACE("[10-%p] setting hTask to 0x%08x\n", lpMMThd
->hThread
, lpMMThd
->hTask
);
2138 lpMMThd
->dwStatus
= 0x10;
2139 MMSYSTEM_ThreadBlock(lpMMThd
);
2140 TRACE("[20-%p]\n", lpMMThd
->hThread
);
2141 lpMMThd
->dwStatus
= 0x20;
2142 if (lpMMThd
->fpThread
) {
2143 WOWCallback16(lpMMThd
->fpThread
, lpMMThd
->dwThreadPmt
);
2145 lpMMThd
->dwStatus
= 0x30;
2146 TRACE("[30-%p]\n", lpMMThd
->hThread
);
2147 while (lpMMThd
->dwCounter
) {
2151 TRACE("[XX-%p]\n", lpMMThd
->hThread
);
2153 lpMMThd
->dwSignature
= WINE_MMTHREAD_DELETED
;
2154 /* close lpMMThread->hVxD directIO */
2155 if (lpMMThd
->hEvent
)
2156 CloseHandle(lpMMThd
->hEvent
);
2163 typedef BOOL16 (WINAPI
*MMCPLCALLBACK
)(HWND
, LPCSTR
, LPCSTR
, LPCSTR
);
2165 /**************************************************************************
2166 * mmShowMMCPLPropertySheet [MMSYSTEM.1150]
2168 BOOL16 WINAPI
mmShowMMCPLPropertySheet16(HWND hWnd
, LPCSTR lpStrDevice
,
2169 LPCSTR lpStrTab
, LPCSTR lpStrTitle
)
2174 TRACE("(%p \"%s\" \"%s\" \"%s\")\n", hWnd
, lpStrDevice
, lpStrTab
, lpStrTitle
);
2176 hndl
= LoadLibraryA("MMSYS.CPL");
2178 MMCPLCALLBACK fp
= (MMCPLCALLBACK
)GetProcAddress(hndl
, "ShowMMCPLPropertySheet");
2181 ReleaseThunkLock(&lc
);
2182 ret
= (fp
)(hWnd
, lpStrDevice
, lpStrTab
, lpStrTitle
);
2183 RestoreThunkLock(lc
);
2191 /**************************************************************************
2192 * StackEnter [MMSYSTEM.32]
2194 void WINAPI
StackEnter16(void)
2197 /* mmsystem.dll from Win 95 does only this: so does Wine */
2202 /**************************************************************************
2203 * StackLeave [MMSYSTEM.33]
2205 void WINAPI
StackLeave16(void)
2208 /* mmsystem.dll from Win 95 does only this: so does Wine */
2213 /**************************************************************************
2214 * WMMMidiRunOnce [MMSYSTEM.8]
2216 void WINAPI
WMMMidiRunOnce16(void)
2218 FIXME("(), stub!\n");
2221 /* ###################################################
2223 * ###################################################
2226 /**************************************************************************
2227 * DRIVER_MapMsg32To16 [internal]
2229 * Map a 32 bit driver message to a 16 bit driver message.
2231 static WINMM_MapType
DRIVER_MapMsg32To16(WORD wMsg
, LPARAM
*lParam1
, LPARAM
*lParam2
)
2233 WINMM_MapType ret
= WINMM_MAP_MSGERROR
;
2240 case DRV_QUERYCONFIGURE
:
2242 case DRV_EXITSESSION
:
2243 case DRV_EXITAPPLICATION
:
2245 case DRV_CLOSE
: /* should be 0/0 */
2246 case DRV_OPEN
: /* pass through */
2247 /* lParam1 and lParam2 are not used */
2252 /* lParam1 is a handle to a window (conf) or to a driver (inst) or not used,
2253 * lParam2 is a pointer to DRVCONFIGINFO
2256 LPDRVCONFIGINFO16 dci16
= HeapAlloc( GetProcessHeap(), 0, sizeof(*dci16
) );
2257 LPDRVCONFIGINFO dci32
= (LPDRVCONFIGINFO
)(*lParam2
);
2260 LPSTR str1
= NULL
,str2
;
2262 dci16
->dwDCISize
= sizeof(DRVCONFIGINFO16
);
2264 if (dci32
->lpszDCISectionName
) {
2265 len
= WideCharToMultiByte( CP_ACP
, 0, dci32
->lpszDCISectionName
, -1, NULL
, 0, NULL
, NULL
);
2266 str1
= HeapAlloc( GetProcessHeap(), 0, len
);
2268 WideCharToMultiByte( CP_ACP
, 0, dci32
->lpszDCISectionName
, -1, str1
, len
, NULL
, NULL
);
2269 dci16
->lpszDCISectionName
= MapLS( str1
);
2271 HeapFree( GetProcessHeap(), 0, dci16
);
2272 return WINMM_MAP_NOMEM
;
2275 dci16
->lpszDCISectionName
= 0L;
2277 if (dci32
->lpszDCIAliasName
) {
2278 len
= WideCharToMultiByte( CP_ACP
, 0, dci32
->lpszDCIAliasName
, -1, NULL
, 0, NULL
, NULL
);
2279 str2
= HeapAlloc( GetProcessHeap(), 0, len
);
2281 WideCharToMultiByte( CP_ACP
, 0, dci32
->lpszDCIAliasName
, -1, str2
, len
, NULL
, NULL
);
2282 dci16
->lpszDCIAliasName
= MapLS( str2
);
2284 HeapFree( GetProcessHeap(), 0, str1
);
2285 HeapFree( GetProcessHeap(), 0, dci16
);
2286 return WINMM_MAP_NOMEM
;
2289 dci16
->lpszDCISectionName
= 0L;
2292 return WINMM_MAP_NOMEM
;
2294 *lParam2
= MapLS( dci16
);
2295 ret
= WINMM_MAP_OKMEM
;
2301 if (!((wMsg
>= 0x800 && wMsg
< 0x900) || (wMsg
>= 0x4000 && wMsg
< 0x4100))) {
2302 FIXME("Unknown message 0x%04x\n", wMsg
);
2309 /**************************************************************************
2310 * DRIVER_UnMapMsg32To16 [internal]
2312 * UnMap a 32 bit driver message to a 16 bit driver message.
2314 static WINMM_MapType
DRIVER_UnMapMsg32To16(WORD wMsg
, DWORD lParam1
, DWORD lParam2
)
2316 WINMM_MapType ret
= WINMM_MAP_MSGERROR
;
2323 case DRV_QUERYCONFIGURE
:
2325 case DRV_EXITSESSION
:
2326 case DRV_EXITAPPLICATION
:
2330 /* lParam1 and lParam2 are not used */
2334 /* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */
2336 LPDRVCONFIGINFO16 dci16
= MapSL(lParam2
);
2337 HeapFree( GetProcessHeap(), 0, MapSL(dci16
->lpszDCISectionName
) );
2338 HeapFree( GetProcessHeap(), 0, MapSL(dci16
->lpszDCIAliasName
) );
2340 UnMapLS( dci16
->lpszDCISectionName
);
2341 UnMapLS( dci16
->lpszDCIAliasName
);
2342 HeapFree( GetProcessHeap(), 0, dci16
);
2347 if (!((wMsg
>= 0x800 && wMsg
< 0x900) || (wMsg
>= 0x4000 && wMsg
< 0x4100))) {
2348 FIXME("Unknown message 0x%04x\n", wMsg
);
2355 /**************************************************************************
2356 * DRIVER_TryOpenDriver16 [internal]
2358 * Tries to load a 16 bit driver whose DLL's (module) name is lpFileName.
2360 static LPWINE_DRIVER
DRIVER_OpenDriver16(LPCWSTR fn
, LPCWSTR sn
, LPARAM lParam2
)
2362 LPWINE_DRIVER lpDrv
= NULL
;
2363 LPCSTR cause
= NULL
;
2364 LPSTR fnA
= NULL
, snA
= NULL
;
2367 TRACE("(%s, %s, %08lX);\n", debugstr_w(fn
), debugstr_w(sn
), lParam2
);
2369 lpDrv
= HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_DRIVER
));
2370 if (lpDrv
== NULL
) {cause
= "OOM"; goto exit
;}
2374 len
= WideCharToMultiByte( CP_ACP
, 0, fn
, -1, NULL
, 0, NULL
, NULL
);
2375 fnA
= HeapAlloc(GetProcessHeap(), 0, len
);
2376 if (fnA
== NULL
) {cause
= "OOM"; goto exit
;}
2377 WideCharToMultiByte( CP_ACP
, 0, fn
, -1, fnA
, len
, NULL
, NULL
);
2382 len
= WideCharToMultiByte( CP_ACP
, 0, sn
, -1, NULL
, 0, NULL
, NULL
);
2383 snA
= HeapAlloc(GetProcessHeap(), 0, len
);
2384 if (snA
== NULL
) {cause
= "OOM"; goto exit
;}
2385 WideCharToMultiByte( CP_ACP
, 0, sn
, -1, snA
, len
, NULL
, NULL
);
2388 /* FIXME: shall we do some black magic here on sn ?
2389 * drivers32 => drivers
2393 lpDrv
->d
.d16
.hDriver16
= OpenDriver16(fnA
, snA
, lParam2
);
2394 if (lpDrv
->d
.d16
.hDriver16
== 0) {cause
= "Not a 16 bit driver"; goto exit
;}
2395 lpDrv
->dwFlags
= WINE_GDF_16BIT
;
2398 HeapFree(GetProcessHeap(), 0, fnA
);
2399 HeapFree(GetProcessHeap(), 0, snA
);
2403 TRACE("Unable to load 16 bit module %s[%s]: %s\n",
2404 debugstr_w(fn
), debugstr_w(sn
), cause
);
2405 HeapFree(GetProcessHeap(), 0, lpDrv
);
2409 TRACE("=> %p\n", lpDrv
);
2413 /******************************************************************
2414 * DRIVER_SendMessage16
2418 static LRESULT
DRIVER_SendMessage16(HDRVR16 hDrv16
, UINT msg
,
2419 LPARAM lParam1
, LPARAM lParam2
)
2424 TRACE("Before sdm16 call hDrv=%04x wMsg=%04x p1=%08lx p2=%08lx\n",
2425 hDrv16
, msg
, lParam1
, lParam2
);
2427 switch (map
= DRIVER_MapMsg32To16(msg
, &lParam1
, &lParam2
)) {
2428 case WINMM_MAP_OKMEM
:
2430 ret
= SendDriverMessage16(hDrv16
, msg
, lParam1
, lParam2
);
2431 if (map
== WINMM_MAP_OKMEM
)
2432 DRIVER_UnMapMsg32To16(msg
, lParam1
, lParam2
);
2439 /******************************************************************
2440 * DRIVER_CloseDriver16
2444 static LRESULT
DRIVER_CloseDriver16(HDRVR16 hDrv16
, LPARAM lParam1
, LPARAM lParam2
)
2446 return CloseDriver16(hDrv16
, lParam1
, lParam2
);
2449 /**************************************************************************
2450 * DrvOpen [MMSYSTEM.1100]
2452 HDRVR16 WINAPI
DrvOpen16(LPSTR lpDriverName
, LPSTR lpSectionName
, LPARAM lParam
)
2454 return OpenDriver16(lpDriverName
, lpSectionName
, lParam
);
2457 /**************************************************************************
2458 * DrvClose [MMSYSTEM.1101]
2460 LRESULT WINAPI
DrvClose16(HDRVR16 hDrv
, LPARAM lParam1
, LPARAM lParam2
)
2462 return CloseDriver16(hDrv
, lParam1
, lParam2
);
2465 /**************************************************************************
2466 * DrvSendMessage [MMSYSTEM.1102]
2468 LRESULT WINAPI
DrvSendMessage16(HDRVR16 hDrv
, WORD msg
, LPARAM lParam1
,
2471 return SendDriverMessage16(hDrv
, msg
, lParam1
, lParam2
);
2474 /**************************************************************************
2475 * DrvGetModuleHandle [MMSYSTEM.1103]
2477 HANDLE16 WINAPI
DrvGetModuleHandle16(HDRVR16 hDrv
)
2479 return GetDriverModuleHandle16(hDrv
);
2482 /**************************************************************************
2483 * DrvDefDriverProc [MMSYSTEM.1104]
2485 LRESULT WINAPI
DrvDefDriverProc16(DWORD dwDriverID
, HDRVR16 hDrv
, WORD wMsg
,
2486 DWORD dwParam1
, DWORD dwParam2
)
2488 return DefDriverProc16(dwDriverID
, hDrv
, wMsg
, dwParam1
, dwParam2
);
2491 /**************************************************************************
2492 * DriverProc [MMSYSTEM.6]
2494 LRESULT WINAPI
DriverProc16(DWORD dwDevID
, HDRVR16 hDrv
, WORD wMsg
,
2495 DWORD dwParam1
, DWORD dwParam2
)
2497 TRACE("dwDevID=%08x hDrv=%04x wMsg=%04x dwParam1=%08x dwParam2=%08x\n",
2498 dwDevID
, hDrv
, wMsg
, dwParam1
, dwParam2
);
2500 return DrvDefDriverProc16(dwDevID
, hDrv
, wMsg
, dwParam1
, dwParam2
);
2503 /* ###################################################
2505 * ###################################################
2508 /******************************************************************
2509 * MMSYSTEM_MMTIME32to16
2513 void MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16
, const MMTIME
* mmt32
)
2515 mmt16
->wType
= mmt32
->wType
;
2516 /* layout of rest is the same for 32/16,
2517 * Note: mmt16->u is 2 bytes smaller than mmt32->u, which has padding
2519 memcpy(&(mmt16
->u
), &(mmt32
->u
), sizeof(mmt16
->u
));
2522 /******************************************************************
2523 * MMSYSTEM_MMTIME16to32
2527 void MMSYSTEM_MMTIME16to32(LPMMTIME mmt32
, const MMTIME16
* mmt16
)
2529 mmt32
->wType
= mmt16
->wType
;
2530 /* layout of rest is the same for 32/16,
2531 * Note: mmt16->u is 2 bytes smaller than mmt32->u, which has padding
2533 memcpy(&(mmt32
->u
), &(mmt16
->u
), sizeof(mmt16
->u
));
2536 /**************************************************************************
2537 * timeGetSystemTime [MMSYSTEM.601]
2539 MMRESULT16 WINAPI
timeGetSystemTime16(LPMMTIME16 lpTime
, UINT16 wSize
)
2541 if (wSize
>= sizeof(*lpTime
)) {
2542 lpTime
->wType
= TIME_MS
;
2543 lpTime
->u
.ms
= GetTickCount();
2545 TRACE("=> %u\n", lpTime
->u
.ms
);
2551 /**************************************************************************
2552 * timeSetEvent [MMSYSTEM.602]
2554 MMRESULT16 WINAPI
timeSetEvent16(UINT16 wDelay
, UINT16 wResol
, LPTIMECALLBACK16 lpFunc
,
2555 DWORD dwUser
, UINT16 wFlags
)
2557 if (wFlags
& WINE_TIMER_IS32
)
2558 WARN("Unknown windows flag... wine internally used.. ooch\n");
2560 return TIME_SetEventInternal(wDelay
, wResol
, (LPTIMECALLBACK
)lpFunc
,
2561 dwUser
, wFlags
& ~WINE_TIMER_IS32
);
2564 /**************************************************************************
2565 * timeKillEvent [MMSYSTEM.603]
2567 MMRESULT16 WINAPI
timeKillEvent16(UINT16 wID
)
2569 return timeKillEvent(wID
);
2572 /**************************************************************************
2573 * timeGetDevCaps [MMSYSTEM.604]
2575 MMRESULT16 WINAPI
timeGetDevCaps16(LPTIMECAPS16 lpCaps
, UINT16 wSize
)
2579 TRACE("(%p, %u) !\n", lpCaps
, wSize
);
2581 if (lpCaps
== NULL
) return MMSYSERR_INVALPARAM
;
2583 ret
= timeGetDevCaps(&caps
, sizeof(caps
));
2584 if (ret
== MMSYSERR_NOERROR
) {
2586 tc16
.wPeriodMin
= caps
.wPeriodMin
;
2587 tc16
.wPeriodMax
= caps
.wPeriodMax
;
2588 memcpy(lpCaps
, &tc16
, min(wSize
, sizeof(tc16
)));
2593 /**************************************************************************
2594 * timeBeginPeriod [MMSYSTEM.605]
2596 MMRESULT16 WINAPI
timeBeginPeriod16(UINT16 wPeriod
)
2598 TRACE("(%u) !\n", wPeriod
);
2600 return timeBeginPeriod(wPeriod
);
2603 /**************************************************************************
2604 * timeEndPeriod [MMSYSTEM.606]
2606 MMRESULT16 WINAPI
timeEndPeriod16(UINT16 wPeriod
)
2608 TRACE("(%u) !\n", wPeriod
);
2610 return timeEndPeriod(wPeriod
);
2613 /**************************************************************************
2614 * mciSendString [MMSYSTEM.702]
2616 DWORD WINAPI
mciSendString16(LPCSTR lpstrCommand
, LPSTR lpstrRet
,
2617 UINT16 uRetLen
, HWND16 hwndCallback
)
2619 return mciSendStringA(lpstrCommand
, lpstrRet
, uRetLen
, HWND_32(hwndCallback
));
2622 /**************************************************************************
2623 * mciLoadCommandResource [MMSYSTEM.705]
2625 UINT16 WINAPI
mciLoadCommandResource16(HINSTANCE16 hInst
, LPCSTR resname
, UINT16 type
)
2631 unsigned pos
= 0, size
= 1024, len
;
2635 UINT16 ret
= MCIERR_OUT_OF_MEMORY
;
2637 if (!(res
= FindResource16( hInst
, resname
, (LPSTR
)RT_RCDATA
))) return MCI_NO_COMMAND_TABLE
;
2638 if (!(handle
= LoadResource16( hInst
, res
))) return MCI_NO_COMMAND_TABLE
;
2639 ptr16
= LockResource16(handle
);
2640 /* converting the 16 bit resource table into a 32W one */
2641 if ((ptr32
= HeapAlloc(GetProcessHeap(), 0, size
)))
2644 str
= (LPCSTR
)ptr16
;
2645 ptr16
+= strlen(str
) + 1;
2646 flg
= *(const DWORD
*)ptr16
;
2647 eid
= *(const WORD
*)(ptr16
+ sizeof(DWORD
));
2648 ptr16
+= sizeof(DWORD
) + sizeof(WORD
);
2649 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0) * sizeof(WCHAR
);
2650 if (pos
+ len
+ sizeof(DWORD
) + sizeof(WORD
) > size
)
2652 while (pos
+ len
* sizeof(WCHAR
) + sizeof(DWORD
) + sizeof(WORD
) > size
) size
+= 1024;
2653 ptr32
= HeapReAlloc(GetProcessHeap(), 0, ptr32
, size
);
2654 if (!ptr32
) goto the_end
;
2656 MultiByteToWideChar(CP_ACP
, 0, str
, -1, (LPWSTR
)(ptr32
+ pos
), len
/ sizeof(WCHAR
));
2657 *(DWORD
*)(ptr32
+ pos
+ len
) = flg
;
2658 *(WORD
*)(ptr32
+ pos
+ len
+ sizeof(DWORD
)) = eid
;
2659 pos
+= len
+ sizeof(DWORD
) + sizeof(WORD
);
2660 } while (eid
!= MCI_END_COMMAND_LIST
);
2663 FreeResource16( handle
);
2664 if (ptr32
) ret
= MCI_SetCommandTable(ptr32
, type
);
2668 /**************************************************************************
2669 * mciFreeCommandResource [MMSYSTEM.713]
2671 BOOL16 WINAPI
mciFreeCommandResource16(UINT16 uTable
)
2673 TRACE("(%04x)!\n", uTable
);
2675 return MCI_DeleteCommandTable(uTable
, TRUE
);
2678 /* ###################################################
2680 * ###################################################
2683 /****************************************************************
2684 * MMIO_Map32To16 [INTERNAL]
2686 static LRESULT
MMIO_Map32To16(DWORD wMsg
, LPARAM
* lp1
, LPARAM
* lp2
)
2696 case MMIOM_WRITEFLUSH
:
2697 *lp1
= MapLS( (void *)*lp1
);
2700 *lp1
= MapLS( (void *)*lp1
);
2701 *lp2
= MapLS( (void *)*lp2
);
2704 if (wMsg
< MMIOM_USER
)
2705 TRACE("Not a mappable message (%d)\n", wMsg
);
2707 return MMSYSERR_NOERROR
;
2710 /****************************************************************
2711 * MMIO_UnMap32To16 [INTERNAL]
2713 static LRESULT
MMIO_UnMap32To16(DWORD wMsg
, LPARAM lParam1
, LPARAM lParam2
,
2714 LPARAM lp1
, LPARAM lp2
)
2724 case MMIOM_WRITEFLUSH
:
2732 if (wMsg
< MMIOM_USER
)
2733 TRACE("Not a mappable message (%d)\n", wMsg
);
2735 return MMSYSERR_NOERROR
;
2738 /******************************************************************
2743 static LRESULT
MMIO_Callback16(SEGPTR cb16
, LPMMIOINFO lpmmioinfo
, UINT uMessage
,
2744 LPARAM lParam1
, LPARAM lParam2
)
2747 MMIOINFO16 mmioInfo16
;
2748 SEGPTR segmmioInfo16
;
2749 LPARAM lp1
= lParam1
, lp2
= lParam2
;
2752 memset(&mmioInfo16
, 0, sizeof(MMIOINFO16
));
2753 mmioInfo16
.lDiskOffset
= lpmmioinfo
->lDiskOffset
;
2754 mmioInfo16
.adwInfo
[0] = lpmmioinfo
->adwInfo
[0];
2755 mmioInfo16
.adwInfo
[1] = lpmmioinfo
->adwInfo
[1];
2756 mmioInfo16
.adwInfo
[2] = lpmmioinfo
->adwInfo
[2];
2757 /* map (lParam1, lParam2) into (lp1, lp2) 32=>16 */
2758 if ((result
= MMIO_Map32To16(uMessage
, &lp1
, &lp2
)) != MMSYSERR_NOERROR
)
2761 segmmioInfo16
= MapLS(&mmioInfo16
);
2762 args
[6] = HIWORD(segmmioInfo16
);
2763 args
[5] = LOWORD(segmmioInfo16
);
2765 args
[3] = HIWORD(lp1
);
2766 args
[2] = LOWORD(lp1
);
2767 args
[1] = HIWORD(lp2
);
2768 args
[0] = LOWORD(lp2
);
2769 WOWCallback16Ex( cb16
, WCB16_PASCAL
, sizeof(args
), args
, &result
);
2770 UnMapLS(segmmioInfo16
);
2771 MMIO_UnMap32To16(uMessage
, lParam1
, lParam2
, lp1
, lp2
);
2773 lpmmioinfo
->lDiskOffset
= mmioInfo16
.lDiskOffset
;
2774 lpmmioinfo
->adwInfo
[0] = mmioInfo16
.adwInfo
[0];
2775 lpmmioinfo
->adwInfo
[1] = mmioInfo16
.adwInfo
[1];
2776 lpmmioinfo
->adwInfo
[2] = mmioInfo16
.adwInfo
[2];
2781 /******************************************************************
2782 * MMIO_ResetSegmentedData
2785 static LRESULT
MMIO_SetSegmentedBuffer(HMMIO hmmio
, SEGPTR ptr
, BOOL release
)
2789 if ((wm
= MMIO_Get(hmmio
)) == NULL
)
2790 return MMSYSERR_INVALHANDLE
;
2791 if (release
) UnMapLS(wm
->segBuffer16
);
2792 wm
->segBuffer16
= ptr
;
2793 return MMSYSERR_NOERROR
;
2796 /**************************************************************************
2797 * mmioOpen [MMSYSTEM.1210]
2799 HMMIO16 WINAPI
mmioOpen16(LPSTR szFileName
, MMIOINFO16
* lpmmioinfo16
,
2807 memset(&mmioinfo
, 0, sizeof(mmioinfo
));
2809 mmioinfo
.dwFlags
= lpmmioinfo16
->dwFlags
;
2810 mmioinfo
.fccIOProc
= lpmmioinfo16
->fccIOProc
;
2811 mmioinfo
.pIOProc
= (LPMMIOPROC
)lpmmioinfo16
->pIOProc
;
2812 mmioinfo
.cchBuffer
= lpmmioinfo16
->cchBuffer
;
2813 mmioinfo
.pchBuffer
= MapSL((DWORD
)lpmmioinfo16
->pchBuffer
);
2814 mmioinfo
.adwInfo
[0] = lpmmioinfo16
->adwInfo
[0];
2815 /* if we don't have a file name, it's likely a passed open file descriptor */
2817 mmioinfo
.adwInfo
[0] = (DWORD
)DosFileHandleToWin32Handle(mmioinfo
.adwInfo
[0]);
2818 mmioinfo
.adwInfo
[1] = lpmmioinfo16
->adwInfo
[1];
2819 mmioinfo
.adwInfo
[2] = lpmmioinfo16
->adwInfo
[2];
2821 ret
= MMIO_Open(szFileName
, &mmioinfo
, dwOpenFlags
, MMIO_PROC_16
);
2822 MMIO_SetSegmentedBuffer(mmioinfo
.hmmio
, (SEGPTR
)lpmmioinfo16
->pchBuffer
, FALSE
);
2824 lpmmioinfo16
->wErrorRet
= mmioinfo
.wErrorRet
;
2825 lpmmioinfo16
->hmmio
= HMMIO_16(mmioinfo
.hmmio
);
2827 ret
= MMIO_Open(szFileName
, NULL
, dwOpenFlags
, MMIO_PROC_32A
);
2829 return HMMIO_16(ret
);
2832 /**************************************************************************
2833 * mmioClose [MMSYSTEM.1211]
2835 MMRESULT16 WINAPI
mmioClose16(HMMIO16 hmmio
, UINT16 uFlags
)
2837 MMIO_SetSegmentedBuffer(HMMIO_32(hmmio
), (SEGPTR
)NULL
, TRUE
);
2838 return mmioClose(HMMIO_32(hmmio
), uFlags
);
2841 /**************************************************************************
2842 * mmioRead [MMSYSTEM.1212]
2844 LONG WINAPI
mmioRead16(HMMIO16 hmmio
, HPSTR pch
, LONG cch
)
2846 return mmioRead(HMMIO_32(hmmio
), pch
, cch
);
2849 /**************************************************************************
2850 * mmioWrite [MMSYSTEM.1213]
2852 LONG WINAPI
mmioWrite16(HMMIO16 hmmio
, HPCSTR pch
, LONG cch
)
2854 return mmioWrite(HMMIO_32(hmmio
),pch
,cch
);
2857 /**************************************************************************
2858 * mmioSeek [MMSYSTEM.1214]
2860 LONG WINAPI
mmioSeek16(HMMIO16 hmmio
, LONG lOffset
, INT16 iOrigin
)
2862 return mmioSeek(HMMIO_32(hmmio
), lOffset
, iOrigin
);
2865 /**************************************************************************
2866 * mmioGetInfo [MMSYSTEM.1215]
2868 MMRESULT16 WINAPI
mmioGetInfo16(HMMIO16 hmmio
, MMIOINFO16
* lpmmioinfo
, UINT16 uFlags
)
2874 TRACE("(0x%04x,%p,0x%08x)\n", hmmio
, lpmmioinfo
, uFlags
);
2876 if ((wm
= MMIO_Get(HMMIO_32(hmmio
))) == NULL
)
2877 return MMSYSERR_INVALHANDLE
;
2879 ret
= mmioGetInfo(HMMIO_32(hmmio
), &mmioinfo
, uFlags
);
2880 if (ret
!= MMSYSERR_NOERROR
) return ret
;
2882 lpmmioinfo
->dwFlags
= mmioinfo
.dwFlags
;
2883 lpmmioinfo
->fccIOProc
= mmioinfo
.fccIOProc
;
2884 lpmmioinfo
->pIOProc
= (wm
->ioProc
->type
== MMIO_PROC_16
) ?
2885 (LPMMIOPROC16
)wm
->ioProc
->pIOProc
: NULL
;
2886 lpmmioinfo
->wErrorRet
= mmioinfo
.wErrorRet
;
2887 lpmmioinfo
->hTask
= HTASK_16(mmioinfo
.hTask
);
2888 lpmmioinfo
->cchBuffer
= mmioinfo
.cchBuffer
;
2889 lpmmioinfo
->pchBuffer
= (void*)wm
->segBuffer16
;
2890 lpmmioinfo
->pchNext
= (void*)(wm
->segBuffer16
+ (mmioinfo
.pchNext
- mmioinfo
.pchBuffer
));
2891 lpmmioinfo
->pchEndRead
= (void*)(wm
->segBuffer16
+ (mmioinfo
.pchEndRead
- mmioinfo
.pchBuffer
));
2892 lpmmioinfo
->pchEndWrite
= (void*)(wm
->segBuffer16
+ (mmioinfo
.pchEndWrite
- mmioinfo
.pchBuffer
));
2893 lpmmioinfo
->lBufOffset
= mmioinfo
.lBufOffset
;
2894 lpmmioinfo
->lDiskOffset
= mmioinfo
.lDiskOffset
;
2895 lpmmioinfo
->adwInfo
[0] = mmioinfo
.adwInfo
[0];
2896 lpmmioinfo
->adwInfo
[1] = mmioinfo
.adwInfo
[1];
2897 lpmmioinfo
->adwInfo
[2] = mmioinfo
.adwInfo
[2];
2898 lpmmioinfo
->dwReserved1
= 0;
2899 lpmmioinfo
->dwReserved2
= 0;
2900 lpmmioinfo
->hmmio
= HMMIO_16(mmioinfo
.hmmio
);
2902 return MMSYSERR_NOERROR
;
2905 /**************************************************************************
2906 * mmioSetInfo [MMSYSTEM.1216]
2908 MMRESULT16 WINAPI
mmioSetInfo16(HMMIO16 hmmio
, const MMIOINFO16
* lpmmioinfo
, UINT16 uFlags
)
2913 TRACE("(0x%04x,%p,0x%08x)\n",hmmio
,lpmmioinfo
,uFlags
);
2915 ret
= mmioGetInfo(HMMIO_32(hmmio
), &mmioinfo
, 0);
2916 if (ret
!= MMSYSERR_NOERROR
) return ret
;
2918 /* check if seg and lin buffers are the same */
2919 if (mmioinfo
.cchBuffer
!= lpmmioinfo
->cchBuffer
||
2920 mmioinfo
.pchBuffer
!= MapSL((DWORD
)lpmmioinfo
->pchBuffer
))
2921 return MMSYSERR_INVALPARAM
;
2923 /* check pointers coherence */
2924 if (lpmmioinfo
->pchNext
< lpmmioinfo
->pchBuffer
||
2925 lpmmioinfo
->pchNext
> lpmmioinfo
->pchBuffer
+ lpmmioinfo
->cchBuffer
||
2926 lpmmioinfo
->pchEndRead
< lpmmioinfo
->pchBuffer
||
2927 lpmmioinfo
->pchEndRead
> lpmmioinfo
->pchBuffer
+ lpmmioinfo
->cchBuffer
||
2928 lpmmioinfo
->pchEndWrite
< lpmmioinfo
->pchBuffer
||
2929 lpmmioinfo
->pchEndWrite
> lpmmioinfo
->pchBuffer
+ lpmmioinfo
->cchBuffer
)
2930 return MMSYSERR_INVALPARAM
;
2932 mmioinfo
.pchNext
= mmioinfo
.pchBuffer
+ (lpmmioinfo
->pchNext
- lpmmioinfo
->pchBuffer
);
2933 mmioinfo
.pchEndRead
= mmioinfo
.pchBuffer
+ (lpmmioinfo
->pchEndRead
- lpmmioinfo
->pchBuffer
);
2934 mmioinfo
.pchEndWrite
= mmioinfo
.pchBuffer
+ (lpmmioinfo
->pchEndWrite
- lpmmioinfo
->pchBuffer
);
2936 return mmioSetInfo(HMMIO_32(hmmio
), &mmioinfo
, uFlags
);
2939 /**************************************************************************
2940 * mmioSetBuffer [MMSYSTEM.1217]
2942 MMRESULT16 WINAPI
mmioSetBuffer16(HMMIO16 hmmio
, LPSTR pchBuffer
,
2943 LONG cchBuffer
, UINT16 uFlags
)
2945 MMRESULT ret
= mmioSetBuffer(HMMIO_32(hmmio
), MapSL((DWORD
)pchBuffer
),
2948 if (ret
== MMSYSERR_NOERROR
)
2949 MMIO_SetSegmentedBuffer(HMMIO_32(hmmio
), (DWORD
)pchBuffer
, TRUE
);
2951 UnMapLS((DWORD
)pchBuffer
);
2955 /**************************************************************************
2956 * mmioFlush [MMSYSTEM.1218]
2958 MMRESULT16 WINAPI
mmioFlush16(HMMIO16 hmmio
, UINT16 uFlags
)
2960 return mmioFlush(HMMIO_32(hmmio
), uFlags
);
2963 /***********************************************************************
2964 * mmioAdvance [MMSYSTEM.1219]
2966 MMRESULT16 WINAPI
mmioAdvance16(HMMIO16 hmmio
, MMIOINFO16
* lpmmioinfo
, UINT16 uFlags
)
2971 /* WARNING: this heavily relies on mmioAdvance implementation (for choosing which
2976 mmioinfo
.pchBuffer
= MapSL((DWORD
)lpmmioinfo
->pchBuffer
);
2977 mmioinfo
.pchNext
= MapSL((DWORD
)lpmmioinfo
->pchNext
);
2978 mmioinfo
.dwFlags
= lpmmioinfo
->dwFlags
;
2979 mmioinfo
.lBufOffset
= lpmmioinfo
->lBufOffset
;
2980 ret
= mmioAdvance(HMMIO_32(hmmio
), &mmioinfo
, uFlags
);
2983 ret
= mmioAdvance(HMMIO_32(hmmio
), NULL
, uFlags
);
2985 if (ret
!= MMSYSERR_NOERROR
) return ret
;
2989 lpmmioinfo
->dwFlags
= mmioinfo
.dwFlags
;
2990 lpmmioinfo
->pchNext
= (void*)(lpmmioinfo
->pchBuffer
+ (mmioinfo
.pchNext
- mmioinfo
.pchBuffer
));
2991 lpmmioinfo
->pchEndRead
= (void*)(lpmmioinfo
->pchBuffer
+ (mmioinfo
.pchEndRead
- mmioinfo
.pchBuffer
));
2992 lpmmioinfo
->pchEndWrite
= (void*)(lpmmioinfo
->pchBuffer
+ (mmioinfo
.pchEndWrite
- mmioinfo
.pchBuffer
));
2993 lpmmioinfo
->lBufOffset
= mmioinfo
.lBufOffset
;
2994 lpmmioinfo
->lDiskOffset
= mmioinfo
.lDiskOffset
;
2997 return MMSYSERR_NOERROR
;
3000 /**************************************************************************
3001 * mmioStringToFOURCC [MMSYSTEM.1220]
3003 FOURCC WINAPI
mmioStringToFOURCC16(LPCSTR sz
, UINT16 uFlags
)
3005 return mmioStringToFOURCCA(sz
, uFlags
);
3008 /**************************************************************************
3009 * mmioInstallIOProc [MMSYSTEM.1221]
3011 LPMMIOPROC16 WINAPI
mmioInstallIOProc16(FOURCC fccIOProc
, LPMMIOPROC16 pIOProc
,
3014 return (LPMMIOPROC16
)MMIO_InstallIOProc(fccIOProc
, (LPMMIOPROC
)pIOProc
,
3015 dwFlags
, MMIO_PROC_16
);
3018 /**************************************************************************
3019 * mmioSendMessage [MMSYSTEM.1222]
3021 LRESULT WINAPI
mmioSendMessage16(HMMIO16 hmmio
, UINT16 uMessage
,
3022 LPARAM lParam1
, LPARAM lParam2
)
3024 return MMIO_SendMessage(HMMIO_32(hmmio
), uMessage
,
3025 lParam1
, lParam2
, MMIO_PROC_16
);
3028 /**************************************************************************
3029 * mmioDescend [MMSYSTEM.1223]
3031 MMRESULT16 WINAPI
mmioDescend16(HMMIO16 hmmio
, LPMMCKINFO lpck
,
3032 const MMCKINFO
* lpckParent
, UINT16 uFlags
)
3034 return mmioDescend(HMMIO_32(hmmio
), lpck
, lpckParent
, uFlags
);
3037 /**************************************************************************
3038 * mmioAscend [MMSYSTEM.1224]
3040 MMRESULT16 WINAPI
mmioAscend16(HMMIO16 hmmio
, MMCKINFO
* lpck
, UINT16 uFlags
)
3042 return mmioAscend(HMMIO_32(hmmio
),lpck
,uFlags
);
3045 /**************************************************************************
3046 * mmioCreateChunk [MMSYSTEM.1225]
3048 MMRESULT16 WINAPI
mmioCreateChunk16(HMMIO16 hmmio
, MMCKINFO
* lpck
, UINT16 uFlags
)
3050 return mmioCreateChunk(HMMIO_32(hmmio
), lpck
, uFlags
);
3053 /**************************************************************************
3054 * mmioRename [MMSYSTEM.1226]
3056 MMRESULT16 WINAPI
mmioRename16(LPCSTR szFileName
, LPCSTR szNewFileName
,
3057 MMIOINFO16
* lpmmioinfo
, DWORD dwRenameFlags
)
3063 if (lpmmioinfo
!= NULL
&& lpmmioinfo
->pIOProc
!= NULL
&&
3064 lpmmioinfo
->fccIOProc
== 0) {
3065 FIXME("Can't handle this case yet\n");
3066 return MMSYSERR_ERROR
;
3069 /* this is a bit hacky, but it'll work if we get a fourCC code or nothing.
3070 * but a non installed ioproc without a fourcc won't do
3072 if (lpmmioinfo
&& lpmmioinfo
->fccIOProc
&& lpmmioinfo
->pIOProc
) {
3073 MMIO_InstallIOProc(lpmmioinfo
->fccIOProc
, (LPMMIOPROC
)lpmmioinfo
->pIOProc
,
3074 MMIO_INSTALLPROC
, MMIO_PROC_16
);
3077 memset(&mmioinfo
, 0, sizeof(mmioinfo
));
3078 mmioinfo
.fccIOProc
= lpmmioinfo
->fccIOProc
;
3079 ret
= mmioRenameA(szFileName
, szNewFileName
, &mmioinfo
, dwRenameFlags
);
3081 MMIO_InstallIOProc(lpmmioinfo
->fccIOProc
, NULL
,
3082 MMIO_REMOVEPROC
, MMIO_PROC_16
);
3087 /* ###################################################
3089 * ###################################################
3092 /**************************************************************************
3093 * joyGetNumDevs [MMSYSTEM.101]
3095 UINT16 WINAPI
joyGetNumDevs16(void)
3097 return joyGetNumDevs();
3100 /**************************************************************************
3101 * joyGetDevCaps [MMSYSTEM.102]
3103 MMRESULT16 WINAPI
joyGetDevCaps16(UINT16 wID
, LPJOYCAPS16 lpCaps
, UINT16 wSize
)
3108 if (lpCaps
== NULL
) return MMSYSERR_INVALPARAM
;
3110 ret
= joyGetDevCapsA(wID
, &jca
, sizeof(jca
));
3112 if (ret
!= JOYERR_NOERROR
) return ret
;
3113 lpCaps
->wMid
= jca
.wMid
;
3114 lpCaps
->wPid
= jca
.wPid
;
3115 strcpy(lpCaps
->szPname
, jca
.szPname
);
3116 lpCaps
->wXmin
= jca
.wXmin
;
3117 lpCaps
->wXmax
= jca
.wXmax
;
3118 lpCaps
->wYmin
= jca
.wYmin
;
3119 lpCaps
->wYmax
= jca
.wYmax
;
3120 lpCaps
->wZmin
= jca
.wZmin
;
3121 lpCaps
->wZmax
= jca
.wZmax
;
3122 lpCaps
->wNumButtons
= jca
.wNumButtons
;
3123 lpCaps
->wPeriodMin
= jca
.wPeriodMin
;
3124 lpCaps
->wPeriodMax
= jca
.wPeriodMax
;
3126 if (wSize
>= sizeof(JOYCAPS16
)) { /* Win95 extensions ? */
3127 lpCaps
->wRmin
= jca
.wRmin
;
3128 lpCaps
->wRmax
= jca
.wRmax
;
3129 lpCaps
->wUmin
= jca
.wUmin
;
3130 lpCaps
->wUmax
= jca
.wUmax
;
3131 lpCaps
->wVmin
= jca
.wVmin
;
3132 lpCaps
->wVmax
= jca
.wVmax
;
3133 lpCaps
->wCaps
= jca
.wCaps
;
3134 lpCaps
->wMaxAxes
= jca
.wMaxAxes
;
3135 lpCaps
->wNumAxes
= jca
.wNumAxes
;
3136 lpCaps
->wMaxButtons
= jca
.wMaxButtons
;
3137 strcpy(lpCaps
->szRegKey
, jca
.szRegKey
);
3138 strcpy(lpCaps
->szOEMVxD
, jca
.szOEMVxD
);
3144 /**************************************************************************
3145 * joyGetPosEx [MMSYSTEM.110]
3147 MMRESULT16 WINAPI
joyGetPosEx16(UINT16 wID
, LPJOYINFOEX lpInfo
)
3149 return joyGetPosEx(wID
, lpInfo
);
3152 /**************************************************************************
3153 * joyGetPos [MMSYSTEM.103]
3155 MMRESULT16 WINAPI
joyGetPos16(UINT16 wID
, LPJOYINFO16 lpInfo
)
3160 TRACE("(%d, %p);\n", wID
, lpInfo
);
3162 if ((ret
= joyGetPos(wID
, &ji
)) == JOYERR_NOERROR
) {
3163 lpInfo
->wXpos
= ji
.wXpos
;
3164 lpInfo
->wYpos
= ji
.wYpos
;
3165 lpInfo
->wZpos
= ji
.wZpos
;
3166 lpInfo
->wButtons
= ji
.wButtons
;
3171 /**************************************************************************
3172 * joyGetThreshold [MMSYSTEM.104]
3174 MMRESULT16 WINAPI
joyGetThreshold16(UINT16 wID
, LPUINT16 lpThreshold
)
3179 ret
= joyGetThreshold(wID
, &t
);
3180 if (ret
== JOYERR_NOERROR
)
3185 /**************************************************************************
3186 * joyReleaseCapture [MMSYSTEM.105]
3188 MMRESULT16 WINAPI
joyReleaseCapture16(UINT16 wID
)
3190 return joyReleaseCapture(wID
);
3193 /**************************************************************************
3194 * joySetCapture [MMSYSTEM.106]
3196 MMRESULT16 WINAPI
joySetCapture16(HWND16 hWnd
, UINT16 wID
, UINT16 wPeriod
, BOOL16 bChanged
)
3198 return joySetCapture(HWND_32(hWnd
), wID
, wPeriod
, bChanged
);
3201 /**************************************************************************
3202 * joySetThreshold [MMSYSTEM.107]
3204 MMRESULT16 WINAPI
joySetThreshold16(UINT16 wID
, UINT16 wThreshold
)
3206 return joySetThreshold(wID
,wThreshold
);
3209 /**************************************************************************
3210 * joySetCalibration [MMSYSTEM.109]
3212 MMRESULT16 WINAPI
joySetCalibration16(UINT16 wID
)
3214 FIXME("(%04X): stub.\n", wID
);
3215 return JOYERR_NOCANDO
;