Mmsystem API timeGetTime

Eric Pouech pouech-eric at wanadoo.fr
Sun Nov 30 14:06:48 CST 2003


Casper Hornstrup wrote:
> 
>>-----Oprindelig meddelelse-----
>>Fra: Eric Pouech [mailto:pouech-eric at wanadoo.fr] 
>>Sendt: 30. november 2003 16:39
>>Til: Casper Hornstrup
>>Cc: wine-devel at winehq.com
>>Emne: Re: Mmsystem API timeGetTime
>>
>>I see two ways of doing it:
>>- either use a function pointer to ReleaseThunkLock & 
>>RestoreThunkLock 
>>which will be initialized if mmsystem is loaded (as we do for most of 
>>the 16 bit functions we need)
>>- or load by hand these two function with GetProcAddress, and 
>>handle the 
>>case where they are not defined.
>>I'd vote for the first one.
> 
> 
> ReleaseThunkLock and RestoreThunkLock need only be called in
> mmsystem.dll? How about this patch?
not exactly, they need to be called when 16 bit support has been added 
to winmm, not only when called from 16 bit (we also need it if called 
from 32 bit with 16 bit support loaded).
this patch should take care of it.
A+

-- 
Eric Pouech
-------------- next part --------------
Name:          mm16p2
ChangeLog:     - move usage of 16 bit specific functions (MapSL) in 16 bit code only
License:       X11
GenDate:       2003/11/30 20:04:40 UTC
ModifiedFiles: dlls/winmm/winemm.h dlls/winmm/mmsystem.c dlls/winmm/time.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/winemm.h,v
retrieving revision 1.48
diff -u -u -r1.48 winemm.h
--- dlls/winmm/winemm.h	9 Nov 2003 01:19:58 -0000	1.48
+++ dlls/winmm/winemm.h	30 Nov 2003 20:00:13 -0000
@@ -305,7 +305,7 @@
 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);
 /* GetDriverFlags() returned bits is not documented (nor the call itself)
  * Here are Wine only definitions of the bits
  */
Index: dlls/winmm/mmsystem.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mmsystem.c,v
retrieving revision 1.101
diff -u -u -r1.101 mmsystem.c
--- dlls/winmm/mmsystem.c	9 Nov 2003 01:19:58 -0000	1.101
+++ dlls/winmm/mmsystem.c	30 Nov 2003 20:01:50 -0000
@@ -53,6 +53,12 @@
 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                        #
@@ -87,6 +93,7 @@
         pFnCloseDriver16  = DRIVER_CloseDriver16;
         pFnSendMessage16  = DRIVER_SendMessage16;
         pFnMmioCallback16 = MMIO_Callback16;
+        pFnYield16        = MMSYSTEM_Yield;
         MMDRV_Init16();
 	break;
     case DLL_PROCESS_DETACH:
Index: dlls/winmm/time.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/time.c,v
retrieving revision 1.22
diff -u -u -r1.22 time.c
--- dlls/winmm/time.c	9 Nov 2003 01:19:58 -0000	1.22
+++ dlls/winmm/time.c	30 Nov 2003 20:04:12 -0000
@@ -348,6 +348,8 @@
     return 0;
 }
 
+void (*pFnYield16)(void) /* = NULL */;
+
 /**************************************************************************
  * 				timeGetTime    [MMSYSTEM.607]
  * 				timeGetTime    [WINMM.@]
@@ -357,9 +359,7 @@
     /* FIXME: releasing the win16 lock here is a temporary hack (I hope)
      * that lets mciavi.drv run correctly
      */
-    DWORD count;
-    ReleaseThunkLock(&count);
-    RestoreThunkLock(count);
+    if (pFnYield16) pFnYield16();
     TIME_MMTimeStart();
     return WINMM_IData->mmSysTimeMS;
 }


More information about the wine-patches mailing list