Commit 1d854a10 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

When unmapping a (wave|midi)-header unprepare message, make sure the

unpreparation was successful.
parent a2251e28
......@@ -39,9 +39,9 @@ typedef struct tagWINE_LLTYPE {
LPSTR typestr; /* name (for debugging) */
BOOL bSupportMapper; /* if type is allowed to support mapper */
MMDRV_MAPFUNC Map16To32A; /* those are function pointers to handle */
MMDRV_MAPFUNC UnMap16To32A; /* the parameter conversion (16 vs 32 bit) */
MMDRV_UNMAPFUNC UnMap16To32A; /* the parameter conversion (16 vs 32 bit) */
MMDRV_MAPFUNC Map32ATo16; /* when hi-func (in mmsystem or winmm) and */
MMDRV_MAPFUNC UnMap32ATo16; /* low-func (in .drv) do not match */
MMDRV_UNMAPFUNC UnMap32ATo16; /* low-func (in .drv) do not match */
LPDRVCALLBACK Callback; /* handles callback for a specified type */
/* those attributes reflect the loaded/current situation for the type */
UINT wMaxId; /* number of loaded devices (sum across all loaded drivers */
......@@ -74,8 +74,8 @@ static WINE_LLTYPE llTypes[MMDRV_MAX] = {
*
*/
void MMDRV_InstallMap(unsigned int drv,
MMDRV_MAPFUNC mp1632, MMDRV_MAPFUNC um1632,
MMDRV_MAPFUNC mp3216, MMDRV_MAPFUNC um3216,
MMDRV_MAPFUNC mp1632, MMDRV_UNMAPFUNC um1632,
MMDRV_MAPFUNC mp3216, MMDRV_UNMAPFUNC um3216,
LPDRVCALLBACK cb)
{
assert(drv < MMDRV_MAX);
......@@ -234,7 +234,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, WORD wMsg, DWORD dwParam1,
dwParam1, dwParam2);
TRACE("=> %lu\n", ret);
if (map == WINMM_MAP_OKMEM)
llType->UnMap16To32A(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2);
llType->UnMap16To32A(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2, ret);
break;
default:
FIXME("NIY\n");
......@@ -264,7 +264,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, WORD wMsg, DWORD dwParam1,
dwParam1, dwParam2);
TRACE("=> %lu\n", ret);
if (map == WINMM_MAP_OKMEM)
llType->UnMap32ATo16(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2);
llType->UnMap32ATo16(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2, ret);
break;
default:
FIXME("NIY\n");
......
......@@ -70,7 +70,7 @@ static WINMM_MapType MMDRV_Aux_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPDWOR
/**************************************************************************
* MMDRV_Aux_UnMap16To32A [internal]
*/
static WINMM_MapType MMDRV_Aux_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
static WINMM_MapType MMDRV_Aux_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT fn_ret)
{
return WINMM_MAP_MSGERROR;
}
......@@ -86,7 +86,7 @@ static WINMM_MapType MMDRV_Aux_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPDWOR
/**************************************************************************
* MMDRV_Aux_UnMap32ATo16 [internal]
*/
static WINMM_MapType MMDRV_Aux_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
static WINMM_MapType MMDRV_Aux_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT fn_ret)
{
#if 0
case AUXDM_GETDEVCAPS:
......@@ -126,7 +126,7 @@ static WINMM_MapType MMDRV_Mixer_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPDW
/**************************************************************************
* MMDRV_Mixer_UnMap16To32A [internal]
*/
static WINMM_MapType MMDRV_Mixer_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
static WINMM_MapType MMDRV_Mixer_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT fn_ret)
{
#if 0
MIXERCAPSA micA;
......@@ -156,7 +156,7 @@ static WINMM_MapType MMDRV_Mixer_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPDW
/**************************************************************************
* MMDRV_Mixer_UnMap32ATo16 [internal]
*/
static WINMM_MapType MMDRV_Mixer_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
static WINMM_MapType MMDRV_Mixer_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT fn_ret)
{
return WINMM_MAP_MSGERROR;
}
......@@ -187,7 +187,7 @@ static WINMM_MapType MMDRV_MidiIn_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPD
/**************************************************************************
* MMDRV_MidiIn_UnMap16To32A [internal]
*/
static WINMM_MapType MMDRV_MidiIn_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
static WINMM_MapType MMDRV_MidiIn_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT fn_ret)
{
return WINMM_MAP_MSGERROR;
}
......@@ -203,7 +203,7 @@ static WINMM_MapType MMDRV_MidiIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
/**************************************************************************
* MMDRV_MidiIn_UnMap32ATo16 [internal]
*/
static WINMM_MapType MMDRV_MidiIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
static WINMM_MapType MMDRV_MidiIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT fn_ret)
{
return WINMM_MAP_MSGERROR;
}
......@@ -360,7 +360,7 @@ static WINMM_MapType MMDRV_MidiOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LP
/**************************************************************************
* MMDRV_MidiOut_UnMap16To32A [internal]
*/
static WINMM_MapType MMDRV_MidiOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
static WINMM_MapType MMDRV_MidiOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT fn_ret)
{
WINMM_MapType ret = WINMM_MAP_MSGERROR;
......@@ -411,7 +411,7 @@ static WINMM_MapType MMDRV_MidiOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LP
if (mh16->reserved >= sizeof(MIDIHDR))
mh16->dwOffset = mh32->dwOffset;
if (wMsg == MODM_UNPREPARE) {
if (wMsg == MODM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) {
HeapFree(GetProcessHeap(), 0, (LPSTR)mh32 - sizeof(LPMIDIHDR));
mh16->lpNext = 0;
}
......@@ -571,7 +571,7 @@ static WINMM_MapType MMDRV_MidiOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LP
/**************************************************************************
* MMDRV_MidiOut_UnMap32ATo16 [internal]
*/
static WINMM_MapType MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
static WINMM_MapType MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT fn_ret)
{
WINMM_MapType ret = WINMM_MAP_MSGERROR;
......@@ -617,7 +617,7 @@ static WINMM_MapType MMDRV_MidiOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LP
mh32->dwUser = mh16->dwUser;
mh32->dwFlags = mh16->dwFlags;
if (wMsg == MODM_UNPREPARE) {
if (wMsg == MODM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) {
HeapFree( GetProcessHeap(), 0, ptr );
mh32->lpNext = 0;
}
......@@ -805,7 +805,7 @@ static WINMM_MapType MMDRV_WaveIn_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LPD
/**************************************************************************
* MMDRV_WaveIn_UnMap16To32A [internal]
*/
static WINMM_MapType MMDRV_WaveIn_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
static WINMM_MapType MMDRV_WaveIn_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT fn_ret)
{
WINMM_MapType ret = WINMM_MAP_MSGERROR;
......@@ -860,7 +860,7 @@ static WINMM_MapType MMDRV_WaveIn_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPD
wh16->dwFlags = wh32->dwFlags;
wh16->dwLoops = wh32->dwLoops;
if (wMsg == WIDM_UNPREPARE) {
if (wMsg == WIDM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) {
HeapFree(GetProcessHeap(), 0, (LPSTR)wh32 - sizeof(LPWAVEHDR));
wh16->lpNext = 0;
}
......@@ -1047,7 +1047,7 @@ static WINMM_MapType MMDRV_WaveIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
/**************************************************************************
* MMDRV_WaveIn_UnMap32ATo16 [internal]
*/
static WINMM_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
static WINMM_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT fn_ret)
{
WINMM_MapType ret = WINMM_MAP_MSGERROR;
......@@ -1089,7 +1089,7 @@ static WINMM_MapType MMDRV_WaveIn_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPD
wh32->dwLoops = wh16->dwLoops;
UnMapLS( *lpParam1 );
if (wMsg == WIDM_UNPREPARE) {
if (wMsg == WIDM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) {
HeapFree( GetProcessHeap(), 0, ptr );
wh32->lpNext = 0;
}
......@@ -1303,7 +1303,7 @@ static WINMM_MapType MMDRV_WaveOut_Map16To32A (UINT wMsg, LPDWORD lpdwUser, LP
/**************************************************************************
* MMDRV_WaveOut_UnMap16To32A [internal]
*/
static WINMM_MapType MMDRV_WaveOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
static WINMM_MapType MMDRV_WaveOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT fn_ret)
{
WINMM_MapType ret = WINMM_MAP_MSGERROR;
......@@ -1369,7 +1369,7 @@ static WINMM_MapType MMDRV_WaveOut_UnMap16To32A(UINT wMsg, LPDWORD lpdwUser, LP
wh16->dwFlags = wh32->dwFlags;
wh16->dwLoops = wh32->dwLoops;
if (wMsg == WODM_UNPREPARE) {
if (wMsg == WODM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) {
HeapFree(GetProcessHeap(), 0, (LPSTR)wh32 - sizeof(LPWAVEHDR));
wh16->lpNext = 0;
}
......@@ -1575,7 +1575,7 @@ static WINMM_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LP
/**************************************************************************
* MMDRV_WaveOut_UnMap32ATo16 [internal]
*/
static WINMM_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2)
static WINMM_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT fn_ret)
{
WINMM_MapType ret;
......@@ -1659,7 +1659,7 @@ static WINMM_MapType MMDRV_WaveOut_UnMap32ATo16(UINT wMsg, LPDWORD lpdwUser, LP
wh32->dwLoops = wh16->dwLoops;
UnMapLS( *lpParam1 );
if (wMsg == WODM_UNPREPARE) {
if (wMsg == WODM_UNPREPARE && fn_ret == MMSYSERR_NOERROR) {
HeapFree( GetProcessHeap(), 0, ptr );
wh32->lpNext = 0;
}
......
......@@ -225,6 +225,7 @@ typedef struct tagWINE_MM_IDATA {
typedef LONG (*MCIPROC16)(DWORD, HDRVR16, WORD, DWORD, DWORD);
typedef LONG (*MCIPROC)(DWORD, HDRVR, DWORD, DWORD, DWORD);
typedef WINMM_MapType (*MMDRV_MAPFUNC)(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2);
typedef WINMM_MapType (*MMDRV_UNMAPFUNC)(UINT wMsg, LPDWORD lpdwUser, LPDWORD lpParam1, LPDWORD lpParam2, MMRESULT ret);
LPWINE_DRIVER DRIVER_FindFromHDrvr(HDRVR hDrvr);
BOOL DRIVER_GetLibName(LPCSTR keyName, LPCSTR sectName, LPSTR buf, int sz);
......@@ -244,8 +245,8 @@ LPWINE_MLD MMDRV_GetRelated(HANDLE hndl, UINT srcType, BOOL bSrcCanBeID, UINT ds
DWORD MMDRV_Message(LPWINE_MLD mld, WORD wMsg, DWORD dwParam1, DWORD dwParam2, BOOL bFrom32);
UINT MMDRV_PhysicalFeatures(LPWINE_MLD mld, UINT uMsg, DWORD dwParam1, DWORD dwParam2);
BOOL MMDRV_Is32(unsigned int);
void MMDRV_InstallMap(unsigned int, MMDRV_MAPFUNC, MMDRV_MAPFUNC,
MMDRV_MAPFUNC, MMDRV_MAPFUNC, LPDRVCALLBACK);
void MMDRV_InstallMap(unsigned int, MMDRV_MAPFUNC, MMDRV_UNMAPFUNC,
MMDRV_MAPFUNC, MMDRV_UNMAPFUNC, LPDRVCALLBACK);
BOOL MCI_Init(void);
WINE_MCIDRIVER* MCI_GetDriver(UINT16 uDevID);
......
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