winmm: Remove commented out code.
The code tried to optimize the usage of the 32bit A(scii) winmm API with a 16bit driver.
This commit is contained in:
parent
0ca2d32682
commit
1134008973
|
@ -1846,672 +1846,6 @@ static unsigned MMDRV_LoadMMDrvFunc16(LPCSTR drvName, LPWINE_DRIVER d,
|
|||
* M C I
|
||||
* ================================= */
|
||||
|
||||
#if 0
|
||||
/* FIXME: this code is kept for not yet implemented optimisation for an application
|
||||
* using the 32A MCI interface and calling a 16 bit driver.
|
||||
* For now, we're doing two conversions:
|
||||
* - 32A => 32W (in 32 bit MCI code)
|
||||
* - 32W => 16 in this file
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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_MsgMapper32ATo16_Create [internal]
|
||||
*
|
||||
* Helper for MCI_MapMsg32ATo16.
|
||||
* 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_MsgMapper32ATo16_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 = (LPBYTE)(*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( *(LPSTR *)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_MsgMapper32ATo16_Destroy [internal]
|
||||
*
|
||||
* Helper for MCI_UnMapMsg32ATo16.
|
||||
*/
|
||||
static WINMM_MapType MCI_MsgMapper32ATo16_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:
|
||||
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_MapMsg32ATo16 [internal]
|
||||
*
|
||||
* Map a 32-A bit MCI message to a 16 bit MCI message.
|
||||
*/
|
||||
static WINMM_MapType MCI_MapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DWORD* 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_PARMSA mip32a = (LPMCI_INFO_PARMSA)(*lParam);
|
||||
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;
|
||||
}
|
||||
mip16 = HeapAlloc( GetProcessHeap(), 0, size);
|
||||
if (mip16)
|
||||
{
|
||||
mip16->dwCallback = mip32a->dwCallback;
|
||||
mip16->lpstrReturn = MapLS( mip32a->lpstrReturn );
|
||||
mip16->dwRetSize = mip32a->dwRetSize;
|
||||
if (uDevType == MCI_DEVTYPE_DIGITAL_VIDEO) {
|
||||
((LPMCI_DGV_INFO_PARMS16)mip16)->dwItem = ((LPMCI_DGV_INFO_PARMSA)mip32a)->dwItem;
|
||||
}
|
||||
} else {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
*lParam = MapLS(mip16);
|
||||
}
|
||||
return WINMM_MAP_OKMEM;
|
||||
/* case MCI_MARK: */
|
||||
/* case MCI_MONITOR: */
|
||||
case MCI_OPEN:
|
||||
case MCI_OPEN_DRIVER:
|
||||
{
|
||||
LPMCI_OPEN_PARMSA mop32a = (LPMCI_OPEN_PARMSA)(*lParam);
|
||||
char* ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPMCI_OPEN_PARMSA) + sizeof(MCI_OPEN_PARMS16) + 2 * sizeof(DWORD));
|
||||
LPMCI_OPEN_PARMS16 mop16;
|
||||
|
||||
|
||||
if (ptr) {
|
||||
*(LPMCI_OPEN_PARMSA*)(ptr) = mop32a;
|
||||
mop16 = (LPMCI_OPEN_PARMS16)(ptr + sizeof(LPMCI_OPEN_PARMSA));
|
||||
mop16->dwCallback = mop32a->dwCallback;
|
||||
mop16->wDeviceID = mop32a->wDeviceID;
|
||||
if (dwFlags & MCI_OPEN_TYPE) {
|
||||
if (dwFlags & MCI_OPEN_TYPE_ID) {
|
||||
/* dword "transparent" value */
|
||||
mop16->lpstrDeviceType = (SEGPTR)mop32a->lpstrDeviceType;
|
||||
} else {
|
||||
/* string */
|
||||
mop16->lpstrDeviceType = MapLS( mop32a->lpstrDeviceType );
|
||||
}
|
||||
} else {
|
||||
/* nuthin' */
|
||||
mop16->lpstrDeviceType = 0;
|
||||
}
|
||||
if (dwFlags & MCI_OPEN_ELEMENT) {
|
||||
if (dwFlags & MCI_OPEN_ELEMENT_ID) {
|
||||
mop16->lpstrElementName = (SEGPTR)mop32a->lpstrElementName;
|
||||
} else {
|
||||
mop16->lpstrElementName = MapLS( mop32a->lpstrElementName );
|
||||
}
|
||||
} else {
|
||||
mop16->lpstrElementName = 0;
|
||||
}
|
||||
if (dwFlags & MCI_OPEN_ALIAS) {
|
||||
mop16->lpstrAlias = MapLS( mop32a->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, mop32a + 1, 2 * sizeof(DWORD));
|
||||
} else {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
*lParam = (LPARAM)MapLS(ptr) + sizeof(LPMCI_OPEN_PARMSA);
|
||||
}
|
||||
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_PARMSA msip32a = (LPMCI_SYSINFO_PARMSA)(*lParam);
|
||||
LPMCI_SYSINFO_PARMS16 msip16;
|
||||
char* ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPMCI_SYSINFO_PARMSA) + sizeof(MCI_SYSINFO_PARMS16) );
|
||||
|
||||
if (ptr) {
|
||||
*(LPMCI_SYSINFO_PARMSA*)(ptr) = msip32a;
|
||||
msip16 = (LPMCI_SYSINFO_PARMS16)(ptr + sizeof(LPMCI_SYSINFO_PARMSA));
|
||||
|
||||
msip16->dwCallback = msip32a->dwCallback;
|
||||
msip16->lpstrReturn = MapLS( msip32a->lpstrReturn );
|
||||
msip16->dwRetSize = msip32a->dwRetSize;
|
||||
msip16->dwNumber = msip32a->dwNumber;
|
||||
msip16->wDeviceType = msip32a->wDeviceType;
|
||||
} else {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
*lParam = (LPARAM)MapLS(ptr) + sizeof(LPMCI_SYSINFO_PARMSA);
|
||||
}
|
||||
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_PARMSA modp32a = (LPMCI_OPEN_DRIVER_PARMSA)(*lParam);
|
||||
LPMCI_OPEN_DRIVER_PARMS16 modp16;
|
||||
char *ptr = HeapAlloc( GetProcessHeap(), 0,
|
||||
sizeof(LPMCI_OPEN_DRIVER_PARMSA) + sizeof(MCI_OPEN_DRIVER_PARMS16));
|
||||
|
||||
if (ptr) {
|
||||
*(LPMCI_OPEN_DRIVER_PARMSA*)(ptr) = modp32a;
|
||||
modp16 = (LPMCI_OPEN_DRIVER_PARMS16)(ptr + sizeof(LPMCI_OPEN_DRIVER_PARMSA));
|
||||
modp16->wDeviceID = modp32a->wDeviceID;
|
||||
modp16->lpstrParams = MapLS( modp32a->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_PARMSA);
|
||||
}
|
||||
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_MsgMapper32ATo16_Create((void**)lParam, size, map, keep);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* MCI_UnMapMsg32ATo16 [internal]
|
||||
*/
|
||||
static WINMM_MapType MCI_UnMapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags, DWORD 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:
|
||||
{
|
||||
LPMCI_INFO_PARMS16 mip16 = (LPMCI_INFO_PARMS16)MapSL(lParam);
|
||||
UnMapLS( lParam );
|
||||
UnMapLS( mip16->lpstrReturn );
|
||||
HeapFree( GetProcessHeap(), 0, mip16 );
|
||||
}
|
||||
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_PARMSA mop32a = *(LPMCI_OPEN_PARMSA*)((char*)mop16 - sizeof(LPMCI_OPEN_PARMSA));
|
||||
UnMapLS( lParam );
|
||||
mop32a->wDeviceID = mop16->wDeviceID;
|
||||
if ((dwFlags & MCI_OPEN_TYPE) && !(dwFlags & MCI_OPEN_TYPE_ID))
|
||||
UnMapLS( mop16->lpstrDeviceType );
|
||||
if ((dwFlags & MCI_OPEN_ELEMENT) && !(dwFlags & MCI_OPEN_ELEMENT_ID))
|
||||
UnMapLS( mop16->lpstrElementName );
|
||||
if (dwFlags & MCI_OPEN_ALIAS)
|
||||
UnMapLS( mop16->lpstrAlias );
|
||||
HeapFree( GetProcessHeap(), 0, (char*)mop16 - sizeof(LPMCI_OPEN_PARMSA) );
|
||||
}
|
||||
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=%08lx\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_PARMSA msip32a = *(LPMCI_SYSINFO_PARMSA*)((char*)msip16 - sizeof(LPMCI_SYSINFO_PARMSA));
|
||||
|
||||
UnMapLS( lParam );
|
||||
if (msip16) {
|
||||
msip16->dwCallback = msip32a->dwCallback;
|
||||
UnMapLS( msip16->lpstrReturn );
|
||||
HeapFree( GetProcessHeap(), 0, (char*)msip16 - sizeof(LPMCI_SYSINFO_PARMSA) );
|
||||
} 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_PARMSA modp32a = *(LPMCI_OPEN_DRIVER_PARMSA*)((char*)modp16 - sizeof(LPMCI_OPEN_DRIVER_PARMSA));
|
||||
|
||||
UnMapLS( lParam );
|
||||
modp32a->wCustomCommandTable = modp16->wCustomCommandTable;
|
||||
modp32a->wType = modp16->wType;
|
||||
UnMapLS( modp16->lpstrParams );
|
||||
HeapFree( GetProcessHeap(), 0, (char *)modp16 - sizeof(LPMCI_OPEN_DRIVER_PARMSA) );
|
||||
}
|
||||
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_MsgMapper32ATo16_Destroy((void*)lParam, size, map, kept);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**************************************************************************
|
||||
* MCI_MapMsg16To32W [internal]
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue