winmm: Get rid of 16bit driver support in mci.
This commit is contained in:
parent
14a68405d3
commit
2a581444d0
|
@ -67,9 +67,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mci);
|
||||
|
||||
WINMM_MapType (*pFnMciMapMsg32WTo16) (WORD,WORD,DWORD,DWORD_PTR*) = NULL;
|
||||
WINMM_MapType (*pFnMciUnMapMsg32WTo16)(WORD,WORD,DWORD,DWORD_PTR) = NULL;
|
||||
|
||||
/* First MCI valid device ID (0 means error) */
|
||||
#define MCI_MAGIC 0x0001
|
||||
|
||||
|
@ -815,30 +812,9 @@ static BOOL MCI_OpenMciDriver(LPWINE_MCIDRIVER wmd, LPCWSTR drvTyp, DWORD_PTR lp
|
|||
if (!DRIVER_GetLibName(drvTyp, wszMci, libName, sizeof(libName)))
|
||||
return FALSE;
|
||||
|
||||
wmd->bIs32 = 0xFFFF;
|
||||
/* First load driver */
|
||||
if ((wmd->hDriver = (HDRVR)DRIVER_TryOpenDriver32(libName, lp))) {
|
||||
wmd->bIs32 = TRUE;
|
||||
} else if (WINMM_CheckForMMSystem() && pFnMciMapMsg32WTo16) {
|
||||
WINMM_MapType res;
|
||||
|
||||
switch (res = pFnMciMapMsg32WTo16(0, DRV_OPEN, 0, &lp)) {
|
||||
case WINMM_MAP_MSGERROR:
|
||||
TRACE("Not handled yet (DRV_OPEN)\n");
|
||||
break;
|
||||
case WINMM_MAP_NOMEM:
|
||||
TRACE("Problem mapping msg=DRV_OPEN from 32W to 16\n");
|
||||
break;
|
||||
case WINMM_MAP_OK:
|
||||
case WINMM_MAP_OKMEM:
|
||||
if ((wmd->hDriver = OpenDriver(drvTyp, wszMci, lp)))
|
||||
wmd->bIs32 = FALSE;
|
||||
if (res == WINMM_MAP_OKMEM)
|
||||
pFnMciUnMapMsg32WTo16(0, DRV_OPEN, 0, lp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (wmd->bIs32 == 0xFFFF) ? FALSE : TRUE;
|
||||
wmd->hDriver = (HDRVR)DRIVER_TryOpenDriver32(libName, lp);
|
||||
return wmd->hDriver != NULL;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -927,28 +903,7 @@ static DWORD MCI_SendCommandFrom32(MCIDEVICEID wDevID, UINT16 wMsg, DWORD_PTR dw
|
|||
LPWINE_MCIDRIVER wmd = MCI_GetDriver(wDevID);
|
||||
|
||||
if (wmd) {
|
||||
if (wmd->bIs32) {
|
||||
dwRet = SendDriverMessage(wmd->hDriver, wMsg, dwParam1, dwParam2);
|
||||
} else if (pFnMciMapMsg32WTo16) {
|
||||
WINMM_MapType res;
|
||||
|
||||
switch (res = pFnMciMapMsg32WTo16(wmd->wType, wMsg, dwParam1, &dwParam2)) {
|
||||
case WINMM_MAP_MSGERROR:
|
||||
TRACE("Not handled yet (%s)\n", MCI_MessageToString(wMsg));
|
||||
dwRet = MCIERR_DRIVER_INTERNAL;
|
||||
break;
|
||||
case WINMM_MAP_NOMEM:
|
||||
TRACE("Problem mapping msg=%s from 32a to 16\n", MCI_MessageToString(wMsg));
|
||||
dwRet = MCIERR_OUT_OF_MEMORY;
|
||||
break;
|
||||
case WINMM_MAP_OK:
|
||||
case WINMM_MAP_OKMEM:
|
||||
dwRet = SendDriverMessage(wmd->hDriver, wMsg, dwParam1, dwParam2);
|
||||
if (res == WINMM_MAP_OKMEM)
|
||||
pFnMciUnMapMsg32WTo16(wmd->wType, wMsg, dwParam1, dwParam2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
dwRet = SendDriverMessage(wmd->hDriver, wMsg, dwParam1, dwParam2);
|
||||
}
|
||||
return dwRet;
|
||||
}
|
||||
|
|
|
@ -1930,688 +1930,6 @@ static unsigned MMDRV_LoadMMDrvFunc16(LPCSTR drvName, LPWINE_DRIVER d,
|
|||
return count;
|
||||
}
|
||||
|
||||
/* =================================
|
||||
* M C I
|
||||
* ================================= */
|
||||
|
||||
/*
|
||||
* 0000 stop
|
||||
* 0001 squeeze signed 4 bytes to 2 bytes *( LPINT16)D = ( INT16)*( LPINT16)S; D += 2; S += 4
|
||||
* 0010 squeeze unsigned 4 bytes to 2 bytes *(LPUINT16)D = (UINT16)*(LPUINT16)S; D += 2; S += 4
|
||||
* 0100
|
||||
* 0101
|
||||
* 0110 zero 4 bytes *(DWORD)D = 0 D += 4; S += 4
|
||||
* 0111 copy string *(LPSTR*)D = seg dup(*(LPSTR*)S) D += 4; S += 4
|
||||
* 1xxx copy xxx + 1 bytes memcpy(D, S, xxx + 1); D += xxx+1; S += xxx+1
|
||||
*/
|
||||
|
||||
/**************************************************************************
|
||||
* MCI_MsgMapper32WTo16_Create [internal]
|
||||
*
|
||||
* Helper for MCI_MapMsg32WTo16.
|
||||
* Maps the 32 bit pointer (*ptr), of size bytes, to an allocated 16 bit
|
||||
* segmented pointer.
|
||||
* map contains a list of action to be performed for the mapping (see list
|
||||
* above)
|
||||
* if keep is TRUE, keeps track of in 32 bit ptr in allocated 16 bit area.
|
||||
*/
|
||||
static WINMM_MapType MCI_MsgMapper32WTo16_Create(void** ptr, int size16, DWORD map, BOOLEAN keep)
|
||||
{
|
||||
void* lp = HeapAlloc( GetProcessHeap(), 0, (keep ? sizeof(void**) : 0) + size16 );
|
||||
LPBYTE p16, p32;
|
||||
|
||||
if (!lp) {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
p32 = *ptr;
|
||||
if (keep) {
|
||||
*(void**)lp = *ptr;
|
||||
p16 = (LPBYTE)lp + sizeof(void**);
|
||||
*ptr = (char*)MapLS(lp) + sizeof(void**);
|
||||
} else {
|
||||
p16 = lp;
|
||||
*ptr = (void*)MapLS(lp);
|
||||
}
|
||||
|
||||
if (map == 0) {
|
||||
memcpy(p16, p32, size16);
|
||||
} else {
|
||||
unsigned nibble;
|
||||
unsigned sz;
|
||||
|
||||
while (map & 0xF) {
|
||||
nibble = map & 0xF;
|
||||
if (nibble & 0x8) {
|
||||
sz = (nibble & 7) + 1;
|
||||
memcpy(p16, p32, sz);
|
||||
p16 += sz;
|
||||
p32 += sz;
|
||||
size16 -= sz; /* DEBUG only */
|
||||
} else {
|
||||
switch (nibble) {
|
||||
case 0x1:
|
||||
*(LPINT16)p16 = *(LPINT)p32;
|
||||
p16 += sizeof(INT16);
|
||||
p32 += sizeof(INT);
|
||||
size16 -= sizeof(INT16);
|
||||
break;
|
||||
case 0x2:
|
||||
*(LPUINT16)p16 = *(LPUINT)p32;
|
||||
p16 += sizeof(UINT16);
|
||||
p32 += sizeof(UINT);
|
||||
size16 -= sizeof(UINT16);
|
||||
break;
|
||||
case 0x6:
|
||||
*(LPDWORD)p16 = 0;
|
||||
p16 += sizeof(DWORD);
|
||||
p32 += sizeof(DWORD);
|
||||
size16 -= sizeof(DWORD);
|
||||
break;
|
||||
case 0x7:
|
||||
*(SEGPTR *)p16 = MapLS( MCI_strdupWtoA( *(LPCWSTR *)p32 ) );
|
||||
p16 += sizeof(SEGPTR);
|
||||
p32 += sizeof(LPSTR);
|
||||
size16 -= sizeof(SEGPTR);
|
||||
break;
|
||||
default:
|
||||
FIXME("Unknown nibble for mapping (%x)\n", nibble);
|
||||
}
|
||||
}
|
||||
map >>= 4;
|
||||
}
|
||||
if (size16 != 0) /* DEBUG only */
|
||||
FIXME("Mismatch between 16 bit struct size and map nibbles serie\n");
|
||||
}
|
||||
return WINMM_MAP_OKMEM;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* MCI_MsgMapper32WTo16_Destroy [internal]
|
||||
*
|
||||
* Helper for MCI_UnMapMsg32WTo16.
|
||||
*/
|
||||
static WINMM_MapType MCI_MsgMapper32WTo16_Destroy(void* ptr, int size16, DWORD map, BOOLEAN kept)
|
||||
{
|
||||
if (ptr) {
|
||||
void* msg16 = MapSL((SEGPTR)ptr);
|
||||
void* alloc;
|
||||
LPBYTE p32, p16;
|
||||
unsigned nibble;
|
||||
|
||||
UnMapLS( (SEGPTR)ptr );
|
||||
if (kept) {
|
||||
alloc = (char*)msg16 - sizeof(void**);
|
||||
p32 = *(void**)alloc;
|
||||
p16 = msg16;
|
||||
|
||||
if (map == 0) {
|
||||
memcpy(p32, p16, size16);
|
||||
} else {
|
||||
while (map & 0xF) {
|
||||
nibble = map & 0xF;
|
||||
if (nibble & 0x8) {
|
||||
memcpy(p32, p16, (nibble & 7) + 1);
|
||||
p16 += (nibble & 7) + 1;
|
||||
p32 += (nibble & 7) + 1;
|
||||
size16 -= (nibble & 7) + 1;
|
||||
} else {
|
||||
switch (nibble) {
|
||||
case 0x1:
|
||||
*(LPINT)p32 = *(LPINT16)p16;
|
||||
p16 += sizeof(INT16);
|
||||
p32 += sizeof(INT);
|
||||
size16 -= sizeof(INT16);
|
||||
break;
|
||||
case 0x2:
|
||||
*(LPUINT)p32 = *(LPUINT16)p16;
|
||||
p16 += sizeof(UINT16);
|
||||
p32 += sizeof(UINT);
|
||||
size16 -= sizeof(UINT16);
|
||||
break;
|
||||
case 0x6:
|
||||
p16 += sizeof(UINT);
|
||||
p32 += sizeof(UINT);
|
||||
size16 -= sizeof(UINT);
|
||||
break;
|
||||
case 0x7:
|
||||
HeapFree(GetProcessHeap(), 0, MapSL(*(SEGPTR *)p16));
|
||||
UnMapLS( *(SEGPTR *)p16 );
|
||||
p16 += sizeof(SEGPTR);
|
||||
p32 += sizeof(char*);
|
||||
size16 -= sizeof(SEGPTR);
|
||||
break;
|
||||
default:
|
||||
FIXME("Unknown nibble for mapping (%x)\n", nibble);
|
||||
}
|
||||
}
|
||||
map >>= 4;
|
||||
}
|
||||
if (size16 != 0) /* DEBUG only */
|
||||
FIXME("Mismatch between 16 bit struct size and map nibbles serie\n");
|
||||
}
|
||||
} else {
|
||||
alloc = msg16;
|
||||
}
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, alloc );
|
||||
}
|
||||
return WINMM_MAP_OK;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* MCI_MapMsg32WTo16 [internal]
|
||||
*
|
||||
* Map a 32W bit MCI message to a 16 bit MCI message.
|
||||
*/
|
||||
static WINMM_MapType MCI_MapMsg32WTo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DWORD_PTR* lParam)
|
||||
{
|
||||
int size;
|
||||
BOOLEAN keep = FALSE;
|
||||
DWORD map = 0;
|
||||
|
||||
if (*lParam == 0)
|
||||
return WINMM_MAP_OK;
|
||||
|
||||
/* FIXME: to add also (with seg/linear modifications to do):
|
||||
* MCI_LIST, MCI_LOAD, MCI_QUALITY, MCI_RESERVE, MCI_RESTORE, MCI_SAVE
|
||||
* MCI_SETAUDIO, MCI_SETTUNER, MCI_SETVIDEO
|
||||
*/
|
||||
switch (wMsg) {
|
||||
case MCI_BREAK:
|
||||
size = sizeof(MCI_BREAK_PARMS);
|
||||
break;
|
||||
/* case MCI_CAPTURE */
|
||||
case MCI_CLOSE:
|
||||
case MCI_CLOSE_DRIVER:
|
||||
case MCI_CONFIGURE:
|
||||
size = sizeof(MCI_GENERIC_PARMS);
|
||||
break;
|
||||
/* case MCI_COPY: */
|
||||
case MCI_CUE:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_CUE_PARMS); break;
|
||||
case MCI_DEVTYPE_VCR: /*size = sizeof(MCI_VCR_CUE_PARMS); break;*/ FIXME("NIY vcr\n"); return WINMM_MAP_NOMEM;
|
||||
default: size = sizeof(MCI_GENERIC_PARMS); break;
|
||||
}
|
||||
break;
|
||||
/* case MCI_CUT:*/
|
||||
case MCI_DELETE:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_DELETE_PARMS16); map = 0x0F1111FB; break;
|
||||
case MCI_DEVTYPE_WAVEFORM_AUDIO:size = sizeof(MCI_WAVE_DELETE_PARMS); break;
|
||||
default: size = sizeof(MCI_GENERIC_PARMS); break;
|
||||
}
|
||||
break;
|
||||
/* case MCI_ESCAPE: */
|
||||
case MCI_FREEZE:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_FREEZE_PARMS); map = 0x0001111B; break;
|
||||
case MCI_DEVTYPE_OVERLAY: size = sizeof(MCI_OVLY_RECT_PARMS); map = 0x0001111B; break;
|
||||
default: size = sizeof(MCI_GENERIC_PARMS); break;
|
||||
}
|
||||
break;
|
||||
case MCI_GETDEVCAPS:
|
||||
keep = TRUE;
|
||||
size = sizeof(MCI_GETDEVCAPS_PARMS);
|
||||
break;
|
||||
/* case MCI_INDEX: */
|
||||
case MCI_INFO:
|
||||
{
|
||||
LPMCI_INFO_PARMSW mip32w = (LPMCI_INFO_PARMSW)(*lParam);
|
||||
char* ptr;
|
||||
LPMCI_INFO_PARMS16 mip16;
|
||||
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_INFO_PARMS16); break;
|
||||
default: size = sizeof(MCI_INFO_PARMS16); break;
|
||||
}
|
||||
ptr = HeapAlloc( GetProcessHeap(), 0, sizeof(LPMCI_INFO_PARMSW) + size);
|
||||
if (ptr)
|
||||
{
|
||||
*(LPMCI_INFO_PARMSW*)ptr = mip32w;
|
||||
mip16 = (LPMCI_INFO_PARMS16)(ptr + sizeof(LPMCI_INFO_PARMSW));
|
||||
mip16->dwCallback = mip32w->dwCallback;
|
||||
mip16->lpstrReturn = MapLS( HeapAlloc(GetProcessHeap(), 0, mip32w->dwRetSize / sizeof(WCHAR)) );
|
||||
mip16->dwRetSize = mip32w->dwRetSize / sizeof(WCHAR);
|
||||
if (uDevType == MCI_DEVTYPE_DIGITAL_VIDEO) {
|
||||
((LPMCI_DGV_INFO_PARMS16)mip16)->dwItem = ((LPMCI_DGV_INFO_PARMSW)mip32w)->dwItem;
|
||||
}
|
||||
} else {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
*lParam = (LPARAM)MapLS(ptr) + sizeof(LPMCI_INFO_PARMSW);
|
||||
}
|
||||
return WINMM_MAP_OKMEM;
|
||||
/* case MCI_MARK: */
|
||||
/* case MCI_MONITOR: */
|
||||
case MCI_OPEN:
|
||||
case MCI_OPEN_DRIVER:
|
||||
{
|
||||
LPMCI_OPEN_PARMSW mop32w = (LPMCI_OPEN_PARMSW)(*lParam);
|
||||
char* ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPMCI_OPEN_PARMSW) + sizeof(MCI_OPEN_PARMS16) + 2 * sizeof(DWORD));
|
||||
LPMCI_OPEN_PARMS16 mop16;
|
||||
|
||||
|
||||
if (ptr) {
|
||||
*(LPMCI_OPEN_PARMSW*)(ptr) = mop32w;
|
||||
mop16 = (LPMCI_OPEN_PARMS16)(ptr + sizeof(LPMCI_OPEN_PARMSW));
|
||||
mop16->dwCallback = mop32w->dwCallback;
|
||||
mop16->wDeviceID = mop32w->wDeviceID;
|
||||
if (dwFlags & MCI_OPEN_TYPE) {
|
||||
if (dwFlags & MCI_OPEN_TYPE_ID) {
|
||||
/* dword "transparent" value */
|
||||
mop16->lpstrDeviceType = (SEGPTR)mop32w->lpstrDeviceType;
|
||||
} else {
|
||||
/* string */
|
||||
mop16->lpstrDeviceType = MapLS( MCI_strdupWtoA(mop32w->lpstrDeviceType) );
|
||||
}
|
||||
} else {
|
||||
/* nuthin' */
|
||||
mop16->lpstrDeviceType = 0;
|
||||
}
|
||||
if (dwFlags & MCI_OPEN_ELEMENT) {
|
||||
if (dwFlags & MCI_OPEN_ELEMENT_ID) {
|
||||
mop16->lpstrElementName = (SEGPTR)mop32w->lpstrElementName;
|
||||
} else {
|
||||
mop16->lpstrElementName = MapLS( MCI_strdupWtoA(mop32w->lpstrElementName) );
|
||||
}
|
||||
} else {
|
||||
mop16->lpstrElementName = 0;
|
||||
}
|
||||
if (dwFlags & MCI_OPEN_ALIAS) {
|
||||
mop16->lpstrAlias = MapLS( MCI_strdupWtoA(mop32w->lpstrAlias) );
|
||||
} else {
|
||||
mop16->lpstrAlias = 0;
|
||||
}
|
||||
/* copy extended information if any...
|
||||
* FIXME: this may seg fault if initial structure does not contain them and
|
||||
* the reads after msip16 fail under LDT limits...
|
||||
* NOTE: this should be split in two. First pass, while calling MCI_OPEN, and
|
||||
* should not take care of extended parameters, and should be used by MCI_Open
|
||||
* to fetch uDevType. When, this is known, the mapping for sending the
|
||||
* MCI_OPEN_DRIVER shall be done depending on uDevType.
|
||||
*/
|
||||
memcpy(mop16 + 1, mop32w + 1, 2 * sizeof(DWORD));
|
||||
} else {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
*lParam = (LPARAM)MapLS(ptr) + sizeof(LPMCI_OPEN_PARMSW);
|
||||
}
|
||||
return WINMM_MAP_OKMEM;
|
||||
/* case MCI_PASTE:*/
|
||||
case MCI_PAUSE:
|
||||
size = sizeof(MCI_GENERIC_PARMS);
|
||||
break;
|
||||
case MCI_PLAY:
|
||||
size = sizeof(MCI_PLAY_PARMS);
|
||||
break;
|
||||
case MCI_PUT:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_RECT_PARMS16); map = 0x0001111B; break;
|
||||
case MCI_DEVTYPE_OVERLAY: size = sizeof(MCI_OVLY_RECT_PARMS); map = 0x0001111B; break;
|
||||
default: size = sizeof(MCI_GENERIC_PARMS); break;
|
||||
}
|
||||
break;
|
||||
case MCI_REALIZE:
|
||||
size = sizeof(MCI_GENERIC_PARMS);
|
||||
break;
|
||||
case MCI_RECORD:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_RECORD_PARMS16); map = 0x0F1111FB; break;
|
||||
case MCI_DEVTYPE_VCR: /*size = sizeof(MCI_VCR_RECORD_PARMS); break;*/FIXME("NIY vcr\n"); return WINMM_MAP_NOMEM;
|
||||
default: size = sizeof(MCI_RECORD_PARMS); break;
|
||||
}
|
||||
break;
|
||||
case MCI_RESUME:
|
||||
size = sizeof(MCI_GENERIC_PARMS);
|
||||
break;
|
||||
case MCI_SEEK:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_VCR: /*size = sizeof(MCI_VCR_SEEK_PARMS); break;*/FIXME("NIY vcr\n"); return WINMM_MAP_NOMEM;
|
||||
default: size = sizeof(MCI_SEEK_PARMS); break;
|
||||
}
|
||||
break;
|
||||
case MCI_SET:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_SET_PARMS); break;
|
||||
case MCI_DEVTYPE_VCR: /*size = sizeof(MCI_VCR_SET_PARMS); break;*/FIXME("NIY vcr\n"); return WINMM_MAP_NOMEM;
|
||||
case MCI_DEVTYPE_SEQUENCER: size = sizeof(MCI_SEQ_SET_PARMS); break;
|
||||
/* FIXME: normally the 16 and 32 bit structures are byte by byte aligned,
|
||||
* so not doing anything should work...
|
||||
*/
|
||||
case MCI_DEVTYPE_WAVEFORM_AUDIO:size = sizeof(MCI_WAVE_SET_PARMS); break;
|
||||
default: size = sizeof(MCI_SET_PARMS); break;
|
||||
}
|
||||
break;
|
||||
case MCI_SETAUDIO:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_SETAUDIO_PARMS16);map = 0x0000077FF; break;
|
||||
case MCI_DEVTYPE_VCR: /*size = sizeof(MCI_VCR_SETAUDIO_PARMS); break;*/FIXME("NIY vcr\n"); return WINMM_MAP_NOMEM;
|
||||
default: size = sizeof(MCI_GENERIC_PARMS); break;
|
||||
}
|
||||
break;
|
||||
/* case MCI_SETTIMECODE:*/
|
||||
/* case MCI_SIGNAL:*/
|
||||
/* case MCI_SOUND:*/
|
||||
case MCI_SPIN:
|
||||
size = sizeof(MCI_SET_PARMS);
|
||||
break;
|
||||
case MCI_STATUS:
|
||||
keep = TRUE;
|
||||
switch (uDevType) {
|
||||
/* FIXME:
|
||||
* don't know if buffer for value is the one passed through lpstrDevice
|
||||
* or is provided by MCI driver.
|
||||
* Assuming solution 2: provided by MCI driver, so zeroing on entry
|
||||
*/
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_STATUS_PARMS16); map = 0x0B6FF; break;
|
||||
case MCI_DEVTYPE_VCR: /*size = sizeof(MCI_VCR_STATUS_PARMS); break;*/FIXME("NIY vcr\n"); return WINMM_MAP_NOMEM;
|
||||
default: size = sizeof(MCI_STATUS_PARMS); break;
|
||||
}
|
||||
break;
|
||||
case MCI_STEP:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_STEP_PARMS); break;
|
||||
case MCI_DEVTYPE_VCR: /*size = sizeof(MCI_VCR_STEP_PARMS); break;*/FIXME("NIY vcr\n"); return WINMM_MAP_NOMEM;
|
||||
case MCI_DEVTYPE_VIDEODISC: size = sizeof(MCI_VD_STEP_PARMS); break;
|
||||
default: size = sizeof(MCI_GENERIC_PARMS); break;
|
||||
}
|
||||
break;
|
||||
case MCI_STOP:
|
||||
size = sizeof(MCI_SET_PARMS);
|
||||
break;
|
||||
case MCI_SYSINFO:
|
||||
{
|
||||
LPMCI_SYSINFO_PARMSW msip32w = (LPMCI_SYSINFO_PARMSW)(*lParam);
|
||||
LPMCI_SYSINFO_PARMS16 msip16;
|
||||
char* ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPMCI_SYSINFO_PARMSW) + sizeof(MCI_SYSINFO_PARMS16) );
|
||||
|
||||
if (ptr) {
|
||||
*(LPMCI_SYSINFO_PARMSW*)(ptr) = msip32w;
|
||||
msip16 = (LPMCI_SYSINFO_PARMS16)(ptr + sizeof(LPMCI_SYSINFO_PARMSW));
|
||||
|
||||
msip16->dwCallback = msip32w->dwCallback;
|
||||
msip16->lpstrReturn = MapLS( HeapAlloc(GetProcessHeap(), 0, msip32w->dwRetSize) );
|
||||
msip16->dwRetSize = msip32w->dwRetSize;
|
||||
msip16->dwNumber = msip32w->dwNumber;
|
||||
msip16->wDeviceType = msip32w->wDeviceType;
|
||||
} else {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
*lParam = (LPARAM)MapLS(ptr) + sizeof(LPMCI_SYSINFO_PARMSW);
|
||||
}
|
||||
return WINMM_MAP_OKMEM;
|
||||
/* case MCI_UNDO: */
|
||||
case MCI_UNFREEZE:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_RECT_PARMS16); map = 0x0001111B; break;
|
||||
case MCI_DEVTYPE_OVERLAY: size = sizeof(MCI_OVLY_RECT_PARMS16); map = 0x0001111B; break;
|
||||
default: size = sizeof(MCI_GENERIC_PARMS); break;
|
||||
}
|
||||
break;
|
||||
case MCI_UPDATE:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_UPDATE_PARMS16); map = 0x000B1111B; break;
|
||||
default: size = sizeof(MCI_GENERIC_PARMS); break;
|
||||
}
|
||||
break;
|
||||
case MCI_WHERE:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_RECT_PARMS16); map = 0x0001111B; keep = TRUE; break;
|
||||
case MCI_DEVTYPE_OVERLAY: size = sizeof(MCI_OVLY_RECT_PARMS16); map = 0x0001111B; keep = TRUE; break;
|
||||
default: size = sizeof(MCI_GENERIC_PARMS); break;
|
||||
}
|
||||
break;
|
||||
case MCI_WINDOW:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_WINDOW_PARMS16); if (dwFlags & MCI_DGV_WINDOW_TEXT) map = 0x7FB; break;
|
||||
case MCI_DEVTYPE_OVERLAY: size = sizeof(MCI_OVLY_WINDOW_PARMS16); if (dwFlags & MCI_OVLY_WINDOW_TEXT) map = 0x7FB; break;
|
||||
default: size = sizeof(MCI_GENERIC_PARMS); break;
|
||||
}
|
||||
break;
|
||||
case DRV_OPEN:
|
||||
{
|
||||
LPMCI_OPEN_DRIVER_PARMSW modp32w = (LPMCI_OPEN_DRIVER_PARMSW)(*lParam);
|
||||
LPMCI_OPEN_DRIVER_PARMS16 modp16;
|
||||
char *ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPMCI_OPEN_DRIVER_PARMSW) + sizeof(MCI_OPEN_DRIVER_PARMS16));
|
||||
|
||||
if (ptr) {
|
||||
*(LPMCI_OPEN_DRIVER_PARMSW*)(ptr) = modp32w;
|
||||
modp16 = (LPMCI_OPEN_DRIVER_PARMS16)(ptr + sizeof(LPMCI_OPEN_DRIVER_PARMSW));
|
||||
modp16->wDeviceID = modp32w->wDeviceID;
|
||||
modp16->lpstrParams = MapLS( MCI_strdupWtoA(modp32w->lpstrParams) );
|
||||
/* other fields are gonna be filled by the driver, don't copy them */
|
||||
} else {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
*lParam = (LPARAM)MapLS(ptr) + sizeof(LPMCI_OPEN_DRIVER_PARMSW);
|
||||
}
|
||||
return WINMM_MAP_OKMEM;
|
||||
case DRV_LOAD:
|
||||
case DRV_ENABLE:
|
||||
case DRV_CLOSE:
|
||||
case DRV_DISABLE:
|
||||
case DRV_FREE:
|
||||
case DRV_CONFIGURE:
|
||||
case DRV_QUERYCONFIGURE:
|
||||
case DRV_INSTALL:
|
||||
case DRV_REMOVE:
|
||||
case DRV_EXITSESSION:
|
||||
case DRV_EXITAPPLICATION:
|
||||
case DRV_POWER:
|
||||
return WINMM_MAP_OK;
|
||||
|
||||
default:
|
||||
FIXME("Don't know how to map msg=%s\n", MCI_MessageToString(wMsg));
|
||||
return WINMM_MAP_MSGERROR;
|
||||
}
|
||||
return MCI_MsgMapper32WTo16_Create((void**)lParam, size, map, keep);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* MCI_UnMapMsg32WTo16 [internal]
|
||||
*/
|
||||
static WINMM_MapType MCI_UnMapMsg32WTo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DWORD_PTR lParam)
|
||||
{
|
||||
int size = 0;
|
||||
BOOLEAN kept = FALSE; /* there is no need to compute size when kept is FALSE */
|
||||
DWORD map = 0;
|
||||
|
||||
switch (wMsg) {
|
||||
case MCI_BREAK:
|
||||
break;
|
||||
/* case MCI_CAPTURE */
|
||||
case MCI_CLOSE:
|
||||
case MCI_CLOSE_DRIVER:
|
||||
case MCI_CONFIGURE:
|
||||
break;
|
||||
/* case MCI_COPY: */
|
||||
case MCI_CUE:
|
||||
break;
|
||||
/* case MCI_CUT: */
|
||||
case MCI_DELETE:
|
||||
break;
|
||||
/* case MCI_ESCAPE: */
|
||||
case MCI_FREEZE:
|
||||
break;
|
||||
case MCI_GETDEVCAPS:
|
||||
kept = TRUE;
|
||||
size = sizeof(MCI_GETDEVCAPS_PARMS);
|
||||
break;
|
||||
/* case MCI_INDEX: */
|
||||
case MCI_INFO:
|
||||
if (lParam) {
|
||||
LPMCI_INFO_PARMS16 mip16 = (LPMCI_INFO_PARMS16)MapSL(lParam);
|
||||
LPMCI_INFO_PARMSW mip32w = *(LPMCI_INFO_PARMSW*)((char*)mip16 - sizeof(LPMCI_INFO_PARMSW));
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, MapSL(mip16->lpstrReturn), mip16->dwRetSize,
|
||||
mip32w->lpstrReturn, mip32w->dwRetSize / sizeof(WCHAR));
|
||||
UnMapLS( lParam );
|
||||
UnMapLS( mip16->lpstrReturn );
|
||||
HeapFree( GetProcessHeap(), 0, MapSL(mip16->lpstrReturn) );
|
||||
HeapFree( GetProcessHeap(), 0, (char*)mip16 - sizeof(LPMCI_OPEN_PARMSW) );
|
||||
}
|
||||
return WINMM_MAP_OK;
|
||||
/* case MCI_MARK: */
|
||||
/* case MCI_MONITOR: */
|
||||
case MCI_OPEN:
|
||||
case MCI_OPEN_DRIVER:
|
||||
if (lParam) {
|
||||
LPMCI_OPEN_PARMS16 mop16 = (LPMCI_OPEN_PARMS16)MapSL(lParam);
|
||||
LPMCI_OPEN_PARMSW mop32w = *(LPMCI_OPEN_PARMSW*)((char*)mop16 - sizeof(LPMCI_OPEN_PARMSW));
|
||||
UnMapLS( lParam );
|
||||
mop32w->wDeviceID = mop16->wDeviceID;
|
||||
if ((dwFlags & MCI_OPEN_TYPE) && !(dwFlags & MCI_OPEN_TYPE_ID))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, MapSL(mop16->lpstrDeviceType));
|
||||
UnMapLS( mop16->lpstrDeviceType );
|
||||
}
|
||||
if ((dwFlags & MCI_OPEN_ELEMENT) && !(dwFlags & MCI_OPEN_ELEMENT_ID))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, MapSL(mop16->lpstrElementName));
|
||||
UnMapLS( mop16->lpstrElementName );
|
||||
}
|
||||
if (dwFlags & MCI_OPEN_ALIAS)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, MapSL(mop16->lpstrAlias));
|
||||
UnMapLS( mop16->lpstrAlias );
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, (char*)mop16 - sizeof(LPMCI_OPEN_PARMSW) );
|
||||
}
|
||||
return WINMM_MAP_OK;
|
||||
/* case MCI_PASTE:*/
|
||||
case MCI_PAUSE:
|
||||
break;
|
||||
case MCI_PLAY:
|
||||
break;
|
||||
case MCI_PUT:
|
||||
break;
|
||||
case MCI_REALIZE:
|
||||
break;
|
||||
case MCI_RECORD:
|
||||
break;
|
||||
case MCI_RESUME:
|
||||
break;
|
||||
case MCI_SEEK:
|
||||
break;
|
||||
case MCI_SET:
|
||||
break;
|
||||
case MCI_SETAUDIO:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: map = 0x0000077FF; break;
|
||||
case MCI_DEVTYPE_VCR: /*size = sizeof(MCI_VCR_SETAUDIO_PARMS); break;*/FIXME("NIY vcr\n"); return WINMM_MAP_NOMEM;
|
||||
}
|
||||
break;
|
||||
/* case MCI_SETTIMECODE:*/
|
||||
/* case MCI_SIGNAL:*/
|
||||
/* case MCI_SOUND:*/
|
||||
case MCI_SPIN:
|
||||
break;
|
||||
case MCI_STATUS:
|
||||
kept = TRUE;
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO:
|
||||
if (lParam) {
|
||||
LPMCI_DGV_STATUS_PARMS16 mdsp16 = (LPMCI_DGV_STATUS_PARMS16)MapSL(lParam);
|
||||
LPMCI_DGV_STATUS_PARMSA mdsp32a = *(LPMCI_DGV_STATUS_PARMSA*)((char*)mdsp16 - sizeof(LPMCI_DGV_STATUS_PARMSA));
|
||||
|
||||
UnMapLS( lParam );
|
||||
if (mdsp16) {
|
||||
mdsp32a->dwReturn = mdsp16->dwReturn;
|
||||
if (dwFlags & MCI_DGV_STATUS_DISKSPACE) {
|
||||
TRACE("MCI_STATUS (DGV) lpstrDrive=%08x\n", mdsp16->lpstrDrive);
|
||||
TRACE("MCI_STATUS (DGV) lpstrDrive=%s\n", (LPSTR)MapSL(mdsp16->lpstrDrive));
|
||||
UnMapLS( mdsp16->lpstrDrive );
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, (char*)mdsp16 - sizeof(LPMCI_DGV_STATUS_PARMSA) );
|
||||
} else {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
}
|
||||
return WINMM_MAP_OKMEM;
|
||||
case MCI_DEVTYPE_VCR: /*size = sizeof(MCI_VCR_STATUS_PARMS); break;*/FIXME("NIY vcr\n"); return WINMM_MAP_NOMEM;
|
||||
default: size = sizeof(MCI_STATUS_PARMS); break;
|
||||
}
|
||||
break;
|
||||
case MCI_STEP:
|
||||
break;
|
||||
case MCI_STOP:
|
||||
break;
|
||||
case MCI_SYSINFO:
|
||||
if (lParam) {
|
||||
LPMCI_SYSINFO_PARMS16 msip16 = (LPMCI_SYSINFO_PARMS16)MapSL(lParam);
|
||||
LPMCI_SYSINFO_PARMSW msip32w = *(LPMCI_SYSINFO_PARMSW*)((char*)msip16 - sizeof(LPMCI_SYSINFO_PARMSW));
|
||||
|
||||
UnMapLS( lParam );
|
||||
if (msip16) {
|
||||
MultiByteToWideChar(CP_ACP, 0, MapSL(msip16->lpstrReturn), msip16->dwRetSize,
|
||||
msip32w->lpstrReturn, msip32w->dwRetSize/sizeof(WCHAR));
|
||||
UnMapLS( msip16->lpstrReturn );
|
||||
HeapFree( GetProcessHeap(), 0, MapSL(msip16->lpstrReturn) );
|
||||
HeapFree( GetProcessHeap(), 0, (char*)msip16 - sizeof(LPMCI_SYSINFO_PARMSW) );
|
||||
} else {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
}
|
||||
return WINMM_MAP_OKMEM;
|
||||
/* case MCI_UNDO: */
|
||||
case MCI_UNFREEZE:
|
||||
break;
|
||||
case MCI_UPDATE:
|
||||
break;
|
||||
case MCI_WHERE:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_RECT_PARMS16); map = 0x0001111B; kept = TRUE; break;
|
||||
case MCI_DEVTYPE_OVERLAY: size = sizeof(MCI_OVLY_RECT_PARMS16); map = 0x0001111B; kept = TRUE; break;
|
||||
default: break;
|
||||
}
|
||||
break;
|
||||
case MCI_WINDOW:
|
||||
switch (uDevType) {
|
||||
case MCI_DEVTYPE_DIGITAL_VIDEO: size = sizeof(MCI_DGV_WINDOW_PARMS16); if (dwFlags & MCI_DGV_WINDOW_TEXT) map = 0x7666; break;
|
||||
case MCI_DEVTYPE_OVERLAY: size = sizeof(MCI_OVLY_WINDOW_PARMS16); if (dwFlags & MCI_OVLY_WINDOW_TEXT) map = 0x7666; break;
|
||||
default: break;
|
||||
}
|
||||
/* FIXME: see map function */
|
||||
break;
|
||||
case DRV_OPEN:
|
||||
if (lParam) {
|
||||
LPMCI_OPEN_DRIVER_PARMS16 modp16 = (LPMCI_OPEN_DRIVER_PARMS16)MapSL(lParam);
|
||||
LPMCI_OPEN_DRIVER_PARMSW modp32w = *(LPMCI_OPEN_DRIVER_PARMSW*)((char*)modp16 - sizeof(LPMCI_OPEN_DRIVER_PARMSW));
|
||||
|
||||
UnMapLS( lParam );
|
||||
modp32w->wCustomCommandTable = modp16->wCustomCommandTable;
|
||||
modp32w->wType = modp16->wType;
|
||||
HeapFree(GetProcessHeap(), 0, MapSL(modp16->lpstrParams));
|
||||
UnMapLS( modp16->lpstrParams );
|
||||
HeapFree( GetProcessHeap(), 0, (char *)modp16 - sizeof(LPMCI_OPEN_DRIVER_PARMSW) );
|
||||
}
|
||||
return WINMM_MAP_OK;
|
||||
case DRV_LOAD:
|
||||
case DRV_ENABLE:
|
||||
case DRV_CLOSE:
|
||||
case DRV_DISABLE:
|
||||
case DRV_FREE:
|
||||
case DRV_CONFIGURE:
|
||||
case DRV_QUERYCONFIGURE:
|
||||
case DRV_INSTALL:
|
||||
case DRV_REMOVE:
|
||||
case DRV_EXITSESSION:
|
||||
case DRV_EXITAPPLICATION:
|
||||
case DRV_POWER:
|
||||
FIXME("This is a hack\n");
|
||||
return WINMM_MAP_OK;
|
||||
|
||||
default:
|
||||
FIXME("Map/Unmap internal error on msg=%s\n", MCI_MessageToString(wMsg));
|
||||
return WINMM_MAP_MSGERROR;
|
||||
}
|
||||
return MCI_MsgMapper32WTo16_Destroy((void*)lParam, size, map, kept);
|
||||
}
|
||||
|
||||
void MMDRV_Init16(void)
|
||||
{
|
||||
#define A(_x,_y) MMDRV_InstallMap(_x, \
|
||||
|
@ -2627,9 +1945,6 @@ MMDRV_##_y##_Callback)
|
|||
|
||||
pFnCallMMDrvFunc16 = MMDRV_CallMMDrvFunc16;
|
||||
pFnLoadMMDrvFunc16 = MMDRV_LoadMMDrvFunc16;
|
||||
|
||||
pFnMciMapMsg32WTo16 = MCI_MapMsg32WTo16;
|
||||
pFnMciUnMapMsg32WTo16 = MCI_UnMapMsg32WTo16;
|
||||
}
|
||||
|
||||
/* ###################################################
|
||||
|
|
|
@ -125,7 +125,6 @@ typedef struct tagWINE_MCIDRIVER {
|
|||
DWORD_PTR dwPrivate;
|
||||
YIELDPROC lpfnYieldProc;
|
||||
DWORD dwYieldData;
|
||||
BOOL bIs32;
|
||||
DWORD CreatorThread;
|
||||
UINT uTypeCmdTable;
|
||||
UINT uSpecificCmdTable;
|
||||
|
@ -197,8 +196,6 @@ extern HANDLE psStopEvent;
|
|||
extern LPWINE_DRIVER (*pFnOpenDriver16)(LPCWSTR,LPCWSTR,LPARAM);
|
||||
extern LRESULT (*pFnCloseDriver16)(UINT16,LPARAM,LPARAM);
|
||||
extern LRESULT (*pFnSendMessage16)(UINT16,UINT,LPARAM,LPARAM);
|
||||
extern WINMM_MapType (*pFnMciMapMsg32WTo16)(WORD,WORD,DWORD,DWORD_PTR*);
|
||||
extern WINMM_MapType (*pFnMciUnMapMsg32WTo16)(WORD,WORD,DWORD,DWORD_PTR);
|
||||
extern LRESULT (*pFnCallMMDrvFunc16)(DWORD /* in fact FARPROC16 */,WORD,WORD,LONG,LONG,LONG);
|
||||
extern unsigned (*pFnLoadMMDrvFunc16)(LPCSTR,LPWINE_DRIVER, LPWINE_MM_DRIVER);
|
||||
|
||||
|
|
Loading…
Reference in New Issue