Commit 894eedf5 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Move driver message mapping out of 32 bit code.

parent 01878bbf
...@@ -72,128 +72,6 @@ LPWINE_DRIVER DRIVER_FindFromHDrvr(HDRVR hDrvr) ...@@ -72,128 +72,6 @@ LPWINE_DRIVER DRIVER_FindFromHDrvr(HDRVR hDrvr)
} }
/************************************************************************** /**************************************************************************
* 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] * DRIVER_SendMessage [internal]
*/ */
static LRESULT inline DRIVER_SendMessage(LPWINE_DRIVER lpDrv, UINT msg, static LRESULT inline DRIVER_SendMessage(LPWINE_DRIVER lpDrv, UINT msg,
......
...@@ -2173,6 +2173,120 @@ void WINAPI WMMMidiRunOnce16(void) ...@@ -2173,6 +2173,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] * DrvOpen [MMSYSTEM.1100]
*/ */
HDRVR16 WINAPI DrvOpen16(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam) HDRVR16 WINAPI DrvOpen16(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
......
...@@ -265,6 +265,10 @@ BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODU ...@@ -265,6 +265,10 @@ BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODU
void TIME_MMTimeStart(void); void TIME_MMTimeStart(void);
void TIME_MMTimeStop(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 */ /* Global variables */
extern LPWINE_MM_IDATA WINMM_IData; extern LPWINE_MM_IDATA WINMM_IData;
......
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