some more winmm 16/32 split (for ROS)

Eric Pouech pouech-eric at wanadoo.fr
Sat Dec 6 14:56:41 CST 2003


Eric Pouech wrote:
> as pointed out by Casper Hornstrup, there were still a couple of thunk 
> lock remaining in 32 bit code. This should take care of it.
> A+
please this one instead (evilish cut & paste)
A+


-- 
Eric Pouech
-------------- next part --------------
Name:          mm16p3
ChangeLog:     - move (again) usage of 16 bit specific functions (thunk lock) to 16 bit code only
License:       X11
GenDate:       2003/12/06 20:54:59 UTC
ModifiedFiles: dlls/winmm/winemm.h dlls/winmm/winmm.c dlls/winmm/mmsystem.c dlls/winmm/time.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/winemm.h,v
retrieving revision 1.50
diff -u -u -r1.50 winemm.h
--- dlls/winmm/winemm.h	2 Dec 2003 03:36:20 -0000	1.50
+++ dlls/winmm/winemm.h	5 Dec 2003 20:55:59 -0000
@@ -305,7 +305,8 @@
 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
  */
Index: dlls/winmm/winmm.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/winmm.c,v
retrieving revision 1.26
diff -u -u -r1.26 winmm.c
--- dlls/winmm/winmm.c	1 Dec 2003 22:38:19 -0000	1.26
+++ dlls/winmm/winmm.c	5 Dec 2003 21:01:57 -0000
@@ -62,6 +62,9 @@
     }
 }
 
+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 @@
     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 @@
 	 * (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",
Index: dlls/winmm/mmsystem.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mmsystem.c,v
retrieving revision 1.103
diff -u -u -r1.103 mmsystem.c
--- dlls/winmm/mmsystem.c	2 Dec 2003 03:36:20 -0000	1.103
+++ dlls/winmm/mmsystem.c	5 Dec 2003 20:55:42 -0000
@@ -53,13 +53,6 @@
 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 @@
 	}
 	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:
Index: dlls/winmm/time.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/time.c,v
retrieving revision 1.23
diff -u -u -r1.23 time.c
--- dlls/winmm/time.c	2 Dec 2003 03:36:20 -0000	1.23
+++ dlls/winmm/time.c	6 Dec 2003 20:54:43 -0000
@@ -348,18 +348,18 @@
     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;
 }


More information about the wine-patches mailing list