Commit b26cfe76 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Fixed return values for some messages in DriverProc (MCI_GETDEVCAPS &

MCI_STATUS) for mciSendString.
parent 71c7efac
...@@ -47,7 +47,7 @@ static DWORD ANIM_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp) ...@@ -47,7 +47,7 @@ static DWORD ANIM_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
wma->wDevID = modp->wDeviceID; wma->wDevID = modp->wDeviceID;
mciSetDriverData(wma->wDevID, (DWORD)wma); mciSetDriverData(wma->wDevID, (DWORD)wma);
modp->wCustomCommandTable = -1; modp->wCustomCommandTable = MCI_NO_COMMAND_TABLE;
modp->wType = MCI_DEVTYPE_SEQUENCER; modp->wType = MCI_DEVTYPE_SEQUENCER;
return modp->wDeviceID; return modp->wDeviceID;
} }
...@@ -165,6 +165,7 @@ static DWORD ANIM_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, ...@@ -165,6 +165,7 @@ static DWORD ANIM_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
LPMCI_GETDEVCAPS_PARMS lpParms) LPMCI_GETDEVCAPS_PARMS lpParms)
{ {
WINE_MCIANIM* wma = ANIM_mciGetOpenDrv(wDevID); WINE_MCIANIM* wma = ANIM_mciGetOpenDrv(wDevID);
DWORD ret;
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms); TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
...@@ -173,47 +174,61 @@ static DWORD ANIM_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, ...@@ -173,47 +174,61 @@ static DWORD ANIM_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
if (dwFlags & MCI_GETDEVCAPS_ITEM) { if (dwFlags & MCI_GETDEVCAPS_ITEM) {
TRACE("MCI_GETDEVCAPS_ITEM dwItem=%08lX;\n", lpParms->dwItem); TRACE("MCI_GETDEVCAPS_ITEM dwItem=%08lX;\n", lpParms->dwItem);
switch(lpParms->dwItem) { switch(lpParms->dwItem) {
case MCI_GETDEVCAPS_CAN_RECORD: case MCI_GETDEVCAPS_CAN_RECORD:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_HAS_AUDIO: case MCI_GETDEVCAPS_HAS_AUDIO:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_HAS_VIDEO: case MCI_GETDEVCAPS_HAS_VIDEO:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_DEVICE_TYPE: case MCI_GETDEVCAPS_DEVICE_TYPE:
lpParms->dwReturn = MCI_DEVTYPE_ANIMATION; lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_ANIMATION, MCI_DEVTYPE_ANIMATION);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_USES_FILES: case MCI_GETDEVCAPS_USES_FILES:
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_COMPOUND_DEVICE: case MCI_GETDEVCAPS_COMPOUND_DEVICE:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_EJECT: case MCI_GETDEVCAPS_CAN_EJECT:
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_PLAY: case MCI_GETDEVCAPS_CAN_PLAY:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_SAVE: case MCI_GETDEVCAPS_CAN_SAVE:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
default: default:
FIXME("Unknown capability (%08lx) !\n", lpParms->dwItem);
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
} else {
WARN("No GETDEVCAPS_ITEM !\n");
return MCIERR_UNRECOGNIZED_COMMAND;
} }
TRACE("lpParms->dwReturn=%08lX;\n", lpParms->dwReturn); TRACE("lpParms->dwReturn=%08lX;\n", lpParms->dwReturn);
return 0; return ret;
} }
/************************************************************************** /**************************************************************************
* ANIM_CalcTime [internal] * ANIM_CalcTime [internal]
*/ */
static DWORD ANIM_CalcTime(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwFrame) static DWORD ANIM_CalcTime(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwFrame, LPDWORD lpRet)
{ {
DWORD dwTime = 0; DWORD dwTime = 0;
UINT16 wTrack; UINT16 wTrack;
...@@ -226,6 +241,7 @@ static DWORD ANIM_CalcTime(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwFrame) ...@@ -226,6 +241,7 @@ static DWORD ANIM_CalcTime(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwFrame)
switch (dwFormatType) { switch (dwFormatType) {
case MCI_FORMAT_MILLISECONDS: case MCI_FORMAT_MILLISECONDS:
dwTime = dwFrame / ANIMFRAMES_PERSEC * 1000; dwTime = dwFrame / ANIMFRAMES_PERSEC * 1000;
*lpRet = 0;
TRACE("MILLISECONDS %lu\n", dwTime); TRACE("MILLISECONDS %lu\n", dwTime);
break; break;
case MCI_FORMAT_MSF: case MCI_FORMAT_MSF:
...@@ -234,8 +250,8 @@ static DWORD ANIM_CalcTime(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwFrame) ...@@ -234,8 +250,8 @@ static DWORD ANIM_CalcTime(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwFrame)
wFrames = dwFrame - ANIMFRAMES_PERMIN * wMinutes - wFrames = dwFrame - ANIMFRAMES_PERMIN * wMinutes -
ANIMFRAMES_PERSEC * wSeconds; ANIMFRAMES_PERSEC * wSeconds;
dwTime = MCI_MAKE_MSF(wMinutes, wSeconds, wFrames); dwTime = MCI_MAKE_MSF(wMinutes, wSeconds, wFrames);
TRACE("MSF %02u:%02u:%02u -> dwTime=%lu\n", TRACE("MSF %02u:%02u:%02u -> dwTime=%lu\n",wMinutes, wSeconds, wFrames, dwTime);
wMinutes, wSeconds, wFrames, dwTime); *lpRet = MCI_COLONIZED3_RETURN;
break; break;
default: default:
/* unknown format ! force TMSF ! ... */ /* unknown format ! force TMSF ! ... */
...@@ -252,8 +268,8 @@ static DWORD ANIM_CalcTime(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwFrame) ...@@ -252,8 +268,8 @@ static DWORD ANIM_CalcTime(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwFrame)
wFrames = dwFrame - ANIMFRAMES_PERMIN * wMinutes - wFrames = dwFrame - ANIMFRAMES_PERMIN * wMinutes -
ANIMFRAMES_PERSEC * wSeconds; ANIMFRAMES_PERSEC * wSeconds;
dwTime = MCI_MAKE_TMSF(wTrack, wMinutes, wSeconds, wFrames); dwTime = MCI_MAKE_TMSF(wTrack, wMinutes, wSeconds, wFrames);
TRACE("%02u-%02u:%02u:%02u\n", *lpRet = MCI_COLONIZED4_RETURN;
wTrack, wMinutes, wSeconds, wFrames); TRACE("%02u-%02u:%02u:%02u\n", wTrack, wMinutes, wSeconds, wFrames);
break; break;
} }
return dwTime; return dwTime;
...@@ -302,23 +318,22 @@ static DWORD ANIM_CalcFrame(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwTime) ...@@ -302,23 +318,22 @@ static DWORD ANIM_CalcFrame(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwTime)
return dwFrame; return dwFrame;
} }
/************************************************************************** /**************************************************************************
* ANIM_mciInfo [internal] * ANIM_mciInfo [internal]
*/ */
static DWORD ANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpParms) static DWORD ANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpParms)
{ {
WINE_MCIANIM* wma = ANIM_mciGetOpenDrv(wDevID); WINE_MCIANIM* wma = ANIM_mciGetOpenDrv(wDevID);
DWORD ret = 0;
LPSTR str = 0; LPSTR str = 0;
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms); TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL || lpParms->lpstrReturn == NULL) { if (lpParms == NULL || lpParms->lpstrReturn == NULL)
ret = MCIERR_NULL_PARAMETER_BLOCK; return MCIERR_NULL_PARAMETER_BLOCK;
} else if (wma == NULL) {
ret = MCIERR_INVALID_DEVICE_ID; if (wma == NULL)
} else { return MCIERR_INVALID_DEVICE_ID;
TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize); TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
switch(dwFlags) { switch(dwFlags) {
...@@ -333,16 +348,10 @@ static DWORD ANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpPar ...@@ -333,16 +348,10 @@ static DWORD ANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpPar
break; break;
default: default:
WARN("Don't know this info command (%lu)\n", dwFlags); WARN("Don't know this info command (%lu)\n", dwFlags);
ret = MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
}
}
if (str) {
ret = MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
} else {
lpParms->lpstrReturn[0] = 0;
} }
return ret; return MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
} }
/************************************************************************** /**************************************************************************
...@@ -351,6 +360,7 @@ static DWORD ANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpPar ...@@ -351,6 +360,7 @@ static DWORD ANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpPar
static DWORD ANIM_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms) static DWORD ANIM_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
{ {
WINE_MCIANIM* wma = ANIM_mciGetOpenDrv(wDevID); WINE_MCIANIM* wma = ANIM_mciGetOpenDrv(wDevID);
DWORD ret;
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms); TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
...@@ -358,8 +368,8 @@ static DWORD ANIM_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP ...@@ -358,8 +368,8 @@ static DWORD ANIM_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID; if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback), mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
...@@ -368,35 +378,33 @@ static DWORD ANIM_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP ...@@ -368,35 +378,33 @@ static DWORD ANIM_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
case MCI_STATUS_CURRENT_TRACK: case MCI_STATUS_CURRENT_TRACK:
lpParms->dwReturn = wma->nCurTrack; lpParms->dwReturn = wma->nCurTrack;
TRACE("CURRENT_TRACK=%lu!\n", lpParms->dwReturn); TRACE("CURRENT_TRACK=%lu!\n", lpParms->dwReturn);
return 0; break;
case MCI_STATUS_LENGTH: case MCI_STATUS_LENGTH:
if (dwFlags & MCI_TRACK) { if (dwFlags & MCI_TRACK) {
TRACE("MCI_TRACK #%lu LENGTH=??? !\n", TRACE("MCI_TRACK #%lu LENGTH=??? !\n", lpParms->dwTrack);
lpParms->dwTrack);
if (lpParms->dwTrack > wma->nTracks) if (lpParms->dwTrack > wma->nTracks)
return MCIERR_OUTOFRANGE; return MCIERR_OUTOFRANGE;
lpParms->dwReturn = wma->lpdwTrackLen[lpParms->dwTrack]; lpParms->dwReturn = wma->lpdwTrackLen[lpParms->dwTrack];
} }
else else
lpParms->dwReturn = wma->dwTotalLen; lpParms->dwReturn = wma->dwTotalLen;
lpParms->dwReturn = ANIM_CalcTime(wma, wma->dwTimeFormat, lpParms->dwReturn); lpParms->dwReturn = ANIM_CalcTime(wma, wma->dwTimeFormat, lpParms->dwReturn, &ret);
TRACE("LENGTH=%lu !\n", lpParms->dwReturn); TRACE("LENGTH=%lu !\n", lpParms->dwReturn);
return 0; break;
case MCI_STATUS_MODE: case MCI_STATUS_MODE:
lpParms->dwReturn = wma->mode; TRACE("MCI_STATUS_MODE=%04X !\n", wma->mode);
TRACE("MCI_STATUS_MODE=%08lX !\n", lpParms->dwReturn = MAKEMCIRESOURCE(wma->mode, wma->mode);
lpParms->dwReturn); ret = MCI_RESOURCE_RETURNED;
return 0; break;
case MCI_STATUS_MEDIA_PRESENT: case MCI_STATUS_MEDIA_PRESENT:
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
TRACE("MCI_STATUS_MEDIA_PRESENT !\n"); TRACE("MCI_STATUS_MEDIA_PRESENT !\n");
return 0; break;
case MCI_STATUS_NUMBER_OF_TRACKS: case MCI_STATUS_NUMBER_OF_TRACKS:
lpParms->dwReturn = 1; lpParms->dwReturn = 1;
TRACE("MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n", TRACE("MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n", lpParms->dwReturn);
lpParms->dwReturn); break;
if (lpParms->dwReturn == (WORD)-1) return MCIERR_INTERNAL;
return 0;
case MCI_STATUS_POSITION: case MCI_STATUS_POSITION:
lpParms->dwReturn = wma->dwCurFrame; lpParms->dwReturn = wma->dwCurFrame;
if (dwFlags & MCI_STATUS_START) { if (dwFlags & MCI_STATUS_START) {
...@@ -409,25 +417,29 @@ static DWORD ANIM_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP ...@@ -409,25 +417,29 @@ static DWORD ANIM_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
lpParms->dwReturn = wma->lpdwTrackPos[lpParms->dwTrack - 1]; lpParms->dwReturn = wma->lpdwTrackPos[lpParms->dwTrack - 1];
TRACE("get MCI_TRACK #%lu !\n", lpParms->dwTrack); TRACE("get MCI_TRACK #%lu !\n", lpParms->dwTrack);
} }
lpParms->dwReturn = ANIM_CalcTime(wma, wma->dwTimeFormat, lpParms->dwReturn); lpParms->dwReturn = ANIM_CalcTime(wma, wma->dwTimeFormat, lpParms->dwReturn, &ret);
TRACE("MCI_STATUS_POSITION=%08lX !\n", TRACE("MCI_STATUS_POSITION=%08lX !\n", lpParms->dwReturn);
lpParms->dwReturn); break;
return 0;
case MCI_STATUS_READY: case MCI_STATUS_READY:
TRACE("MCI_STATUS_READY !\n"); TRACE("MCI_STATUS_READY !\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
return 0; return 0;
case MCI_STATUS_TIME_FORMAT: case MCI_STATUS_TIME_FORMAT:
TRACE("MCI_STATUS_TIME_FORMAT !\n"); TRACE("MCI_STATUS_TIME_FORMAT !\n");
lpParms->dwReturn = MCI_FORMAT_MILLISECONDS; lpParms->dwReturn = MAKEMCIRESOURCE(MCI_FORMAT_MILLISECONDS, MCI_FORMAT_MILLISECONDS);
TRACE("MCI_STATUS_TIME_FORMAT => %u\n", LOWORD(lpParms->dwReturn));
ret = MCI_RESOURCE_RETURNED;
return 0; return 0;
default: default:
WARN("Unknown command %08lX !\n", lpParms->dwItem); FIXME("Unknown command %08lX !\n", lpParms->dwItem);
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
} else {
WARN("No MCI_STATUS_ITEM !\n");
return MCIERR_UNRECOGNIZED_COMMAND;
} }
WARN("Not MCI_STATUS_ITEM !\n"); return ret;
return 0;
} }
...@@ -478,8 +490,8 @@ static DWORD ANIM_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa ...@@ -478,8 +490,8 @@ static DWORD ANIM_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
wma->mode = MCI_MODE_STOP; wma->mode = MCI_MODE_STOP;
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback), mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
...@@ -497,8 +509,8 @@ static DWORD ANIM_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP ...@@ -497,8 +509,8 @@ static DWORD ANIM_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
wma->mode = MCI_MODE_PAUSE; wma->mode = MCI_MODE_PAUSE;
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback), mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
...@@ -516,8 +528,8 @@ static DWORD ANIM_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lp ...@@ -516,8 +528,8 @@ static DWORD ANIM_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lp
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
wma->mode = MCI_MODE_STOP; wma->mode = MCI_MODE_STOP;
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback), mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
...@@ -537,7 +549,7 @@ static DWORD ANIM_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms ...@@ -537,7 +549,7 @@ static DWORD ANIM_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
wma->mode = MCI_MODE_SEEK; wma->mode = MCI_MODE_SEEK;
switch(dwFlags) { switch (dwFlags) {
case MCI_SEEK_TO_START: case MCI_SEEK_TO_START:
PlayParms.dwFrom = 0; PlayParms.dwFrom = 0;
break; break;
...@@ -552,8 +564,8 @@ static DWORD ANIM_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms ...@@ -552,8 +564,8 @@ static DWORD ANIM_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
if (dwRet != 0) return dwRet; if (dwRet != 0) return dwRet;
dwRet = ANIM_mciStop(wDevID, MCI_WAIT, (LPMCI_GENERIC_PARMS)&PlayParms); dwRet = ANIM_mciStop(wDevID, MCI_WAIT, (LPMCI_GENERIC_PARMS)&PlayParms);
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback), mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
...@@ -569,6 +581,7 @@ static DWORD ANIM_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms) ...@@ -569,6 +581,7 @@ static DWORD ANIM_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
WINE_MCIANIM* wma = ANIM_mciGetOpenDrv(wDevID); WINE_MCIANIM* wma = ANIM_mciGetOpenDrv(wDevID);
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms); TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID; if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
/* /*
...@@ -596,8 +609,7 @@ static DWORD ANIM_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms) ...@@ -596,8 +609,7 @@ static DWORD ANIM_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
if (dwFlags & MCI_SET_ON) return MCIERR_UNSUPPORTED_FUNCTION; if (dwFlags & MCI_SET_ON) return MCIERR_UNSUPPORTED_FUNCTION;
if (dwFlags & MCI_SET_OFF) return MCIERR_UNSUPPORTED_FUNCTION; if (dwFlags & MCI_SET_OFF) return MCIERR_UNSUPPORTED_FUNCTION;
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback), mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
...@@ -610,7 +622,7 @@ static DWORD ANIM_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms) ...@@ -610,7 +622,7 @@ static DWORD ANIM_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
LONG CALLBACK MCIANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, LONG CALLBACK MCIANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
DWORD dwParam1, DWORD dwParam2) DWORD dwParam1, DWORD dwParam2)
{ {
switch(wMsg) { switch (wMsg) {
case DRV_LOAD: return 1; case DRV_LOAD: return 1;
case DRV_FREE: return 1; case DRV_FREE: return 1;
case DRV_OPEN: return ANIM_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2); case DRV_OPEN: return ANIM_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
...@@ -649,14 +661,14 @@ LONG CALLBACK MCIANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, ...@@ -649,14 +661,14 @@ LONG CALLBACK MCIANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_CUT: case MCI_CUT:
case MCI_DELETE: case MCI_DELETE:
case MCI_PASTE: case MCI_PASTE:
WARN("Unsupported command=%s\n", MCI_CommandToString(wMsg)); FIXME("Unsupported message=%s\n", MCI_MessageToString(wMsg));
break; break;
case MCI_OPEN: case MCI_OPEN:
case MCI_CLOSE: case MCI_CLOSE:
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n"); ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
break; break;
default: default:
TRACE("Sending msg=%s to default driver proc\n", MCI_CommandToString(wMsg)); TRACE("Sending msg=%s to default driver proc\n", MCI_MessageToString(wMsg));
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
} }
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
......
...@@ -44,7 +44,7 @@ static DWORD AVI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp) ...@@ -44,7 +44,7 @@ static DWORD AVI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
wma->wDevID = modp->wDeviceID; wma->wDevID = modp->wDeviceID;
mciSetDriverData(wma->wDevID, (DWORD)wma); mciSetDriverData(wma->wDevID, (DWORD)wma);
modp->wCustomCommandTable = -1; modp->wCustomCommandTable = MCI_NO_COMMAND_TABLE;
modp->wType = MCI_DEVTYPE_SEQUENCER; modp->wType = MCI_DEVTYPE_SEQUENCER;
return modp->wDeviceID; return modp->wDeviceID;
} }
...@@ -354,6 +354,7 @@ static DWORD AVI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParm ...@@ -354,6 +354,7 @@ static DWORD AVI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParm
static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA lpParms) static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA lpParms)
{ {
WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID); WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
DWORD ret = 0;
TRACE("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms); TRACE("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
...@@ -376,12 +377,14 @@ static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA ...@@ -376,12 +377,14 @@ static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA
TRACE("MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn); TRACE("MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn);
break; break;
case MCI_STATUS_MODE: case MCI_STATUS_MODE:
lpParms->dwReturn = wma->wStatus; lpParms->dwReturn = MAKEMCIRESOURCE(wma->wStatus, wma->wStatus);
TRACE("MCI_STATUS_MODE => %lu\n", lpParms->dwReturn); ret = MCI_RESOURCE_RETURNED;
TRACE("MCI_STATUS_MODE => %u\n", LOWORD(lpParms->dwReturn));
break; break;
case MCI_STATUS_MEDIA_PRESENT: case MCI_STATUS_MEDIA_PRESENT:
TRACE("MCI_STATUS_MEDIA_PRESENT => TRUE\n"); TRACE("MCI_STATUS_MEDIA_PRESENT => TRUE\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_STATUS_NUMBER_OF_TRACKS: case MCI_STATUS_NUMBER_OF_TRACKS:
lpParms->dwReturn = 3; lpParms->dwReturn = 3;
...@@ -394,15 +397,18 @@ static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA ...@@ -394,15 +397,18 @@ static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA
(dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn); (dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn);
break; break;
case MCI_STATUS_READY: case MCI_STATUS_READY:
lpParms->dwReturn = (wma->wStatus != MCI_MODE_NOT_READY); lpParms->dwReturn = (wma->wStatus == MCI_MODE_NOT_READY) ?
TRACE("MCI_STATUS_READY = %lu\n", lpParms->dwReturn); MAKEMCIRESOURCE(FALSE, MCI_FALSE) : MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
TRACE("MCI_STATUS_READY = %u\n", LOWORD(lpParms->dwReturn));
break; break;
case MCI_STATUS_TIME_FORMAT: case MCI_STATUS_TIME_FORMAT:
lpParms->dwReturn = wma->dwTimeFormat; lpParms->dwReturn = MAKEMCIRESOURCE(wma->dwTimeFormat, wma->dwTimeFormat);
TRACE("MCI_STATUS_TIME_FORMAT => %lu\n", lpParms->dwReturn); TRACE("MCI_STATUS_TIME_FORMAT => %u\n", LOWORD(lpParms->dwReturn));
ret = MCI_RESOURCE_RETURNED;
break; break;
default: default:
WARN("Unknowm command %08lX !\n", lpParms->dwItem); FIXME("Unknowm command %08lX !\n", lpParms->dwItem);
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
} else { } else {
...@@ -415,7 +421,7 @@ static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA ...@@ -415,7 +421,7 @@ static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA
wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
return 0; return ret;
} }
/*************************************************************************** /***************************************************************************
...@@ -424,6 +430,7 @@ static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA ...@@ -424,6 +430,7 @@ static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA
static DWORD AVI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS lpParms) static DWORD AVI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS lpParms)
{ {
WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID); WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
DWORD ret;
TRACE("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms); TRACE("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
...@@ -434,49 +441,58 @@ static DWORD AVI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_P ...@@ -434,49 +441,58 @@ static DWORD AVI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_P
switch (lpParms->dwItem) { switch (lpParms->dwItem) {
case MCI_GETDEVCAPS_DEVICE_TYPE: case MCI_GETDEVCAPS_DEVICE_TYPE:
TRACE("MCI_GETDEVCAPS_DEVICE_TYPE !\n"); TRACE("MCI_GETDEVCAPS_DEVICE_TYPE !\n");
lpParms->dwReturn = MCI_DEVTYPE_DIGITAL_VIDEO; lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_DIGITAL_VIDEO, MCI_DEVTYPE_DIGITAL_VIDEO);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_HAS_AUDIO: case MCI_GETDEVCAPS_HAS_AUDIO:
TRACE("MCI_GETDEVCAPS_HAS_AUDIO !\n"); TRACE("MCI_GETDEVCAPS_HAS_AUDIO !\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_HAS_VIDEO: case MCI_GETDEVCAPS_HAS_VIDEO:
TRACE("MCI_GETDEVCAPS_HAS_VIDEO !\n"); TRACE("MCI_GETDEVCAPS_HAS_VIDEO !\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_USES_FILES: case MCI_GETDEVCAPS_USES_FILES:
TRACE("MCI_GETDEVCAPS_USES_FILES !\n"); TRACE("MCI_GETDEVCAPS_USES_FILES !\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_COMPOUND_DEVICE: case MCI_GETDEVCAPS_COMPOUND_DEVICE:
TRACE("MCI_GETDEVCAPS_COMPOUND_DEVICE !\n"); TRACE("MCI_GETDEVCAPS_COMPOUND_DEVICE !\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_EJECT: case MCI_GETDEVCAPS_CAN_EJECT:
TRACE("MCI_GETDEVCAPS_CAN_EJECT !\n"); TRACE("MCI_GETDEVCAPS_CAN_EJECT !\n");
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_PLAY: case MCI_GETDEVCAPS_CAN_PLAY:
TRACE("MCI_GETDEVCAPS_CAN_PLAY !\n"); TRACE("MCI_GETDEVCAPS_CAN_PLAY !\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_RECORD: case MCI_GETDEVCAPS_CAN_RECORD:
TRACE("MCI_GETDEVCAPS_CAN_RECORD !\n"); TRACE("MCI_GETDEVCAPS_CAN_RECORD !\n");
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_SAVE: case MCI_GETDEVCAPS_CAN_SAVE:
TRACE("MCI_GETDEVCAPS_CAN_SAVE !\n"); TRACE("MCI_GETDEVCAPS_CAN_SAVE !\n");
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
default: default:
TRACE("Unknown capability (%08lx) !\n", lpParms->dwItem); FIXME("Unknown capability (%08lx) !\n", lpParms->dwItem);
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
} else { } else {
TRACE("No GetDevCaps-Item !\n"); WARN("No GetDevCaps-Item !\n");
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
return 0; return ret;
} }
/*************************************************************************** /***************************************************************************
...@@ -484,17 +500,15 @@ static DWORD AVI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_P ...@@ -484,17 +500,15 @@ static DWORD AVI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_P
*/ */
static DWORD AVI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSA lpParms) static DWORD AVI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSA lpParms)
{ {
DWORD ret = 0;
LPSTR str = 0; LPSTR str = 0;
WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID); WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
TRACE("(%04X, %08lX, %p) : stub;\n", wDevID, dwFlags, lpParms); TRACE("(%04X, %08lX, %p) : stub;\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL || lpParms->lpstrReturn == NULL) { if (lpParms == NULL || lpParms->lpstrReturn == NULL)
ret = MCIERR_NULL_PARAMETER_BLOCK; return MCIERR_NULL_PARAMETER_BLOCK;
} else if (wma == NULL) { if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
ret = MCIERR_INVALID_DEVICE_ID;
} else {
TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize); TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
switch (dwFlags) { switch (dwFlags) {
...@@ -513,16 +527,9 @@ static DWORD AVI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSA lpP ...@@ -513,16 +527,9 @@ static DWORD AVI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSA lpP
#endif #endif
default: default:
WARN("Don't know this info command (%lu)\n", dwFlags); WARN("Don't know this info command (%lu)\n", dwFlags);
ret = MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
}
}
if (str) {
ret = MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
} else {
lpParms->lpstrReturn[0] = 0;
} }
return MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
return ret;
} }
/*************************************************************************** /***************************************************************************
...@@ -1018,14 +1025,14 @@ LONG CALLBACK MCIAVI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, ...@@ -1018,14 +1025,14 @@ LONG CALLBACK MCIAVI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_SPIN: case MCI_SPIN:
case MCI_ESCAPE: case MCI_ESCAPE:
WARN("Unsupported command=%s\n", MCI_CommandToString(wMsg)); WARN("Unsupported command=%s\n", MCI_MessageToString(wMsg));
break; break;
case MCI_OPEN: case MCI_OPEN:
case MCI_CLOSE: case MCI_CLOSE:
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n"); FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
break; break;
default: default:
TRACE("Sending msg=%s to default driver proc\n", MCI_CommandToString(wMsg)); TRACE("Sending msg=%s to default driver proc\n", MCI_MessageToString(wMsg));
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
} }
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
......
...@@ -40,7 +40,7 @@ static DWORD CDAUDIO_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp) ...@@ -40,7 +40,7 @@ static DWORD CDAUDIO_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
wmcda->wDevID = modp->wDeviceID; wmcda->wDevID = modp->wDeviceID;
mciSetDriverData(wmcda->wDevID, (DWORD)wmcda); mciSetDriverData(wmcda->wDevID, (DWORD)wmcda);
modp->wCustomCommandTable = -1; modp->wCustomCommandTable = MCI_NO_COMMAND_TABLE;
modp->wType = MCI_DEVTYPE_SEQUENCER; modp->wType = MCI_DEVTYPE_SEQUENCER;
return modp->wDeviceID; return modp->wDeviceID;
} }
...@@ -152,7 +152,7 @@ static DWORD CDAUDIO_CalcFrame(WINE_MCICDAUDIO* wmcda, DWORD dwTime) ...@@ -152,7 +152,7 @@ static DWORD CDAUDIO_CalcFrame(WINE_MCICDAUDIO* wmcda, DWORD dwTime)
/************************************************************************** /**************************************************************************
* CDAUDIO_CalcTime [internal] * CDAUDIO_CalcTime [internal]
*/ */
static DWORD CDAUDIO_CalcTime(WINE_MCICDAUDIO* wmcda, DWORD dwFrame) static DWORD CDAUDIO_CalcTime(WINE_MCICDAUDIO* wmcda, DWORD dwFrame, LPDWORD lpRet)
{ {
DWORD dwTime = 0; DWORD dwTime = 0;
UINT16 wTrack; UINT16 wTrack;
...@@ -166,6 +166,7 @@ static DWORD CDAUDIO_CalcTime(WINE_MCICDAUDIO* wmcda, DWORD dwFrame) ...@@ -166,6 +166,7 @@ static DWORD CDAUDIO_CalcTime(WINE_MCICDAUDIO* wmcda, DWORD dwFrame)
case MCI_FORMAT_MILLISECONDS: case MCI_FORMAT_MILLISECONDS:
dwTime = (dwFrame * 1000) / CDFRAMES_PERSEC; dwTime = (dwFrame * 1000) / CDFRAMES_PERSEC;
TRACE("MILLISECONDS %lu\n", dwTime); TRACE("MILLISECONDS %lu\n", dwTime);
*lpRet = 0;
break; break;
case MCI_FORMAT_MSF: case MCI_FORMAT_MSF:
wMinutes = dwFrame / CDFRAMES_PERMIN; wMinutes = dwFrame / CDFRAMES_PERMIN;
...@@ -174,6 +175,7 @@ static DWORD CDAUDIO_CalcTime(WINE_MCICDAUDIO* wmcda, DWORD dwFrame) ...@@ -174,6 +175,7 @@ static DWORD CDAUDIO_CalcTime(WINE_MCICDAUDIO* wmcda, DWORD dwFrame)
dwTime = MCI_MAKE_MSF(wMinutes, wSeconds, wFrames); dwTime = MCI_MAKE_MSF(wMinutes, wSeconds, wFrames);
TRACE("MSF %02u:%02u:%02u -> dwTime=%lu\n", TRACE("MSF %02u:%02u:%02u -> dwTime=%lu\n",
wMinutes, wSeconds, wFrames, dwTime); wMinutes, wSeconds, wFrames, dwTime);
*lpRet = MCI_COLONIZED3_RETURN;
break; break;
case MCI_FORMAT_TMSF: case MCI_FORMAT_TMSF:
default: default:
...@@ -189,6 +191,7 @@ static DWORD CDAUDIO_CalcTime(WINE_MCICDAUDIO* wmcda, DWORD dwFrame) ...@@ -189,6 +191,7 @@ static DWORD CDAUDIO_CalcTime(WINE_MCICDAUDIO* wmcda, DWORD dwFrame)
wFrames = dwFrame - CDFRAMES_PERMIN * wMinutes - CDFRAMES_PERSEC * wSeconds; wFrames = dwFrame - CDFRAMES_PERMIN * wMinutes - CDFRAMES_PERSEC * wSeconds;
dwTime = MCI_MAKE_TMSF(wTrack, wMinutes, wSeconds, wFrames); dwTime = MCI_MAKE_TMSF(wTrack, wMinutes, wSeconds, wFrames);
TRACE("%02u-%02u:%02u:%02u\n", wTrack, wMinutes, wSeconds, wFrames); TRACE("%02u-%02u:%02u:%02u\n", wTrack, wMinutes, wSeconds, wFrames);
*lpRet = MCI_COLONIZED4_RETURN;
break; break;
} }
return dwTime; return dwTime;
...@@ -281,6 +284,8 @@ static DWORD CDAUDIO_mciClose(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS ...@@ -281,6 +284,8 @@ static DWORD CDAUDIO_mciClose(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS
static DWORD CDAUDIO_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, static DWORD CDAUDIO_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
LPMCI_GETDEVCAPS_PARMS lpParms) LPMCI_GETDEVCAPS_PARMS lpParms)
{ {
DWORD ret = 0;
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms); TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK; if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
...@@ -288,40 +293,53 @@ static DWORD CDAUDIO_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, ...@@ -288,40 +293,53 @@ static DWORD CDAUDIO_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
if (dwFlags & MCI_GETDEVCAPS_ITEM) { if (dwFlags & MCI_GETDEVCAPS_ITEM) {
TRACE("MCI_GETDEVCAPS_ITEM dwItem=%08lX;\n", lpParms->dwItem); TRACE("MCI_GETDEVCAPS_ITEM dwItem=%08lX;\n", lpParms->dwItem);
switch(lpParms->dwItem) { switch (lpParms->dwItem) {
case MCI_GETDEVCAPS_CAN_RECORD: case MCI_GETDEVCAPS_CAN_RECORD:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_HAS_AUDIO: case MCI_GETDEVCAPS_HAS_AUDIO:
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_HAS_VIDEO: case MCI_GETDEVCAPS_HAS_VIDEO:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_DEVICE_TYPE: case MCI_GETDEVCAPS_DEVICE_TYPE:
lpParms->dwReturn = MCI_DEVTYPE_CD_AUDIO; lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_CD_AUDIO, MCI_DEVTYPE_CD_AUDIO);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_USES_FILES: case MCI_GETDEVCAPS_USES_FILES:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_COMPOUND_DEVICE: case MCI_GETDEVCAPS_COMPOUND_DEVICE:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_EJECT: case MCI_GETDEVCAPS_CAN_EJECT:
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_PLAY: case MCI_GETDEVCAPS_CAN_PLAY:
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_SAVE: case MCI_GETDEVCAPS_CAN_SAVE:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
default: default:
ERR("Unsupported %lx devCaps item\n", lpParms->dwItem);
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
} else {
TRACE("No GetDevCaps-Item !\n");
return MCIERR_UNRECOGNIZED_COMMAND;
} }
TRACE("lpParms->dwReturn=%08lX;\n", lpParms->dwReturn); TRACE("lpParms->dwReturn=%08lX;\n", lpParms->dwReturn);
return 0; return ret;
} }
/************************************************************************** /**************************************************************************
...@@ -329,17 +347,15 @@ static DWORD CDAUDIO_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, ...@@ -329,17 +347,15 @@ static DWORD CDAUDIO_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
*/ */
static DWORD CDAUDIO_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpParms) static DWORD CDAUDIO_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpParms)
{ {
DWORD ret = 0;
LPSTR str = 0; LPSTR str = 0;
WINE_MCICDAUDIO* wmcda = CDAUDIO_mciGetOpenDrv(wDevID); WINE_MCICDAUDIO* wmcda = CDAUDIO_mciGetOpenDrv(wDevID);
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms); TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL || lpParms->lpstrReturn == NULL) { if (lpParms == NULL || lpParms->lpstrReturn == NULL)
ret = MCIERR_NULL_PARAMETER_BLOCK; return MCIERR_NULL_PARAMETER_BLOCK;
} else if (wmcda == NULL) { if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
ret = MCIERR_INVALID_DEVICE_ID;
} else {
TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize); TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
switch(dwFlags) { switch(dwFlags) {
...@@ -348,16 +364,9 @@ static DWORD CDAUDIO_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lp ...@@ -348,16 +364,9 @@ static DWORD CDAUDIO_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lp
break; break;
default: default:
WARN("Don't know this info command (%lu)\n", dwFlags); WARN("Don't know this info command (%lu)\n", dwFlags);
ret = MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
}
}
if (str) {
ret = MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
} else {
lpParms->lpstrReturn[0] = 0;
} }
return MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
return ret;
} }
/************************************************************************** /**************************************************************************
...@@ -370,11 +379,9 @@ static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS ...@@ -370,11 +379,9 @@ static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms); TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) { if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
ret = MCIERR_NULL_PARAMETER_BLOCK; if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
} else if (wmcda == NULL) {
ret = MCIERR_INVALID_DEVICE_ID;
} else {
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback); TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback), mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
...@@ -388,7 +395,7 @@ static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS ...@@ -388,7 +395,7 @@ static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS
} }
lpParms->dwReturn = wmcda->wcda.nCurTrack; lpParms->dwReturn = wmcda->wcda.nCurTrack;
TRACE("CURRENT_TRACK=%lu!\n", lpParms->dwReturn); TRACE("CURRENT_TRACK=%lu!\n", lpParms->dwReturn);
return 0; break;
case MCI_STATUS_LENGTH: case MCI_STATUS_LENGTH:
if (wmcda->wcda.nTracks == 0) { if (wmcda->wcda.nTracks == 0) {
if (!CDAUDIO_GetTracksInfo(&wmcda->wcda)) { if (!CDAUDIO_GetTracksInfo(&wmcda->wcda)) {
...@@ -404,28 +411,32 @@ static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS ...@@ -404,28 +411,32 @@ static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS
} else { } else {
lpParms->dwReturn = wmcda->wcda.dwTotalLen; lpParms->dwReturn = wmcda->wcda.dwTotalLen;
} }
lpParms->dwReturn = CDAUDIO_CalcTime(wmcda, lpParms->dwReturn); lpParms->dwReturn = CDAUDIO_CalcTime(wmcda, lpParms->dwReturn, &ret);
TRACE("LENGTH=%lu !\n", lpParms->dwReturn); TRACE("LENGTH=%lu !\n", lpParms->dwReturn);
return 0; break;
case MCI_STATUS_MODE: case MCI_STATUS_MODE:
if (!CDAUDIO_GetCDStatus(&wmcda->wcda)) if (!CDAUDIO_GetCDStatus(&wmcda->wcda))
return CDAUDIO_mciGetError(wmcda); return CDAUDIO_mciGetError(wmcda);
lpParms->dwReturn = CDAUDIO_mciMode(wmcda->wcda.cdaMode); lpParms->dwReturn = CDAUDIO_mciMode(wmcda->wcda.cdaMode);
if (!lpParms->dwReturn) lpParms->dwReturn = wmcda->mciMode; if (!lpParms->dwReturn) lpParms->dwReturn = wmcda->mciMode;
TRACE("MCI_STATUS_MODE=%08lX !\n", lpParms->dwReturn); TRACE("MCI_STATUS_MODE=%08lX !\n", lpParms->dwReturn);
return 0; lpParms->dwReturn = MAKEMCIRESOURCE(lpParms->dwReturn, lpParms->dwReturn);
ret = MCI_RESOURCE_RETURNED;
break;
case MCI_STATUS_MEDIA_PRESENT: case MCI_STATUS_MEDIA_PRESENT:
if (!CDAUDIO_GetCDStatus(&wmcda->wcda)) if (!CDAUDIO_GetCDStatus(&wmcda->wcda))
return CDAUDIO_mciGetError(wmcda); return CDAUDIO_mciGetError(wmcda);
lpParms->dwReturn = (wmcda->wcda.nTracks > 0) ? TRUE : FALSE; lpParms->dwReturn = (wmcda->wcda.nTracks == 0) ?
TRACE("MCI_STATUS_MEDIA_PRESENT =%s!\n", lpParms->dwReturn ? "Y" : "N"); MAKEMCIRESOURCE(FALSE, MCI_FALSE) : MAKEMCIRESOURCE(TRUE, MCI_TRUE);
return 0; TRACE("MCI_STATUS_MEDIA_PRESENT =%s!\n", LOWORD(lpParms->dwReturn) ? "Y" : "N");
ret = MCI_RESOURCE_RETURNED;
break;
case MCI_STATUS_NUMBER_OF_TRACKS: case MCI_STATUS_NUMBER_OF_TRACKS:
lpParms->dwReturn = CDAUDIO_GetNumberOfTracks(&wmcda->wcda); lpParms->dwReturn = CDAUDIO_GetNumberOfTracks(&wmcda->wcda);
TRACE("MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n", lpParms->dwReturn); TRACE("MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n", lpParms->dwReturn);
if (lpParms->dwReturn == (WORD)-1) if (lpParms->dwReturn == (WORD)-1)
return CDAUDIO_mciGetError(wmcda); return CDAUDIO_mciGetError(wmcda);
return 0; break;
case MCI_STATUS_POSITION: case MCI_STATUS_POSITION:
if (!CDAUDIO_GetCDStatus(&wmcda->wcda)) if (!CDAUDIO_GetCDStatus(&wmcda->wcda))
return CDAUDIO_mciGetError(wmcda); return CDAUDIO_mciGetError(wmcda);
...@@ -440,35 +451,40 @@ static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS ...@@ -440,35 +451,40 @@ static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS
lpParms->dwReturn = wmcda->wcda.lpdwTrackPos[lpParms->dwTrack - 1]; lpParms->dwReturn = wmcda->wcda.lpdwTrackPos[lpParms->dwTrack - 1];
TRACE("get MCI_TRACK #%lu !\n", lpParms->dwTrack); TRACE("get MCI_TRACK #%lu !\n", lpParms->dwTrack);
} }
lpParms->dwReturn = CDAUDIO_CalcTime(wmcda, lpParms->dwReturn); lpParms->dwReturn = CDAUDIO_CalcTime(wmcda, lpParms->dwReturn, &ret);
TRACE("MCI_STATUS_POSITION=%08lX !\n", lpParms->dwReturn); TRACE("MCI_STATUS_POSITION=%08lX !\n", lpParms->dwReturn);
return 0; break;
case MCI_STATUS_READY: case MCI_STATUS_READY:
TRACE("MCI_STATUS_READY !\n"); TRACE("MCI_STATUS_READY !\n");
lpParms->dwReturn = (wmcda->wcda.cdaMode != WINE_CDA_DONTKNOW && wmcda->wcda.cdaMode != WINE_CDA_NOTREADY); lpParms->dwReturn = (wmcda->wcda.cdaMode == WINE_CDA_DONTKNOW ||
TRACE("MCI_STATUS_READY=%ld!\n", lpParms->dwReturn); wmcda->wcda.cdaMode == WINE_CDA_NOTREADY) ?
return 0; MAKEMCIRESOURCE(FALSE, MCI_FALSE) : MAKEMCIRESOURCE(TRUE, MCI_TRUE);
TRACE("MCI_STATUS_READY=%u!\n", LOWORD(lpParms->dwReturn));
ret = MCI_RESOURCE_RETURNED;
break;
case MCI_STATUS_TIME_FORMAT: case MCI_STATUS_TIME_FORMAT:
lpParms->dwReturn = wmcda->dwTimeFormat; lpParms->dwReturn = MAKEMCIRESOURCE(wmcda->dwTimeFormat, wmcda->dwTimeFormat);
TRACE("MCI_STATUS_TIME_FORMAT =%08lx!\n", lpParms->dwReturn); TRACE("MCI_STATUS_TIME_FORMAT=%08x!\n", LOWORD(lpParms->dwReturn));
return 0; ret = MCI_RESOURCE_RETURNED;
break;
case MCI_CDA_STATUS_TYPE_TRACK: case MCI_CDA_STATUS_TYPE_TRACK:
if (!(dwFlags & MCI_TRACK)) if (!(dwFlags & MCI_TRACK))
return MCIERR_MISSING_PARAMETER; ret = MCIERR_MISSING_PARAMETER;
if (lpParms->dwTrack > wmcda->wcda.nTracks || lpParms->dwTrack == 0) else if (lpParms->dwTrack > wmcda->wcda.nTracks || lpParms->dwTrack == 0)
return MCIERR_OUTOFRANGE; ret = MCIERR_OUTOFRANGE;
else
lpParms->dwReturn = (wmcda->wcda.lpbTrackFlags[lpParms->dwTrack - 1] & lpParms->dwReturn = (wmcda->wcda.lpbTrackFlags[lpParms->dwTrack - 1] &
CDROM_DATA_TRACK) ? MCI_CDA_TRACK_OTHER : MCI_CDA_TRACK_AUDIO; CDROM_DATA_TRACK) ? MCI_CDA_TRACK_OTHER : MCI_CDA_TRACK_AUDIO;
TRACE("MCI_CDA_STATUS_TYPE_TRACK[%ld]=%08lx\n", lpParms->dwTrack, lpParms->dwReturn); TRACE("MCI_CDA_STATUS_TYPE_TRACK[%ld]=%08lx\n", lpParms->dwTrack, lpParms->dwReturn);
return 0; break;
default: default:
WARN("unknown command %08lX !\n", lpParms->dwItem); FIXME("unknown command %08lX !\n", lpParms->dwItem);
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
} } else {
}
WARN("not MCI_STATUS_ITEM !\n"); WARN("not MCI_STATUS_ITEM !\n");
return 0; }
return ret;
} }
/************************************************************************** /**************************************************************************
...@@ -730,6 +746,7 @@ LONG CALLBACK MCICDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, ...@@ -730,6 +746,7 @@ LONG CALLBACK MCICDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
/* FIXME: I wonder if those two next items are really called ? */ /* FIXME: I wonder if those two next items are really called ? */
case MCI_SET_DOOR_OPEN: return CDAUDIO_mciSetDoor(dwDevID, TRUE); case MCI_SET_DOOR_OPEN: return CDAUDIO_mciSetDoor(dwDevID, TRUE);
case MCI_SET_DOOR_CLOSED: return CDAUDIO_mciSetDoor(dwDevID, FALSE); case MCI_SET_DOOR_CLOSED: return CDAUDIO_mciSetDoor(dwDevID, FALSE);
/* commands that should be supported */
case MCI_LOAD: case MCI_LOAD:
case MCI_SAVE: case MCI_SAVE:
case MCI_FREEZE: case MCI_FREEZE:
...@@ -738,7 +755,6 @@ LONG CALLBACK MCICDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, ...@@ -738,7 +755,6 @@ LONG CALLBACK MCICDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_UNFREEZE: case MCI_UNFREEZE:
case MCI_UPDATE: case MCI_UPDATE:
case MCI_WHERE: case MCI_WHERE:
case MCI_WINDOW:
case MCI_STEP: case MCI_STEP:
case MCI_SPIN: case MCI_SPIN:
case MCI_ESCAPE: case MCI_ESCAPE:
...@@ -746,14 +762,18 @@ LONG CALLBACK MCICDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, ...@@ -746,14 +762,18 @@ LONG CALLBACK MCICDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_CUT: case MCI_CUT:
case MCI_DELETE: case MCI_DELETE:
case MCI_PASTE: case MCI_PASTE:
WARN("Unsupported command=%s\n", MCI_CommandToString(wMsg)); FIXME("Unsupported yet command=%s\n", MCI_MessageToString(wMsg));
break;
/* commands that should report an error */
case MCI_WINDOW:
FIXME("Unsupported command=%s\n", MCI_MessageToString(wMsg));
break; break;
case MCI_OPEN: case MCI_OPEN:
case MCI_CLOSE: case MCI_CLOSE:
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n"); ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
break; break;
default: default:
TRACE("Sending msg=%s to default driver proc\n", MCI_CommandToString(wMsg)); TRACE("Sending msg=%s to default driver proc\n", MCI_MessageToString(wMsg));
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
} }
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
......
...@@ -34,7 +34,7 @@ typedef struct { ...@@ -34,7 +34,7 @@ typedef struct {
WORD wEventLength; /* current length (event) pointed by dwIndex */ WORD wEventLength; /* current length (event) pointed by dwIndex */
WORD wStatus : 1, /* 1 : playing, 0 : done */ WORD wStatus : 1, /* 1 : playing, 0 : done */
wTrackNr : 7, wTrackNr : 7,
wLastCommand : 8; wLastCommand : 8; /* last MIDI command on track */
} MCI_MIDITRACK; } MCI_MIDITRACK;
typedef struct tagWINE_MCIMIDI { typedef struct tagWINE_MCIMIDI {
...@@ -44,7 +44,7 @@ typedef struct tagWINE_MCIMIDI { ...@@ -44,7 +44,7 @@ typedef struct tagWINE_MCIMIDI {
WORD wNotifyDeviceID; /* MCI device ID with a pending notification */ WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
HANDLE16 hCallback; /* Callback handle for pending notification */ HANDLE16 hCallback; /* Callback handle for pending notification */
HMMIO hFile; /* mmio file handle open as Element */ HMMIO hFile; /* mmio file handle open as Element */
MCI_OPEN_PARMSA openParms; LPCSTR lpstrElementName; /* Name of file */
HLOCAL16 hMidiHdr; HLOCAL16 hMidiHdr;
WORD dwStatus; /* one from MCI_MODE_xxxx */ WORD dwStatus; /* one from MCI_MODE_xxxx */
DWORD dwMciTimeFormat; /* One of the supported MCI_FORMAT_xxxx */ DWORD dwMciTimeFormat; /* One of the supported MCI_FORMAT_xxxx */
...@@ -80,7 +80,7 @@ static DWORD MIDI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp) ...@@ -80,7 +80,7 @@ static DWORD MIDI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
wmm->wDevID = modp->wDeviceID; wmm->wDevID = modp->wDeviceID;
mciSetDriverData(wmm->wDevID, (DWORD)wmm); mciSetDriverData(wmm->wDevID, (DWORD)wmm);
modp->wCustomCommandTable = -1; modp->wCustomCommandTable = MCI_NO_COMMAND_TABLE;
modp->wType = MCI_DEVTYPE_SEQUENCER; modp->wType = MCI_DEVTYPE_SEQUENCER;
return modp->wDeviceID; return modp->wDeviceID;
} }
...@@ -619,7 +619,8 @@ static DWORD MIDI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpParm ...@@ -619,7 +619,8 @@ static DWORD MIDI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpParm
} }
TRACE("hFile=%u\n", wmm->hFile); TRACE("hFile=%u\n", wmm->hFile);
memcpy(&wmm->openParms, lpParms, sizeof(MCI_OPEN_PARMSA)); /* FIXME: should I get a strdup() of it instead? */
wmm->lpstrElementName = lpParms->lpstrElementName;
wmm->wNotifyDeviceID = dwDeviceID; wmm->wNotifyDeviceID = dwDeviceID;
wmm->dwStatus = MCI_MODE_NOT_READY; /* while loading file contents */ wmm->dwStatus = MCI_MODE_NOT_READY; /* while loading file contents */
...@@ -775,7 +776,7 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms ...@@ -775,7 +776,7 @@ static DWORD MIDI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID; if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
if (wmm->hFile == 0) { if (wmm->hFile == 0) {
WARN("Can't play: no file '%s' !\n", wmm->openParms.lpstrElementName); WARN("Can't play: no file '%s' !\n", wmm->lpstrElementName);
return MCIERR_FILE_NOT_FOUND; return MCIERR_FILE_NOT_FOUND;
} }
...@@ -1063,8 +1064,7 @@ static DWORD MIDI_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP ...@@ -1063,8 +1064,7 @@ static DWORD MIDI_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP
if (wmm == 0) return MCIERR_INVALID_DEVICE_ID; if (wmm == 0) return MCIERR_INVALID_DEVICE_ID;
if (wmm->hFile == 0) { if (wmm->hFile == 0) {
WARN("Can't find file='%08lx' !\n", WARN("Can't find file='%s' !\n", wmm->lpstrElementName);
(DWORD)wmm->openParms.lpstrElementName);
return MCIERR_FILE_NOT_FOUND; return MCIERR_FILE_NOT_FOUND;
} }
start = 1; end = 99999; start = 1; end = 99999;
...@@ -1246,6 +1246,7 @@ static DWORD MIDI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms) ...@@ -1246,6 +1246,7 @@ static DWORD MIDI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms) static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
{ {
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID); WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
DWORD ret = 0;
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms); TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
...@@ -1272,12 +1273,14 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP ...@@ -1272,12 +1273,14 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
TRACE("MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn); TRACE("MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn);
break; break;
case MCI_STATUS_MODE: case MCI_STATUS_MODE:
lpParms->dwReturn = wmm->dwStatus; TRACE("MCI_STATUS_MODE => %u\n", wmm->dwStatus);
TRACE("MCI_STATUS_MODE => %lu\n", lpParms->dwReturn); lpParms->dwReturn = MAKEMCIRESOURCE(wmm->dwStatus, wmm->dwStatus);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_STATUS_MEDIA_PRESENT: case MCI_STATUS_MEDIA_PRESENT:
TRACE("MCI_STATUS_MEDIA_PRESENT => TRUE\n"); TRACE("MCI_STATUS_MEDIA_PRESENT => TRUE\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_STATUS_NUMBER_OF_TRACKS: case MCI_STATUS_NUMBER_OF_TRACKS:
lpParms->dwReturn = (wmm->wFormat == 2) ? wmm->nTracks : 1; lpParms->dwReturn = (wmm->wFormat == 2) ? wmm->nTracks : 1;
...@@ -1291,12 +1294,15 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP ...@@ -1291,12 +1294,15 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
(dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn); (dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn);
break; break;
case MCI_STATUS_READY: case MCI_STATUS_READY:
lpParms->dwReturn = (wmm->dwStatus != MCI_MODE_NOT_READY); lpParms->dwReturn = (wmm->dwStatus == MCI_MODE_NOT_READY) ?
TRACE("MCI_STATUS_READY = %lu\n", lpParms->dwReturn); MAKEMCIRESOURCE(FALSE, MCI_FALSE) : MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
TRACE("MCI_STATUS_READY = %u\n", LOWORD(lpParms->dwReturn));
break; break;
case MCI_STATUS_TIME_FORMAT: case MCI_STATUS_TIME_FORMAT:
lpParms->dwReturn = wmm->dwMciTimeFormat; lpParms->dwReturn = MAKEMCIRESOURCE(wmm->dwMciTimeFormat, wmm->dwMciTimeFormat);
TRACE("MCI_STATUS_TIME_FORMAT => %lu\n", lpParms->dwReturn); TRACE("MCI_STATUS_TIME_FORMAT => %u\n", LOWORD(lpParms->dwReturn));
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_SEQ_STATUS_DIVTYPE: case MCI_SEQ_STATUS_DIVTYPE:
TRACE("MCI_SEQ_STATUS_DIVTYPE !\n"); TRACE("MCI_SEQ_STATUS_DIVTYPE !\n");
...@@ -1311,6 +1317,8 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP ...@@ -1311,6 +1317,8 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
} else { } else {
lpParms->dwReturn = MCI_SEQ_DIV_PPQN; lpParms->dwReturn = MCI_SEQ_DIV_PPQN;
} }
lpParms->dwReturn = MAKEMCIRESOURCE(lpParms->dwReturn,lpParms->dwReturn);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_SEQ_STATUS_MASTER: case MCI_SEQ_STATUS_MASTER:
TRACE("MCI_SEQ_STATUS_MASTER !\n"); TRACE("MCI_SEQ_STATUS_MASTER !\n");
...@@ -1333,7 +1341,7 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP ...@@ -1333,7 +1341,7 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
lpParms->dwReturn = wmm->dwTempo; lpParms->dwReturn = wmm->dwTempo;
break; break;
default: default:
WARN("Unknowm command %08lX !\n", lpParms->dwItem); FIXME("Unknowm command %08lX !\n", lpParms->dwItem);
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
} else { } else {
...@@ -1345,7 +1353,7 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP ...@@ -1345,7 +1353,7 @@ static DWORD MIDI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback), mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); wmm->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
return 0; return ret;
} }
/************************************************************************** /**************************************************************************
...@@ -1355,6 +1363,7 @@ static DWORD MIDI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, ...@@ -1355,6 +1363,7 @@ static DWORD MIDI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
LPMCI_GETDEVCAPS_PARMS lpParms) LPMCI_GETDEVCAPS_PARMS lpParms)
{ {
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID); WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
DWORD ret;
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms); TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
...@@ -1365,49 +1374,58 @@ static DWORD MIDI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, ...@@ -1365,49 +1374,58 @@ static DWORD MIDI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
switch (lpParms->dwItem) { switch (lpParms->dwItem) {
case MCI_GETDEVCAPS_DEVICE_TYPE: case MCI_GETDEVCAPS_DEVICE_TYPE:
TRACE("MCI_GETDEVCAPS_DEVICE_TYPE !\n"); TRACE("MCI_GETDEVCAPS_DEVICE_TYPE !\n");
lpParms->dwReturn = MCI_DEVTYPE_SEQUENCER; lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_SEQUENCER, MCI_DEVTYPE_SEQUENCER);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_HAS_AUDIO: case MCI_GETDEVCAPS_HAS_AUDIO:
TRACE("MCI_GETDEVCAPS_HAS_AUDIO !\n"); TRACE("MCI_GETDEVCAPS_HAS_AUDIO !\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_HAS_VIDEO: case MCI_GETDEVCAPS_HAS_VIDEO:
TRACE("MCI_GETDEVCAPS_HAS_VIDEO !\n"); TRACE("MCI_GETDEVCAPS_HAS_VIDEO !\n");
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_USES_FILES: case MCI_GETDEVCAPS_USES_FILES:
TRACE("MCI_GETDEVCAPS_USES_FILES !\n"); TRACE("MCI_GETDEVCAPS_USES_FILES !\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_COMPOUND_DEVICE: case MCI_GETDEVCAPS_COMPOUND_DEVICE:
TRACE("MCI_GETDEVCAPS_COMPOUND_DEVICE !\n"); TRACE("MCI_GETDEVCAPS_COMPOUND_DEVICE !\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_EJECT: case MCI_GETDEVCAPS_CAN_EJECT:
TRACE("MCI_GETDEVCAPS_CAN_EJECT !\n"); TRACE("MCI_GETDEVCAPS_CAN_EJECT !\n");
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_PLAY: case MCI_GETDEVCAPS_CAN_PLAY:
TRACE("MCI_GETDEVCAPS_CAN_PLAY !\n"); TRACE("MCI_GETDEVCAPS_CAN_PLAY !\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_RECORD: case MCI_GETDEVCAPS_CAN_RECORD:
TRACE("MCI_GETDEVCAPS_CAN_RECORD !\n"); TRACE("MCI_GETDEVCAPS_CAN_RECORD !\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_SAVE: case MCI_GETDEVCAPS_CAN_SAVE:
TRACE("MCI_GETDEVCAPS_CAN_SAVE !\n"); TRACE("MCI_GETDEVCAPS_CAN_SAVE !\n");
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
default: default:
TRACE("Unknown capability (%08lx) !\n", lpParms->dwItem); FIXME("Unknown capability (%08lx) !\n", lpParms->dwItem);
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
} else { } else {
TRACE("No GetDevCaps-Item !\n"); WARN("No GetDevCaps-Item !\n");
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
return 0; return ret;
} }
/************************************************************************** /**************************************************************************
...@@ -1415,17 +1433,15 @@ static DWORD MIDI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, ...@@ -1415,17 +1433,15 @@ static DWORD MIDI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
*/ */
static DWORD MIDI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms) static DWORD MIDI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
{ {
DWORD ret = 0; LPCSTR str = 0;
LPSTR str = 0;
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID); WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms); TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL || lpParms->lpstrReturn == NULL) { if (lpParms == NULL || lpParms->lpstrReturn == NULL)
ret = MCIERR_NULL_PARAMETER_BLOCK; return MCIERR_NULL_PARAMETER_BLOCK;
} else if (wmm == NULL) { if (wmm == NULL) return MCIERR_INVALID_DEVICE_ID;
ret = MCIERR_INVALID_DEVICE_ID;
} else {
TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize); TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
switch (dwFlags) { switch (dwFlags) {
...@@ -1433,7 +1449,7 @@ static DWORD MIDI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParm ...@@ -1433,7 +1449,7 @@ static DWORD MIDI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParm
str = "Wine's MIDI sequencer"; str = "Wine's MIDI sequencer";
break; break;
case MCI_INFO_FILE: case MCI_INFO_FILE:
str = wmm->openParms.lpstrElementName; str = wmm->lpstrElementName;
break; break;
#if 0 #if 0
/* FIXME: the following manifest constants are not defined in <WINE>/include/mmsystem.h */ /* FIXME: the following manifest constants are not defined in <WINE>/include/mmsystem.h */
...@@ -1444,16 +1460,9 @@ static DWORD MIDI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParm ...@@ -1444,16 +1460,9 @@ static DWORD MIDI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParm
#endif #endif
default: default:
WARN("Don't know this info command (%lu)\n", dwFlags); WARN("Don't know this info command (%lu)\n", dwFlags);
ret = MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
}
}
if (str) {
ret = MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
} else {
lpParms->lpstrReturn[0] = 0;
} }
return MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
return ret;
} }
/************************************************************************** /**************************************************************************
...@@ -1546,6 +1555,7 @@ LONG CALLBACK MCIMIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, ...@@ -1546,6 +1555,7 @@ LONG CALLBACK MCIMIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_INFO: case MCI_INFO:
case MCI_SEEK: case MCI_SEEK:
#endif #endif
/* commands that should be supported */
case MCI_LOAD: case MCI_LOAD:
case MCI_SAVE: case MCI_SAVE:
case MCI_FREEZE: case MCI_FREEZE:
...@@ -1554,7 +1564,6 @@ LONG CALLBACK MCIMIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, ...@@ -1554,7 +1564,6 @@ LONG CALLBACK MCIMIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_UNFREEZE: case MCI_UNFREEZE:
case MCI_UPDATE: case MCI_UPDATE:
case MCI_WHERE: case MCI_WHERE:
case MCI_WINDOW:
case MCI_STEP: case MCI_STEP:
case MCI_SPIN: case MCI_SPIN:
case MCI_ESCAPE: case MCI_ESCAPE:
...@@ -1562,14 +1571,18 @@ LONG CALLBACK MCIMIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, ...@@ -1562,14 +1571,18 @@ LONG CALLBACK MCIMIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_CUT: case MCI_CUT:
case MCI_DELETE: case MCI_DELETE:
case MCI_PASTE: case MCI_PASTE:
WARN("Unsupported command=%s\n", MCI_CommandToString(wMsg)); WARN("Unsupported command=%s\n", MCI_MessageToString(wMsg));
break;
/* commands that should report an error */
case MCI_WINDOW:
FIXME("Unsupported command=%s\n", MCI_MessageToString(wMsg));
break; break;
case MCI_OPEN: case MCI_OPEN:
case MCI_CLOSE: case MCI_CLOSE:
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n"); FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
break; break;
default: default:
TRACE("Sending msg=%s to default driver proc\n", MCI_CommandToString(wMsg)); TRACE("Sending msg=%s to default driver proc\n", MCI_MessageToString(wMsg));
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
} }
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
......
...@@ -60,7 +60,7 @@ static DWORD WAVE_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp) ...@@ -60,7 +60,7 @@ static DWORD WAVE_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
wmw->wDevID = modp->wDeviceID; wmw->wDevID = modp->wDeviceID;
mciSetDriverData(wmw->wDevID, (DWORD)wmw); mciSetDriverData(wmw->wDevID, (DWORD)wmw);
modp->wCustomCommandTable = -1; modp->wCustomCommandTable = MCI_NO_COMMAND_TABLE;
modp->wType = MCI_DEVTYPE_WAVEFORM_AUDIO; modp->wType = MCI_DEVTYPE_WAVEFORM_AUDIO;
return modp->wDeviceID; return modp->wDeviceID;
} }
...@@ -94,7 +94,10 @@ static WINE_MCIWAVE* WAVE_mciGetOpenDev(UINT16 wDevID) ...@@ -94,7 +94,10 @@ static WINE_MCIWAVE* WAVE_mciGetOpenDev(UINT16 wDevID)
return wmw; return wmw;
} }
static DWORD WAVE_ConvertByteToTimeFormat(WINE_MCIWAVE* wmw, DWORD val) /**************************************************************************
* WAVE_ConvertByteToTimeFormat [internal]
*/
static DWORD WAVE_ConvertByteToTimeFormat(WINE_MCIWAVE* wmw, DWORD val, LPDWORD lpRet)
{ {
DWORD ret = 0; DWORD ret = 0;
...@@ -112,9 +115,13 @@ static DWORD WAVE_ConvertByteToTimeFormat(WINE_MCIWAVE* wmw, DWORD val) ...@@ -112,9 +115,13 @@ static DWORD WAVE_ConvertByteToTimeFormat(WINE_MCIWAVE* wmw, DWORD val)
WARN("Bad time format %lu!\n", wmw->dwMciTimeFormat); WARN("Bad time format %lu!\n", wmw->dwMciTimeFormat);
} }
TRACE("val=%lu=0x%08lx [tf=%lu] => ret=%lu\n", val, val, wmw->dwMciTimeFormat, ret); TRACE("val=%lu=0x%08lx [tf=%lu] => ret=%lu\n", val, val, wmw->dwMciTimeFormat, ret);
*lpRet = 0;
return ret; return ret;
} }
/**************************************************************************
* WAVE_ConvertTimeFormatToByte [internal]
*/
static DWORD WAVE_ConvertTimeFormatToByte(WINE_MCIWAVE* wmw, DWORD val) static DWORD WAVE_ConvertTimeFormatToByte(WINE_MCIWAVE* wmw, DWORD val)
{ {
DWORD ret = 0; DWORD ret = 0;
...@@ -136,6 +143,9 @@ static DWORD WAVE_ConvertTimeFormatToByte(WINE_MCIWAVE* wmw, DWORD val) ...@@ -136,6 +143,9 @@ static DWORD WAVE_ConvertTimeFormatToByte(WINE_MCIWAVE* wmw, DWORD val)
return ret; return ret;
} }
/**************************************************************************
* WAVE_mciReadFmt [internal]
*/
static DWORD WAVE_mciReadFmt(WINE_MCIWAVE* wmw, MMCKINFO* pckMainRIFF) static DWORD WAVE_mciReadFmt(WINE_MCIWAVE* wmw, MMCKINFO* pckMainRIFF)
{ {
MMCKINFO mmckInfo; MMCKINFO mmckInfo;
...@@ -741,6 +751,7 @@ static DWORD WAVE_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms) ...@@ -741,6 +751,7 @@ static DWORD WAVE_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms) static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
{ {
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID); WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
DWORD ret;
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms); TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK; if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
...@@ -754,16 +765,18 @@ static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP ...@@ -754,16 +765,18 @@ static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
break; break;
case MCI_STATUS_LENGTH: case MCI_STATUS_LENGTH:
/* only one track in file is currently handled, so don't take care of MCI_TRACK flag */ /* only one track in file is currently handled, so don't take care of MCI_TRACK flag */
lpParms->dwReturn = WAVE_ConvertByteToTimeFormat(wmw, wmw->dwLength); lpParms->dwReturn = WAVE_ConvertByteToTimeFormat(wmw, wmw->dwLength, &ret);
TRACE("MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn); TRACE("MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn);
break; break;
case MCI_STATUS_MODE: case MCI_STATUS_MODE:
lpParms->dwReturn = wmw->dwStatus; TRACE("MCI_STATUS_MODE => %u\n", wmw->dwStatus);
TRACE("MCI_STATUS_MODE => %lu\n", lpParms->dwReturn); lpParms->dwReturn = MAKEMCIRESOURCE(wmw->dwStatus, wmw->dwStatus);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_STATUS_MEDIA_PRESENT: case MCI_STATUS_MEDIA_PRESENT:
TRACE("MCI_STATUS_MEDIA_PRESENT => TRUE!\n"); TRACE("MCI_STATUS_MEDIA_PRESENT => TRUE!\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_STATUS_NUMBER_OF_TRACKS: case MCI_STATUS_NUMBER_OF_TRACKS:
/* only one track in file is currently handled, so don't take care of MCI_TRACK flag */ /* only one track in file is currently handled, so don't take care of MCI_TRACK flag */
...@@ -773,17 +786,21 @@ static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP ...@@ -773,17 +786,21 @@ static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
case MCI_STATUS_POSITION: case MCI_STATUS_POSITION:
/* only one track in file is currently handled, so don't take care of MCI_TRACK flag */ /* only one track in file is currently handled, so don't take care of MCI_TRACK flag */
lpParms->dwReturn = WAVE_ConvertByteToTimeFormat(wmw, lpParms->dwReturn = WAVE_ConvertByteToTimeFormat(wmw,
(dwFlags & MCI_STATUS_START) ? 0 : wmw->dwPosition); (dwFlags & MCI_STATUS_START) ? 0 : wmw->dwPosition,
&ret);
TRACE("MCI_STATUS_POSITION %s => %lu\n", TRACE("MCI_STATUS_POSITION %s => %lu\n",
(dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn); (dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn);
break; break;
case MCI_STATUS_READY: case MCI_STATUS_READY:
lpParms->dwReturn = (wmw->dwStatus != MCI_MODE_NOT_READY); lpParms->dwReturn = (wmw->dwStatus == MCI_MODE_NOT_READY) ?
TRACE("MCI_STATUS_READY => %lu!\n", lpParms->dwReturn); MAKEMCIRESOURCE(FALSE, MCI_FALSE) : MAKEMCIRESOURCE(TRUE, MCI_TRUE);
TRACE("MCI_STATUS_READY => %u!\n", LOWORD(lpParms->dwReturn));
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_STATUS_TIME_FORMAT: case MCI_STATUS_TIME_FORMAT:
lpParms->dwReturn = wmw->dwMciTimeFormat; lpParms->dwReturn = MAKEMCIRESOURCE(wmw->dwMciTimeFormat, wmw->dwMciTimeFormat);
TRACE("MCI_STATUS_TIME_FORMAT => %lu\n", lpParms->dwReturn); TRACE("MCI_STATUS_TIME_FORMAT => %lu\n", lpParms->dwReturn);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_WAVE_INPUT: case MCI_WAVE_INPUT:
TRACE("MCI_WAVE_INPUT !\n"); TRACE("MCI_WAVE_INPUT !\n");
...@@ -831,7 +848,7 @@ static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP ...@@ -831,7 +848,7 @@ static DWORD WAVE_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpP
mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback), mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
wmw->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); wmw->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
return 0; return ret;
} }
/************************************************************************** /**************************************************************************
...@@ -841,6 +858,7 @@ static DWORD WAVE_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, ...@@ -841,6 +858,7 @@ static DWORD WAVE_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
LPMCI_GETDEVCAPS_PARMS lpParms) LPMCI_GETDEVCAPS_PARMS lpParms)
{ {
WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID); WINE_MCIWAVE* wmw = WAVE_mciGetOpenDev(wDevID);
DWORD ret = 0;
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms); TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
...@@ -850,31 +868,40 @@ static DWORD WAVE_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, ...@@ -850,31 +868,40 @@ static DWORD WAVE_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
if (dwFlags & MCI_GETDEVCAPS_ITEM) { if (dwFlags & MCI_GETDEVCAPS_ITEM) {
switch(lpParms->dwItem) { switch(lpParms->dwItem) {
case MCI_GETDEVCAPS_DEVICE_TYPE: case MCI_GETDEVCAPS_DEVICE_TYPE:
lpParms->dwReturn = MCI_DEVTYPE_WAVEFORM_AUDIO; lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_WAVEFORM_AUDIO, MCI_DEVTYPE_WAVEFORM_AUDIO);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_HAS_AUDIO: case MCI_GETDEVCAPS_HAS_AUDIO:
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_HAS_VIDEO: case MCI_GETDEVCAPS_HAS_VIDEO:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_USES_FILES: case MCI_GETDEVCAPS_USES_FILES:
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_COMPOUND_DEVICE: case MCI_GETDEVCAPS_COMPOUND_DEVICE:
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_RECORD: case MCI_GETDEVCAPS_CAN_RECORD:
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_EJECT: case MCI_GETDEVCAPS_CAN_EJECT:
lpParms->dwReturn = FALSE; lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_PLAY: case MCI_GETDEVCAPS_CAN_PLAY:
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_GETDEVCAPS_CAN_SAVE: case MCI_GETDEVCAPS_CAN_SAVE:
lpParms->dwReturn = TRUE; lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
ret = MCI_RESOURCE_RETURNED;
break; break;
case MCI_WAVE_GETDEVCAPS_INPUTS: case MCI_WAVE_GETDEVCAPS_INPUTS:
lpParms->dwReturn = 1; lpParms->dwReturn = 1;
...@@ -883,11 +910,14 @@ static DWORD WAVE_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, ...@@ -883,11 +910,14 @@ static DWORD WAVE_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
lpParms->dwReturn = 1; lpParms->dwReturn = 1;
break; break;
default: default:
TRACE("Unknown capability (%08lx) !\n", lpParms->dwItem); FIXME("Unknown capability (%08lx) !\n", lpParms->dwItem);
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
} else {
WARN("No GetDevCaps-Item !\n");
return MCIERR_UNRECOGNIZED_COMMAND;
} }
return 0; return ret;
} }
/************************************************************************** /**************************************************************************
...@@ -972,6 +1002,7 @@ LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, ...@@ -972,6 +1002,7 @@ LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_GETDEVCAPS: return WAVE_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2); case MCI_GETDEVCAPS: return WAVE_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
case MCI_INFO: return WAVE_mciInfo (dwDevID, dwParam1, (LPMCI_INFO_PARMS16) dwParam2); case MCI_INFO: return WAVE_mciInfo (dwDevID, dwParam1, (LPMCI_INFO_PARMS16) dwParam2);
case MCI_SEEK: return WAVE_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2); case MCI_SEEK: return WAVE_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
/* commands that should be supported */
case MCI_LOAD: case MCI_LOAD:
case MCI_SAVE: case MCI_SAVE:
case MCI_FREEZE: case MCI_FREEZE:
...@@ -980,7 +1011,6 @@ LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, ...@@ -980,7 +1011,6 @@ LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_UNFREEZE: case MCI_UNFREEZE:
case MCI_UPDATE: case MCI_UPDATE:
case MCI_WHERE: case MCI_WHERE:
case MCI_WINDOW:
case MCI_STEP: case MCI_STEP:
case MCI_SPIN: case MCI_SPIN:
case MCI_ESCAPE: case MCI_ESCAPE:
...@@ -988,14 +1018,17 @@ LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg, ...@@ -988,14 +1018,17 @@ LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
case MCI_CUT: case MCI_CUT:
case MCI_DELETE: case MCI_DELETE:
case MCI_PASTE: case MCI_PASTE:
WARN("Unsupported command=%s\n", MCI_CommandToString(wMsg)); FIXME("Unsupported yet command=%s\n", MCI_MessageToString(wMsg));
break;
case MCI_WINDOW:
TRACE("Unsupported command=%s\n", MCI_MessageToString(wMsg));
break; break;
case MCI_OPEN: case MCI_OPEN:
case MCI_CLOSE: case MCI_CLOSE:
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n"); ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
break; break;
default: default:
FIXME("is probably wrong msg=%s\n", MCI_CommandToString(wMsg)); FIXME("is probably wrong msg=%s\n", MCI_MessageToString(wMsg));
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
} }
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment