Let MCI drivers support the session instance loading mechanism (NULL

lParam2 in MCI_OPEN).
This commit is contained in:
Eric Pouech 2002-05-11 23:02:55 +00:00 committed by Alexandre Julliard
parent 0ef65382b3
commit 8be2e3d489
5 changed files with 62 additions and 18 deletions

View File

@ -57,7 +57,11 @@ typedef struct {
*/ */
static DWORD MCIANIM_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp) 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) if (!wma)
return 0; return 0;
@ -80,7 +84,7 @@ static DWORD MCIANIM_drvClose(DWORD dwDevID)
HeapFree(GetProcessHeap(), 0, wma); HeapFree(GetProcessHeap(), 0, wma);
return 1; return 1;
} }
return 0; return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
} }
/************************************************************************** /**************************************************************************
@ -661,7 +665,11 @@ LONG WINAPI MCIANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case DRV_CONFIGURE: MessageBoxA(0, "Sample MultiMedia Driver !", "Wine Driver", MB_OK); return 1; case DRV_CONFIGURE: MessageBoxA(0, "Sample MultiMedia Driver !", "Wine Driver", MB_OK); return 1;
case DRV_INSTALL: return DRVCNF_RESTART; case DRV_INSTALL: return DRVCNF_RESTART;
case DRV_REMOVE: 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_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_CLOSE_DRIVER: return MCIANIM_mciClose(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
case MCI_GETDEVCAPS: return MCIANIM_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2); case MCI_GETDEVCAPS: return MCIANIM_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2);

View File

@ -133,9 +133,12 @@ BOOL WINAPI MCIAVI_LibMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
*/ */
static DWORD MCIAVI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp) 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}; 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) if (!wma)
return 0; return 0;
@ -160,7 +163,7 @@ static DWORD MCIAVI_drvClose(DWORD dwDevID)
HeapFree(GetProcessHeap(), 0, wma); HeapFree(GetProcessHeap(), 0, wma);
return 1; return 1;
} }
return 0; return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
} }
/************************************************************************** /**************************************************************************
@ -947,7 +950,11 @@ LONG CALLBACK MCIAVI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case DRV_CONFIGURE: return MCIAVI_drvConfigure(dwDevID); case DRV_CONFIGURE: return MCIAVI_drvConfigure(dwDevID);
case DRV_INSTALL: return DRVCNF_RESTART; case DRV_INSTALL: return DRVCNF_RESTART;
case DRV_REMOVE: 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_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_CLOSE_DRIVER: return MCIAVI_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_PLAY: return MCIAVI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2); case MCI_PLAY: return MCIAVI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);

View File

@ -59,7 +59,11 @@ typedef struct {
*/ */
static DWORD MCICDA_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp) 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) if (!wmcda)
return 0; return 0;
@ -82,7 +86,7 @@ static DWORD MCICDA_drvClose(DWORD dwDevID)
HeapFree(GetProcessHeap(), 0, wmcda); HeapFree(GetProcessHeap(), 0, wmcda);
mciSetDriverData(dwDevID, 0); mciSetDriverData(dwDevID, 0);
} }
return 0; return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
} }
/************************************************************************** /**************************************************************************
@ -118,10 +122,10 @@ static DWORD MCICDA_GetStatus(WINE_MCICDAUDIO* wmcda)
{ {
case AUDIO_STATUS_IN_PROGRESS: mode = MCI_MODE_PLAY; break; case AUDIO_STATUS_IN_PROGRESS: mode = MCI_MODE_PLAY; break;
case AUDIO_STATUS_PAUSED: mode = MCI_MODE_PAUSE; 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_COMPLETE: mode = MCI_MODE_STOP; break;
case AUDIO_STATUS_PLAY_ERROR: case AUDIO_STATUS_PLAY_ERROR:
case AUDIO_STATUS_NOT_SUPPORTED: case AUDIO_STATUS_NOT_SUPPORTED:
case AUDIO_STATUS_NO_STATUS:
default: default:
break; break;
} }
@ -953,7 +957,11 @@ LONG CALLBACK MCICDA_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case DRV_CONFIGURE: MessageBoxA(0, "MCI audio CD driver !", "Wine Driver", MB_OK); return 1; case DRV_CONFIGURE: MessageBoxA(0, "MCI audio CD driver !", "Wine Driver", MB_OK); return 1;
case DRV_INSTALL: return DRVCNF_RESTART; case DRV_INSTALL: return DRVCNF_RESTART;
case DRV_REMOVE: 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_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_CLOSE_DRIVER: return MCICDA_Close(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
case MCI_GETDEVCAPS: return MCICDA_GetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2); case MCI_GETDEVCAPS: return MCICDA_GetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2);

View File

@ -162,7 +162,11 @@ static DWORD MIDI_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
*/ */
static DWORD MIDI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp) 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) if (!wmm)
return 0; return 0;
@ -186,7 +190,7 @@ static DWORD MIDI_drvClose(DWORD dwDevID)
mciSetDriverData(dwDevID, 0); mciSetDriverData(dwDevID, 0);
return 1; return 1;
} }
return 0; return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
} }
/************************************************************************** /**************************************************************************
@ -958,15 +962,18 @@ static DWORD MIDI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
MIDI_mciReadNextEvent(wmm, mmt); /* FIXME == 0 */ 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->dwPulse = 0;
wmm->dwTempo = 500000; wmm->dwTempo = 500000;
wmm->dwStatus = MCI_MODE_PLAY; wmm->dwStatus = MCI_MODE_PLAY;
wmm->dwPositionMS = 0; wmm->dwPositionMS = 0;
wmm->wStartedPlaying = FALSE; 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) { 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 /* 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. * too much. Tell gcc not to optimize status value using volatile.
@ -1656,6 +1663,11 @@ LONG CALLBACK MCIMIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case DRV_REMOVE: return DRVCNF_RESTART; case DRV_REMOVE: return DRVCNF_RESTART;
case DRV_OPEN: return MIDI_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2); case DRV_OPEN: return MIDI_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
case DRV_CLOSE: return MIDI_drvClose(dwDevID); 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_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_CLOSE_DRIVER: return MIDI_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_PLAY: return MIDI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2); case MCI_PLAY: return MIDI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);

View File

@ -132,7 +132,11 @@ static DWORD WAVE_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
*/ */
static DWORD WAVE_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp) 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) if (!wmw)
return 0; return 0;
@ -165,7 +169,7 @@ static DWORD WAVE_drvClose(DWORD dwDevID)
mciSetDriverData(dwDevID, 0); mciSetDriverData(dwDevID, 0);
return 1; return 1;
} }
return 0; return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
} }
/************************************************************************** /**************************************************************************
@ -1595,6 +1599,11 @@ LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case DRV_CONFIGURE: MessageBoxA(0, "Sample MultiMedia Driver !", "OSS Driver", MB_OK); return 1; case DRV_CONFIGURE: MessageBoxA(0, "Sample MultiMedia Driver !", "OSS Driver", MB_OK); return 1;
case DRV_INSTALL: return DRVCNF_RESTART; case DRV_INSTALL: return DRVCNF_RESTART;
case DRV_REMOVE: 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_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_CLOSE_DRIVER: return WAVE_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_CUE: return WAVE_mciCue (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2); case MCI_CUE: return WAVE_mciCue (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);