Commit 1cc26cba authored by Jörg Höhle's avatar Jörg Höhle Committed by Alexandre Julliard

mmsystem: Do not rewrite input parameters.

parent 5155e801
......@@ -188,8 +188,6 @@ static MMSYSTEM_MapType MMSYSTDRV_MidiOut_Map16To32W (UINT wMsg, DWORD_PTR* lpP
mh32->dwBytesRecorded = mh16->dwBytesRecorded;
mh32->dwUser = mh16->dwUser;
mh32->dwFlags = mh16->dwFlags;
/* FIXME: nothing on mh32->lpNext */
/* could link the mh32->lpNext at this level for memory house keeping */
mh32->dwOffset = (*lpParam2 >= sizeof(MIDIHDR)) ? mh16->dwOffset : 0;
mh16->lpNext = mh32; /* for reuse in unprepare and write */
/* store size of passed MIDIHDR?? structure to know if dwOffset is available or not */
......@@ -278,9 +276,6 @@ static MMSYSTEM_MapType MMSYSTDRV_MidiOut_UnMap16To32W(UINT wMsg, DWORD_PTR* lp
LPMIDIHDR mh16 = MapSL(*(SEGPTR*)((LPSTR)mh32 - sizeof(LPMIDIHDR)));
assert(mh16->lpNext == mh32);
mh16->dwBufferLength = mh32->dwBufferLength;
mh16->dwBytesRecorded = mh32->dwBytesRecorded;
mh16->dwUser = mh32->dwUser;
mh16->dwFlags = mh32->dwFlags;
if (mh16->reserved >= sizeof(MIDIHDR))
mh16->dwOffset = mh32->dwOffset;
......@@ -501,11 +496,8 @@ static MMSYSTEM_MapType MMSYSTDRV_WaveIn_UnMap16To32W(UINT wMsg, DWORD_PTR* lpP
LPWAVEHDR wh16 = MapSL(*(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR)));
assert(wh16->lpNext == wh32);
wh16->dwBufferLength = wh32->dwBufferLength;
wh16->dwBytesRecorded = wh32->dwBytesRecorded;
wh16->dwUser = wh32->dwUser;
wh16->dwFlags = wh32->dwFlags;
wh16->dwLoops = wh32->dwLoops;
if (wMsg == WIDM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) {
HeapFree(GetProcessHeap(), 0, (LPSTR)wh32 - sizeof(LPWAVEHDR));
......@@ -734,11 +726,7 @@ static MMSYSTEM_MapType MMSYSTDRV_WaveOut_UnMap16To32W(UINT wMsg, DWORD_PTR* lp
LPWAVEHDR wh16 = MapSL(*(SEGPTR*)((LPSTR)wh32 - sizeof(LPWAVEHDR)));
assert(wh16->lpNext == wh32);
wh16->dwBufferLength = wh32->dwBufferLength;
wh16->dwBytesRecorded = wh32->dwBytesRecorded;
wh16->dwUser = wh32->dwUser;
wh16->dwFlags = wh32->dwFlags;
wh16->dwLoops = wh32->dwLoops;
if (wMsg == WODM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) {
HeapFree(GetProcessHeap(), 0, (LPSTR)wh32 - sizeof(LPWAVEHDR));
......
......@@ -104,20 +104,6 @@ void MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16, const MMTIME* mmt32)
memcpy(&(mmt16->u), &(mmt32->u), sizeof(mmt16->u));
}
/******************************************************************
* MMSYSTEM_MMTIME16to32
*
*
*/
static void MMSYSTEM_MMTIME16to32(LPMMTIME mmt32, const MMTIME16* mmt16)
{
mmt32->wType = mmt16->wType;
/* layout of rest is the same for 32/16,
* Note: mmt16->u is 2 bytes smaller than mmt32->u, which has padding
*/
memcpy(&(mmt32->u), &(mmt16->u), sizeof(mmt16->u));
}
/**************************************************************************
* timeGetSystemTime [MMSYSTEM.601]
*/
......@@ -1153,7 +1139,7 @@ MMRESULT16 WINAPI midiStreamPosition16(HMIDISTRM16 hMidiStrm, LPMMTIME16 lpmmt16
if (!lpmmt16)
return MMSYSERR_INVALPARAM;
MMSYSTEM_MMTIME16to32(&mmt32, lpmmt16);
mmt32.wType = lpmmt16->wType;
ret = midiStreamPosition(HMIDISTRM_32(hMidiStrm), &mmt32, sizeof(MMTIME));
MMSYSTEM_MMTIME32to16(lpmmt16, &mmt32);
return ret;
......@@ -1288,24 +1274,11 @@ UINT16 WINAPI waveOutPrepareHeader16(HWAVEOUT16 hWaveOut, /* [in] */
SEGPTR lpsegWaveOutHdr, /* [???] */
UINT16 uSize) /* [in] */
{
LPWAVEHDR lpWaveOutHdr = MapSL(lpsegWaveOutHdr);
UINT16 result;
TRACE("(%04X, %08x, %u);\n", hWaveOut, lpsegWaveOutHdr, uSize);
if (lpWaveOutHdr == NULL) return MMSYSERR_INVALPARAM;
if (lpsegWaveOutHdr == 0) return MMSYSERR_INVALPARAM;
if ((result = MMSYSTDRV_Message(HWAVEOUT_32(hWaveOut), WODM_PREPARE, lpsegWaveOutHdr,
uSize)) != MMSYSERR_NOTSUPPORTED)
return result;
if (lpWaveOutHdr->dwFlags & WHDR_INQUEUE)
return WAVERR_STILLPLAYING;
lpWaveOutHdr->dwFlags |= WHDR_PREPARED;
lpWaveOutHdr->dwFlags &= ~WHDR_DONE;
return MMSYSERR_NOERROR;
return MMSYSTDRV_Message(HWAVEOUT_32(hWaveOut), WODM_PREPARE, lpsegWaveOutHdr, uSize);
}
/**************************************************************************
......@@ -1581,15 +1554,12 @@ UINT16 WINAPI waveInPrepareHeader16(HWAVEIN16 hWaveIn, /* [in] */
UINT16 uSize) /* [in] */
{
LPWAVEHDR lpWaveInHdr = MapSL(lpsegWaveInHdr);
UINT16 ret;
TRACE("(%04X, %p, %u);\n", hWaveIn, lpWaveInHdr, uSize);
if (lpWaveInHdr == NULL) return MMSYSERR_INVALHANDLE;
lpWaveInHdr->dwBytesRecorded = 0;
ret = MMSYSTDRV_Message(HWAVEIN_32(hWaveIn), WIDM_PREPARE, lpsegWaveInHdr, uSize);
return ret;
return MMSYSTDRV_Message(HWAVEIN_32(hWaveIn), WIDM_PREPARE, lpsegWaveInHdr, uSize);
}
/**************************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment