All driver functions are now properly separated.

This commit is contained in:
Eric Pouech 2002-10-29 21:51:24 +00:00 committed by Alexandre Julliard
parent 74b20fb8d8
commit b4df16b3b2
4 changed files with 233 additions and 172 deletions

View File

@ -25,16 +25,20 @@
#include <string.h> #include <string.h>
#include "heap.h" #include "heap.h"
#include "windef.h" #include "windef.h"
#include "wingdi.h"
#include "winuser.h"
#include "mmddk.h" #include "mmddk.h"
#include "winemm.h" #include "winemm.h"
#include "wine/winbase16.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(driver); WINE_DEFAULT_DEBUG_CHANNEL(driver);
static LPWINE_DRIVER lpDrvItemList = NULL; static LPWINE_DRIVER lpDrvItemList /* = NULL */;
WINE_MMTHREAD* (*pFnGetMMThread16)(HANDLE16 h) /* = NULL */; WINE_MMTHREAD* (*pFnGetMMThread16)(HANDLE16 h) /* = NULL */;
LPWINE_DRIVER (*pFnOpenDriver16)(LPCSTR,LPCSTR,LPARAM) /* = NULL */;
LRESULT (*pFnCloseDriver16)(HDRVR16,LPARAM,LPARAM) /* = NULL */;
LRESULT (*pFnSendMessage16)(HDRVR16,UINT,LPARAM,LPARAM) /* = NULL */;
/************************************************************************** /**************************************************************************
* DRIVER_GetNumberOfModuleRefs [internal] * DRIVER_GetNumberOfModuleRefs [internal]
@ -77,26 +81,23 @@ LPWINE_DRIVER DRIVER_FindFromHDrvr(HDRVR hDrvr)
* 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,
LPARAM lParam1, LPARAM lParam2) LPARAM lParam1, LPARAM lParam2)
{ {
if (lpDrv->dwFlags & WINE_GDF_16BIT) { LRESULT ret = 0;
LRESULT ret;
int map = 0;
TRACE("Before sdm16 call hDrv=%04x wMsg=%04x p1=%08lx p2=%08lx\n",
lpDrv->d.d16.hDriver16, msg, lParam1, lParam2);
if ((map = DRIVER_MapMsg32To16(msg, &lParam1, &lParam2)) >= 0) { if (lpDrv->dwFlags & WINE_GDF_16BIT) {
ret = SendDriverMessage16(lpDrv->d.d16.hDriver16, msg, lParam1, lParam2); /* no need to check mmsystem presence: the driver must have been opened as a 16 bit one,
if (map == 1) */
DRIVER_UnMapMsg32To16(msg, lParam1, lParam2); if (pFnSendMessage16)
} else { ret = pFnSendMessage16(lpDrv->d.d16.hDriver16, msg, lParam1, lParam2);
ret = 0; } else {
} TRACE("Before call32 proc=%p drvrID=%08lx hDrv=%08x wMsg=%04x p1=%08lx p2=%08lx\n",
return ret; lpDrv->d.d32.lpDrvProc, lpDrv->d.d32.dwDriverID, (HDRVR)lpDrv, msg, lParam1, lParam2);
ret = lpDrv->d.d32.lpDrvProc(lpDrv->d.d32.dwDriverID, (HDRVR)lpDrv, msg, lParam1, lParam2);
TRACE("After call32 proc=%p drvrID=%08lx hDrv=%08x wMsg=%04x p1=%08lx p2=%08lx => %08lx\n",
lpDrv->d.d32.lpDrvProc, lpDrv->d.d32.dwDriverID, (HDRVR)lpDrv, msg, lParam1, lParam2, ret);
} }
TRACE("Before func32 call proc=%p driverID=%08lx hDrv=%08x wMsg=%04x p1=%08lx p2=%08lx\n", return ret;
lpDrv->d.d32.lpDrvProc, lpDrv->d.d32.dwDriverID, (HDRVR)lpDrv, msg, lParam1, lParam2);
return lpDrv->d.d32.lpDrvProc(lpDrv->d.d32.dwDriverID, (HDRVR)lpDrv, msg, lParam1, lParam2);
} }
/************************************************************************** /**************************************************************************
@ -274,40 +275,6 @@ LPWINE_DRIVER DRIVER_TryOpenDriver32(LPCSTR fn, LPARAM lParam2)
return NULL; return NULL;
} }
/**************************************************************************
* DRIVER_TryOpenDriver16 [internal]
*
* Tries to load a 16 bit driver whose DLL's (module) name is lpFileName.
*/
static LPWINE_DRIVER DRIVER_TryOpenDriver16(LPCSTR fn, LPCSTR sn, LPARAM lParam2)
{
LPWINE_DRIVER lpDrv = NULL;
LPCSTR cause = 0;
TRACE("(%s, %08lX);\n", debugstr_a(sn), lParam2);
lpDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_DRIVER));
if (lpDrv == NULL) {cause = "OOM"; goto exit;}
/* FIXME: shall we do some black magic here on sn ?
* drivers32 => drivers
* mci32 => mci
* ...
*/
lpDrv->d.d16.hDriver16 = OpenDriver16(fn, sn, lParam2);
if (lpDrv->d.d16.hDriver16 == 0) {cause = "Not a 16 bit driver"; goto exit;}
lpDrv->dwFlags = WINE_GDF_16BIT;
if (!DRIVER_AddToList(lpDrv, 0, lParam2)) {cause = "load failed"; goto exit;}
TRACE("=> %p\n", lpDrv);
return lpDrv;
exit:
HeapFree(GetProcessHeap(), 0, lpDrv);
TRACE("Unable to load 32 bit module %s: %s\n", debugstr_a(fn), cause);
return NULL;
}
/************************************************************************** /**************************************************************************
* OpenDriverA [WINMM.@] * OpenDriverA [WINMM.@]
* DrvOpenA [WINMM.@] * DrvOpenA [WINMM.@]
@ -334,8 +301,20 @@ HDRVR WINAPI OpenDriverA(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lPara
(lpDrv = DRIVER_TryOpenDriver32(libName, lParam2))) (lpDrv = DRIVER_TryOpenDriver32(libName, lParam2)))
goto the_end; goto the_end;
if (!(lpDrv = DRIVER_TryOpenDriver16(lpDriverName, lpSectionName, lParam2))) /* now we will try a 16 bit driver (and add all the glue to make it work... which
TRACE("Failed to open driver %s from system.ini file, section %s\n", debugstr_a(lpDriverName), debugstr_a(lpSectionName)); * is located in our mmsystem implementation)
* so ensure, we can load our mmsystem, otherwise just fail
*/
WINMM_CheckForMMSystem();
if (pFnOpenDriver16 &&
(lpDrv = pFnOpenDriver16(lpDriverName, lpSectionName, lParam2)))
{
if (DRIVER_AddToList(lpDrv, 0, lParam2)) goto the_end;
HeapFree(GetProcessHeap(), 0, lpDrv);
}
TRACE("Failed to open driver %s from system.ini file, section %s\n", debugstr_a(lpDriverName), debugstr_a(lpSectionName));
return 0;
the_end: the_end:
if (lpDrv) TRACE("=> %08lx\n", (DWORD)lpDrv); if (lpDrv) TRACE("=> %08lx\n", (DWORD)lpDrv);
return (HDRVR)lpDrv; return (HDRVR)lpDrv;
@ -369,7 +348,10 @@ LRESULT WINAPI CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
if ((lpDrv = DRIVER_FindFromHDrvr(hDrvr)) != NULL) if ((lpDrv = DRIVER_FindFromHDrvr(hDrvr)) != NULL)
{ {
if (lpDrv->dwFlags & WINE_GDF_16BIT) if (lpDrv->dwFlags & WINE_GDF_16BIT)
CloseDriver16(lpDrv->d.d16.hDriver16, lParam1, lParam2); {
if (pFnCloseDriver16)
pFnCloseDriver16(lpDrv->d.d16.hDriver16, lParam1, lParam2);
}
else else
{ {
DRIVER_SendMessage(lpDrv, DRV_CLOSE, lParam1, lParam2); DRIVER_SendMessage(lpDrv, DRV_CLOSE, lParam1, lParam2);
@ -464,3 +446,64 @@ LRESULT WINAPI DefDriverProc(DWORD dwDriverIdentifier, HDRVR hDrv,
return 0; return 0;
} }
} }
/**************************************************************************
* DriverCallback [WINMM.@]
*/
BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev,
UINT wMsg, DWORD dwUser, DWORD dwParam1,
DWORD dwParam2)
{
TRACE("(%08lX, %04X, %04X, %04X, %08lX, %08lX, %08lX); !\n",
dwCallBack, uFlags, hDev, wMsg, dwUser, dwParam1, dwParam2);
switch (uFlags & DCB_TYPEMASK) {
case DCB_NULL:
TRACE("Null !\n");
if (dwCallBack)
WARN("uFlags=%04X has null DCB value, but dwCallBack=%08lX is not null !\n", uFlags, dwCallBack);
break;
case DCB_WINDOW:
TRACE("Window(%04lX) handle=%04X!\n", dwCallBack, hDev);
PostMessageA((HWND)dwCallBack, wMsg, (WPARAM)hDev, dwParam1);
break;
case DCB_TASK: /* aka DCB_THREAD */
TRACE("Task(%04lx) !\n", dwCallBack);
PostThreadMessageA(dwCallBack, wMsg, (WPARAM)hDev, dwParam1);
break;
case DCB_FUNCTION:
TRACE("Function (32 bit) !\n");
((LPDRVCALLBACK)dwCallBack)(hDev, wMsg, dwUser, dwParam1, dwParam2);
break;
case DCB_EVENT:
TRACE("Event(%08lx) !\n", dwCallBack);
SetEvent((HANDLE)dwCallBack);
break;
case 6: /* I would dub it DCB_MMTHREADSIGNAL */
/* this is an undocumented DCB_ value used for mmThreads
* loword of dwCallBack contains the handle of the lpMMThd block
* which dwSignalCount has to be incremented
*/
if (pFnGetMMThread16)
{
WINE_MMTHREAD* lpMMThd = pFnGetMMThread16(LOWORD(dwCallBack));
TRACE("mmThread (%04x, %p) !\n", LOWORD(dwCallBack), lpMMThd);
/* same as mmThreadSignal16 */
InterlockedIncrement(&lpMMThd->dwSignalCount);
SetEvent(lpMMThd->hEvent);
/* some other stuff on lpMMThd->hVxD */
}
break;
#if 0
case 4:
/* this is an undocumented DCB_ value for... I don't know */
break;
#endif
default:
WARN("Unknown callback type %d\n", uFlags & DCB_TYPEMASK);
return FALSE;
}
TRACE("Done\n");
return TRUE;
}

View File

@ -50,6 +50,9 @@ extern LONG CALLBACK MMSYSTEM_CallTo16_long_lwll (LPMMIOPROC16,LONG,WORD,LONG,LO
/* ### stop build ### */ /* ### stop build ### */
static WINE_MMTHREAD* WINMM_GetmmThread(HANDLE16); static WINE_MMTHREAD* WINMM_GetmmThread(HANDLE16);
static LPWINE_DRIVER DRIVER_OpenDriver16(LPCSTR, LPCSTR, LPARAM);
static LRESULT DRIVER_CloseDriver16(HDRVR16, LPARAM, LPARAM);
static LRESULT DRIVER_SendMessage16(HDRVR16, UINT, LPARAM, LPARAM);
static LRESULT MMIO_Callback16(SEGPTR, LPMMIOINFO, UINT, LPARAM, LPARAM); static LRESULT MMIO_Callback16(SEGPTR, LPMMIOINFO, UINT, LPARAM, LPARAM);
/* ################################################### /* ###################################################
@ -81,11 +84,17 @@ BOOL WINAPI MMSYSTEM_LibMain(DWORD fdwReason, HINSTANCE hinstDLL, WORD ds,
WINMM_IData->hWinMM16Instance = hinstDLL; WINMM_IData->hWinMM16Instance = hinstDLL;
/* hook in our 16 bit function pointers */ /* hook in our 16 bit function pointers */
pFnGetMMThread16 = WINMM_GetmmThread; pFnGetMMThread16 = WINMM_GetmmThread;
pFnOpenDriver16 = DRIVER_OpenDriver16;
pFnCloseDriver16 = DRIVER_CloseDriver16;
pFnSendMessage16 = DRIVER_SendMessage16;
pFnMmioCallback16 = MMIO_Callback16; pFnMmioCallback16 = MMIO_Callback16;
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
WINMM_IData->hWinMM16Instance = 0; WINMM_IData->hWinMM16Instance = 0;
pFnGetMMThread16 = NULL; pFnGetMMThread16 = NULL;
pFnOpenDriver16 = NULL;
pFnCloseDriver16 = NULL;
pFnSendMessage16 = NULL;
pFnMmioCallback16 = NULL; pFnMmioCallback16 = NULL;
break; break;
case DLL_THREAD_ATTACH: case DLL_THREAD_ATTACH:
@ -2183,11 +2192,11 @@ void WINAPI WMMMidiRunOnce16(void)
*/ */
/************************************************************************** /**************************************************************************
* DRIVER_MapMsg32To16 [internal] * DRIVER_MapMsg32To16 [internal]
* *
* Map a 32 bit driver message to a 16 bit driver message. * Map a 32 bit driver message to a 16 bit driver message.
*/ */
WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2) static WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
{ {
WINMM_MapType ret = WINMM_MAP_MSGERROR; WINMM_MapType ret = WINMM_MAP_MSGERROR;
@ -2201,63 +2210,63 @@ WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
case DRV_EXITSESSION: case DRV_EXITSESSION:
case DRV_EXITAPPLICATION: case DRV_EXITAPPLICATION:
case DRV_POWER: case DRV_POWER:
case DRV_CLOSE: /* should be 0/0 */ case DRV_CLOSE: /* should be 0/0 */
case DRV_OPEN: /* pass through */ case DRV_OPEN: /* pass through */
/* lParam1 and lParam2 are not used */ /* lParam1 and lParam2 are not used */
ret = WINMM_MAP_OK; ret = WINMM_MAP_OK;
break; break;
case DRV_CONFIGURE: case DRV_CONFIGURE:
case DRV_INSTALL: case DRV_INSTALL:
/* lParam1 is a handle to a window (conf) or to a driver (inst) or not used, /* lParam1 is a handle to a window (conf) or to a driver (inst) or not used,
* lParam2 is a pointer to DRVCONFIGINFO * lParam2 is a pointer to DRVCONFIGINFO
*/ */
if (*lParam2) { if (*lParam2) {
LPDRVCONFIGINFO16 dci16 = HeapAlloc( GetProcessHeap(), 0, sizeof(*dci16) ); LPDRVCONFIGINFO16 dci16 = HeapAlloc( GetProcessHeap(), 0, sizeof(*dci16) );
LPDRVCONFIGINFO dci32 = (LPDRVCONFIGINFO)(*lParam2); LPDRVCONFIGINFO dci32 = (LPDRVCONFIGINFO)(*lParam2);
if (dci16) { if (dci16) {
LPSTR str1; LPSTR str1;
dci16->dwDCISize = sizeof(DRVCONFIGINFO16); dci16->dwDCISize = sizeof(DRVCONFIGINFO16);
if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL) if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCISectionName)) != NULL)
{ {
dci16->lpszDCISectionName = MapLS( str1 ); dci16->lpszDCISectionName = MapLS( str1 );
} else { } else {
return WINMM_MAP_NOMEM; return WINMM_MAP_NOMEM;
} }
if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL) if ((str1 = HEAP_strdupWtoA(GetProcessHeap(), 0, dci32->lpszDCIAliasName)) != NULL)
{ {
dci16->lpszDCIAliasName = MapLS( str1 ); dci16->lpszDCIAliasName = MapLS( str1 );
} else { } else {
return WINMM_MAP_NOMEM; return WINMM_MAP_NOMEM;
} }
} else { } else {
return WINMM_MAP_NOMEM; return WINMM_MAP_NOMEM;
} }
*lParam2 = MapLS( dci16 ); *lParam2 = MapLS( dci16 );
ret = WINMM_MAP_OKMEM; ret = WINMM_MAP_OKMEM;
} else { } else {
ret = WINMM_MAP_OK; ret = WINMM_MAP_OK;
} }
break; break;
default: default:
if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) { if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) {
FIXME("Unknown message 0x%04x\n", wMsg); FIXME("Unknown message 0x%04x\n", wMsg);
} }
ret = WINMM_MAP_OK; ret = WINMM_MAP_OK;
} }
return ret; return ret;
} }
/************************************************************************** /**************************************************************************
* DRIVER_UnMapMsg32To16 [internal] * DRIVER_UnMapMsg32To16 [internal]
* *
* UnMap a 32 bit driver message to a 16 bit driver message. * UnMap a 32 bit driver message to a 16 bit driver message.
*/ */
WINMM_MapType DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2) static WINMM_MapType DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2)
{ {
WINMM_MapType ret = WINMM_MAP_MSGERROR; WINMM_MapType ret = WINMM_MAP_MSGERROR;
switch (wMsg) { switch (wMsg) {
case DRV_LOAD: case DRV_LOAD:
@ -2271,31 +2280,99 @@ WINMM_MapType DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2)
case DRV_POWER: case DRV_POWER:
case DRV_OPEN: case DRV_OPEN:
case DRV_CLOSE: case DRV_CLOSE:
/* lParam1 and lParam2 are not used */ /* lParam1 and lParam2 are not used */
break; break;
case DRV_CONFIGURE: case DRV_CONFIGURE:
case DRV_INSTALL: case DRV_INSTALL:
/* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */ /* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */
if (lParam2) { if (lParam2) {
LPDRVCONFIGINFO16 dci16 = MapSL(lParam2); LPDRVCONFIGINFO16 dci16 = MapSL(lParam2);
HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCISectionName) ); HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCISectionName) );
HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCIAliasName) ); HeapFree( GetProcessHeap(), 0, MapSL(dci16->lpszDCIAliasName) );
UnMapLS( lParam2 ); UnMapLS( lParam2 );
UnMapLS( dci16->lpszDCISectionName ); UnMapLS( dci16->lpszDCISectionName );
UnMapLS( dci16->lpszDCIAliasName ); UnMapLS( dci16->lpszDCIAliasName );
HeapFree( GetProcessHeap(), 0, dci16 ); HeapFree( GetProcessHeap(), 0, dci16 );
} }
ret = WINMM_MAP_OK; ret = WINMM_MAP_OK;
break; break;
default: default:
if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) { if (!((wMsg >= 0x800 && wMsg < 0x900) || (wMsg >= 0x4000 && wMsg < 0x4100))) {
FIXME("Unknown message 0x%04x\n", wMsg); FIXME("Unknown message 0x%04x\n", wMsg);
} }
ret = WINMM_MAP_OK; ret = WINMM_MAP_OK;
} }
return ret; return ret;
} }
/**************************************************************************
* DRIVER_TryOpenDriver16 [internal]
*
* Tries to load a 16 bit driver whose DLL's (module) name is lpFileName.
*/
static LPWINE_DRIVER DRIVER_OpenDriver16(LPCSTR fn, LPCSTR sn, LPARAM lParam2)
{
LPWINE_DRIVER lpDrv = NULL;
LPCSTR cause = 0;
TRACE("(%s, %08lX);\n", debugstr_a(sn), lParam2);
lpDrv = HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_DRIVER));
if (lpDrv == NULL) {cause = "OOM"; goto exit;}
/* FIXME: shall we do some black magic here on sn ?
* drivers32 => drivers
* mci32 => mci
* ...
*/
lpDrv->d.d16.hDriver16 = OpenDriver16(fn, sn, lParam2);
if (lpDrv->d.d16.hDriver16 == 0) {cause = "Not a 16 bit driver"; goto exit;}
lpDrv->dwFlags = WINE_GDF_16BIT;
TRACE("=> %p\n", lpDrv);
return lpDrv;
exit:
HeapFree(GetProcessHeap(), 0, lpDrv);
TRACE("Unable to load 16 bit module %s: %s\n", debugstr_a(fn), cause);
return NULL;
}
/******************************************************************
* DRIVER_SendMessage16
*
*
*/
static LRESULT DRIVER_SendMessage16(HDRVR16 hDrv16, UINT msg,
LPARAM lParam1, LPARAM lParam2)
{
LRESULT ret = 0;
WINMM_MapType map;
TRACE("Before sdm16 call hDrv=%04x wMsg=%04x p1=%08lx p2=%08lx\n",
hDrv16, msg, lParam1, lParam2);
switch (map = DRIVER_MapMsg32To16(msg, &lParam1, &lParam2)) {
case WINMM_MAP_OKMEM:
case WINMM_MAP_OK:
ret = SendDriverMessage16(hDrv16, msg, lParam1, lParam2);
if (map == WINMM_MAP_OKMEM)
DRIVER_UnMapMsg32To16(msg, lParam1, lParam2);
default:
break;
}
return ret;
}
/******************************************************************
* DRIVER_CloseDriver16
*
*
*/
static LRESULT DRIVER_CloseDriver16(HDRVR16 hDrv16, LPARAM lParam1, LPARAM lParam2)
{
return CloseDriver16(hDrv16, lParam1, lParam2);
}
/************************************************************************** /**************************************************************************
* DrvOpen [MMSYSTEM.1100] * DrvOpen [MMSYSTEM.1100]
*/ */

