Move driver message mapping out of 32 bit code.
This commit is contained in:
parent
01878bbf22
commit
894eedf5d3
|
@ -71,128 +71,6 @@ LPWINE_DRIVER DRIVER_FindFromHDrvr(HDRVR hDrvr)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* DRIVER_MapMsg32To16 [internal]
|
||||
*
|
||||
* Map a 32 bit driver message to a 16 bit driver message.
|
||||
* 1 : ok, some memory allocated, need to call DRIVER_UnMapMsg32To16
|
||||
* 0 : ok, no memory allocated
|
||||
* -1 : ko, unknown message
|
||||
* -2 : ko, memory problem
|
||||
*/
|
||||
static int DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
switch (wMsg) {
|
||||
case DRV_LOAD:
|
||||
case DRV_ENABLE:
|
||||
case DRV_DISABLE:
|
||||
case DRV_FREE:
|
||||
case DRV_QUERYCONFIGURE:
|
||||
case DRV_REMOVE:
|
||||
case DRV_EXITSESSION:
|
||||
case DRV_EXITAPPLICATION:
|
||||
case DRV_POWER:
|
||||
case DRV_CLOSE: /* should be 0/0 */
|
||||
case DRV_OPEN: /* pass through */
|
||||
/* lParam1 and lParam2 are not used */
|
||||
ret = 0;
|
||||
break;
|
||||
break;
|
||||
case DRV_CONFIGURE:
|
||||
case DRV_INSTALL:
|
||||
/* lParam1 is a handle to a window (conf) or to a driver (inst) or not used,
|
||||
* lParam2 is a pointer to DRVCONFIGINFO
|
||||
*/
|
||||
if (*lParam2) {
|
||||
LPDRVCONFIGINFO16 dci16 = HeapAlloc( GetProcessHeap(), 0, sizeof(*dci16) );
|
||||
LPDRVCONFIGINFO dci32 = (LPDRVCONFIGINFO)(*lParam2);
|
||||
|
||||
if (dci16) {
|
||||
LPSTR str1;
|
||||
|
||||
dci16->dwDCISize = sizeof(DRVCONFIGINFO16);
|
||||
|
||||
if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL)
|
||||
{
|
||||
dci16->lpszDCISectionName = MapLS( str1 );
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL)
|
||||
{
|
||||
dci16->lpszDCIAliasName = MapLS( str1 );
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
*lParam2 = MapLS( dci16 );
|
||||
ret = 1;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) {
|
||||
FIXME("Unknown message 0x%04x\n", wMsg);
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* DRIVER_UnMapMsg32To16 [internal]
|
||||
*
|
||||
* UnMap a 32 bit driver message to a 16 bit driver message.
|
||||
* 0 : ok
|
||||
* -1 : ko
|
||||
* -2 : ko, memory problem
|
||||
*/
|
||||
static int DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2)
|
||||
{
|
||||
int ret = -1;
|
||||
|
||||
switch (wMsg) {
|
||||
case DRV_LOAD:
|
||||
case DRV_ENABLE:
|
||||
case DRV_DISABLE:
|
||||
case DRV_FREE:
|
||||
case DRV_QUERYCONFIGURE:
|
||||
case DRV_REMOVE:
|
||||
case DRV_EXITSESSION:
|
||||
case DRV_EXITAPPLICATION:
|
||||
case DRV_POWER:
|
||||
case DRV_OPEN:
|
||||
case DRV_CLOSE:
|
||||
/* lParam1 and lParam2 are not used */
|
||||
break;
|
||||
case DRV_CONFIGURE:
|
||||
case DRV_INSTALL:
|
||||
/* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */
|
||||
if (lParam2) {
|
||||
LPDRVCONFIGINFO16 dci16 = MapSL(lParam2);
|
||||
HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCISectionName) );
|
||||
HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCIAliasName) );
|
||||
UnMapLS( lParam2 );
|
||||
UnMapLS( dci16->lpszDCISectionName );
|
||||
UnMapLS( dci16->lpszDCIAliasName );
|
||||
HeapFree( GetProcessHeap(), 0, dci16 );
|
||||
}
|
||||
ret = 0;
|
||||
break;
|
||||
default:
|
||||
if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) {
|
||||
FIXME("Unknown message 0x%04x\n", wMsg);
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* DRIVER_SendMessage [internal]
|
||||
*/
|
||||
|
|
|
@ -2172,6 +2172,120 @@ void WINAPI WMMMidiRunOnce16(void)
|
|||
* ###################################################
|
||||
*/
|
||||
|
||||
/**************************************************************************
|
||||
* DRIVER_MapMsg32To16 [internal]
|
||||
*
|
||||
* Map a 32 bit driver message to a 16 bit driver message.
|
||||
*/
|
||||
WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
|
||||
{
|
||||
WINMM_MapType ret = WINMM_MAP_MSGERROR;
|
||||
|
||||
switch (wMsg) {
|
||||
case DRV_LOAD:
|
||||
case DRV_ENABLE:
|
||||
case DRV_DISABLE:
|
||||
case DRV_FREE:
|
||||
case DRV_QUERYCONFIGURE:
|
||||
case DRV_REMOVE:
|
||||
case DRV_EXITSESSION:
|
||||
case DRV_EXITAPPLICATION:
|
||||
case DRV_POWER:
|
||||
case DRV_CLOSE: /* should be 0/0 */
|
||||
case DRV_OPEN: /* pass through */
|
||||
/* lParam1 and lParam2 are not used */
|
||||
ret = WINMM_MAP_OK;
|
||||
break;
|
||||
case DRV_CONFIGURE:
|
||||
case DRV_INSTALL:
|
||||
/* lParam1 is a handle to a window (conf) or to a driver (inst) or not used,
|
||||
* lParam2 is a pointer to DRVCONFIGINFO
|
||||
*/
|
||||
if (*lParam2) {
|
||||
LPDRVCONFIGINFO16 dci16 = HeapAlloc( GetProcessHeap(), 0, sizeof(*dci16) );
|
||||
LPDRVCONFIGINFO dci32 = (LPDRVCONFIGINFO)(*lParam2);
|
||||
|
||||
if (dci16) {
|
||||
LPSTR str1;
|
||||
|
||||
dci16->dwDCISize = sizeof(DRVCONFIGINFO16);
|
||||
|
||||
if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL)
|
||||
{
|
||||
dci16->lpszDCISectionName = MapLS( str1 );
|
||||
} else {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL)
|
||||
{
|
||||
dci16->lpszDCIAliasName = MapLS( str1 );
|
||||
} else {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
} else {
|
||||
return WINMM_MAP_NOMEM;
|
||||
}
|
||||
*lParam2 = MapLS( dci16 );
|
||||
ret = WINMM_MAP_OKMEM;
|
||||
} else {
|
||||
ret = WINMM_MAP_OK;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) {
|
||||
FIXME("Unknown message 0x%04x\n", wMsg);
|
||||
}
|
||||
ret = WINMM_MAP_OK;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* DRIVER_UnMapMsg32To16 [internal]
|
||||
*
|
||||
* UnMap a 32 bit driver message to a 16 bit driver message.
|
||||
*/
|
||||
WINMM_MapType DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2)
|
||||
{
|
||||
WINMM_MapType ret = WINMM_MAP_MSGERROR;
|
||||
|
||||
switch (wMsg) {
|
||||
case DRV_LOAD:
|
||||
case DRV_ENABLE:
|
||||
case DRV_DISABLE:
|
||||
case DRV_FREE:
|
||||
case DRV_QUERYCONFIGURE:
|
||||
case DRV_REMOVE:
|
||||
case DRV_EXITSESSION:
|
||||
case DRV_EXITAPPLICATION:
|
||||
case DRV_POWER:
|
||||
case DRV_OPEN:
|
||||
case DRV_CLOSE:
|
||||
/* lParam1 and lParam2 are not used */
|
||||
break;
|
||||
case DRV_CONFIGURE:
|
||||
case DRV_INSTALL:
|
||||
/* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */
|
||||
if (lParam2) {
|
||||
LPDRVCONFIGINFO16 dci16 = MapSL(lParam2);
|
||||
HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCISectionName) );
|
||||
HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCIAliasName) );
|
||||
UnMapLS( lParam2 );
|
||||
UnMapLS( dci16->lpszDCISectionName );
|
||||
UnMapLS( dci16->lpszDCIAliasName );
|
||||
HeapFree( GetProcessHeap(), 0, dci16 );
|
||||
}
|
||||
ret = WINMM_MAP_OK;
|
||||
break;
|
||||
default:
|
||||
if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) {
|
||||
FIXME("Unknown message 0x%04x\n", wMsg);
|
||||
}
|
||||
ret = WINMM_MAP_OK;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* DrvOpen [MMSYSTEM.1100]
|
||||
*/
|
||||
|
|
|
@ -265,6 +265,10 @@ BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODU
|
|||
void TIME_MMTimeStart(void);
|
||||
void TIME_MMTimeStop(void);
|
||||
|
||||
/* temporary defines */
|
||||
WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2);
|
||||
WINMM_MapType DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2);
|
||||
|
||||
/* Global variables */
|
||||
extern LPWINE_MM_IDATA WINMM_IData;
|
||||
|
||||
|
|
Loading…
Reference in New Issue