Multimedia "session instance" session for drivers [3/3]

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

 



see previous patch

A+
Name:          mci2load
ChangeLog:     let MCI drivers support the session instance loading mechanism (NULL lParam2 in MCI_OPEN)
License:       X11
GenDate:       2002/05/10 20:51:04 UTC
ModifiedFiles: dlls/winmm/mcianim/mcianim.c dlls/winmm/mciavi/mciavi.c dlls/winmm/mcicda/mcicda.c dlls/winmm/mciseq/mcimidi.c dlls/winmm/mciwave/mciwave.c
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mcianim/mcianim.c,v
retrieving revision 1.11
diff -u -u -r1.11 mcianim.c
--- dlls/winmm/mcianim/mcianim.c	9 Mar 2002 23:44:33 -0000	1.11
+++ dlls/winmm/mcianim/mcianim.c	16 Apr 2002 17:00:49 -0000
@@ -57,7 +57,11 @@
  */
 static	DWORD	MCIANIM_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
 {
-    WINE_MCIANIM*	wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIANIM));
+    WINE_MCIANIM*	wma;
+
+    if (!modp) return 0xFFFFFFFF;
+
+    wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIANIM));
 
     if (!wma)
 	return 0;
@@ -80,7 +84,7 @@
 	HeapFree(GetProcessHeap(), 0, wma);
 	return 1;
     }
-    return 0;
+    return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
 }
 
 /**************************************************************************
@@ -661,7 +665,11 @@
     case DRV_CONFIGURE:		MessageBoxA(0, "Sample MultiMedia Driver !", "Wine Driver", MB_OK); return 1;
     case DRV_INSTALL:		return DRVCNF_RESTART;
     case DRV_REMOVE:		return DRVCNF_RESTART;
-	
+    }
+    
+    if (dwDevID == 0xFFFFFFFF) return MCIERR_UNSUPPORTED_FUNCTION;
+
+    switch (wMsg) {
     case MCI_OPEN_DRIVER:	return MCIANIM_mciOpen(dwDevID, dwParam1, (LPMCI_OPEN_PARMSA)dwParam2); 
     case MCI_CLOSE_DRIVER:	return MCIANIM_mciClose(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
     case MCI_GETDEVCAPS:	return MCIANIM_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2);
Index: dlls/winmm/mciavi/mciavi.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mciavi/mciavi.c,v
retrieving revision 1.10
diff -u -u -r1.10 mciavi.c
--- dlls/winmm/mciavi/mciavi.c	9 Mar 2002 23:44:34 -0000	1.10
+++ dlls/winmm/mciavi/mciavi.c	16 Apr 2002 17:01:48 -0000
@@ -133,9 +133,12 @@
  */
 static	DWORD	MCIAVI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
 {
-    WINE_MCIAVI*	wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIAVI));
+    WINE_MCIAVI*	wma;
     static WCHAR	mciAviWStr[] = {'M','C','I','A','V','I',0};
 
+    if (!modp) return 0xFFFFFFFF;
+
+    wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIAVI));
     if (!wma)
 	return 0;
     
@@ -160,7 +163,7 @@
 	HeapFree(GetProcessHeap(), 0, wma);	
 	return 1;
     }
-    return 0;
+    return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
 }
 
 /**************************************************************************
@@ -947,7 +950,11 @@
     case DRV_CONFIGURE:		return MCIAVI_drvConfigure(dwDevID);
     case DRV_INSTALL:		return DRVCNF_RESTART;
     case DRV_REMOVE:		return DRVCNF_RESTART;
-	
+    }
+    
+    if (dwDevID == 0xFFFFFFFF) return MCIERR_UNSUPPORTED_FUNCTION;
+
+    switch (wMsg) {
     case MCI_OPEN_DRIVER:	return MCIAVI_mciOpen      (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSA)     dwParam2);
     case MCI_CLOSE_DRIVER:	return MCIAVI_mciClose     (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)       dwParam2);
     case MCI_PLAY:		return MCIAVI_mciPlay      (dwDevID, dwParam1, (LPMCI_PLAY_PARMS)          dwParam2);
Index: dlls/winmm/mcicda/mcicda.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mcicda/mcicda.c,v
retrieving revision 1.22
diff -u -u -r1.22 mcicda.c
--- dlls/winmm/mcicda/mcicda.c	9 Mar 2002 23:44:34 -0000	1.22
+++ dlls/winmm/mcicda/mcicda.c	16 Apr 2002 19:08:38 -0000
@@ -59,7 +59,11 @@
  */
 static	DWORD	MCICDA_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
 {
-    WINE_MCICDAUDIO*	wmcda = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,  sizeof(WINE_MCICDAUDIO));
+    WINE_MCICDAUDIO*	wmcda;
+
+    if (!modp) return 0xFFFFFFFF;
+
+    wmcda = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,  sizeof(WINE_MCICDAUDIO));
 
     if (!wmcda)
 	return 0;
@@ -82,7 +86,7 @@
 	HeapFree(GetProcessHeap(), 0, wmcda);
 	mciSetDriverData(dwDevID, 0);
     }
-    return 0;
+    return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
 }
 
 /**************************************************************************
@@ -118,10 +122,10 @@
         {
         case AUDIO_STATUS_IN_PROGRESS:          mode = MCI_MODE_PLAY;   break;
         case AUDIO_STATUS_PAUSED:               mode = MCI_MODE_PAUSE;  break;
+        case AUDIO_STATUS_NO_STATUS:
         case AUDIO_STATUS_PLAY_COMPLETE:        mode = MCI_MODE_STOP;   break;
         case AUDIO_STATUS_PLAY_ERROR:
         case AUDIO_STATUS_NOT_SUPPORTED:
-        case AUDIO_STATUS_NO_STATUS:
         default:
             break;
         }
@@ -953,7 +957,11 @@
     case DRV_CONFIGURE:		MessageBoxA(0, "MCI audio CD driver !", "Wine Driver", MB_OK); return 1;
     case DRV_INSTALL:		return DRVCNF_RESTART;
     case DRV_REMOVE:		return DRVCNF_RESTART;
-	
+    }
+    
+    if (dwDevID == 0xFFFFFFFF) return MCIERR_UNSUPPORTED_FUNCTION;
+
+    switch (wMsg) {
     case MCI_OPEN_DRIVER:	return MCICDA_Open(dwDevID, dwParam1, (LPMCI_OPEN_PARMSA)dwParam2);
     case MCI_CLOSE_DRIVER:	return MCICDA_Close(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
     case MCI_GETDEVCAPS:	return MCICDA_GetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2);
Index: dlls/winmm/mciseq/mcimidi.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mciseq/mcimidi.c,v
retrieving revision 1.14
diff -u -u -r1.14 mcimidi.c
--- dlls/winmm/mciseq/mcimidi.c	9 Mar 2002 23:44:34 -0000	1.14
+++ dlls/winmm/mciseq/mcimidi.c	16 Apr 2002 16:59:32 -0000
@@ -162,7 +162,11 @@
  */
 static	DWORD	MIDI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
 {
-    WINE_MCIMIDI*	wmm = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIMIDI));
+    WINE_MCIMIDI*	wmm;
+
+    if (!modp) return 0xFFFFFFFF;
+
+    wmm = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIMIDI));
 
     if (!wmm)
 	return 0;
@@ -186,7 +190,7 @@
 	mciSetDriverData(dwDevID, 0);
 	return 1;
     }
-    return 0;
+    return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
 }
 
 /**************************************************************************
@@ -958,15 +962,18 @@
 	MIDI_mciReadNextEvent(wmm, mmt); /* FIXME == 0 */
     }
     
+    dwRet = midiOutOpen(&wmm->hMidi, MIDIMAPPER, 0L, 0L, CALLBACK_NULL);
+    /*	dwRet = midiInOpen(&wmm->hMidi, MIDIMAPPER, 0L, 0L, CALLBACK_NULL);*/
+    if (dwRet != MMSYSERR_NOERROR) {
+	return dwRet;
+    }
+
     wmm->dwPulse = 0;
     wmm->dwTempo = 500000;
     wmm->dwStatus = MCI_MODE_PLAY;
     wmm->dwPositionMS = 0;
     wmm->wStartedPlaying = FALSE;
     
-    dwRet = midiOutOpen(&wmm->hMidi, MIDIMAPPER, 0L, 0L, CALLBACK_NULL);
-    /*	dwRet = midiInOpen(&wmm->hMidi, MIDIMAPPER, 0L, 0L, CALLBACK_NULL);*/
-
     while (wmm->dwStatus != MCI_MODE_STOP && wmm->dwStatus != MCI_MODE_NOT_READY) {
 	/* it seems that in case of multi-threading, gcc is optimizing just a little bit 
 	 * too much. Tell gcc not to optimize status value using volatile. 
@@ -1656,6 +1663,11 @@
     case DRV_REMOVE:		return DRVCNF_RESTART;
     case DRV_OPEN:		return MIDI_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
     case DRV_CLOSE:		return MIDI_drvClose(dwDevID);
+    }
+
+    if (dwDevID == 0xFFFFFFFF) return MCIERR_UNSUPPORTED_FUNCTION;
+
+    switch (wMsg) {
     case MCI_OPEN_DRIVER:	return MIDI_mciOpen      (dwDevID, dwParam1, (LPMCI_OPEN_PARMSA)     dwParam2);
     case MCI_CLOSE_DRIVER:	return MIDI_mciClose     (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)   dwParam2);
     case MCI_PLAY:		return MIDI_mciPlay      (dwDevID, dwParam1, (LPMCI_PLAY_PARMS)      dwParam2);
Index: dlls/winmm/mciwave/mciwave.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/winmm/mciwave/mciwave.c,v
retrieving revision 1.20
diff -u -u -r1.20 mciwave.c
--- dlls/winmm/mciwave/mciwave.c	8 Apr 2002 20:10:10 -0000	1.20
+++ dlls/winmm/mciwave/mciwave.c	16 Apr 2002 16:57:47 -0000
@@ -132,7 +131,11 @@
  */
 static	DWORD	WAVE_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
 {
-    WINE_MCIWAVE*	wmw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIWAVE));
+    WINE_MCIWAVE*	wmw;
+
+    if (modp == NULL) return 0xFFFFFFFF;
+
+    wmw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIWAVE));
 
     if (!wmw)
 	return 0;
@@ -165,7 +168,7 @@
 	mciSetDriverData(dwDevID, 0);
 	return 1;
     }
-    return 0;
+    return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
 }
 
 /**************************************************************************
@@ -1584,7 +1625,7 @@
     TRACE("(%08lX, %04X, %08lX, %08lX, %08lX)\n", 
 	  dwDevID, hDriv, wMsg, dwParam1, dwParam2);
     
-    switch(wMsg) {
+    switch (wMsg) {
     case DRV_LOAD:		return 1;
     case DRV_FREE:		return 1;
     case DRV_OPEN:		return WAVE_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
@@ -1595,6 +1636,11 @@
     case DRV_CONFIGURE:		MessageBoxA(0, "Sample MultiMedia Driver !", "OSS Driver", MB_OK);	return 1;
     case DRV_INSTALL:		return DRVCNF_RESTART;
     case DRV_REMOVE:		return DRVCNF_RESTART;
+    }
+
+    if (dwDevID == 0xFFFFFFFF) return MCIERR_UNSUPPORTED_FUNCTION;
+
+    switch (wMsg) {
     case MCI_OPEN_DRIVER:	return WAVE_mciOpen      (dwDevID, dwParam1, (LPMCI_WAVE_OPEN_PARMSA)  dwParam2);
     case MCI_CLOSE_DRIVER:	return WAVE_mciClose     (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)     dwParam2);
     case MCI_CUE:		return WAVE_mciCue       (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)     dwParam2);

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

  Powered by Linux