View File

@ -505,63 +505,3 @@ UINT WINAPI mmsystemGetVersion(void)
TRACE("3.10 (Win95?)\n"); TRACE("3.10 (Win95?)\n");
return 0x030a; return 0x030a;
} }
/**************************************************************************
* DriverCallback [WINMM.@]
*/
BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev,
UINT wMsg, DWORD dwUser, DWORD dwParam1,
DWORD dwParam2)
{
TRACE("(%08lX, %04X, %04X, %04X, %08lX, %08lX, %08lX); !\n",
dwCallBack, uFlags, hDev, wMsg, dwUser, dwParam1, dwParam2);
switch (uFlags & DCB_TYPEMASK) {
case DCB_NULL:
TRACE("Null !\n");
if (dwCallBack)
WARN("uFlags=%04X has null DCB value, but dwCallBack=%08lX is not null !\n", uFlags, dwCallBack);
break;
case DCB_WINDOW:
TRACE("Window(%04lX) handle=%04X!\n", dwCallBack, hDev);
PostMessageA((HWND)dwCallBack, wMsg, (WPARAM)hDev, dwParam1);
break;
case DCB_TASK: /* aka DCB_THREAD */
TRACE("Task(%04lx) !\n", dwCallBack);
PostThreadMessageA(dwCallBack, wMsg, (WPARAM)hDev, dwParam1);
break;
case DCB_FUNCTION:
TRACE("Function (32 bit) !\n");
((LPDRVCALLBACK)dwCallBack)(hDev, wMsg, dwUser, dwParam1, dwParam2);
break;
case DCB_EVENT:
TRACE("Event(%08lx) !\n", dwCallBack);
SetEvent((HANDLE)dwCallBack);
break;
case 6: /* I would dub it DCB_MMTHREADSIGNAL */
/* this is an undocumented DCB_ value used for mmThreads
* loword of dwCallBack contains the handle of the lpMMThd block
* which dwSignalCount has to be incremented
*/
{
WINE_MMTHREAD* lpMMThd = MapSL( MAKESEGPTR(LOWORD(dwCallBack), 0) );
TRACE("mmThread (%04x, %p) !\n", LOWORD(dwCallBack), lpMMThd);
/* same as mmThreadSignal16 */
InterlockedIncrement(&lpMMThd->dwSignalCount);
SetEvent(lpMMThd->hEvent);
/* some other stuff on lpMMThd->hVxD */
}
break;
#if 0
case 4:
/* this is an undocumented DCB_ value for... I don't know */
break;
#endif
default:
WARN("Unknown callback type %d\n", uFlags & DCB_TYPEMASK);
return FALSE;
}
TRACE("Done\n");
return TRUE;
}

