more 16/32 bit split in winmm (& mmsystem)

Eric Pouech eric.pouech at wanadoo.fr
Thu Oct 10 15:40:25 CDT 2002


TSIA
A+
-------------- next part --------------
Name:          mm1632_2
ChangeLog:     keep on moving 16 bit code out of winmm
License:       X11
GenDate:       2002/10/10 19:58:00 UTC
ModifiedFiles: dlls/winmm/driver.c dlls/winmm/mci.c dlls/winmm/mmsystem.c dlls/winmm/time.c dlls/winmm/winemm.h
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/driver.c,v
retrieving revision 1.17
diff -u -u -r1.17 driver.c
--- dlls/winmm/driver.c	9 Aug 2002 01:02:25 -0000	1.17
+++ dlls/winmm/driver.c	10 Oct 2002 19:08:13 -0000
@@ -565,48 +624,6 @@
 }
 
 /**************************************************************************
- * 				DrvOpen	       		[MMSYSTEM.1100]
- */
-HDRVR16 WINAPI DrvOpen16(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
-{
-    return OpenDriver16(lpDriverName, lpSectionName, lParam);
-}
-
-/**************************************************************************
- * 				DrvClose       		[MMSYSTEM.1101]
- */
-LRESULT WINAPI DrvClose16(HDRVR16 hDrv, LPARAM lParam1, LPARAM lParam2)
-{
-    return CloseDriver16(hDrv, lParam1, lParam2);
-}
-
-/**************************************************************************
- * 				DrvSendMessage		[MMSYSTEM.1102]
- */
-LRESULT WINAPI DrvSendMessage16(HDRVR16 hDrv, WORD msg, LPARAM lParam1,
-				LPARAM lParam2)
-{
-    return SendDriverMessage16(hDrv, msg, lParam1, lParam2);
-}
-
-/**************************************************************************
- * 				DrvGetModuleHandle	[MMSYSTEM.1103]
- */
-HANDLE16 WINAPI DrvGetModuleHandle16(HDRVR16 hDrv)
-{
-    return GetDriverModuleHandle16(hDrv);
-}
-
-/**************************************************************************
- * 				DrvDefDriverProc	[MMSYSTEM.1104]
- */
-LRESULT WINAPI DrvDefDriverProc16(DWORD dwDriverID, HDRVR16 hDrv, WORD wMsg,
-				  DWORD dwParam1, DWORD dwParam2)
-{
-    return DefDriverProc16(dwDriverID, hDrv, wMsg, dwParam1, dwParam2);
-}
-
-/**************************************************************************
  * 				DefDriverProc			  [WINMM.@]
  * 				DrvDefDriverProc		  [WINMM.@]
  */
@@ -627,14 +644,3 @@
     }
 }
 
-/**************************************************************************
- * 				DriverProc			[MMSYSTEM.6]
- */
-LRESULT WINAPI DriverProc16(DWORD dwDevID, HDRVR16 hDrv, WORD wMsg,
-			    DWORD dwParam1, DWORD dwParam2)
-{
-    TRACE("dwDevID=%08lx hDrv=%04x wMsg=%04x dwParam1=%08lx dwParam2=%08lx\n",
-	  dwDevID, hDrv, wMsg, dwParam1, dwParam2);
-
-    return DrvDefDriverProc16(dwDevID, hDrv, wMsg, dwParam1, dwParam2);
-}
Index: dlls/winmm/mci.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mci.c,v
retrieving revision 1.33
diff -u -u -r1.33 mci.c
--- dlls/winmm/mci.c	10 Oct 2002 03:43:53 -0000	1.33
+++ dlls/winmm/mci.c	10 Oct 2002 19:37:39 -0000
@@ -1085,15 +1108,6 @@
 }
 
 /**************************************************************************
- * 				mciSendString			[MMSYSTEM.702]
- */
-DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrRet,
-			     UINT16 uRetLen, HWND16 hwndCallback)
-{
-    return mciSendStringA(lpstrCommand, lpstrRet, uRetLen, HWND_32(hwndCallback));
-}
-
-/**************************************************************************
  * 				mciExecute			[WINMM.@]
  * 				mciExecute			[MMSYSTEM.712]
  */
