this is the final round of patches (split in 9 small parts from 7 to 15) let them roll!! ChangeLog: - finish mmio separation - no longer storing function pointers in global IData A+
--- winmm_ref/mmio.c Sat Oct 26 15:06:40 2002 +++ winmm_7/mmio.c Tue Oct 29 11:43:03 2002 @@ -44,6 +44,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmio); +LRESULT (*pFnMmioCallback16)(SEGPTR,LPMMIOINFO,UINT,LPARAM,LPARAM) /* = NULL */; + /************************************************************************** * mmioDosIOProc [internal] */ @@ -71,9 +73,7 @@ } /* if filename NULL, assume open file handle in adwInfo[0] */ - if (!szFileName) { - lpmmioinfo->adwInfo[0] = DosFileHandleToWin32Handle(lpmmioinfo->adwInfo[0]); - } else { + if (szFileName) { OFSTRUCT ofs; lpmmioinfo->adwInfo[0] = (DWORD)OpenFile(szFileName, &ofs, lpmmioinfo->dwFlags & 0xFFFF); } @@ -352,9 +352,9 @@ switch (ioProc->type) { case MMIO_PROC_16: - if (WINMM_IData && WINMM_IData->pFnMmioCallback16) - result = WINMM_IData->pFnMmioCallback16((SEGPTR)ioProc->pIOProc, - mmioinfo, wMsg, lp1, lp2); + if (pFnMmioCallback16) + result = pFnMmioCallback16((SEGPTR)ioProc->pIOProc, + mmioinfo, wMsg, lp1, lp2); break; case MMIO_PROC_32A: case MMIO_PROC_32W: @@ -579,9 +579,6 @@ wm->info.pchBuffer = NULL; } - if (wm->ioProc->type == MMIO_PROC_16) - wm->info.dwReserved1 = MapLS(wm->info.pchBuffer); - wm->info.cchBuffer = cchBuffer; wm->info.pchNext = wm->info.pchBuffer; wm->info.pchEndRead = wm->info.pchBuffer; @@ -1350,3 +1347,4 @@ HeapFree(GetProcessHeap(),0,sznFn); return ret; } + --- winmm_ref/mmsystem.c Tue Oct 29 09:54:09 2002 +++ winmm_7/mmsystem.c Tue Oct 29 12:03:44 2002 @@ -49,9 +49,7 @@ extern LONG CALLBACK MMSYSTEM_CallTo16_long_lwll (LPMMIOPROC16,LONG,WORD,LONG,LONG); /* ### stop build ### */ -static LRESULT CALLBACK mmioCallback16(SEGPTR cb16, - LPMMIOINFO lpmmioinfo, UINT uMessage, - LPARAM lParam1, LPARAM lParam2); +static LRESULT MMIO_Callback16(SEGPTR, LPMMIOINFO, UINT, LPARAM, LPARAM); /* ################################################### * # LIBRARY # @@ -85,10 +83,12 @@ } WINMM_IData->hWinMM16Instance = hinstDLL; WINMM_IData->h16Module32 = hndl; - WINMM_IData->pFnMmioCallback16 = mmioCallback16; + /* hook in our 16 bit function pointers */ + pFnMmioCallback16 = MMIO_Callback16; break; case DLL_PROCESS_DETACH: FreeLibrary(WINMM_IData->h16Module32); + pFnMmioCallback16 = NULL; break; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: @@ -2511,13 +2511,12 @@ } /****************************************************************** - * mmioCallback16 + * MMIO_Callback16 * * */ -static LRESULT CALLBACK mmioCallback16(SEGPTR cb16, - LPMMIOINFO lpmmioinfo, UINT uMessage, - LPARAM lParam1, LPARAM lParam2) +static LRESULT MMIO_Callback16(SEGPTR cb16, LPMMIOINFO lpmmioinfo, UINT uMessage, + LPARAM lParam1, LPARAM lParam2) { LRESULT result; MMIOINFO16 mmioInfo16; @@ -2552,8 +2551,6 @@ /****************************************************************** * MMIO_ResetSegmentedData * - * - * */ static LRESULT MMIO_SetSegmentedBuffer(HMMIO hmmio, SEGPTR ptr) { @@ -2583,7 +2580,10 @@ mmioinfo.pIOProc = (LPMMIOPROC)lpmmioinfo16->pIOProc; mmioinfo.cchBuffer = lpmmioinfo16->cchBuffer; 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[2] = lpmmioinfo16->adwInfo[2]; mmioinfo.adwInfo[3] = lpmmioinfo16->adwInfo[3]; --- winmm_ref/winemm.h Tue Oct 29 16:13:57 2002 +++ winmm_7/winemm.h Tue Oct 29 16:09:10 2002 @@ -217,7 +217,6 @@ /* LPWINE_MIXER lpMixer; */ /* mmio part */ LPWINE_MMIO lpMMIO; - LRESULT (CALLBACK* pFnMmioCallback16)(SEGPTR,LPMMIOINFO,UINT,LPARAM,LPARAM); /* playsound and sndPlaySound */ WINE_PLAYSOUND* lpPlaySound; HANDLE psLastEvent; @@ -340,6 +339,11 @@ /* Global variables */ 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 */ #define HDRVR_32(h16) ((HDRVR)(ULONG_PTR)(h16))