From: Vijay Kiran Kamuju infyquest@gmail.com Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/mmsystem.dll16/message16.c | 938 ++++++++++++++++---------------- 1 file changed, 469 insertions(+), 469 deletions(-)
diff --git a/dlls/mmsystem.dll16/message16.c b/dlls/mmsystem.dll16/message16.c index 012d3dca869..28f20ba0b29 100644 --- a/dlls/mmsystem.dll16/message16.c +++ b/dlls/mmsystem.dll16/message16.c @@ -42,29 +42,29 @@ WINE_DEFAULT_DEBUG_CHANNEL(winmm); * ================================= */
/************************************************************************** - * MMSYSTDRV_Mixer_Map16To32W [internal] + * MMSYSTDRV_Mixer_Map16To32W [internal] */ -static MMSYSTEM_MapType MMSYSTDRV_Mixer_Map16To32W (UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2) +static MMSYSTEM_MapType MMSYSTDRV_Mixer_Map16To32W (UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2) { return MMSYSTEM_MAP_MSGERROR; }
/************************************************************************** - * MMSYSTDRV_Mixer_UnMap16To32W [internal] + * MMSYSTDRV_Mixer_UnMap16To32W [internal] */ -static MMSYSTEM_MapType MMSYSTDRV_Mixer_UnMap16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT fn_ret) +static MMSYSTEM_MapType MMSYSTDRV_Mixer_UnMap16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT fn_ret) { #if 0 - MIXERCAPSA micA; - UINT ret = mixerGetDevCapsA(devid, &micA, sizeof(micA)); + MIXERCAPSA micA; + UINT ret = mixerGetDevCapsA(devid, &micA, sizeof(micA));
if (ret == MMSYSERR_NOERROR) { - mixcaps->wMid = micA.wMid; - mixcaps->wPid = micA.wPid; - mixcaps->vDriverVersion = micA.vDriverVersion; - strcpy(mixcaps->szPname, micA.szPname); - mixcaps->fdwSupport = micA.fdwSupport; - mixcaps->cDestinations = micA.cDestinations; + mixcaps->wMid = micA.wMid; + mixcaps->wPid = micA.wPid; + mixcaps->vDriverVersion = micA.vDriverVersion; + strcpy(mixcaps->szPname, micA.szPname); + mixcaps->fdwSupport = micA.fdwSupport; + mixcaps->cDestinations = micA.cDestinations; } return ret; #endif @@ -72,9 +72,9 @@ static MMSYSTEM_MapType MMSYSTDRV_Mixer_UnMap16To32W(UINT wMsg, DWORD_PTR* lpPa }
/************************************************************************** - * MMSYSTDRV_Mixer_MapCB + * MMSYSTDRV_Mixer_MapCB */ -static void MMSYSTDRV_Mixer_MapCB(DWORD uMsg, DWORD_PTR* dwUser, DWORD_PTR* dwParam1, DWORD_PTR* dwParam2) +static void MMSYSTDRV_Mixer_MapCB(DWORD uMsg, DWORD_PTR* dwUser, DWORD_PTR* dwParam1, DWORD_PTR* dwParam2) { FIXME("NIY\n"); } @@ -84,50 +84,50 @@ static void MMSYSTDRV_Mixer_MapCB(DWORD uMsg, DWORD_PTR* dwUser * ================================= */
/************************************************************************** - * MMSYSTDRV_MidiIn_Map16To32W [internal] + * MMSYSTDRV_MidiIn_Map16To32W [internal] */ -static MMSYSTEM_MapType MMSYSTDRV_MidiIn_Map16To32W (UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2) +static MMSYSTEM_MapType MMSYSTDRV_MidiIn_Map16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2) { return MMSYSTEM_MAP_MSGERROR; }
/************************************************************************** - * MMSYSTDRV_MidiIn_UnMap16To32W [internal] + * MMSYSTDRV_MidiIn_UnMap16To32W [internal] */ -static MMSYSTEM_MapType MMSYSTDRV_MidiIn_UnMap16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT fn_ret) +static MMSYSTEM_MapType MMSYSTDRV_MidiIn_UnMap16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT fn_ret) { return MMSYSTEM_MAP_MSGERROR; }
/************************************************************************** - * MMSYSTDRV_MidiIn_MapCB [internal] + * MMSYSTDRV_MidiIn_MapCB [internal] */ -static void MMSYSTDRV_MidiIn_MapCB(UINT uMsg, DWORD_PTR* dwUser, DWORD_PTR* dwParam1, DWORD_PTR* dwParam2) +static void MMSYSTDRV_MidiIn_MapCB(UINT uMsg, DWORD_PTR* dwUser, DWORD_PTR* dwParam1, DWORD_PTR* dwParam2) { switch (uMsg) { case MIM_OPEN: case MIM_CLOSE: - /* dwParam1 & dwParam2 are supposed to be 0, nothing to do */ + /* dwParam1 & dwParam2 are supposed to be 0, nothing to do */
case MIM_DATA: case MIM_MOREDATA: case MIM_ERROR: - /* dwParam1 & dwParam2 are data, nothing to do */ - break; + /* dwParam1 & dwParam2 are data, nothing to do */ + break; case MIM_LONGDATA: case MIM_LONGERROR: - { - LPMIDIHDR mh32 = (LPMIDIHDR)(*dwParam1); - SEGPTR segmh16 = *(SEGPTR*)((LPSTR)mh32 - sizeof(LPMIDIHDR)); - LPMIDIHDR16 mh16 = MapSL(segmh16); - - *dwParam1 = (DWORD)segmh16; - mh16->dwFlags = mh32->dwFlags; - mh16->dwBytesRecorded = mh32->dwBytesRecorded; - } - break; + { + LPMIDIHDR mh32 = (LPMIDIHDR)(*dwParam1); + SEGPTR segmh16 = *(SEGPTR*)((LPSTR)mh32 - sizeof(LPMIDIHDR)); + LPMIDIHDR16 mh16 = MapSL(segmh16); + + *dwParam1 = (DWORD)segmh16; + mh16->dwFlags = mh32->dwFlags; + mh16->dwBytesRecorded = mh32->dwBytesRecorded; + } + break; default: - ERR("Unknown msg %u\n", uMsg); + ERR("Unknown msg %u\n", uMsg); } }
@@ -136,187 +136,187 @@ static void MMSYSTDRV_MidiIn_MapCB(UINT uMsg, DWORD_PTR* dwUser, DW * ================================= */
/************************************************************************** - * MMSYSTDRV_MidiOut_Map16To32W [internal] + * MMSYSTDRV_MidiOut_Map16To32W [internal] */ -static MMSYSTEM_MapType MMSYSTDRV_MidiOut_Map16To32W (UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2) +static MMSYSTEM_MapType MMSYSTDRV_MidiOut_Map16To32W (UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2) { - MMSYSTEM_MapType ret = MMSYSTEM_MAP_MSGERROR; + MMSYSTEM_MapType ret = MMSYSTEM_MAP_MSGERROR;
switch (wMsg) { case MODM_GETNUMDEVS: case MODM_DATA: case MODM_RESET: case MODM_SETVOLUME: - ret = MMSYSTEM_MAP_OK; - break; + ret = MMSYSTEM_MAP_OK; + break;
case MODM_OPEN: case MODM_CLOSE: case MODM_GETVOLUME: - FIXME("Shouldn't be used: the corresponding 16 bit functions use the 32 bit interface\n"); - break; + FIXME("Shouldn't be used: the corresponding 16 bit functions use the 32 bit interface\n"); + break;
case MODM_GETDEVCAPS: - { - LPMIDIOUTCAPSW moc32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMIDIOUTCAPS16) + sizeof(MIDIOUTCAPSW)); - LPMIDIOUTCAPS16 moc16 = MapSL(*lpParam1); - - if (moc32) { - *(LPMIDIOUTCAPS16*)moc32 = moc16; - moc32 = (LPMIDIOUTCAPSW)((LPSTR)moc32 + sizeof(LPMIDIOUTCAPS16)); - *lpParam1 = (DWORD)moc32; - *lpParam2 = sizeof(MIDIOUTCAPSW); - - ret = MMSYSTEM_MAP_OKMEM; - } else { - ret = MMSYSTEM_MAP_NOMEM; - } - } - break; + { + LPMIDIOUTCAPSW moc32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMIDIOUTCAPS16) + sizeof(MIDIOUTCAPSW)); + LPMIDIOUTCAPS16 moc16 = MapSL(*lpParam1); + + if (moc32) { + *(LPMIDIOUTCAPS16*)moc32 = moc16; + moc32 = (LPMIDIOUTCAPSW)((LPSTR)moc32 + sizeof(LPMIDIOUTCAPS16)); + *lpParam1 = (DWORD)moc32; + *lpParam2 = sizeof(MIDIOUTCAPSW); + + ret = MMSYSTEM_MAP_OKMEM; + } else { + ret = MMSYSTEM_MAP_NOMEM; + } + } + break; case MODM_PREPARE: - { - LPMIDIHDR mh32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMIDIHDR) + sizeof(MIDIHDR)); - LPMIDIHDR16 mh16 = MapSL(*lpParam1); - - if (mh32) { - *(LPMIDIHDR*)mh32 = (LPMIDIHDR)*lpParam1; - mh32 = (LPMIDIHDR)((LPSTR)mh32 + sizeof(LPMIDIHDR)); - mh32->lpData = MapSL((SEGPTR)mh16->lpData); - mh32->dwBufferLength = mh16->dwBufferLength; - mh32->dwBytesRecorded = mh16->dwBytesRecorded; - mh32->dwUser = mh16->dwUser; - mh32->dwFlags = mh16->dwFlags; - mh16->lpNext = (MIDIHDR16*)mh32; /* for reuse in unprepare and write */ - *lpParam1 = (DWORD)mh32; - *lpParam2 = offsetof(MIDIHDR,dwOffset); /* old size, without dwOffset */ - - ret = MMSYSTEM_MAP_OKMEM; - } else { - ret = MMSYSTEM_MAP_NOMEM; - } - } - break; + { + LPMIDIHDR mh32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMIDIHDR) + sizeof(MIDIHDR)); + LPMIDIHDR16 mh16 = MapSL(*lpParam1); + + if (mh32) { + *(LPMIDIHDR*)mh32 = (LPMIDIHDR)*lpParam1; + mh32 = (LPMIDIHDR)((LPSTR)mh32 + sizeof(LPMIDIHDR)); + mh32->lpData = MapSL((SEGPTR)mh16->lpData); + mh32->dwBufferLength = mh16->dwBufferLength; + mh32->dwBytesRecorded = mh16->dwBytesRecorded; + mh32->dwUser = mh16->dwUser; + mh32->dwFlags = mh16->dwFlags; + mh16->lpNext = (MIDIHDR16*)mh32; /* for reuse in unprepare and write */ + *lpParam1 = (DWORD)mh32; + *lpParam2 = offsetof(MIDIHDR,dwOffset); /* old size, without dwOffset */ + + ret = MMSYSTEM_MAP_OKMEM; + } else { + ret = MMSYSTEM_MAP_NOMEM; + } + } + break; case MODM_UNPREPARE: case MODM_LONGDATA: - { - LPMIDIHDR16 mh16 = MapSL(*lpParam1); - LPMIDIHDR mh32 = (MIDIHDR*)mh16->lpNext; - - *lpParam1 = (DWORD)mh32; - *lpParam2 = offsetof(MIDIHDR,dwOffset); - /* dwBufferLength can be reduced between prepare & write */ - if (wMsg == MODM_LONGDATA && mh32->dwBufferLength < mh16->dwBufferLength) { - ERR("Size of buffer has been increased from %d to %d, keeping initial value\n", - mh32->dwBufferLength, mh16->dwBufferLength); - } else - mh32->dwBufferLength = mh16->dwBufferLength; - ret = MMSYSTEM_MAP_OKMEM; - } - break; + { + LPMIDIHDR16 mh16 = MapSL(*lpParam1); + LPMIDIHDR mh32 = (MIDIHDR*)mh16->lpNext; + + *lpParam1 = (DWORD)mh32; + *lpParam2 = offsetof(MIDIHDR,dwOffset); + /* dwBufferLength can be reduced between prepare & write */ + if (wMsg == MODM_LONGDATA && mh32->dwBufferLength < mh16->dwBufferLength) { + ERR("Size of buffer has been increased from %d to %d, keeping initial value\n", + mh32->dwBufferLength, mh16->dwBufferLength); + } else + mh32->dwBufferLength = mh16->dwBufferLength; + ret = MMSYSTEM_MAP_OKMEM; + } + break;
case MODM_CACHEPATCHES: case MODM_CACHEDRUMPATCHES: default: - FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2); - break; + FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2); + break; } return ret; }
/************************************************************************** - * MMSYSTDRV_MidiOut_UnMap16To32W [internal] + * MMSYSTDRV_MidiOut_UnMap16To32W [internal] */ -static MMSYSTEM_MapType MMSYSTDRV_MidiOut_UnMap16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT fn_ret) +static MMSYSTEM_MapType MMSYSTDRV_MidiOut_UnMap16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT fn_ret) { - MMSYSTEM_MapType ret = MMSYSTEM_MAP_MSGERROR; + MMSYSTEM_MapType ret = MMSYSTEM_MAP_MSGERROR;
switch (wMsg) { case MODM_GETNUMDEVS: case MODM_DATA: case MODM_RESET: case MODM_SETVOLUME: - ret = MMSYSTEM_MAP_OK; - break; + ret = MMSYSTEM_MAP_OK; + break;
case MODM_OPEN: case MODM_CLOSE: case MODM_GETVOLUME: - FIXME("Shouldn't be used: the corresponding 16 bit functions use the 32 bit interface\n"); - break; + FIXME("Shouldn't be used: the corresponding 16 bit functions use the 32 bit interface\n"); + break;
case MODM_GETDEVCAPS: - { - LPMIDIOUTCAPSW moc32 = (LPMIDIOUTCAPSW)(*lpParam1); - LPMIDIOUTCAPS16 moc16 = *(LPMIDIOUTCAPS16*)((LPSTR)moc32 - sizeof(LPMIDIOUTCAPS16)); - - moc16->wMid = moc32->wMid; - moc16->wPid = moc32->wPid; - moc16->vDriverVersion = moc32->vDriverVersion; - WideCharToMultiByte( CP_ACP, 0, moc32->szPname, -1, moc16->szPname, - sizeof(moc16->szPname), NULL, NULL ); - moc16->wTechnology = moc32->wTechnology; - moc16->wVoices = moc32->wVoices; - moc16->wNotes = moc32->wNotes; - moc16->wChannelMask = moc32->wChannelMask; - moc16->dwSupport = moc32->dwSupport; - HeapFree(GetProcessHeap(), 0, (LPSTR)moc32 - sizeof(LPMIDIOUTCAPS16)); - ret = MMSYSTEM_MAP_OK; - } - break; + { + LPMIDIOUTCAPSW moc32 = (LPMIDIOUTCAPSW)(*lpParam1); + LPMIDIOUTCAPS16 moc16 = *(LPMIDIOUTCAPS16*)((LPSTR)moc32 - sizeof(LPMIDIOUTCAPS16)); + + moc16->wMid = moc32->wMid; + moc16->wPid = moc32->wPid; + moc16->vDriverVersion = moc32->vDriverVersion; + WideCharToMultiByte( CP_ACP, 0, moc32->szPname, -1, moc16->szPname, + sizeof(moc16->szPname), NULL, NULL ); + moc16->wTechnology = moc32->wTechnology; + moc16->wVoices = moc32->wVoices; + moc16->wNotes = moc32->wNotes; + moc16->wChannelMask = moc32->wChannelMask; + moc16->dwSupport = moc32->dwSupport; + HeapFree(GetProcessHeap(), 0, (LPSTR)moc32 - sizeof(LPMIDIOUTCAPS16)); + ret = MMSYSTEM_MAP_OK; + } + break; case MODM_PREPARE: case MODM_UNPREPARE: case MODM_LONGDATA: - { - LPMIDIHDR mh32 = (LPMIDIHDR)(*lpParam1); - LPMIDIHDR16 mh16 = MapSL(*(SEGPTR*)((LPSTR)mh32 - sizeof(LPMIDIHDR))); + { + LPMIDIHDR mh32 = (LPMIDIHDR)(*lpParam1); + LPMIDIHDR16 mh16 = MapSL(*(SEGPTR*)((LPSTR)mh32 - sizeof(LPMIDIHDR)));
- assert((MIDIHDR*)mh16->lpNext == mh32); - mh16->dwFlags = mh32->dwFlags; + assert((MIDIHDR*)mh16->lpNext == mh32); + mh16->dwFlags = mh32->dwFlags;
- if (wMsg == MODM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) { - HeapFree(GetProcessHeap(), 0, (LPSTR)mh32 - sizeof(LPMIDIHDR)); - mh16->lpNext = 0; - } - ret = MMSYSTEM_MAP_OK; - } - break; + if (wMsg == MODM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) { + HeapFree(GetProcessHeap(), 0, (LPSTR)mh32 - sizeof(LPMIDIHDR)); + mh16->lpNext = 0; + } + ret = MMSYSTEM_MAP_OK; + } + break;
case MODM_CACHEPATCHES: case MODM_CACHEDRUMPATCHES: default: - FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2); - break; + FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2); + break; } return ret; }
/****************************************************************** - * MMSYSTDRV_MidiOut_MapCB + * MMSYSTDRV_MidiOut_MapCB */ -static void MMSYSTDRV_MidiOut_MapCB(UINT uMsg, DWORD_PTR* dwUser, DWORD_PTR* dwParam1, DWORD_PTR* dwParam2) +static void MMSYSTDRV_MidiOut_MapCB(UINT uMsg, DWORD_PTR* dwUser, DWORD_PTR* dwParam1, DWORD_PTR* dwParam2) { switch (uMsg) { case MOM_OPEN: case MOM_CLOSE: - /* dwParam1 & dwParam2 are supposed to be 0, nothing to do */ - break; + /* dwParam1 & dwParam2 are supposed to be 0, nothing to do */ + break; case MOM_POSITIONCB: - /* MIDIHDR.dwOffset exists since Win 32 only */ - FIXME("MOM_POSITIONCB/MEVT_F_CALLBACK wants MIDIHDR.dwOffset in 16 bit code\n"); - /* fall through */ + /* MIDIHDR.dwOffset exists since Win 32 only */ + FIXME("MOM_POSITIONCB/MEVT_F_CALLBACK wants MIDIHDR.dwOffset in 16 bit code\n"); + /* fall through */ case MOM_DONE: - { - /* initial map is: 16 => 32 */ - LPMIDIHDR mh32 = (LPMIDIHDR)(*dwParam1); - SEGPTR segmh16 = *(SEGPTR*)((LPSTR)mh32 - sizeof(LPMIDIHDR)); - LPMIDIHDR16 mh16 = MapSL(segmh16); - - *dwParam1 = (DWORD)segmh16; - mh16->dwFlags = mh32->dwFlags; - } - break; + { + /* initial map is: 16 => 32 */ + LPMIDIHDR mh32 = (LPMIDIHDR)(*dwParam1); + SEGPTR segmh16 = *(SEGPTR*)((LPSTR)mh32 - sizeof(LPMIDIHDR)); + LPMIDIHDR16 mh16 = MapSL(segmh16); + + *dwParam1 = (DWORD)segmh16; + mh16->dwFlags = mh32->dwFlags; + } + break; default: - ERR("Unknown msg %u\n", uMsg); + ERR("Unknown msg %u\n", uMsg); } }
@@ -325,120 +325,120 @@ static void MMSYSTDRV_MidiOut_MapCB(UINT uMsg, DWORD_PTR* dwUser, DWORD_PTR* dw * ================================= */
/************************************************************************** - * MMSYSTDRV_WaveIn_Map16To32W [internal] + * MMSYSTDRV_WaveIn_Map16To32W [internal] */ -static MMSYSTEM_MapType MMSYSTDRV_WaveIn_Map16To32W (UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2) +static MMSYSTEM_MapType MMSYSTDRV_WaveIn_Map16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2) { - MMSYSTEM_MapType ret = MMSYSTEM_MAP_MSGERROR; + MMSYSTEM_MapType ret = MMSYSTEM_MAP_MSGERROR;
switch (wMsg) { case WIDM_GETNUMDEVS: case WIDM_RESET: case WIDM_START: case WIDM_STOP: - ret = MMSYSTEM_MAP_OK; - break; + ret = MMSYSTEM_MAP_OK; + break; case WIDM_OPEN: case WIDM_CLOSE: - FIXME("Shouldn't be used: the corresponding 16 bit functions use the 32 bit interface\n"); - break; + FIXME("Shouldn't be used: the corresponding 16 bit functions use the 32 bit interface\n"); + break; case WIDM_GETDEVCAPS: - { - LPWAVEINCAPSW wic32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEINCAPS16) + sizeof(WAVEINCAPSW)); - LPWAVEINCAPS16 wic16 = MapSL(*lpParam1); - - if (wic32) { - *(LPWAVEINCAPS16*)wic32 = wic16; - wic32 = (LPWAVEINCAPSW)((LPSTR)wic32 + sizeof(LPWAVEINCAPS16)); - *lpParam1 = (DWORD)wic32; - *lpParam2 = sizeof(WAVEINCAPSW); - - ret = MMSYSTEM_MAP_OKMEM; - } else { - ret = MMSYSTEM_MAP_NOMEM; - } - } - break; + { + LPWAVEINCAPSW wic32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEINCAPS16) + sizeof(WAVEINCAPSW)); + LPWAVEINCAPS16 wic16 = MapSL(*lpParam1); + + if (wic32) { + *(LPWAVEINCAPS16*)wic32 = wic16; + wic32 = (LPWAVEINCAPSW)((LPSTR)wic32 + sizeof(LPWAVEINCAPS16)); + *lpParam1 = (DWORD)wic32; + *lpParam2 = sizeof(WAVEINCAPSW); + + ret = MMSYSTEM_MAP_OKMEM; + } else { + ret = MMSYSTEM_MAP_NOMEM; + } + } + break; case WIDM_GETPOS: - { - LPMMTIME mmt32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMMTIME16) + sizeof(MMTIME)); - LPMMTIME16 mmt16 = MapSL(*lpParam1); - - if (mmt32) { - *(LPMMTIME16*)mmt32 = mmt16; - mmt32 = (LPMMTIME)((LPSTR)mmt32 + sizeof(LPMMTIME16)); - - mmt32->wType = mmt16->wType; - *lpParam1 = (DWORD)mmt32; - *lpParam2 = sizeof(MMTIME); - - ret = MMSYSTEM_MAP_OKMEM; - } else { - ret = MMSYSTEM_MAP_NOMEM; - } - } - break; + { + LPMMTIME mmt32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMMTIME16) + sizeof(MMTIME)); + LPMMTIME16 mmt16 = MapSL(*lpParam1); + + if (mmt32) { + *(LPMMTIME16*)mmt32 = mmt16; + mmt32 = (LPMMTIME)((LPSTR)mmt32 + sizeof(LPMMTIME16)); + + mmt32->wType = mmt16->wType; + *lpParam1 = (DWORD)mmt32; + *lpParam2 = sizeof(MMTIME); + + ret = MMSYSTEM_MAP_OKMEM; + } else { + ret = MMSYSTEM_MAP_NOMEM; + } + } + break; case WIDM_PREPARE: - { - LPWAVEHDR wh32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEHDR) + sizeof(WAVEHDR)); - LPWAVEHDR wh16 = MapSL(*lpParam1); - - if (wh32) { - *(LPWAVEHDR*)wh32 = (LPWAVEHDR)*lpParam1; - wh32 = (LPWAVEHDR)((LPSTR)wh32 + sizeof(LPWAVEHDR)); - wh32->lpData = MapSL((SEGPTR)wh16->lpData); - wh32->dwBufferLength = wh16->dwBufferLength; - wh32->dwBytesRecorded = wh16->dwBytesRecorded; - wh32->dwUser = wh16->dwUser; - wh32->dwFlags = wh16->dwFlags; - wh32->dwLoops = wh16->dwLoops; - /* FIXME: nothing on wh32->lpNext */ - /* could link the wh32->lpNext at this level for memory house keeping */ - wh16->lpNext = wh32; /* for reuse in unprepare and write */ - *lpParam1 = (DWORD)wh32; - *lpParam2 = sizeof(WAVEHDR); - - ret = MMSYSTEM_MAP_OKMEM; - } else { - ret = MMSYSTEM_MAP_NOMEM; - } - } - break; + { + LPWAVEHDR wh32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEHDR) + sizeof(WAVEHDR)); + LPWAVEHDR wh16 = MapSL(*lpParam1); + + if (wh32) { + *(LPWAVEHDR*)wh32 = (LPWAVEHDR)*lpParam1; + wh32 = (LPWAVEHDR)((LPSTR)wh32 + sizeof(LPWAVEHDR)); + wh32->lpData = MapSL((SEGPTR)wh16->lpData); + wh32->dwBufferLength = wh16->dwBufferLength; + wh32->dwBytesRecorded = wh16->dwBytesRecorded; + wh32->dwUser = wh16->dwUser; + wh32->dwFlags = wh16->dwFlags; + wh32->dwLoops = wh16->dwLoops; + /* FIXME: nothing on wh32->lpNext */ + /* could link the wh32->lpNext at this level for memory house keeping */ + wh16->lpNext = wh32; /* for reuse in unprepare and write */ + *lpParam1 = (DWORD)wh32; + *lpParam2 = sizeof(WAVEHDR); + + ret = MMSYSTEM_MAP_OKMEM; + } else { + ret = MMSYSTEM_MAP_NOMEM; + } + } + break; case WIDM_ADDBUFFER: case WIDM_UNPREPARE: - { - LPWAVEHDR wh16 = MapSL(*lpParam1); - LPWAVEHDR wh32 = wh16->lpNext; - - *lpParam1 = (DWORD)wh32; - *lpParam2 = sizeof(WAVEHDR); - /* dwBufferLength can be reduced between prepare & write */ - if (wMsg == WIDM_ADDBUFFER && wh32->dwBufferLength < wh16->dwBufferLength) { - ERR("Size of buffer has been increased from %d to %d, keeping initial value\n", - wh32->dwBufferLength, wh16->dwBufferLength); - } else - wh32->dwBufferLength = wh16->dwBufferLength; - ret = MMSYSTEM_MAP_OKMEM; - } - break; + { + LPWAVEHDR wh16 = MapSL(*lpParam1); + LPWAVEHDR wh32 = wh16->lpNext; + + *lpParam1 = (DWORD)wh32; + *lpParam2 = sizeof(WAVEHDR); + /* dwBufferLength can be reduced between prepare & write */ + if (wMsg == WIDM_ADDBUFFER && wh32->dwBufferLength < wh16->dwBufferLength) { + ERR("Size of buffer has been increased from %d to %d, keeping initial value\n", + wh32->dwBufferLength, wh16->dwBufferLength); + } else + wh32->dwBufferLength = wh16->dwBufferLength; + ret = MMSYSTEM_MAP_OKMEM; + } + break; case WIDM_MAPPER_STATUS: - /* just a single DWORD */ - *lpParam2 = (DWORD)MapSL(*lpParam2); - ret = MMSYSTEM_MAP_OK; - break; + /* just a single DWORD */ + *lpParam2 = (DWORD)MapSL(*lpParam2); + ret = MMSYSTEM_MAP_OK; + break; default: - FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2); - break; + FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2); + break; } return ret; }
/************************************************************************** - * MMSYSTDRV_WaveIn_UnMap16To32W [internal] + * MMSYSTDRV_WaveIn_UnMap16To32W [internal] */ -static MMSYSTEM_MapType MMSYSTDRV_WaveIn_UnMap16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT fn_ret) +static MMSYSTEM_MapType MMSYSTDRV_WaveIn_UnMap16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT fn_ret) { - MMSYSTEM_MapType ret = MMSYSTEM_MAP_MSGERROR; + MMSYSTEM_MapType ret = MMSYSTEM_MAP_MSGERROR;
switch (wMsg) { case WIDM_GETNUMDEVS: @@ -446,87 +446,87 @@ static MMSYSTEM_MapType MMSYSTDRV_WaveIn_UnMap16To32W(UINT wMsg, DWORD_PTR* lpP case WIDM_START: case WIDM_STOP: case WIDM_MAPPER_STATUS: - ret = MMSYSTEM_MAP_OK; - break; + ret = MMSYSTEM_MAP_OK; + break; case WIDM_OPEN: case WIDM_CLOSE: - FIXME("Shouldn't be used: the corresponding 16 bit functions use the 32 bit interface\n"); - break; + FIXME("Shouldn't be used: the corresponding 16 bit functions use the 32 bit interface\n"); + break; case WIDM_GETDEVCAPS: - { - LPWAVEINCAPSW wic32 = (LPWAVEINCAPSW)(*lpParam1); - LPWAVEINCAPS16 wic16 = *(LPWAVEINCAPS16*)((LPSTR)wic32 - sizeof(LPWAVEINCAPS16)); - - wic16->wMid = wic32->wMid; - wic16->wPid = wic32->wPid; - wic16->vDriverVersion = wic32->vDriverVersion; - WideCharToMultiByte( CP_ACP, 0, wic32->szPname, -1, wic16->szPname, - sizeof(wic16->szPname), NULL, NULL ); - wic16->dwFormats = wic32->dwFormats; - wic16->wChannels = wic32->wChannels; - HeapFree(GetProcessHeap(), 0, (LPSTR)wic32 - sizeof(LPWAVEINCAPS16)); - ret = MMSYSTEM_MAP_OK; - } - break; + { + LPWAVEINCAPSW wic32 = (LPWAVEINCAPSW)(*lpParam1); + LPWAVEINCAPS16 wic16 = *(LPWAVEINCAPS16*)((LPSTR)wic32 - sizeof(LPWAVEINCAPS16)); + + wic16->wMid = wic32->wMid; + wic16->wPid = wic32->wPid; + wic16->vDriverVersion = wic32->vDriverVersion; + WideCharToMultiByte( CP_ACP, 0, wic32->szPname, -1, wic16->szPname, + sizeof(wic16->szPname), NULL, NULL ); + wic16->dwFormats = wic32->dwFormats; + wic16->wChannels = wic32->wChannels; + HeapFree(GetProcessHeap(), 0, (LPSTR)wic32 - sizeof(LPWAVEINCAPS16)); + ret = MMSYSTEM_MAP_OK; + } + break; case WIDM_GETPOS: - { - LPMMTIME mmt32 = (LPMMTIME)(*lpParam1); - LPMMTIME16 mmt16 = *(LPMMTIME16*)((LPSTR)mmt32 - sizeof(LPMMTIME16)); - - MMSYSTEM_MMTIME32to16(mmt16, mmt32); - HeapFree(GetProcessHeap(), 0, (LPSTR)mmt32 - sizeof(LPMMTIME16)); - ret = MMSYSTEM_MAP_OK; - } - break; + { + LPMMTIME mmt32 = (LPMMTIME)(*lpParam1); + LPMMTIME16 mmt16 = *(LPMMTIME16*)((LPSTR)mmt32 - sizeof(LPMMTIME16)); + + MMSYSTEM_MMTIME32to16(mmt16, mmt32); + HeapFree(GetProcessHeap(), 0, (LPSTR)mmt32 - sizeof(LPMMTIME16)); + ret = MMSYSTEM_MAP_OK; + } + break; case WIDM_ADDBUFFER: case WIDM_PREPARE: case WIDM_UNPREPARE: - { - LPWAVEHDR wh32 = (LPWAVEHDR)(*lpParam1); - LPWAVEHDR wh16 = MapSL(*(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR))); - - assert(wh16->lpNext == wh32); - wh16->dwBytesRecorded = wh32->dwBytesRecorded; - wh16->dwFlags = wh32->dwFlags; - - if (wMsg == WIDM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) { - HeapFree(GetProcessHeap(), 0, (LPSTR)wh32 - sizeof(LPWAVEHDR)); - wh16->lpNext = 0; - } - ret = MMSYSTEM_MAP_OK; - } - break; + { + LPWAVEHDR wh32 = (LPWAVEHDR)(*lpParam1); + LPWAVEHDR wh16 = MapSL(*(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR))); + + assert(wh16->lpNext == wh32); + wh16->dwBytesRecorded = wh32->dwBytesRecorded; + wh16->dwFlags = wh32->dwFlags; + + if (wMsg == WIDM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) { + HeapFree(GetProcessHeap(), 0, (LPSTR)wh32 - sizeof(LPWAVEHDR)); + wh16->lpNext = 0; + } + ret = MMSYSTEM_MAP_OK; + } + break; default: - FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2); - break; + FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2); + break; } return ret; }
/************************************************************************** - * MMSYSTDRV_WaveIn_MapCB [internal] + * MMSYSTDRV_WaveIn_MapCB [internal] */ -static void MMSYSTDRV_WaveIn_MapCB(UINT uMsg, DWORD_PTR* dwUser, DWORD_PTR* dwParam1, DWORD_PTR* dwParam2) +static void MMSYSTDRV_WaveIn_MapCB(UINT uMsg, DWORD_PTR* dwUser, DWORD_PTR* dwParam1, DWORD_PTR* dwParam2) { switch (uMsg) { case WIM_OPEN: case WIM_CLOSE: - /* dwParam1 & dwParam2 are supposed to be 0, nothing to do */ - break; + /* dwParam1 & dwParam2 are supposed to be 0, nothing to do */ + break; case WIM_DATA: - { - /* initial map is: 16 => 32 */ - LPWAVEHDR wh32 = (LPWAVEHDR)(*dwParam1); - SEGPTR segwh16 = *(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR)); - LPWAVEHDR wh16 = MapSL(segwh16); - - *dwParam1 = (DWORD)segwh16; - wh16->dwFlags = wh32->dwFlags; - wh16->dwBytesRecorded = wh32->dwBytesRecorded; - } - break; + { + /* initial map is: 16 => 32 */ + LPWAVEHDR wh32 = (LPWAVEHDR)(*dwParam1); + SEGPTR segwh16 = *(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR)); + LPWAVEHDR wh16 = MapSL(segwh16); + + *dwParam1 = (DWORD)segwh16; + wh16->dwFlags = wh32->dwFlags; + wh16->dwBytesRecorded = wh32->dwBytesRecorded; + } + break; default: - ERR("Unknown msg %u\n", uMsg); + ERR("Unknown msg %u\n", uMsg); } }
@@ -535,11 +535,11 @@ static void MMSYSTDRV_WaveIn_MapCB(UINT uMsg, DWORD_PTR* dwUser, DWORD_PTR* * ================================= */
/************************************************************************** - * MMSYSTDRV_WaveOut_Map16To32W [internal] + * MMSYSTDRV_WaveOut_Map16To32W [internal] */ -static MMSYSTEM_MapType MMSYSTDRV_WaveOut_Map16To32W (UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2) +static MMSYSTEM_MapType MMSYSTDRV_WaveOut_Map16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2) { - MMSYSTEM_MapType ret = MMSYSTEM_MAP_MSGERROR; + MMSYSTEM_MapType ret = MMSYSTEM_MAP_MSGERROR;
switch (wMsg) { /* nothing to do */ @@ -552,112 +552,112 @@ static MMSYSTEM_MapType MMSYSTDRV_WaveOut_Map16To32W (UINT wMsg, DWORD_PTR* lp case WODM_SETPITCH: case WODM_SETPLAYBACKRATE: case WODM_SETVOLUME: - ret = MMSYSTEM_MAP_OK; - break; + ret = MMSYSTEM_MAP_OK; + break;
case WODM_GETPITCH: case WODM_GETPLAYBACKRATE: case WODM_GETVOLUME: case WODM_OPEN: - FIXME("Shouldn't be used: the corresponding 16 bit functions use the 32 bit interface\n"); - break; + FIXME("Shouldn't be used: the corresponding 16 bit functions use the 32 bit interface\n"); + break;
case WODM_GETDEVCAPS: - { - LPWAVEOUTCAPSW woc32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEOUTCAPS16) + sizeof(WAVEOUTCAPSW)); - LPWAVEOUTCAPS16 woc16 = MapSL(*lpParam1); - - if (woc32) { - *(LPWAVEOUTCAPS16*)woc32 = woc16; - woc32 = (LPWAVEOUTCAPSW)((LPSTR)woc32 + sizeof(LPWAVEOUTCAPS16)); - *lpParam1 = (DWORD)woc32; - *lpParam2 = sizeof(WAVEOUTCAPSW); - - ret = MMSYSTEM_MAP_OKMEM; - } else { - ret = MMSYSTEM_MAP_NOMEM; - } - } - break; + { + LPWAVEOUTCAPSW woc32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEOUTCAPS16) + sizeof(WAVEOUTCAPSW)); + LPWAVEOUTCAPS16 woc16 = MapSL(*lpParam1); + + if (woc32) { + *(LPWAVEOUTCAPS16*)woc32 = woc16; + woc32 = (LPWAVEOUTCAPSW)((LPSTR)woc32 + sizeof(LPWAVEOUTCAPS16)); + *lpParam1 = (DWORD)woc32; + *lpParam2 = sizeof(WAVEOUTCAPSW); + + ret = MMSYSTEM_MAP_OKMEM; + } else { + ret = MMSYSTEM_MAP_NOMEM; + } + } + break; case WODM_GETPOS: - { - LPMMTIME mmt32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMMTIME16) + sizeof(MMTIME)); - LPMMTIME16 mmt16 = MapSL(*lpParam1); - - if (mmt32) { - *(LPMMTIME16*)mmt32 = mmt16; - mmt32 = (LPMMTIME)((LPSTR)mmt32 + sizeof(LPMMTIME16)); - - mmt32->wType = mmt16->wType; - *lpParam1 = (DWORD)mmt32; - *lpParam2 = sizeof(MMTIME); - - ret = MMSYSTEM_MAP_OKMEM; - } else { - ret = MMSYSTEM_MAP_NOMEM; - } - } - break; + { + LPMMTIME mmt32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPMMTIME16) + sizeof(MMTIME)); + LPMMTIME16 mmt16 = MapSL(*lpParam1); + + if (mmt32) { + *(LPMMTIME16*)mmt32 = mmt16; + mmt32 = (LPMMTIME)((LPSTR)mmt32 + sizeof(LPMMTIME16)); + + mmt32->wType = mmt16->wType; + *lpParam1 = (DWORD)mmt32; + *lpParam2 = sizeof(MMTIME); + + ret = MMSYSTEM_MAP_OKMEM; + } else { + ret = MMSYSTEM_MAP_NOMEM; + } + } + break; case WODM_PREPARE: - { - LPWAVEHDR wh32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEHDR) + sizeof(WAVEHDR)); - LPWAVEHDR wh16 = MapSL(*lpParam1); - - if (wh32) { - *(LPWAVEHDR*)wh32 = (LPWAVEHDR)*lpParam1; - wh32 = (LPWAVEHDR)((LPSTR)wh32 + sizeof(LPWAVEHDR)); - wh32->lpData = MapSL((SEGPTR)wh16->lpData); - wh32->dwBufferLength = wh16->dwBufferLength; - wh32->dwBytesRecorded = wh16->dwBytesRecorded; - wh32->dwUser = wh16->dwUser; - wh32->dwFlags = wh16->dwFlags; - wh32->dwLoops = wh16->dwLoops; - /* FIXME: nothing on wh32->lpNext */ - /* could link the wh32->lpNext at this level for memory house keeping */ - wh16->lpNext = wh32; /* for reuse in unprepare and write */ - *lpParam1 = (DWORD)wh32; - *lpParam2 = sizeof(WAVEHDR); - - ret = MMSYSTEM_MAP_OKMEM; - } else { - ret = MMSYSTEM_MAP_NOMEM; - } - } - break; + { + LPWAVEHDR wh32 = HeapAlloc(GetProcessHeap(), 0, sizeof(LPWAVEHDR) + sizeof(WAVEHDR)); + LPWAVEHDR wh16 = MapSL(*lpParam1); + + if (wh32) { + *(LPWAVEHDR*)wh32 = (LPWAVEHDR)*lpParam1; + wh32 = (LPWAVEHDR)((LPSTR)wh32 + sizeof(LPWAVEHDR)); + wh32->lpData = MapSL((SEGPTR)wh16->lpData); + wh32->dwBufferLength = wh16->dwBufferLength; + wh32->dwBytesRecorded = wh16->dwBytesRecorded; + wh32->dwUser = wh16->dwUser; + wh32->dwFlags = wh16->dwFlags; + wh32->dwLoops = wh16->dwLoops; + /* FIXME: nothing on wh32->lpNext */ + /* could link the wh32->lpNext at this level for memory house keeping */ + wh16->lpNext = wh32; /* for reuse in unprepare and write */ + *lpParam1 = (DWORD)wh32; + *lpParam2 = sizeof(WAVEHDR); + + ret = MMSYSTEM_MAP_OKMEM; + } else { + ret = MMSYSTEM_MAP_NOMEM; + } + } + break; case WODM_UNPREPARE: case WODM_WRITE: - { - LPWAVEHDR wh16 = MapSL(*lpParam1); - LPWAVEHDR wh32 = wh16->lpNext; - - *lpParam1 = (DWORD)wh32; - *lpParam2 = sizeof(WAVEHDR); - /* dwBufferLength can be reduced between prepare & write */ - if (wMsg == WODM_WRITE && wh32->dwBufferLength < wh16->dwBufferLength) { - ERR("Size of buffer has been increased from %d to %d, keeping initial value\n", - wh32->dwBufferLength, wh16->dwBufferLength); - } else - wh32->dwBufferLength = wh16->dwBufferLength; - ret = MMSYSTEM_MAP_OKMEM; - } - break; + { + LPWAVEHDR wh16 = MapSL(*lpParam1); + LPWAVEHDR wh32 = wh16->lpNext; + + *lpParam1 = (DWORD)wh32; + *lpParam2 = sizeof(WAVEHDR); + /* dwBufferLength can be reduced between prepare & write */ + if (wMsg == WODM_WRITE && wh32->dwBufferLength < wh16->dwBufferLength) { + ERR("Size of buffer has been increased from %d to %d, keeping initial value\n", + wh32->dwBufferLength, wh16->dwBufferLength); + } else + wh32->dwBufferLength = wh16->dwBufferLength; + ret = MMSYSTEM_MAP_OKMEM; + } + break; case WODM_MAPPER_STATUS: - *lpParam2 = (DWORD)MapSL(*lpParam2); - ret = MMSYSTEM_MAP_OK; - break; + *lpParam2 = (DWORD)MapSL(*lpParam2); + ret = MMSYSTEM_MAP_OK; + break; default: - FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2); - break; + FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2); + break; } return ret; }
/************************************************************************** - * MMSYSTDRV_WaveOut_UnMap16To32W [internal] + * MMSYSTDRV_WaveOut_UnMap16To32W [internal] */ -static MMSYSTEM_MapType MMSYSTDRV_WaveOut_UnMap16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT fn_ret) +static MMSYSTEM_MapType MMSYSTDRV_WaveOut_UnMap16To32W(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT fn_ret) { - MMSYSTEM_MapType ret = MMSYSTEM_MAP_MSGERROR; + MMSYSTEM_MapType ret = MMSYSTEM_MAP_MSGERROR;
switch (wMsg) { /* nothing to do */ @@ -671,90 +671,90 @@ static MMSYSTEM_MapType MMSYSTDRV_WaveOut_UnMap16To32W(UINT wMsg, DWORD_PTR* lp case WODM_SETPLAYBACKRATE: case WODM_SETVOLUME: case WODM_MAPPER_STATUS: - ret = MMSYSTEM_MAP_OK; - break; + ret = MMSYSTEM_MAP_OK; + break;
case WODM_GETPITCH: case WODM_GETPLAYBACKRATE: case WODM_GETVOLUME: case WODM_OPEN: - FIXME("Shouldn't be used: those 16 bit functions use the 32 bit interface\n"); - break; + FIXME("Shouldn't be used: those 16 bit functions use the 32 bit interface\n"); + break;
case WODM_GETDEVCAPS: - { - LPWAVEOUTCAPSW woc32 = (LPWAVEOUTCAPSW)(*lpParam1); - LPWAVEOUTCAPS16 woc16 = *(LPWAVEOUTCAPS16*)((LPSTR)woc32 - sizeof(LPWAVEOUTCAPS16)); - - woc16->wMid = woc32->wMid; - woc16->wPid = woc32->wPid; - woc16->vDriverVersion = woc32->vDriverVersion; - WideCharToMultiByte( CP_ACP, 0, woc32->szPname, -1, woc16->szPname, - sizeof(woc16->szPname), NULL, NULL ); - woc16->dwFormats = woc32->dwFormats; - woc16->wChannels = woc32->wChannels; - woc16->dwSupport = woc32->dwSupport; - HeapFree(GetProcessHeap(), 0, (LPSTR)woc32 - sizeof(LPWAVEOUTCAPS16)); - ret = MMSYSTEM_MAP_OK; - } - break; + { + LPWAVEOUTCAPSW woc32 = (LPWAVEOUTCAPSW)(*lpParam1); + LPWAVEOUTCAPS16 woc16 = *(LPWAVEOUTCAPS16*)((LPSTR)woc32 - sizeof(LPWAVEOUTCAPS16)); + + woc16->wMid = woc32->wMid; + woc16->wPid = woc32->wPid; + woc16->vDriverVersion = woc32->vDriverVersion; + WideCharToMultiByte( CP_ACP, 0, woc32->szPname, -1, woc16->szPname, + sizeof(woc16->szPname), NULL, NULL ); + woc16->dwFormats = woc32->dwFormats; + woc16->wChannels = woc32->wChannels; + woc16->dwSupport = woc32->dwSupport; + HeapFree(GetProcessHeap(), 0, (LPSTR)woc32 - sizeof(LPWAVEOUTCAPS16)); + ret = MMSYSTEM_MAP_OK; + } + break; case WODM_GETPOS: - { - LPMMTIME mmt32 = (LPMMTIME)(*lpParam1); - LPMMTIME16 mmt16 = *(LPMMTIME16*)((LPSTR)mmt32 - sizeof(LPMMTIME16)); - - MMSYSTEM_MMTIME32to16(mmt16, mmt32); - HeapFree(GetProcessHeap(), 0, (LPSTR)mmt32 - sizeof(LPMMTIME16)); - ret = MMSYSTEM_MAP_OK; - } - break; + { + LPMMTIME mmt32 = (LPMMTIME)(*lpParam1); + LPMMTIME16 mmt16 = *(LPMMTIME16*)((LPSTR)mmt32 - sizeof(LPMMTIME16)); + + MMSYSTEM_MMTIME32to16(mmt16, mmt32); + HeapFree(GetProcessHeap(), 0, (LPSTR)mmt32 - sizeof(LPMMTIME16)); + ret = MMSYSTEM_MAP_OK; + } + break; case WODM_PREPARE: case WODM_UNPREPARE: case WODM_WRITE: - { - LPWAVEHDR wh32 = (LPWAVEHDR)(*lpParam1); - LPWAVEHDR wh16 = MapSL(*(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR))); - - assert(wh16->lpNext == wh32); - wh16->dwFlags = wh32->dwFlags; - - if (wMsg == WODM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) { - HeapFree(GetProcessHeap(), 0, (LPSTR)wh32 - sizeof(LPWAVEHDR)); - wh16->lpNext = 0; - } - ret = MMSYSTEM_MAP_OK; - } - break; + { + LPWAVEHDR wh32 = (LPWAVEHDR)(*lpParam1); + LPWAVEHDR wh16 = MapSL(*(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR))); + + assert(wh16->lpNext == wh32); + wh16->dwFlags = wh32->dwFlags; + + if (wMsg == WODM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) { + HeapFree(GetProcessHeap(), 0, (LPSTR)wh32 - sizeof(LPWAVEHDR)); + wh16->lpNext = 0; + } + ret = MMSYSTEM_MAP_OK; + } + break; default: - FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2); - break; + FIXME("NIY: no conversion yet for %u [%lx,%lx]\n", wMsg, *lpParam1, *lpParam2); + break; } return ret; }
/************************************************************************** - * MMDRV_WaveOut_Callback [internal] + * MMDRV_WaveOut_Callback [internal] */ -static void MMSYSTDRV_WaveOut_MapCB(UINT uMsg, DWORD_PTR* dwUser, DWORD_PTR* dwParam1, DWORD_PTR* dwParam2) +static void MMSYSTDRV_WaveOut_MapCB(UINT uMsg, DWORD_PTR* dwUser, DWORD_PTR* dwParam1, DWORD_PTR* dwParam2) { switch (uMsg) { case WOM_OPEN: case WOM_CLOSE: - /* dwParam1 & dwParam2 are supposed to be 0, nothing to do */ - break; + /* dwParam1 & dwParam2 are supposed to be 0, nothing to do */ + break; case WOM_DONE: { - /* initial map is: 16 => 32 */ - LPWAVEHDR wh32 = (LPWAVEHDR)(*dwParam1); - SEGPTR segwh16 = *(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR)); - LPWAVEHDR wh16 = MapSL(segwh16); - - *dwParam1 = (DWORD)segwh16; - wh16->dwFlags = wh32->dwFlags; - } - break; + /* initial map is: 16 => 32 */ + LPWAVEHDR wh32 = (LPWAVEHDR)(*dwParam1); + SEGPTR segwh16 = *(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR)); + LPWAVEHDR wh16 = MapSL(segwh16); + + *dwParam1 = (DWORD)segwh16; + wh16->dwFlags = wh32->dwFlags; + } + break; default: - ERR("Unknown msg %u\n", uMsg); + ERR("Unknown msg %u\n", uMsg); } }
@@ -762,12 +762,12 @@ static void MMSYSTDRV_WaveOut_MapCB(UINT uMsg, DWORD_PTR* dwUser, DWORD_PTR* dw * # DRIVER THUNKING # * ################################################### */ -typedef MMSYSTEM_MapType (*MMSYSTDRV_MAPMSG)(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2); -typedef MMSYSTEM_MapType (*MMSYSTDRV_UNMAPMSG)(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT ret); -typedef void (*MMSYSTDRV_MAPCB)(DWORD wMsg, DWORD_PTR* dwUser, DWORD_PTR* dwParam1, DWORD_PTR* dwParam2); +typedef MMSYSTEM_MapType (*MMSYSTDRV_MAPMSG)(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2); +typedef MMSYSTEM_MapType (*MMSYSTDRV_UNMAPMSG)(UINT wMsg, DWORD_PTR* lpParam1, DWORD_PTR* lpParam2, MMRESULT ret); +typedef void (*MMSYSTDRV_MAPCB)(DWORD wMsg, DWORD_PTR* dwUser, DWORD_PTR* dwParam1, DWORD_PTR* dwParam2);
#include <pshpack1.h> -#define MMSYSTDRV_MAX_THUNKS 32 +#define MMSYSTDRV_MAX_THUNKS 32
static struct mmsystdrv_thunk { @@ -800,7 +800,7 @@ static struct MMSYSTDRV_Type };
/****************************************************************** - * MMSYSTDRV_Callback3216 + * MMSYSTDRV_Callback3216 * */ static LRESULT CALLBACK MMSYSTDRV_Callback3216(struct mmsystdrv_thunk* thunk, HDRVR hDev, @@ -852,10 +852,10 @@ static LRESULT CALLBACK MMSYSTDRV_Callback3216(struct mmsystdrv_thunk* thunk, HD }
/****************************************************************** - * MMSYSTDRV_AddThunk + * MMSYSTDRV_AddThunk * */ -struct mmsystdrv_thunk* MMSYSTDRV_AddThunk(DWORD callback, DWORD flags, enum MMSYSTEM_DriverType kind) +struct mmsystdrv_thunk* MMSYSTDRV_AddThunk(DWORD callback, DWORD flags, enum MMSYSTEM_DriverType kind) { struct mmsystdrv_thunk* thunk;
@@ -901,11 +901,11 @@ struct mmsystdrv_thunk* MMSYSTDRV_AddThunk(DWORD callback, DWORD flags, en }
/****************************************************************** - * MMSYSTDRV_FindHandle + * MMSYSTDRV_FindHandle * * Must be called with lock set */ -static void* MMSYSTDRV_FindHandle(void* h) +static void* MMSYSTDRV_FindHandle(void* h) { struct mmsystdrv_thunk* thunk;
@@ -921,19 +921,19 @@ static void* MMSYSTDRV_FindHandle(void* h) }
/****************************************************************** - * MMSYSTDRV_SetHandle + * MMSYSTDRV_SetHandle * */ -void MMSYSTDRV_SetHandle(struct mmsystdrv_thunk* thunk, void* h) +void MMSYSTDRV_SetHandle(struct mmsystdrv_thunk* thunk, void* h) { if (MMSYSTDRV_FindHandle(h)) FIXME("Already has a thunk for this handle %p!!!\n", h); thunk->hMmdrv = h; }
/****************************************************************** - * MMSYSTDRV_DeleteThunk + * MMSYSTDRV_DeleteThunk */ -void MMSYSTDRV_DeleteThunk(struct mmsystdrv_thunk* thunk) +void MMSYSTDRV_DeleteThunk(struct mmsystdrv_thunk* thunk) { thunk->callback = 0; thunk->flags = CALLBACK_NULL; @@ -942,9 +942,9 @@ void MMSYSTDRV_DeleteThunk(struct mmsystdrv_thunk* thunk) }
/****************************************************************** - * MMSYSTDRV_CloseHandle + * MMSYSTDRV_CloseHandle */ -void MMSYSTDRV_CloseHandle(void* h) +void MMSYSTDRV_CloseHandle(void* h) { struct mmsystdrv_thunk* thunk;
@@ -957,9 +957,9 @@ void MMSYSTDRV_CloseHandle(void* h) }
/****************************************************************** - * MMSYSTDRV_Message + * MMSYSTDRV_Message */ -DWORD MMSYSTDRV_Message(void* h, UINT msg, DWORD_PTR param1, DWORD_PTR param2) +DWORD MMSYSTDRV_Message(void* h, UINT msg, DWORD_PTR param1, DWORD_PTR param2) { struct mmsystdrv_thunk* thunk = MMSYSTDRV_FindHandle(h); struct MMSYSTDRV_Type* drvtype;