- finish mmio separation

- no longer storing function pointers in global IData
This commit is contained in:
Eric Pouech 2002-10-29 21:26:00 +00:00 committed by Alexandre Julliard
parent 02af550a2a
commit 5e81d9a7ba
3 changed files with 22 additions and 21 deletions

View File

@ -44,6 +44,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(mmio); WINE_DEFAULT_DEBUG_CHANNEL(mmio);
LRESULT (*pFnMmioCallback16)(SEGPTR,LPMMIOINFO,UINT,LPARAM,LPARAM) /* = NULL */;
/************************************************************************** /**************************************************************************
* mmioDosIOProc [internal] * mmioDosIOProc [internal]
*/ */
@ -71,9 +73,7 @@ static LRESULT CALLBACK mmioDosIOProc(LPMMIOINFO lpmmioinfo, UINT uMessage,
} }
/* if filename NULL, assume open file handle in adwInfo[0] */ /* if filename NULL, assume open file handle in adwInfo[0] */
if (!szFileName) { if (szFileName) {
lpmmioinfo->adwInfo[0] = DosFileHandleToWin32Handle(lpmmioinfo->adwInfo[0]);
} else {
OFSTRUCT ofs; OFSTRUCT ofs;
lpmmioinfo->adwInfo[0] = (DWORD)OpenFile(szFileName, &ofs, lpmmioinfo->dwFlags & 0xFFFF); lpmmioinfo->adwInfo[0] = (DWORD)OpenFile(szFileName, &ofs, lpmmioinfo->dwFlags & 0xFFFF);
} }
@ -352,8 +352,8 @@ static LRESULT send_message(struct IOProcList* ioProc, LPMMIOINFO mmioinfo,
switch (ioProc->type) { switch (ioProc->type) {
case MMIO_PROC_16: case MMIO_PROC_16:
if (WINMM_IData && WINMM_IData->pFnMmioCallback16) if (pFnMmioCallback16)
result = WINMM_IData->pFnMmioCallback16((SEGPTR)ioProc->pIOProc, result = pFnMmioCallback16((SEGPTR)ioProc->pIOProc,
mmioinfo, wMsg, lp1, lp2); mmioinfo, wMsg, lp1, lp2);
break; break;
case MMIO_PROC_32A: case MMIO_PROC_32A:
@ -579,9 +579,6 @@ static MMRESULT MMIO_SetBuffer(WINE_MMIO* wm, void* pchBuffer, LONG cchBuffer,
wm->info.pchBuffer = NULL; wm->info.pchBuffer = NULL;
} }
if (wm->ioProc->type == MMIO_PROC_16)
wm->info.dwReserved1 = MapLS(wm->info.pchBuffer);
wm->info.cchBuffer = cchBuffer; wm->info.cchBuffer = cchBuffer;
wm->info.pchNext = wm->info.pchBuffer; wm->info.pchNext = wm->info.pchBuffer;
wm->info.pchEndRead = wm->info.pchBuffer; wm->info.pchEndRead = wm->info.pchBuffer;

View File

@ -49,9 +49,7 @@ extern LONG CALLBACK MMSYSTEM_CallTo16_long_l (FARPROC16,LONG);
extern LONG CALLBACK MMSYSTEM_CallTo16_long_lwll (LPMMIOPROC16,LONG,WORD,LONG,LONG); extern LONG CALLBACK MMSYSTEM_CallTo16_long_lwll (LPMMIOPROC16,LONG,WORD,LONG,LONG);
/* ### stop build ### */ /* ### stop build ### */
static LRESULT CALLBACK mmioCallback16(SEGPTR cb16, static LRESULT MMIO_Callback16(SEGPTR, LPMMIOINFO, UINT, LPARAM, LPARAM);
LPMMIOINFO lpmmioinfo, UINT uMessage,
LPARAM lParam1, LPARAM lParam2);
/* ################################################### /* ###################################################
* # LIBRARY # * # LIBRARY #
@ -85,10 +83,12 @@ BOOL WINAPI MMSYSTEM_LibMain(DWORD fdwReason, HINSTANCE hinstDLL, WORD ds,
} }
WINMM_IData->hWinMM16Instance = hinstDLL; WINMM_IData->hWinMM16Instance = hinstDLL;
WINMM_IData->h16Module32 = hndl; WINMM_IData->h16Module32 = hndl;
WINMM_IData->pFnMmioCallback16 = mmioCallback16; /* hook in our 16 bit function pointers */
pFnMmioCallback16 = MMIO_Callback16;
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
FreeLibrary(WINMM_IData->h16Module32); FreeLibrary(WINMM_IData->h16Module32);
pFnMmioCallback16 = NULL;
break; break;
case DLL_THREAD_ATTACH: case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH: case DLL_THREAD_DETACH:
@ -2511,12 +2511,11 @@ static LRESULT MMIO_UnMap32To16(DWORD wMsg, LPARAM lParam1, LPARAM lParam2,
} }
/****************************************************************** /******************************************************************
* mmioCallback16 * MMIO_Callback16
* *
* *
*/ */
static LRESULT CALLBACK mmioCallback16(SEGPTR cb16, static LRESULT MMIO_Callback16(SEGPTR cb16, LPMMIOINFO lpmmioinfo, UINT uMessage,
LPMMIOINFO lpmmioinfo, UINT uMessage,
LPARAM lParam1, LPARAM lParam2) LPARAM lParam1, LPARAM lParam2)
{ {
LRESULT result; LRESULT result;
@ -2552,8 +2551,6 @@ static LRESULT CALLBACK mmioCallback16(SEGPTR cb16,
/****************************************************************** /******************************************************************
* MMIO_ResetSegmentedData * MMIO_ResetSegmentedData
* *
*
*
*/ */
static LRESULT MMIO_SetSegmentedBuffer(HMMIO hmmio, SEGPTR ptr) static LRESULT MMIO_SetSegmentedBuffer(HMMIO hmmio, SEGPTR ptr)
{ {
@ -2584,6 +2581,9 @@ HMMIO16 WINAPI mmioOpen16(LPSTR szFileName, MMIOINFO16* lpmmioinfo16,
mmioinfo.cchBuffer = lpmmioinfo16->cchBuffer; mmioinfo.cchBuffer = lpmmioinfo16->cchBuffer;
mmioinfo.pchBuffer = MapSL((DWORD)lpmmioinfo16->pchBuffer); mmioinfo.pchBuffer = MapSL((DWORD)lpmmioinfo16->pchBuffer);
mmioinfo.adwInfo[0] = lpmmioinfo16->adwInfo[0]; mmioinfo.adwInfo[0] = lpmmioinfo16->adwInfo[0];
/* if we don't have a file name, it's likely a passed open file descriptor */
if (!szFileName)
mmioinfo.adwInfo[0] = DosFileHandleToWin32Handle(mmioinfo.adwInfo[0]);
mmioinfo.adwInfo[1] = lpmmioinfo16->adwInfo[1]; mmioinfo.adwInfo[1] = lpmmioinfo16->adwInfo[1];
mmioinfo.adwInfo[2] = lpmmioinfo16->adwInfo[2]; mmioinfo.adwInfo[2] = lpmmioinfo16->adwInfo[2];
mmioinfo.adwInfo[3] = lpmmioinfo16->adwInfo[3]; mmioinfo.adwInfo[3] = lpmmioinfo16->adwInfo[3];

View File

@ -217,7 +217,6 @@ typedef struct tagWINE_MM_IDATA {
/* LPWINE_MIXER lpMixer; */ /* LPWINE_MIXER lpMixer; */
/* mmio part */ /* mmio part */
LPWINE_MMIO lpMMIO; LPWINE_MMIO lpMMIO;
LRESULT (CALLBACK* pFnMmioCallback16)(SEGPTR,LPMMIOINFO,UINT,LPARAM,LPARAM);
/* playsound and sndPlaySound */ /* playsound and sndPlaySound */
WINE_PLAYSOUND* lpPlaySound; WINE_PLAYSOUND* lpPlaySound;
HANDLE psLastEvent; HANDLE psLastEvent;
@ -341,6 +340,11 @@ BOOL MMDRV_GetDescription16(const char* fname, char* buf, int buflen);
/* Global variables */ /* Global variables */
extern LPWINE_MM_IDATA WINMM_IData; extern LPWINE_MM_IDATA WINMM_IData;
/* pointers to 16 bit functions (if sibling MMSYSTEM.DLL is loaded
* NULL otherwise
*/
extern LRESULT (*pFnMmioCallback16)(SEGPTR,LPMMIOINFO,UINT,LPARAM,LPARAM);
/* HANDLE16 -> HANDLE conversions */ /* HANDLE16 -> HANDLE conversions */
#define HDRVR_32(h16) ((HDRVR)(ULONG_PTR)(h16)) #define HDRVR_32(h16) ((HDRVR)(ULONG_PTR)(h16))
#define HMIDI_32(h16) ((HMIDI)(ULONG_PTR)(h16)) #define HMIDI_32(h16) ((HMIDI)(ULONG_PTR)(h16))