Commit 2b0e56c8 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Now only storing thread id for mci tasks (16 bit htask is now gotten

from WOW functions).
parent c07a6cf5
...@@ -34,6 +34,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(driver); ...@@ -34,6 +34,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(driver);
static LPWINE_DRIVER lpDrvItemList = NULL; static LPWINE_DRIVER lpDrvItemList = NULL;
WINE_MMTHREAD* (*pFnGetMMThread16)(HANDLE16 h) /* = NULL */;
/************************************************************************** /**************************************************************************
* DRIVER_GetNumberOfModuleRefs [internal] * DRIVER_GetNumberOfModuleRefs [internal]
* *
......
...@@ -489,7 +489,6 @@ static DWORD MCI_LoadMciDriver(LPCSTR _strDevTyp, LPWINE_MCIDRIVER* lpwmd) ...@@ -489,7 +489,6 @@ static DWORD MCI_LoadMciDriver(LPCSTR _strDevTyp, LPWINE_MCIDRIVER* lpwmd)
wmd->lpfnYieldProc = MCI_DefYieldProc; wmd->lpfnYieldProc = MCI_DefYieldProc;
wmd->dwYieldData = VK_CANCEL; wmd->dwYieldData = VK_CANCEL;
wmd->hCreatorTask = GetCurrentTask();
wmd->CreatorThread = GetCurrentThreadId(); wmd->CreatorThread = GetCurrentThreadId();
EnterCriticalSection(&WINMM_IData->cs); EnterCriticalSection(&WINMM_IData->cs);
......
...@@ -49,6 +49,7 @@ extern LONG CALLBACK MMSYSTEM_CallTo16_long_l (FARPROC16,LONG); ...@@ -49,6 +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 WINE_MMTHREAD* WINMM_GetmmThread(HANDLE16);
static LRESULT MMIO_Callback16(SEGPTR, LPMMIOINFO, UINT, LPARAM, LPARAM); static LRESULT MMIO_Callback16(SEGPTR, LPMMIOINFO, UINT, LPARAM, LPARAM);
/* ################################################### /* ###################################################
...@@ -85,10 +86,12 @@ BOOL WINAPI MMSYSTEM_LibMain(DWORD fdwReason, HINSTANCE hinstDLL, WORD ds, ...@@ -85,10 +86,12 @@ BOOL WINAPI MMSYSTEM_LibMain(DWORD fdwReason, HINSTANCE hinstDLL, WORD ds,
WINMM_IData->h16Module32 = hndl; WINMM_IData->h16Module32 = hndl;
/* hook in our 16 bit function pointers */ /* hook in our 16 bit function pointers */
pFnMmioCallback16 = MMIO_Callback16; pFnMmioCallback16 = MMIO_Callback16;
pFnGetMMThread16 = WINMM_GetmmThread;
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
FreeLibrary(WINMM_IData->h16Module32); FreeLibrary(WINMM_IData->h16Module32);
pFnMmioCallback16 = NULL; pFnMmioCallback16 = NULL;
pFnGetMMThread16 = NULL;
break; break;
case DLL_THREAD_ATTACH: case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH: case DLL_THREAD_DETACH:
...@@ -625,7 +628,7 @@ HTASK16 WINAPI mciGetCreatorTask16(UINT16 uDeviceID) ...@@ -625,7 +628,7 @@ HTASK16 WINAPI mciGetCreatorTask16(UINT16 uDeviceID)
LPWINE_MCIDRIVER wmd; LPWINE_MCIDRIVER wmd;
HTASK16 ret = 0; HTASK16 ret = 0;
if ((wmd = MCI_GetDriver(uDeviceID))) ret = wmd->hCreatorTask; if ((wmd = MCI_GetDriver(uDeviceID))) ret = K32WOWHandle16(wmd->CreatorThread, WOW_TYPE_HTASK);
TRACE("(%u) => %04x\n", uDeviceID, ret); TRACE("(%u) => %04x\n", uDeviceID, ret);
return ret; return ret;
...@@ -1829,6 +1832,18 @@ void WINAPI mmTaskYield16(void) ...@@ -1829,6 +1832,18 @@ void WINAPI mmTaskYield16(void)
extern DWORD WINAPI GetProcessFlags(DWORD); extern DWORD WINAPI GetProcessFlags(DWORD);
/******************************************************************
* WINMM_GetmmThread
*
*
*/
static WINE_MMTHREAD* WINMM_GetmmThread(HANDLE16 h)
{
return (WINE_MMTHREAD*)MapSL( MAKESEGPTR(h, 0) );
}
void WINAPI WINE_mmThreadEntryPoint(DWORD);
/************************************************************************** /**************************************************************************
* mmThreadCreate [MMSYSTEM.1120] * mmThreadCreate [MMSYSTEM.1120]
* *
...@@ -1850,7 +1865,7 @@ LRESULT WINAPI mmThreadCreate16(FARPROC16 fpThreadAddr, LPHANDLE lpHndl, DWORD d ...@@ -1850,7 +1865,7 @@ LRESULT WINAPI mmThreadCreate16(FARPROC16 fpThreadAddr, LPHANDLE lpHndl, DWORD d
if (hndl == 0) { if (hndl == 0) {
ret = 2; ret = 2;
} else { } else {
WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); WINE_MMTHREAD* lpMMThd = WINMM_GetmmThread(hndl);
#if 0 #if 0
/* force mmtask routines even if mmthread is required */ /* force mmtask routines even if mmthread is required */
...@@ -1938,7 +1953,7 @@ void WINAPI mmThreadSignal16(HANDLE16 hndl) ...@@ -1938,7 +1953,7 @@ void WINAPI mmThreadSignal16(HANDLE16 hndl)
TRACE("(%04x)!\n", hndl); TRACE("(%04x)!\n", hndl);
if (hndl) { if (hndl) {
WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); WINE_MMTHREAD* lpMMThd = WINMM_GetmmThread(hndl);
lpMMThd->dwCounter++; lpMMThd->dwCounter++;
if (lpMMThd->hThread != 0) { if (lpMMThd->hThread != 0) {
...@@ -1994,7 +2009,7 @@ void WINAPI mmThreadBlock16(HANDLE16 hndl) ...@@ -1994,7 +2009,7 @@ void WINAPI mmThreadBlock16(HANDLE16 hndl)
TRACE("(%04x)!\n", hndl); TRACE("(%04x)!\n", hndl);
if (hndl) { if (hndl) {
WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); WINE_MMTHREAD* lpMMThd = WINMM_GetmmThread(hndl);
if (lpMMThd->hThread != 0) { if (lpMMThd->hThread != 0) {
DWORD lc; DWORD lc;
...@@ -2019,7 +2034,7 @@ BOOL16 WINAPI mmThreadIsCurrent16(HANDLE16 hndl) ...@@ -2019,7 +2034,7 @@ BOOL16 WINAPI mmThreadIsCurrent16(HANDLE16 hndl)
TRACE("(%04x)!\n", hndl); TRACE("(%04x)!\n", hndl);
if (hndl && mmThreadIsValid16(hndl)) { if (hndl && mmThreadIsValid16(hndl)) {
WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); WINE_MMTHREAD* lpMMThd = WINMM_GetmmThread(hndl);
ret = (GetCurrentThreadId() == lpMMThd->dwThreadID); ret = (GetCurrentThreadId() == lpMMThd->dwThreadID);
} }
TRACE("=> %d\n", ret); TRACE("=> %d\n", ret);
...@@ -2036,7 +2051,7 @@ BOOL16 WINAPI mmThreadIsValid16(HANDLE16 hndl) ...@@ -2036,7 +2051,7 @@ BOOL16 WINAPI mmThreadIsValid16(HANDLE16 hndl)
TRACE("(%04x)!\n", hndl); TRACE("(%04x)!\n", hndl);
if (hndl) { if (hndl) {
WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); WINE_MMTHREAD* lpMMThd = WINMM_GetmmThread(hndl);
if (!IsBadWritePtr(lpMMThd, sizeof(WINE_MMTHREAD)) && if (!IsBadWritePtr(lpMMThd, sizeof(WINE_MMTHREAD)) &&
lpMMThd->dwSignature == WINE_MMTHREAD_CREATED && lpMMThd->dwSignature == WINE_MMTHREAD_CREATED &&
...@@ -2068,19 +2083,19 @@ HANDLE16 WINAPI mmThreadGetTask16(HANDLE16 hndl) ...@@ -2068,19 +2083,19 @@ HANDLE16 WINAPI mmThreadGetTask16(HANDLE16 hndl)
TRACE("(%04x)\n", hndl); TRACE("(%04x)\n", hndl);
if (mmThreadIsValid16(hndl)) { if (mmThreadIsValid16(hndl)) {
WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); WINE_MMTHREAD* lpMMThd = WINMM_GetmmThread(hndl);
ret = lpMMThd->hTask; ret = lpMMThd->hTask;
} }
return ret; return ret;
} }
/************************************************************************** /**************************************************************************
* __wine_mmThreadEntryPoint (MMSYSTEM.2047) * WINE_mmThreadEntryPoint (MMSYSTEM.2047)
*/ */
void WINAPI WINE_mmThreadEntryPoint(DWORD _pmt) void WINAPI WINE_mmThreadEntryPoint(DWORD _pmt)
{ {
HANDLE16 hndl = (HANDLE16)_pmt; HANDLE16 hndl = (HANDLE16)_pmt;
WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(hndl, 0) ); WINE_MMTHREAD* lpMMThd = WINMM_GetmmThread(hndl);
TRACE("(%04x %p)\n", hndl, lpMMThd); TRACE("(%04x %p)\n", hndl, lpMMThd);
......
...@@ -147,7 +147,6 @@ typedef struct tagWINE_MCIDRIVER { ...@@ -147,7 +147,6 @@ typedef struct tagWINE_MCIDRIVER {
YIELDPROC lpfnYieldProc; YIELDPROC lpfnYieldProc;
DWORD dwYieldData; DWORD dwYieldData;
BOOL bIs32; BOOL bIs32;
HTASK16 hCreatorTask;
DWORD CreatorThread; DWORD CreatorThread;
UINT uTypeCmdTable; UINT uTypeCmdTable;
UINT uSpecificCmdTable; UINT uSpecificCmdTable;
...@@ -255,8 +254,6 @@ DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2, ...@@ -255,8 +254,6 @@ DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2,
DWORD MCI_SendCommandFrom32(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2); DWORD MCI_SendCommandFrom32(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2);
DWORD MCI_SendCommandFrom16(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2); DWORD MCI_SendCommandFrom16(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwParam2);
void CALLBACK WINE_mmThreadEntryPoint(DWORD _pmt);
void MMSYSTEM_MMTIME16to32(LPMMTIME mmt32, const MMTIME16* mmt16); void MMSYSTEM_MMTIME16to32(LPMMTIME mmt32, const MMTIME16* mmt16);
void MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16, const MMTIME* mmt32); void MMSYSTEM_MMTIME32to16(LPMMTIME16 mmt16, const MMTIME* mmt32);
...@@ -338,12 +335,13 @@ void CALLBACK MMDRV_WaveOut_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DW ...@@ -338,12 +335,13 @@ void CALLBACK MMDRV_WaveOut_Callback(HDRVR hDev, UINT uMsg, DWORD dwInstance, DW
BOOL MMDRV_GetDescription16(const char* fname, char* buf, int buflen); 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 /* pointers to 16 bit functions (if sibling MMSYSTEM.DLL is loaded
* NULL otherwise * NULL otherwise
*/ */
extern LRESULT (*pFnMmioCallback16)(SEGPTR,LPMMIOINFO,UINT,LPARAM,LPARAM); extern LRESULT (*pFnMmioCallback16)(SEGPTR,LPMMIOINFO,UINT,LPARAM,LPARAM);
extern WINE_MMTHREAD* (*pFnGetMMThread16)(HANDLE16);
/* HANDLE16 -> HANDLE conversions */ /* HANDLE16 -> HANDLE conversions */
#define HDRVR_32(h16) ((HDRVR)(ULONG_PTR)(h16)) #define HDRVR_32(h16) ((HDRVR)(ULONG_PTR)(h16))
......
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