Commit 840aacc1 authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

mmsystem.dll16: Fix MCI_STATUS mapping for digitalvideo.

parent c44ab0cd
......@@ -128,10 +128,21 @@ static LPWSTR MCI_strdupAtoW( LPCSTR str )
return ret;
}
static DWORD MCI_get_device_type(UINT16 deviceId)
{
MCI_GETDEVCAPS_PARMS parms;
MCIERROR err;
err = mciSendCommandW(deviceId, MCI_GETDEVCAPS, MCI_GETDEVCAPS_DEVICE_TYPE | MCI_WAIT, (DWORD_PTR)&parms);
if (err != MMSYSERR_NOERROR)
return MCI_DEVTYPE_OTHER;
return parms.dwReturn;
}
/**************************************************************************
* MCI_MapMsg16To32W [internal]
*/
static MMSYSTEM_MapType MCI_MapMsg16To32W(WORD wMsg, DWORD dwFlags, DWORD_PTR* lParam)
static MMSYSTEM_MapType MCI_MapMsg16To32W(UINT16 wDevID, WORD wMsg, DWORD dwFlags, DWORD_PTR* lParam)
{
if (*lParam == 0)
return MMSYSTEM_MAP_OK;
......@@ -163,7 +174,6 @@ static MMSYSTEM_MapType MCI_MapMsg16To32W(WORD wMsg, DWORD dwFlags, DWORD_PTR* l
/* case MCI_SETTIMECODE:*/
/* case MCI_SIGNAL:*/
case MCI_SPIN:
case MCI_STATUS: /* FIXME: is wrong for digital video */
case MCI_STEP:
case MCI_STOP:
/* case MCI_UNDO: */
......@@ -192,6 +202,31 @@ static MMSYSTEM_MapType MCI_MapMsg16To32W(WORD wMsg, DWORD dwFlags, DWORD_PTR* l
*lParam = (DWORD)mdrp32;
}
return MMSYSTEM_MAP_OKMEM;
case MCI_STATUS:
{
if (MCI_get_device_type(wDevID) == MCI_DEVTYPE_DIGITAL_VIDEO) {
LPMCI_DGV_STATUS_PARMSW mdsp32w = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(LPMCI_DGV_STATUS_PARMS16) + sizeof(MCI_DGV_STATUS_PARMSW));
LPMCI_DGV_STATUS_PARMS16 mdsp16 = MapSL(*lParam);
if (mdsp32w) {
*(LPMCI_DGV_STATUS_PARMS16*)(mdsp32w) = mdsp16;
mdsp32w = (LPMCI_DGV_STATUS_PARMSW)((char*)mdsp32w + sizeof(LPMCI_DGV_STATUS_PARMS16));
mdsp32w->dwCallback = mdsp16->dwCallback;
mdsp32w->dwReturn = mdsp16->dwReturn;
mdsp32w->dwItem = mdsp16->dwItem;
mdsp32w->dwTrack = mdsp16->dwTrack;
if (dwFlags & MCI_DGV_STATUS_DISKSPACE)
mdsp32w->lpstrDrive = MCI_strdupAtoW(MapSL(mdsp16->lpstrDrive));
mdsp32w->dwReference = mdsp16->dwReference;
*lParam = (DWORD)mdsp32w;
} else {
return MMSYSTEM_MAP_NOMEM;
}
} else {
*lParam = (DWORD)MapSL(*lParam);
}
}
return MMSYSTEM_MAP_OKMEM;
case MCI_WINDOW:
{
LPMCI_OVLY_WINDOW_PARMSW mowp32w = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MCI_OVLY_WINDOW_PARMSW));
......@@ -359,7 +394,7 @@ static MMSYSTEM_MapType MCI_MapMsg16To32W(WORD wMsg, DWORD dwFlags, DWORD_PTR* l
/**************************************************************************
* MCI_UnMapMsg16To32W [internal]
*/
static MMSYSTEM_MapType MCI_UnMapMsg16To32W(WORD wMsg, DWORD dwFlags, DWORD_PTR lParam)
static MMSYSTEM_MapType MCI_UnMapMsg16To32W(UINT16 wDevID, WORD wMsg, DWORD dwFlags, DWORD_PTR lParam)
{
switch (wMsg) {
/* case MCI_CAPTURE */
......@@ -385,7 +420,6 @@ static MMSYSTEM_MapType MCI_UnMapMsg16To32W(WORD wMsg, DWORD dwFlags, DWORD_PTR
/* case MCI_SETTIMECODE:*/
/* case MCI_SIGNAL:*/
case MCI_SPIN:
case MCI_STATUS:
case MCI_STEP:
case MCI_STOP:
/* case MCI_UNDO: */
......@@ -407,6 +441,20 @@ static MMSYSTEM_MapType MCI_UnMapMsg16To32W(WORD wMsg, DWORD dwFlags, DWORD_PTR
HeapFree(GetProcessHeap(), 0, (LPVOID)lParam);
}
return MMSYSTEM_MAP_OK;
case MCI_STATUS:
if (lParam && MCI_get_device_type(wDevID) == MCI_DEVTYPE_DIGITAL_VIDEO) {
LPMCI_DGV_STATUS_PARMSW mdsp32w = (LPMCI_DGV_STATUS_PARMSW)lParam;
char *base = (char*)lParam - sizeof(LPMCI_DGV_STATUS_PARMS16);
LPMCI_DGV_STATUS_PARMS16 mdsp16 = *(LPMCI_DGV_STATUS_PARMS16*)base;
mdsp16->dwCallback = mdsp32w->dwCallback;
mdsp16->dwReturn = mdsp32w->dwReturn;
mdsp16->dwItem = mdsp32w->dwItem;
mdsp16->dwTrack = mdsp32w->dwTrack;
mdsp16->dwReference = mdsp32w->dwReference;
HeapFree(GetProcessHeap(), 0, (LPVOID)mdsp32w->lpstrDrive);
HeapFree(GetProcessHeap(), 0, base);
}
return MMSYSTEM_MAP_OK;
case MCI_WINDOW:
if (lParam) {
LPMCI_OVLY_WINDOW_PARMSW mowp32w = (LPMCI_OVLY_WINDOW_PARMSW)lParam;
......@@ -707,7 +755,7 @@ DWORD WINAPI mciSendCommand16(UINT16 wDevID, UINT16 wMsg, DWORD dwParam1, DWORD
dwRet = MCIERR_INVALID_DEVICE_ID;
switch (res = MCI_MapMsg16To32W(wMsg, dwParam1, &dwParam2)) {
switch (res = MCI_MapMsg16To32W(wDevID, wMsg, dwParam1, &dwParam2)) {
case MMSYSTEM_MAP_MSGERROR:
TRACE("%s not handled yet\n", MCI_MessageToString(wMsg));
dwRet = MCIERR_DRIVER_INTERNAL;
......@@ -720,7 +768,7 @@ DWORD WINAPI mciSendCommand16(UINT16 wDevID, UINT16 wMsg, DWORD dwParam1, DWORD
case MMSYSTEM_MAP_OKMEM:
dwRet = mciSendCommandW(wDevID, wMsg, dwParam1, dwParam2);
if (res == MMSYSTEM_MAP_OKMEM)
MCI_UnMapMsg16To32W(wMsg, dwParam1, dwParam2);
MCI_UnMapMsg16To32W(wDevID, wMsg, dwParam1, dwParam2);
break;
}
}
......
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