@@ -1116,52 +1130,6 @@
 }
 
 /**************************************************************************
- *                    	mciLoadCommandResource			[MMSYSTEM.705]
- */
-UINT16 WINAPI mciLoadCommandResource16(HANDLE16 hInst, LPCSTR resname, UINT16 type)
-{
-    HRSRC	        hRsrc = 0;
-    HGLOBAL      	hMem;
-    UINT16		ret = MCI_NO_COMMAND_TABLE;
-    LPWINE_MM_IDATA 	iData = MULTIMEDIA_GetIData();
-
-    TRACE("(%04x, %s, %d)!\n", hInst, resname, type);
-
-    /* if file exists "resname.mci", then load resource "resname" from it
-     * otherwise directly from driver
-     * We don't support it (who uses this feature ?), but we check anyway
-     */
-    if (!type) {
-	char		buf[128];
-	OFSTRUCT       	ofs;
-
-	strcat(strcpy(buf, resname), ".mci");
-	if (OpenFile(buf, &ofs, OF_EXIST) != HFILE_ERROR) {
-	    FIXME("NIY: command table to be loaded from '%s'\n", ofs.szPathName);
-	}
-    }
-    if (!(hRsrc = FindResourceA(hInst, resname, (LPCSTR)RT_RCDATAA))) {
-	WARN("No command table found in resource\n");
-    } else if ((hMem = LoadResource(hInst, hRsrc))) {
-	ret = MCI_SetCommandTable(iData, hMem, type);
-    } else {
-	WARN("Couldn't load resource.\n");
-    }
-    TRACE("=> %04x\n", ret);
-    return ret;
-}
-
-/**************************************************************************
- *                    	mciFreeCommandResource			[MMSYSTEM.713]
- */
-BOOL16 WINAPI mciFreeCommandResource16(UINT16 uTable)
-{
-    TRACE("(%04x)!\n", uTable);
-
-    return MCI_DeleteCommandTable(uTable);
-}
-
-/**************************************************************************
  *                    	mciLoadCommandResource  		[WINMM.@]
  *
  * Strangely, this function only exists as an UNICODE one.
@@ -1175,12 +1143,15 @@
 
     TRACE("(%04x, %s, %d)!\n", hInst, debugstr_w(resNameW), type);
 
-#if 0
-    /* if file exists "resname.mci", then load resource "resname" from it
+    /* if a file named "resname.mci" exits, then load resource "resname" from it
      * otherwise directly from driver
      * We don't support it (who uses this feature ?), but we check anyway
      */
     if (!type) {
+#if 0
+        /* FIXME: we should put this back into order, but I never found a program
+         * actually using this feature, so we not need it
+         */
 	char		buf[128];
 	OFSTRUCT       	ofs;
 
@@ -1188,8 +1159,8 @@
 	if (OpenFile(buf, &ofs, OF_EXIST) != HFILE_ERROR) {
 	    FIXME("NIY: command table to be loaded from '%s'\n", ofs.szPathName);
 	}
-    }
 #endif
+    }
     if (!(hRsrc = FindResourceW(hInst, resNameW, (LPCWSTR)RT_RCDATAA))) {
 	WARN("No command table found in resource\n");
     } else if ((hMem = LoadResource(hInst, hRsrc))) {
@@ -1201,18 +1172,6 @@
     return ret;
 }
 
-#if 0
-    LPSTR 	resNameA;
-    UINT	ret;
-
-    TRACE("(%04x, %s, %d)!\n", hinst, debugstr_w(resNameW), type);
-
-    resNameA = HEAP_strdupWtoA(GetProcessHeap(), 0, resNameW);
-    ret = mciLoadCommandResource16(hinst, resNameA, type);
-    HeapFree(GetProcessHeap(), 0, resNameA);
-    return ret;
-#endif
-
 /**************************************************************************
  *                    	mciFreeCommandResource			[WINMM.@]
  */
Index: dlls/winmm/mmsystem.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mmsystem.c,v
retrieving revision 1.71
diff -u -u -r1.71 mmsystem.c
--- dlls/winmm/mmsystem.c	10 Oct 2002 03:43:53 -0000	1.71
+++ dlls/winmm/mmsystem.c	10 Oct 2002 19:46:44 -0000
@@ -38,6 +38,7 @@
 #include "wine/mmsystem16.h"
 #include "wine/winuser16.h"
 #include "winemm.h"
