Commit ed37b7a8 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Move (again) usage of 16 bit specific functions (thunk lock) to 16 bit

code only.
parent 88b928fd
......@@ -53,13 +53,6 @@ static LRESULT DRIVER_CloseDriver16(HDRVR16, LPARAM, LPARAM);
static LRESULT DRIVER_SendMessage16(HDRVR16, UINT, LPARAM, LPARAM);
static LRESULT MMIO_Callback16(SEGPTR, LPMMIOINFO, UINT, LPARAM, LPARAM);
static void MMSYSTEM_Yield(void)
{
DWORD count;
ReleaseThunkLock(&count);
RestoreThunkLock(count);
}
/* ###################################################
* # LIBRARY #
* ###################################################
......@@ -88,21 +81,24 @@ BOOL WINAPI MMSYSTEM_LibMain(DWORD fdwReason, HINSTANCE hinstDLL, WORD ds,
}
WINMM_IData->hWinMM16Instance = hinstDLL;
/* hook in our 16 bit function pointers */
pFnGetMMThread16 = WINMM_GetmmThread;
pFnOpenDriver16 = DRIVER_OpenDriver16;
pFnCloseDriver16 = DRIVER_CloseDriver16;
pFnSendMessage16 = DRIVER_SendMessage16;
pFnMmioCallback16 = MMIO_Callback16;
pFnYield16 = MMSYSTEM_Yield;
pFnGetMMThread16 = WINMM_GetmmThread;
pFnOpenDriver16 = DRIVER_OpenDriver16;
pFnCloseDriver16 = DRIVER_CloseDriver16;
pFnSendMessage16 = DRIVER_SendMessage16;
pFnMmioCallback16 = MMIO_Callback16;
pFnReleaseThunkLock = ReleaseThunkLock;
pFnRestoreThunkLock = RestoreThunkLock;
MMDRV_Init16();
break;
case DLL_PROCESS_DETACH:
WINMM_IData->hWinMM16Instance = 0;
pFnGetMMThread16 = NULL;
pFnOpenDriver16 = NULL;
pFnCloseDriver16 = NULL;
pFnSendMessage16 = NULL;
pFnMmioCallback16 = NULL;
pFnGetMMThread16 = NULL;
pFnOpenDriver16 = NULL;
pFnCloseDriver16 = NULL;
pFnSendMessage16 = NULL;
pFnMmioCallback16 = NULL;
pFnReleaseThunkLock = NULL;
pFnRestoreThunkLock = NULL;
/* FIXME: add equivalent for MMDRV_Init16() */
break;
case DLL_THREAD_ATTACH:
......
......@@ -348,18 +348,18 @@ MMRESULT WINAPI timeEndPeriod(UINT wPeriod)
return 0;
}
void (*pFnYield16)(void) /* = NULL */;
/**************************************************************************
* timeGetTime [MMSYSTEM.607]
* timeGetTime [WINMM.@]
*/
DWORD WINAPI timeGetTime(void)
{
DWORD count;
/* FIXME: releasing the win16 lock here is a temporary hack (I hope)
* that lets mciavi.drv run correctly
*/
if (pFnYield16) pFnYield16();
if (pFnReleaseThunkLock) pFnReleaseThunkLock(&count);
TIME_MMTimeStart();
if (pFnRestoreThunkLock) pFnRestoreThunkLock(count);
return WINMM_IData->mmSysTimeMS;
}
......@@ -305,7 +305,8 @@ extern WINMM_MapType (*pFnMciUnMapMsg32ATo16)(WORD,WORD,DWORD,DWORD);
extern LRESULT (*pFnCallMMDrvFunc16)(DWORD /* in fact FARPROC16 */,WORD,WORD,LONG,LONG,LONG);
extern unsigned (*pFnLoadMMDrvFunc16)(LPCSTR,LPWINE_DRIVER, LPWINE_MM_DRIVER);
extern LRESULT (*pFnMmioCallback16)(DWORD,LPMMIOINFO,UINT,LPARAM,LPARAM);
extern void (*pFnYield16)(void);
extern void (WINAPI *pFnReleaseThunkLock)(DWORD*);
extern void (WINAPI *pFnRestoreThunkLock)(DWORD);
/* GetDriverFlags() returned bits is not documented (nor the call itself)
* Here are Wine only definitions of the bits
*/
......
......@@ -62,6 +62,9 @@ static void MyUserYield(void)
}
}
void (WINAPI *pFnReleaseThunkLock)(DWORD*);
void (WINAPI *pFnRestoreThunkLock)(DWORD);
/* ========================================================================
* G L O B A L S E T T I N G S
* ========================================================================*/
......@@ -1895,9 +1898,9 @@ static BOOL MMSYSTEM_MidiStream_PostMessage(WINE_MIDIStream* lpMidiStrm, WORD ms
if (PostThreadMessageA(lpMidiStrm->dwThreadID, msg, pmt1, pmt2)) {
DWORD count;
ReleaseThunkLock(&count);
if (pFnReleaseThunkLock) pFnReleaseThunkLock(&count);
WaitForSingleObject(lpMidiStrm->hEvent, INFINITE);
RestoreThunkLock(count);
if (pFnRestoreThunkLock) pFnRestoreThunkLock(count);
} else {
WARN("bad PostThreadMessageA\n");
return FALSE;
......@@ -1982,9 +1985,9 @@ MMRESULT MIDI_StreamOpen(HMIDISTRM* lphMidiStrm, LPUINT lpuDeviceID, DWORD cMidi
* (meaning the Win16Lock is set), so that it's released and the 32 bit thread running
* MMSYSTEM_MidiStreamPlayer can acquire Win16Lock to create its queue.
*/
ReleaseThunkLock(&count);
if (pFnReleaseThunkLock) pFnReleaseThunkLock(&count);
WaitForSingleObject(lpMidiStrm->hEvent, INFINITE);
RestoreThunkLock(count);
if (pFnRestoreThunkLock) pFnRestoreThunkLock(count);
}
TRACE("=> (%u/%d) hMidi=%p ret=%d lpMidiStrm=%p\n",
......
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