mmsystem.drv: Always map parameters for all callback kinds.
This commit is contained in:
parent
b8978553ad
commit
6f778a79f4
|
@ -25,6 +25,7 @@
|
||||||
#include "wine/winbase16.h"
|
#include "wine/winbase16.h"
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
|
#include "winuser.h"
|
||||||
#include "wownt32.h"
|
#include "wownt32.h"
|
||||||
#include "winemm16.h"
|
#include "winemm16.h"
|
||||||
#include "digitalv.h"
|
#include "digitalv.h"
|
||||||
|
@ -796,9 +797,10 @@ static struct mmsystdrv_thunk
|
||||||
BYTE pushl_this; /* pushl this (this very thunk) */
|
BYTE pushl_this; /* pushl this (this very thunk) */
|
||||||
struct mmsystdrv_thunk* this;
|
struct mmsystdrv_thunk* this;
|
||||||
BYTE pushl_eax; /* pushl %eax */
|
BYTE pushl_eax; /* pushl %eax */
|
||||||
BYTE jmp; /* ljmp MMDRV_Callback1632 */
|
BYTE jmp; /* ljmp MMDRV_Callback3216 */
|
||||||
DWORD callback;
|
DWORD callback3216;
|
||||||
DWORD pfn16; /* 16bit callback function */
|
DWORD callback; /* callback value (function, window, event...) */
|
||||||
|
DWORD flags; /* flags to control callback value (CALLBACK_???) */
|
||||||
void* hMmdrv; /* Handle to 32bit mmdrv object */
|
void* hMmdrv; /* Handle to 32bit mmdrv object */
|
||||||
enum MMSYSTEM_DriverType kind;
|
enum MMSYSTEM_DriverType kind;
|
||||||
} *MMSYSTDRV_Thunks;
|
} *MMSYSTDRV_Thunks;
|
||||||
|
@ -834,25 +836,48 @@ static LRESULT CALLBACK MMSYSTDRV_Callback3216(struct mmsystdrv_thunk* thunk, HD
|
||||||
|
|
||||||
MMSYSTEM_DriversType[thunk->kind].mapcb(wMsg, &dwUser, &dwParam1, &dwParam2);
|
MMSYSTEM_DriversType[thunk->kind].mapcb(wMsg, &dwUser, &dwParam1, &dwParam2);
|
||||||
|
|
||||||
/* 16 bit func, call it */
|
switch (thunk->flags & CALLBACK_TYPEMASK) {
|
||||||
TRACE("Function (16 bit) %x!\n", thunk->pfn16);
|
case CALLBACK_NULL:
|
||||||
|
TRACE("Null !\n");
|
||||||
|
break;
|
||||||
|
case CALLBACK_WINDOW:
|
||||||
|
TRACE("Window(%04X) handle=%p!\n", thunk->callback, hDev);
|
||||||
|
PostMessageA((HWND)thunk->callback, wMsg, (WPARAM)hDev, dwParam1);
|
||||||
|
break;
|
||||||
|
case CALLBACK_TASK: /* aka CALLBACK_THREAD */
|
||||||
|
TRACE("Task(%04x) !\n", thunk->callback);
|
||||||
|
PostThreadMessageA(thunk->callback, wMsg, (WPARAM)hDev, dwParam1);
|
||||||
|
break;
|
||||||
|
case CALLBACK_FUNCTION:
|
||||||
|
/* 16 bit func, call it */
|
||||||
|
TRACE("Function (16 bit) %x!\n", thunk->callback);
|
||||||
|
|
||||||
args[7] = HDRVR_16(hDev);
|
args[7] = HDRVR_16(hDev);
|
||||||
args[6] = wMsg;
|
args[6] = wMsg;
|
||||||
args[5] = HIWORD(dwUser);
|
args[5] = HIWORD(dwUser);
|
||||||
args[4] = LOWORD(dwUser);
|
args[4] = LOWORD(dwUser);
|
||||||
args[3] = HIWORD(dwParam1);
|
args[3] = HIWORD(dwParam1);
|
||||||
args[2] = LOWORD(dwParam1);
|
args[2] = LOWORD(dwParam1);
|
||||||
args[1] = HIWORD(dwParam2);
|
args[1] = HIWORD(dwParam2);
|
||||||
args[0] = LOWORD(dwParam2);
|
args[0] = LOWORD(dwParam2);
|
||||||
return WOWCallback16Ex(thunk->pfn16, WCB16_PASCAL, sizeof(args), args, NULL);
|
return WOWCallback16Ex(thunk->callback, WCB16_PASCAL, sizeof(args), args, NULL);
|
||||||
|
case CALLBACK_EVENT:
|
||||||
|
TRACE("Event(%08x) !\n", thunk->callback);
|
||||||
|
SetEvent((HANDLE)thunk->callback);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
WARN("Unknown callback type %lx\n", thunk->flags & CALLBACK_TYPEMASK);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
TRACE("Done\n");
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
* MMSYSTDRV_AddThunk
|
* MMSYSTDRV_AddThunk
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
struct mmsystdrv_thunk* MMSYSTDRV_AddThunk(DWORD pfn16, enum MMSYSTEM_DriverType kind)
|
struct mmsystdrv_thunk* MMSYSTDRV_AddThunk(DWORD callback, DWORD flags, enum MMSYSTEM_DriverType kind)
|
||||||
{
|
{
|
||||||
struct mmsystdrv_thunk* thunk;
|
struct mmsystdrv_thunk* thunk;
|
||||||
|
|
||||||
|
@ -873,17 +898,19 @@ struct mmsystdrv_thunk* MMSYSTDRV_AddThunk(DWORD pfn16, enum MMSYSTEM_Driv
|
||||||
thunk->this = thunk;
|
thunk->this = thunk;
|
||||||
thunk->pushl_eax = 0x50; /* pushl %eax */
|
thunk->pushl_eax = 0x50; /* pushl %eax */
|
||||||
thunk->jmp = 0xe9; /* jmp MMDRV_Callback3216 */
|
thunk->jmp = 0xe9; /* jmp MMDRV_Callback3216 */
|
||||||
thunk->callback = (char *)MMSYSTDRV_Callback3216 - (char *)(&thunk->callback + 1);
|
thunk->callback3216 = (char *)MMSYSTDRV_Callback3216 - (char *)(&thunk->callback3216 + 1);
|
||||||
thunk->pfn16 = 0;
|
thunk->callback = 0;
|
||||||
|
thunk->flags = CALLBACK_NULL;
|
||||||
thunk->hMmdrv = NULL;
|
thunk->hMmdrv = NULL;
|
||||||
thunk->kind = MMSYSTDRV_MAX;
|
thunk->kind = MMSYSTDRV_MAX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (thunk = MMSYSTDRV_Thunks; thunk < &MMSYSTDRV_Thunks[MMSYSTDRV_MAX_THUNKS]; thunk++)
|
for (thunk = MMSYSTDRV_Thunks; thunk < &MMSYSTDRV_Thunks[MMSYSTDRV_MAX_THUNKS]; thunk++)
|
||||||
{
|
{
|
||||||
if (thunk->pfn16 == 0 && thunk->hMmdrv == NULL)
|
if (thunk->callback == 0 && thunk->hMmdrv == NULL)
|
||||||
{
|
{
|
||||||
thunk->pfn16 = pfn16;
|
thunk->callback = callback;
|
||||||
|
thunk->flags = flags;
|
||||||
thunk->hMmdrv = NULL;
|
thunk->hMmdrv = NULL;
|
||||||
thunk->kind = kind;
|
thunk->kind = kind;
|
||||||
LeaveCriticalSection(&mmdrv_cs);
|
LeaveCriticalSection(&mmdrv_cs);
|
||||||
|
@ -930,7 +957,8 @@ void MMSYSTDRV_SetHandle(struct mmsystdrv_thunk* thunk, void* h)
|
||||||
*/
|
*/
|
||||||
void MMSYSTDRV_DeleteThunk(struct mmsystdrv_thunk* thunk)
|
void MMSYSTDRV_DeleteThunk(struct mmsystdrv_thunk* thunk)
|
||||||
{
|
{
|
||||||
thunk->pfn16 = 0;
|
thunk->callback = 0;
|
||||||
|
thunk->flags = CALLBACK_NULL;
|
||||||
thunk->hMmdrv = NULL;
|
thunk->hMmdrv = NULL;
|
||||||
thunk->kind = MMSYSTDRV_MAX;
|
thunk->kind = MMSYSTDRV_MAX;
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,16 +400,13 @@ UINT16 WINAPI mixerOpen16(LPHMIXER16 lphmix, UINT16 uDeviceID, DWORD dwCallback,
|
||||||
UINT ret;
|
UINT ret;
|
||||||
struct mmsystdrv_thunk* thunk;
|
struct mmsystdrv_thunk* thunk;
|
||||||
|
|
||||||
if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, MMSYSTDRV_MIXER)))
|
if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, fdwOpen, MMSYSTDRV_MIXER)))
|
||||||
{
|
{
|
||||||
return MMSYSERR_NOMEM;
|
return MMSYSERR_NOMEM;
|
||||||
}
|
}
|
||||||
if ((fdwOpen & CALLBACK_TYPEMASK) == CALLBACK_FUNCTION)
|
if ((fdwOpen & CALLBACK_TYPEMASK) != CALLBACK_NULL)
|
||||||
{
|
fdwOpen = (fdwOpen & ~CALLBACK_TYPEMASK) | CALLBACK_FUNCTION;
|
||||||
dwCallback = (DWORD)thunk;
|
ret = mixerOpen(&hmix, uDeviceID, (DWORD)thunk, dwInstance, fdwOpen);
|
||||||
}
|
|
||||||
|
|
||||||
ret = mixerOpen(&hmix, uDeviceID, dwCallback, dwInstance, fdwOpen);
|
|
||||||
if (ret == MMSYSERR_NOERROR)
|
if (ret == MMSYSERR_NOERROR)
|
||||||
{
|
{
|
||||||
if (lphmix) *lphmix = HMIXER_16(hmix);
|
if (lphmix) *lphmix = HMIXER_16(hmix);
|
||||||
|
@ -747,15 +744,13 @@ UINT16 WINAPI midiOutOpen16(HMIDIOUT16* lphMidiOut, UINT16 uDeviceID,
|
||||||
UINT ret;
|
UINT ret;
|
||||||
struct mmsystdrv_thunk* thunk;
|
struct mmsystdrv_thunk* thunk;
|
||||||
|
|
||||||
if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, MMSYSTDRV_MIDIOUT)))
|
if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, dwFlags, MMSYSTDRV_MIDIOUT)))
|
||||||
{
|
{
|
||||||
return MMSYSERR_NOMEM;
|
return MMSYSERR_NOMEM;
|
||||||
}
|
}
|
||||||
if ((dwFlags & CALLBACK_TYPEMASK) == CALLBACK_FUNCTION)
|
if ((dwFlags & CALLBACK_TYPEMASK) != CALLBACK_NULL)
|
||||||
{
|
dwFlags = (dwFlags & ~CALLBACK_TYPEMASK) | CALLBACK_FUNCTION;
|
||||||
dwCallback = (DWORD)thunk;
|
ret = midiOutOpen(&hmo, uDeviceID, (DWORD)thunk, dwInstance, dwFlags);
|
||||||
}
|
|
||||||
ret = midiOutOpen(&hmo, uDeviceID, dwCallback, dwInstance, dwFlags);
|
|
||||||
if (ret == MMSYSERR_NOERROR)
|
if (ret == MMSYSERR_NOERROR)
|
||||||
{
|
{
|
||||||
if (lphMidiOut != NULL) *lphMidiOut = HMIDIOUT_16(hmo);
|
if (lphMidiOut != NULL) *lphMidiOut = HMIDIOUT_16(hmo);
|
||||||
|
@ -953,15 +948,13 @@ UINT16 WINAPI midiInOpen16(HMIDIIN16* lphMidiIn, UINT16 uDeviceID,
|
||||||
UINT ret;
|
UINT ret;
|
||||||
struct mmsystdrv_thunk* thunk;
|
struct mmsystdrv_thunk* thunk;
|
||||||
|
|
||||||
if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, MMSYSTDRV_MIDIIN)))
|
if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, dwFlags, MMSYSTDRV_MIDIIN)))
|
||||||
{
|
{
|
||||||
return MMSYSERR_NOMEM;
|
return MMSYSERR_NOMEM;
|
||||||
}
|
}
|
||||||
if ((dwFlags & CALLBACK_TYPEMASK) == CALLBACK_FUNCTION)
|
if ((dwFlags & CALLBACK_TYPEMASK) != CALLBACK_NULL)
|
||||||
{
|
dwFlags = (dwFlags & ~CALLBACK_TYPEMASK) | CALLBACK_FUNCTION;
|
||||||
dwCallback = (DWORD)thunk;
|
ret = midiInOpen(&hmid, uDeviceID, (DWORD)thunk, dwInstance, dwFlags);
|
||||||
}
|
|
||||||
ret = midiInOpen(&hmid, uDeviceID, dwCallback, dwInstance, dwFlags);
|
|
||||||
if (ret == MMSYSERR_NOERROR)
|
if (ret == MMSYSERR_NOERROR)
|
||||||
{
|
{
|
||||||
if (lphMidiIn) *lphMidiIn = HMIDIIN_16(hmid);
|
if (lphMidiIn) *lphMidiIn = HMIDIIN_16(hmid);
|
||||||
|
@ -1116,15 +1109,13 @@ MMRESULT16 WINAPI midiStreamOpen16(HMIDISTRM16* phMidiStrm, LPUINT16 devid,
|
||||||
return MMSYSERR_INVALPARAM;
|
return MMSYSERR_INVALPARAM;
|
||||||
devid32 = *devid;
|
devid32 = *devid;
|
||||||
|
|
||||||
if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, MMSYSTDRV_MIDIOUT)))
|
if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, fdwOpen, MMSYSTDRV_MIDIOUT)))
|
||||||
{
|
{
|
||||||
return MMSYSERR_NOMEM;
|
return MMSYSERR_NOMEM;
|
||||||
}
|
}
|
||||||
if ((fdwOpen & CALLBACK_TYPEMASK) == CALLBACK_FUNCTION)
|
if ((fdwOpen & CALLBACK_TYPEMASK) != CALLBACK_NULL)
|
||||||
{
|
fdwOpen = (fdwOpen & ~CALLBACK_TYPEMASK) | CALLBACK_FUNCTION;
|
||||||
dwCallback = (DWORD)thunk;
|
ret = midiStreamOpen(&hMidiStrm32, &devid32, cMidi, (DWORD)thunk, dwInstance, fdwOpen);
|
||||||
}
|
|
||||||
ret = midiStreamOpen(&hMidiStrm32, &devid32, cMidi, dwCallback, dwInstance, fdwOpen);
|
|
||||||
if (ret == MMSYSERR_NOERROR)
|
if (ret == MMSYSERR_NOERROR)
|
||||||
{
|
{
|
||||||
*phMidiStrm = HMIDISTRM_16(hMidiStrm32);
|
*phMidiStrm = HMIDISTRM_16(hMidiStrm32);
|
||||||
|
@ -1252,21 +1243,19 @@ UINT16 WINAPI waveOutOpen16(HWAVEOUT16* lphWaveOut, UINT16 uDeviceID,
|
||||||
UINT ret;
|
UINT ret;
|
||||||
struct mmsystdrv_thunk* thunk;
|
struct mmsystdrv_thunk* thunk;
|
||||||
|
|
||||||
if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, MMSYSTDRV_WAVEOUT)))
|
if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, dwFlags, MMSYSTDRV_WAVEOUT)))
|
||||||
{
|
{
|
||||||
return MMSYSERR_NOMEM;
|
return MMSYSERR_NOMEM;
|
||||||
}
|
}
|
||||||
if ((dwFlags & CALLBACK_TYPEMASK) == CALLBACK_FUNCTION)
|
if ((dwFlags & CALLBACK_TYPEMASK) != CALLBACK_NULL)
|
||||||
{
|
dwFlags = (dwFlags & ~CALLBACK_TYPEMASK) | CALLBACK_FUNCTION;
|
||||||
dwCallback = (DWORD)thunk;
|
|
||||||
}
|
|
||||||
/* since layout of WAVEFORMATEX is the same for 16/32 bits, we directly
|
/* since layout of WAVEFORMATEX is the same for 16/32 bits, we directly
|
||||||
* call the 32 bit version
|
* call the 32 bit version
|
||||||
* however, we need to promote correctly the wave mapper id
|
* however, we need to promote correctly the wave mapper id
|
||||||
* (0xFFFFFFFF and not 0x0000FFFF)
|
* (0xFFFFFFFF and not 0x0000FFFF)
|
||||||
*/
|
*/
|
||||||
ret = waveOutOpen(&hWaveOut, (uDeviceID == (UINT16)-1) ? (UINT)-1 : uDeviceID,
|
ret = waveOutOpen(&hWaveOut, (uDeviceID == (UINT16)-1) ? (UINT)-1 : uDeviceID,
|
||||||
lpFormat, dwCallback, dwInstance, dwFlags);
|
lpFormat, (DWORD)thunk, dwInstance, dwFlags);
|
||||||
|
|
||||||
if (ret == MMSYSERR_NOERROR)
|
if (ret == MMSYSERR_NOERROR)
|
||||||
{
|
{
|
||||||
|
@ -1547,21 +1536,19 @@ UINT16 WINAPI waveInOpen16(HWAVEIN16* lphWaveIn, UINT16 uDeviceID,
|
||||||
UINT ret;
|
UINT ret;
|
||||||
struct mmsystdrv_thunk* thunk;
|
struct mmsystdrv_thunk* thunk;
|
||||||
|
|
||||||
if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, MMSYSTDRV_WAVEIN)))
|
if (!(thunk = MMSYSTDRV_AddThunk(dwCallback, dwFlags, MMSYSTDRV_WAVEIN)))
|
||||||
{
|
{
|
||||||
return MMSYSERR_NOMEM;
|
return MMSYSERR_NOMEM;
|
||||||
}
|
}
|
||||||
if ((dwFlags & CALLBACK_TYPEMASK) == CALLBACK_FUNCTION)
|
if ((dwFlags & CALLBACK_TYPEMASK) != CALLBACK_NULL)
|
||||||
{
|
dwFlags = (dwFlags & ~CALLBACK_TYPEMASK) | CALLBACK_FUNCTION;
|
||||||
dwCallback = (DWORD)thunk;
|
|
||||||
}
|
|
||||||
/* since layout of WAVEFORMATEX is the same for 16/32 bits, we directly
|
/* since layout of WAVEFORMATEX is the same for 16/32 bits, we directly
|
||||||
* call the 32 bit version
|
* call the 32 bit version
|
||||||
* however, we need to promote correctly the wave mapper id
|
* however, we need to promote correctly the wave mapper id
|
||||||
* (0xFFFFFFFF and not 0x0000FFFF)
|
* (0xFFFFFFFF and not 0x0000FFFF)
|
||||||
*/
|
*/
|
||||||
ret = waveInOpen(&hWaveIn, (uDeviceID == (UINT16)-1) ? (UINT)-1 : uDeviceID,
|
ret = waveInOpen(&hWaveIn, (uDeviceID == (UINT16)-1) ? (UINT)-1 : uDeviceID,
|
||||||
lpFormat, dwCallback, dwInstance, dwFlags);
|
lpFormat, (DWORD)thunk, dwInstance, dwFlags);
|
||||||
|
|
||||||
if (ret == MMSYSERR_NOERROR)
|
if (ret == MMSYSERR_NOERROR)
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,7 +73,7 @@ enum MMSYSTEM_DriverType
|
||||||
MMSYSTDRV_MAX
|
MMSYSTDRV_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct mmsystdrv_thunk* MMSYSTDRV_AddThunk(DWORD pfn16, enum MMSYSTEM_DriverType kind);
|
extern struct mmsystdrv_thunk* MMSYSTDRV_AddThunk(DWORD callback, DWORD flags, enum MMSYSTEM_DriverType kind);
|
||||||
extern void MMSYSTDRV_DeleteThunk(struct mmsystdrv_thunk* thunk);
|
extern void MMSYSTDRV_DeleteThunk(struct mmsystdrv_thunk* thunk);
|
||||||
extern void MMSYSTDRV_SetHandle(struct mmsystdrv_thunk* thunk, void* h);
|
extern void MMSYSTDRV_SetHandle(struct mmsystdrv_thunk* thunk, void* h);
|
||||||
extern void MMSYSTDRV_CloseHandle(void* h);
|
extern void MMSYSTDRV_CloseHandle(void* h);
|
||||||
|
|
Loading…
Reference in New Issue