+#include "heap.h"
 
 #include "wine/debug.h"
 
@@ -2117,3 +2118,162 @@
 {
     OutputDebugStringA( str );
 }
+
+/**************************************************************************
+ * 				DrvOpen	       		[MMSYSTEM.1100]
+ */
+HDRVR16 WINAPI DrvOpen16(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
+{
+    return OpenDriver16(lpDriverName, lpSectionName, lParam);
+}
+
+/**************************************************************************
+ * 				DrvClose       		[MMSYSTEM.1101]
+ */
+LRESULT WINAPI DrvClose16(HDRVR16 hDrv, LPARAM lParam1, LPARAM lParam2)
+{
+    return CloseDriver16(hDrv, lParam1, lParam2);
+}
+
+/**************************************************************************
+ * 				DrvSendMessage		[MMSYSTEM.1102]
+ */
+LRESULT WINAPI DrvSendMessage16(HDRVR16 hDrv, WORD msg, LPARAM lParam1,
+				LPARAM lParam2)
+{
+    return SendDriverMessage16(hDrv, msg, lParam1, lParam2);
+}
+
+/**************************************************************************
+ * 				DrvGetModuleHandle	[MMSYSTEM.1103]
+ */
+HANDLE16 WINAPI DrvGetModuleHandle16(HDRVR16 hDrv)
+{
+    return GetDriverModuleHandle16(hDrv);
+}
+
+/**************************************************************************
+ * 				DrvDefDriverProc	[MMSYSTEM.1104]
+ */
+LRESULT WINAPI DrvDefDriverProc16(DWORD dwDriverID, HDRVR16 hDrv, WORD wMsg,
+				  DWORD dwParam1, DWORD dwParam2)
+{
+    return DefDriverProc16(dwDriverID, hDrv, wMsg, dwParam1, dwParam2);
+}
+
+/**************************************************************************
+ * 				DriverProc			[MMSYSTEM.6]
+ */
+LRESULT WINAPI DriverProc16(DWORD dwDevID, HDRVR16 hDrv, WORD wMsg,
+			    DWORD dwParam1, DWORD dwParam2)
+{
+    TRACE("dwDevID=%08lx hDrv=%04x wMsg=%04x dwParam1=%08lx dwParam2=%08lx\n",
+	  dwDevID, hDrv, wMsg, dwParam1, dwParam2);
+
+    return DrvDefDriverProc16(dwDevID, hDrv, wMsg, dwParam1, dwParam2);
+}
+
+/**************************************************************************
+ * 				timeGetSystemTime	[MMSYSTEM.601]
+ */
+MMRESULT16 WINAPI timeGetSystemTime16(LPMMTIME16 lpTime, UINT16 wSize)
+{
+    TRACE("(%p, %u);\n", lpTime, wSize);
+
+    if (wSize >= sizeof(*lpTime)) {
+	lpTime->wType = TIME_MS;
+	lpTime->u.ms = TIME_MMTimeStart()->mmSysTimeMS;
+
+	TRACE("=> %lu\n", lpTime->u.ms);
+    }
+
+    return 0;
+}
+
+/**************************************************************************
+ * 				timeSetEvent		[MMSYSTEM.602]
+ */
+MMRESULT16 WINAPI timeSetEvent16(UINT16 wDelay, UINT16 wResol, LPTIMECALLBACK16 lpFunc,
+				 DWORD dwUser, UINT16 wFlags)
+{
+    if (wFlags & WINE_TIMER_IS32)
+	WARN("Unknown windows flag... wine internally used.. ooch\n");
+
+    return timeSetEventInternal(wDelay, wResol, (FARPROC16)lpFunc,
+				dwUser, wFlags & ~WINE_TIMER_IS32);
+}
+
+/**************************************************************************
+ * 				timeKillEvent		[MMSYSTEM.603]
+ */
+MMRESULT16 WINAPI timeKillEvent16(UINT16 wID)
+{
+    return timeKillEvent(wID);
+}
+
+/**************************************************************************
+ * 				timeGetDevCaps		[MMSYSTEM.604]
+ */
+MMRESULT16 WINAPI timeGetDevCaps16(LPTIMECAPS16 lpCaps, UINT16 wSize)
+{
+    TIMECAPS    caps;
+    MMRESULT    ret;
+
+    TRACE("(%p, %u) !\n", lpCaps, wSize);
+
+    ret = timeGetDevCaps(&caps, sizeof(caps));
+    lpCaps->wPeriodMin = caps.wPeriodMin;
+    lpCaps->wPeriodMax = caps.wPeriodMax;
+    return 0;
+}
+
+/**************************************************************************
+ * 				timeBeginPeriod	[MMSYSTEM.605]
+ */
+MMRESULT16 WINAPI timeBeginPeriod16(UINT16 wPeriod)
+{
+    TRACE("(%u) !\n", wPeriod);
+
+    return timeBeginPeriod(wPeriod);
+}
+
+/**************************************************************************
+ * 				timeEndPeriod		[MMSYSTEM.606]
+ */
+MMRESULT16 WINAPI timeEndPeriod16(UINT16 wPeriod)
+{
+    TRACE("(%u) !\n", wPeriod);
+
+    return timeEndPeriod(wPeriod);
+}
+
+/**************************************************************************
+ * 				mciSendString			[MMSYSTEM.702]
+ */
+DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrRet,
+			     UINT16 uRetLen, HWND16 hwndCallback)
+{
+    return mciSendStringA(lpstrCommand, lpstrRet, uRetLen, HWND_32(hwndCallback));
+}
+
+/**************************************************************************
+ *                    	mciLoadCommandResource			[MMSYSTEM.705]
+ */
+UINT16 WINAPI mciLoadCommandResource16(HANDLE16 hInst, LPCSTR resname, UINT16 type)
+{
+    LPCWSTR     ptr = HEAP_strdupAtoW(GetProcessHeap(), 0, resname);
+    UINT        ret = mciLoadCommandResource(hInst, ptr, type);
+    HeapFree(GetProcessHeap(), 0, (LPWSTR)ptr);
+    return ret;
+}
+
+/**************************************************************************
+ *                    	mciFreeCommandResource			[MMSYSTEM.713]
+ */
+BOOL16 WINAPI mciFreeCommandResource16(UINT16 uTable)
+{
+    TRACE("(%04x)!\n", uTable);
+
+    return mciFreeCommandResource(uTable);
+}
+
Index: dlls/winmm/time.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/time.c,v
retrieving revision 1.16
diff -u -u -r1.16 time.c
--- dlls/winmm/time.c	17 Aug 2002 00:43:18 -0000	1.16
+++ dlls/winmm/time.c	10 Oct 2002 19:26:06 -0000
@@ -34,10 +34,7 @@
 #include "mmsystem.h"
 #include "windef.h"
 #include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
 
