winmm 16/32 split (#8)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ChangeLog:
- now only storing thread id for mci tasks (16 bit htask is now gotten
from WOW functions)

A+
--- winmm_7/driver.c	Tue Oct 29 09:54:08 2002
+++ winmm_8/driver.c	Tue Oct 29 12:05:30 2002
@@ -34,6 +34,8 @@
 
 static LPWINE_DRIVER	lpDrvItemList = NULL;
 
+WINE_MMTHREAD* (*pFnGetMMThread16)(HANDLE16 h) /* = NULL */;
+
 /**************************************************************************
  *			DRIVER_GetNumberOfModuleRefs		[internal]
  *
--- winmm_7/mci.c	Tue Oct 29 09:54:08 2002
+++ winmm_8/mci.c	Tue Oct 29 12:19:02 2002
@@ -489,7 +489,6 @@
 
     wmd->lpfnYieldProc = MCI_DefYieldProc;
     wmd->dwYieldData = VK_CANCEL;
-    wmd->hCreatorTask = GetCurrentTask();
     wmd->CreatorThread = GetCurrentThreadId();
 
     EnterCriticalSection(&WINMM_IData->cs);
--- winmm_7/mmsystem.c	Tue Oct 29 12:03:44 2002
+++ winmm_8/mmsystem.c	Tue Oct 29 15:04:10 2002
@@ -49,6 +49,7 @@
 extern LONG CALLBACK MMSYSTEM_CallTo16_long_lwll (LPMMIOPROC16,LONG,WORD,LONG,LONG);
 /* ### stop build ### */
 
+static WINE_MMTHREAD*   WINMM_GetmmThread(HANDLE16);
 static LRESULT          MMIO_Callback16(SEGPTR, LPMMIOINFO, UINT, LPARAM, LPARAM);
 
 /* ###################################################
@@ -85,10 +86,12 @@
 	WINMM_IData->h16Module32 = hndl;
         /* hook in our 16 bit function pointers */
         pFnMmioCallback16 = MMIO_Callback16;
+        pFnGetMMThread16  = WINMM_GetmmThread;
 	break;
     case DLL_PROCESS_DETACH:
 	FreeLibrary(WINMM_IData->h16Module32);
         pFnMmioCallback16 = NULL;
+        pFnGetMMThread16  = NULL;
 	break;
     case DLL_THREAD_ATTACH:
     case DLL_THREAD_DETACH:
@@ -625,7 +628,7 @@
     LPWINE_MCIDRIVER wmd;
     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);
     return ret;
@@ -1829,6 +1832,18 @@
 
 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]
  *
@@ -1850,7 +1865,7 @@
     if (hndl == 0) {
 	ret = 2;
     } else {
-	WINE_MMTHREAD*	lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
+	WINE_MMTHREAD*	lpMMThd = WINMM_GetmmThread(hndl);
 
 #if 0
 	/* force mmtask routines even if mmthread is required */
@@ -1938,7 +1953,7 @@
     TRACE("(%04x)!\n", hndl);
 
     if (hndl) {
-	WINE_MMTHREAD*	lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
+	WINE_MMTHREAD*	lpMMThd = WINMM_GetmmThread(hndl);
 
 	lpMMThd->dwCounter++;
 	if (lpMMThd->hThread != 0) {
@@ -1994,7 +2009,7 @@
     TRACE("(%04x)!\n", hndl);
 
     if (hndl) {
-	WINE_MMTHREAD*	lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
+	WINE_MMTHREAD*	lpMMThd = WINMM_GetmmThread(hndl);
 
 	if (lpMMThd->hThread != 0) {
 	    DWORD	lc;
@@ -2019,7 +2034,7 @@
     TRACE("(%04x)!\n", hndl);
 
     if (hndl && mmThreadIsValid16(hndl)) {
-	WINE_MMTHREAD*	lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
+	WINE_MMTHREAD*	lpMMThd = WINMM_GetmmThread(hndl);
 	ret = (GetCurrentThreadId() == lpMMThd->dwThreadID);
     }
     TRACE("=> %d\n", ret);
@@ -2036,7 +2051,7 @@
     TRACE("(%04x)!\n", hndl);
 
     if (hndl) {
-	WINE_MMTHREAD*	lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
+	WINE_MMTHREAD*	lpMMThd = WINMM_GetmmThread(hndl);
 
 	if (!IsBadWritePtr(lpMMThd, sizeof(WINE_MMTHREAD)) &&
 	    lpMMThd->dwSignature == WINE_MMTHREAD_CREATED &&
@@ -2068,19 +2083,19 @@
     TRACE("(%04x)\n", hndl);
 
     if (mmThreadIsValid16(hndl)) {
-	WINE_MMTHREAD*	lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
+	WINE_MMTHREAD*	lpMMThd = WINMM_GetmmThread(hndl);
 	ret = lpMMThd->hTask;
     }
     return ret;
 }
 
 /**************************************************************************
- * 				__wine_mmThreadEntryPoint (MMSYSTEM.2047)
+ * 			        WINE_mmThreadEntryPoint (MMSYSTEM.2047)
  */
 void WINAPI WINE_mmThreadEntryPoint(DWORD _pmt)
 {
     HANDLE16		hndl = (HANDLE16)_pmt;
-    WINE_MMTHREAD*	lpMMThd = MapSL( MAKESEGPTR(hndl, 0) );
+    WINE_MMTHREAD*	lpMMThd = WINMM_GetmmThread(hndl);
 
     TRACE("(%04x %p)\n", hndl, lpMMThd);
 
--- winmm_7/winemm.h	Tue Oct 29 16:09:10 2002
+++ winmm_8/winemm.h	Tue Oct 29 16:09:24 2002
@@ -147,7 +147,6 @@
         YIELDPROC		lpfnYieldProc;
         DWORD	                dwYieldData;
         BOOL			bIs32;
-        HTASK16			hCreatorTask;
         DWORD                   CreatorThread;
         UINT			uTypeCmdTable;
         UINT			uSpecificCmdTable;
@@ -255,8 +254,6 @@
 DWORD		MCI_SendCommandFrom32(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_MMTIME32to16(LPMMTIME16 mmt16, const MMTIME* mmt32);
 
@@ -338,12 +335,13 @@
 BOOL	MMDRV_GetDescription16(const char* fname, char* buf, int buflen);
 
 /* 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);
+extern LRESULT          (*pFnMmioCallback16)(SEGPTR,LPMMIOINFO,UINT,LPARAM,LPARAM);
+extern WINE_MMTHREAD*   (*pFnGetMMThread16)(HANDLE16);
 
 /* HANDLE16 -> HANDLE conversions */
 #define HDRVR_32(h16)		((HDRVR)(ULONG_PTR)(h16))

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux