winmm split

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

 



before (finally ;-) really splitting the core of the winmm/mmsystem
code, let's first start by moving the largest part of the 16 bit code
(mainly the message mapping) into 16 bit only files
this will be made out of three patches:
mm1632_d: moving driver message mapping out of 32 bit code
mm1632_m: moving MCI message mapping out of 32 bit code
mm1632_l: moving low level multimedia message mapping out of 32 bit code
patches must be applied in the d/m/l order

the attached patch is the d (driver one)

A+
Index: driver.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/driver.c,v
retrieving revision 1.18
diff -u -r1.18 driver.c
--- driver.c	10 Oct 2002 23:28:22 -0000	1.18
+++ driver.c	26 Oct 2002 16:55:28 -0000
@@ -72,128 +72,6 @@
 }
 
 /**************************************************************************
- *				DRIVER_MapMsg32To16		[internal]
- *
- * Map a 32 bit driver message to a 16 bit driver message.
- *  1 : ok, some memory allocated, need to call DRIVER_UnMapMsg32To16
- *  0 : ok, no memory allocated
- * -1 : ko, unknown message
- * -2 : ko, memory problem
- */
-static int DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
-{
-    int	ret = -1;
-
-    switch (wMsg) {
-    case DRV_LOAD:
-    case DRV_ENABLE:
-    case DRV_DISABLE:
-    case DRV_FREE:
-    case DRV_QUERYCONFIGURE:
-    case DRV_REMOVE:
-    case DRV_EXITSESSION:
-    case DRV_EXITAPPLICATION:
-    case DRV_POWER:
-    case DRV_CLOSE:	/* should be 0/0 */
-    case DRV_OPEN:	/* pass through */
-	/* lParam1 and lParam2 are not used */
-	ret = 0;
-	break;
-	break;
-    case DRV_CONFIGURE:
-    case DRV_INSTALL:
-	/* lParam1 is a handle to a window (conf) or to a driver (inst) or not used,
-	 * lParam2 is a pointer to DRVCONFIGINFO
-	 */
-	if (*lParam2) {
-            LPDRVCONFIGINFO16 dci16 = HeapAlloc( GetProcessHeap(), 0, sizeof(*dci16) );
-            LPDRVCONFIGINFO	dci32 = (LPDRVCONFIGINFO)(*lParam2);
-
-	    if (dci16) {
-		LPSTR str1;
-
-		dci16->dwDCISize = sizeof(DRVCONFIGINFO16);
-
-		if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL)
-                {
-		    dci16->lpszDCISectionName = MapLS( str1 );
-		} else {
-		    return -2;
-		}
-		if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL)
-                {
-		    dci16->lpszDCIAliasName = MapLS( str1 );
-		} else {
-		    return -2;
-		}
-	    } else {
-		return -2;
-	    }
-	    *lParam2 = MapLS( dci16 );
-	    ret = 1;
-	} else {
-	    ret = 0;
-	}
-	break;
-    default:
-	if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) {
-	   FIXME("Unknown message 0x%04x\n", wMsg);
-	}
-	ret = 0;
-    }
-    return ret;
-}
-
-/**************************************************************************
- *				DRIVER_UnMapMsg32To16		[internal]
- *
- * UnMap a 32 bit driver message to a 16 bit driver message.
- *  0 : ok
- * -1 : ko
- * -2 : ko, memory problem
- */
-static int DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2)
-{
-    int	ret = -1;
-
-    switch (wMsg) {
-    case DRV_LOAD:
-    case DRV_ENABLE:
-    case DRV_DISABLE:
-    case DRV_FREE:
-    case DRV_QUERYCONFIGURE:
-    case DRV_REMOVE:
-    case DRV_EXITSESSION:
-    case DRV_EXITAPPLICATION:
-    case DRV_POWER:
-    case DRV_OPEN:
-    case DRV_CLOSE:
-	/* lParam1 and lParam2 are not used */
-	break;
-    case DRV_CONFIGURE:
-    case DRV_INSTALL:
-	/* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */
-	if (lParam2) {
-	    LPDRVCONFIGINFO16	dci16 = MapSL(lParam2);
-            HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCISectionName) );
-            HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCIAliasName) );
-            UnMapLS( lParam2 );
-            UnMapLS( dci16->lpszDCISectionName );
-            UnMapLS( dci16->lpszDCIAliasName );
-            HeapFree( GetProcessHeap(), 0, dci16 );
-	}
-	ret = 0;
-	break;
-    default:
-	if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) {
-	    FIXME("Unknown message 0x%04x\n", wMsg);
-	}
-	ret = 0;
-    }
-    return ret;
-}
-
-/**************************************************************************
  *				DRIVER_SendMessage		[internal]
  */
 static LRESULT inline DRIVER_SendMessage(LPWINE_DRIVER lpDrv, UINT msg,
Index: mmsystem.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mmsystem.c,v
retrieving revision 1.74
diff -u -r1.74 mmsystem.c
--- mmsystem.c	25 Oct 2002 19:00:12 -0000	1.74
+++ mmsystem.c	26 Oct 2002 16:57:28 -0000
@@ -2173,6 +2173,120 @@
  */
 
 /**************************************************************************
+ *                              DRIVER_MapMsg32To16             [internal]
+ *
+ * Map a 32 bit driver message to a 16 bit driver message.
+ */
+WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
+{
+    WINMM_MapType       ret = WINMM_MAP_MSGERROR;
+
+    switch (wMsg) {
+    case DRV_LOAD:
+    case DRV_ENABLE:
+    case DRV_DISABLE:
+    case DRV_FREE:
+    case DRV_QUERYCONFIGURE:
+    case DRV_REMOVE:
+    case DRV_EXITSESSION:
+    case DRV_EXITAPPLICATION:
+    case DRV_POWER:
+    case DRV_CLOSE:     /* should be 0/0 */
+    case DRV_OPEN:      /* pass through */
+        /* lParam1 and lParam2 are not used */
+        ret = WINMM_MAP_OK;
+        break;
+    case DRV_CONFIGURE:
+    case DRV_INSTALL:
+        /* lParam1 is a handle to a window (conf) or to a driver (inst) or not used,
+         * lParam2 is a pointer to DRVCONFIGINFO
+         */
+        if (*lParam2) {
+            LPDRVCONFIGINFO16 dci16 = HeapAlloc( GetProcessHeap(), 0, sizeof(*dci16) );
+            LPDRVCONFIGINFO     dci32 = (LPDRVCONFIGINFO)(*lParam2);
+
+            if (dci16) {
+                LPSTR str1;
+
+                dci16->dwDCISize = sizeof(DRVCONFIGINFO16);
+
+                if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL)
+                {
+                    dci16->lpszDCISectionName = MapLS( str1 );
+                } else {
+                    return WINMM_MAP_NOMEM;
+                }
+                if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL)
+                {
+                    dci16->lpszDCIAliasName = MapLS( str1 );
+                } else {
+                    return WINMM_MAP_NOMEM;
+                }
+            } else {
+                return WINMM_MAP_NOMEM;
+            }
+            *lParam2 = MapLS( dci16 );
+            ret = WINMM_MAP_OKMEM;
+        } else {
+            ret = WINMM_MAP_OK;
+        }
+        break;
+    default:
+        if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) {
+           FIXME("Unknown message 0x%04x\n", wMsg);
+        }
+        ret = WINMM_MAP_OK;
+    }
+    return ret;
+}
+
+/**************************************************************************
+ *                              DRIVER_UnMapMsg32To16           [internal]
+ *
+ * UnMap a 32 bit driver message to a 16 bit driver message.
+ */
+WINMM_MapType DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2)
+{
+    WINMM_MapType       ret = WINMM_MAP_MSGERROR;
+
+    switch (wMsg) {
+    case DRV_LOAD:
+    case DRV_ENABLE:
+    case DRV_DISABLE:
+    case DRV_FREE:
+    case DRV_QUERYCONFIGURE:
+    case DRV_REMOVE:
+    case DRV_EXITSESSION:
+    case DRV_EXITAPPLICATION:
+    case DRV_POWER:
+    case DRV_OPEN:
+    case DRV_CLOSE:
+        /* lParam1 and lParam2 are not used */
+        break;
+    case DRV_CONFIGURE:
+    case DRV_INSTALL:
+        /* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */
+        if (lParam2) {
+            LPDRVCONFIGINFO16   dci16 = MapSL(lParam2);
+            HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCISectionName) );
+            HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCIAliasName) );
+            UnMapLS( lParam2 );
+            UnMapLS( dci16->lpszDCISectionName );
+            UnMapLS( dci16->lpszDCIAliasName );
+            HeapFree( GetProcessHeap(), 0, dci16 );
+        }
+        ret = WINMM_MAP_OK;
+        break;
+    default:
+        if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) {
+            FIXME("Unknown message 0x%04x\n", wMsg);
+        }
+        ret = WINMM_MAP_OK;
+    }
+    return ret;
+}
+
+/**************************************************************************
  * 				DrvOpen	       		[MMSYSTEM.1100]
  */
 HDRVR16 WINAPI DrvOpen16(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
Index: winemm.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/winemm.h,v
retrieving revision 1.28
diff -u -r1.28 winemm.h
--- winemm.h	25 Oct 2002 19:00:12 -0000	1.28
+++ winemm.h	26 Oct 2002 16:57:51 -0000
@@ -265,6 +265,10 @@
 void    			TIME_MMTimeStart(void);
 void				TIME_MMTimeStop(void);
 
+/* temporary defines */
+WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2);
+WINMM_MapType DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2);
+
 /* Global variables */
 extern LPWINE_MM_IDATA		WINMM_IData;
 

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

  Powered by Linux