View File

@ -290,8 +290,6 @@ void TIME_MMTimeStart(void);
void TIME_MMTimeStop(void); void TIME_MMTimeStop(void);
/* temporary definitions */ /* temporary definitions */
WINMM_MapType DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2);
WINMM_MapType DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2);
WINMM_MapType MCI_MapMsg16To32A (WORD uDevType, WORD wMsg, DWORD* lParam); WINMM_MapType MCI_MapMsg16To32A (WORD uDevType, WORD wMsg, DWORD* lParam);
WINMM_MapType MCI_UnMapMsg16To32A(WORD uDevType, WORD wMsg, DWORD lParam); WINMM_MapType MCI_UnMapMsg16To32A(WORD uDevType, WORD wMsg, DWORD lParam);
WINMM_MapType MCI_MapMsg32ATo16 (WORD uDevType, WORD wMsg, DWORD dwFlags, DWORD* lParam); WINMM_MapType MCI_MapMsg32ATo16 (WORD uDevType, WORD wMsg, DWORD dwFlags, DWORD* lParam);
@ -343,6 +341,9 @@ extern LPWINE_MM_IDATA WINMM_IData;
* NULL otherwise * NULL otherwise
*/ */
extern LRESULT (*pFnMmioCallback16)(SEGPTR,LPMMIOINFO,UINT,LPARAM,LPARAM); extern LRESULT (*pFnMmioCallback16)(SEGPTR,LPMMIOINFO,UINT,LPARAM,LPARAM);
extern LPWINE_DRIVER (*pFnOpenDriver16)(LPCSTR,LPCSTR,LPARAM);
extern LRESULT (*pFnCloseDriver16)(HDRVR16,LPARAM,LPARAM);
extern LRESULT (*pFnSendMessage16)(HDRVR16,UINT,LPARAM,LPARAM);
extern WINE_MMTHREAD* (*pFnGetMMThread16)(HANDLE16); extern WINE_MMTHREAD* (*pFnGetMMThread16)(HANDLE16);
/* HANDLE16 -> HANDLE conversions */ /* HANDLE16 -> HANDLE conversions */