-#include "wine/mmsystem16.h"
 #include "winemm.h"
 
 #include "wine/debug.h"
@@ -237,27 +234,10 @@
 }
 
 /**************************************************************************
- * 				timeGetSystemTime	[MMSYSTEM.601]
- */
-MMRESULT16 WINAPI timeGetSystemTime16(LPMMTIME16 lpTime, UINT16 wSize)
-{
-    TRACE("(%p, %u);\n", lpTime, wSize);
-
-    if (wSize >= sizeof(*lpTime)) {
-	lpTime->wType = TIME_MS;
-	lpTime->u.ms = TIME_MMTimeStart()->mmSysTimeMS;
-
-	TRACE("=> %lu\n", lpTime->u.ms);
-    }
-
-    return 0;
-}
-
-/**************************************************************************
  * 				timeSetEventInternal	[internal]
  */
-static	WORD	timeSetEventInternal(UINT wDelay, UINT wResol,
-				     FARPROC16 lpFunc, DWORD dwUser, UINT wFlags)
+WORD	timeSetEventInternal(UINT wDelay, UINT wResol,
+                             FARPROC16 lpFunc, DWORD dwUser, UINT wFlags)
 {
     WORD 		wNewID = 0;
     LPWINE_TIMERENTRY	lpNewTimer;
@@ -313,19 +293,6 @@
 }
 
 /**************************************************************************
- * 				timeSetEvent		[MMSYSTEM.602]
- */
-MMRESULT16 WINAPI timeSetEvent16(UINT16 wDelay, UINT16 wResol, LPTIMECALLBACK16 lpFunc,
-				 DWORD dwUser, UINT16 wFlags)
-{
-    if (wFlags & WINE_TIMER_IS32)
-	WARN("Unknown windows flag... wine internally used.. ooch\n");
-
-    return timeSetEventInternal(wDelay, wResol, (FARPROC16)lpFunc,
-				dwUser, wFlags & ~WINE_TIMER_IS32);
-}
-
-/**************************************************************************
  * 				timeKillEvent		[WINMM.@]
  */
 MMRESULT WINAPI timeKillEvent(UINT wID)
@@ -359,14 +326,6 @@
 }
 
 /**************************************************************************
- * 				timeKillEvent		[MMSYSTEM.603]
- */
-MMRESULT16 WINAPI timeKillEvent16(UINT16 wID)
-{
-    return timeKillEvent(wID);
-}
-
-/**************************************************************************
  * 				timeGetDevCaps		[WINMM.@]
  */
 MMRESULT WINAPI timeGetDevCaps(LPTIMECAPS lpCaps, UINT wSize)
@@ -379,18 +338,6 @@
 }
 
 /**************************************************************************
- * 				timeGetDevCaps		[MMSYSTEM.604]
- */
-MMRESULT16 WINAPI timeGetDevCaps16(LPTIMECAPS16 lpCaps, UINT16 wSize)
-{
-    TRACE("(%p, %u) !\n", lpCaps, wSize);
-
-    lpCaps->wPeriodMin = MMSYSTIME_MININTERVAL;
-    lpCaps->wPeriodMax = MMSYSTIME_MAXINTERVAL;
-    return 0;
-}
-
-/**************************************************************************
  * 				timeBeginPeriod		[WINMM.@]
  */
 MMRESULT WINAPI timeBeginPeriod(UINT wPeriod)
@@ -403,33 +350,9 @@
 }
 
 /**************************************************************************
- * 				timeBeginPeriod	[MMSYSTEM.605]
- */
-MMRESULT16 WINAPI timeBeginPeriod16(UINT16 wPeriod)
-{
-    TRACE("(%u) !\n", wPeriod);
-
-    if (wPeriod < MMSYSTIME_MININTERVAL || wPeriod > MMSYSTIME_MAXINTERVAL)
-	return TIMERR_NOCANDO;
-    return 0;
-}
-
-/**************************************************************************
  * 				timeEndPeriod		[WINMM.@]
  */
 MMRESULT WINAPI timeEndPeriod(UINT wPeriod)
-{
-    TRACE("(%u) !\n", wPeriod);
-
-    if (wPeriod < MMSYSTIME_MININTERVAL || wPeriod > MMSYSTIME_MAXINTERVAL)
-	return TIMERR_NOCANDO;
-    return 0;
-}
-
-/**************************************************************************
- * 				timeEndPeriod		[MMSYSTEM.606]
- */
-MMRESULT16 WINAPI timeEndPeriod16(UINT16 wPeriod)
 {
     TRACE("(%u) !\n", wPeriod);
 
Index: dlls/winmm/winemm.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/winemm.h,v
retrieving revision 1.22
diff -u -u -r1.22 winemm.h
--- dlls/winmm/winemm.h	10 Oct 2002 03:43:53 -0000	1.22
+++ dlls/winmm/winemm.h	10 Oct 2002 19:22:39 -0000
@@ -233,6 +230,8 @@
 UINT                            MMSYSTEM_waveOpen(HANDLE* lphndl, UINT uDeviceID, UINT uType,
                                                   const LPWAVEFORMATEX lpFormat, DWORD dwCallback, 
                                                   DWORD dwInstance, DWORD dwFlags, BOOL bFrom32);
+WORD	                        timeSetEventInternal(UINT wDelay, UINT wResol,
+                                                     FARPROC16 lpFunc, DWORD dwUser, UINT wFlags);
 
 BOOL				MULTIMEDIA_MciInit(void);
 LPWINE_MM_IDATA			MULTIMEDIA_GetIData(void);


More information about the wine-patches mailing list