Commit fd758586 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Added some trace and debug printing.

parent 458cf0bd
...@@ -221,7 +221,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, ...@@ -221,7 +221,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
TRACE("Calling message(dev=%u msg=%u usr=0x%08lx p1=0x%08lx p2=0x%08lx)\n", TRACE("Calling message(dev=%u msg=%u usr=0x%08lx p1=0x%08lx p2=0x%08lx)\n",
mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2); mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
ret = part->u.fnMessage32(mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2); ret = part->u.fnMessage32(mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
TRACE("=> %lu\n", ret); TRACE("=> %s\n", WINMM_ErrorToString(ret));
} else { } else {
map = llType->Map16To32A(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2); map = llType->Map16To32A(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2);
switch (map) { switch (map) {
...@@ -238,7 +238,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, ...@@ -238,7 +238,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2); mld->uDeviceID, wMsg, mld->dwDriverInstance, dwParam1, dwParam2);
ret = part->u.fnMessage32(mld->uDeviceID, wMsg, mld->dwDriverInstance, ret = part->u.fnMessage32(mld->uDeviceID, wMsg, mld->dwDriverInstance,
dwParam1, dwParam2); dwParam1, dwParam2);
TRACE("=> %lu\n", ret); TRACE("=> %s\n", WINMM_ErrorToString(ret));
if (map == WINMM_MAP_OKMEM) if (map == WINMM_MAP_OKMEM)
llType->UnMap16To32A(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2, ret); llType->UnMap16To32A(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2, ret);
break; break;
...@@ -268,7 +268,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, ...@@ -268,7 +268,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16, ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16,
mld->uDeviceID, wMsg, mld->dwDriverInstance, mld->uDeviceID, wMsg, mld->dwDriverInstance,
dwParam1, dwParam2); dwParam1, dwParam2);
TRACE("=> %lu\n", ret); TRACE("=> %s\n", WINMM_ErrorToString(ret));
if (map == WINMM_MAP_OKMEM) if (map == WINMM_MAP_OKMEM)
llType->UnMap32ATo16(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2, ret); llType->UnMap32ATo16(wMsg, &mld->dwDriverInstance, &dwParam1, &dwParam2, ret);
break; break;
...@@ -283,7 +283,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1, ...@@ -283,7 +283,7 @@ DWORD MMDRV_Message(LPWINE_MLD mld, UINT wMsg, DWORD_PTR dwParam1,
ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16, ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16,
mld->uDeviceID, wMsg, mld->dwDriverInstance, mld->uDeviceID, wMsg, mld->dwDriverInstance,
dwParam1, dwParam2); dwParam1, dwParam2);
TRACE("=> %lu\n", ret); TRACE("=> %s\n", WINMM_ErrorToString(ret));
} }
} }
return ret; return ret;
...@@ -540,7 +540,7 @@ static BOOL MMDRV_InitPerType(LPWINE_MM_DRIVER lpDrv, UINT type, UINT wMsg) ...@@ -540,7 +540,7 @@ static BOOL MMDRV_InitPerType(LPWINE_MM_DRIVER lpDrv, UINT type, UINT wMsg)
if (lpDrv->bIs32 && part->u.fnMessage32) { if (lpDrv->bIs32 && part->u.fnMessage32) {
ret = part->u.fnMessage32(0, DRVM_INIT, 0L, 0L, 0L); ret = part->u.fnMessage32(0, DRVM_INIT, 0L, 0L, 0L);
TRACE("DRVM_INIT => %08lx\n", ret); TRACE("DRVM_INIT => %s\n", WINMM_ErrorToString(ret));
#if 0 #if 0
ret = part->u.fnMessage32(0, DRVM_ENABLE, 0L, 0L, 0L); ret = part->u.fnMessage32(0, DRVM_ENABLE, 0L, 0L, 0L);
TRACE("DRVM_ENABLE => %08lx\n", ret); TRACE("DRVM_ENABLE => %08lx\n", ret);
...@@ -549,7 +549,7 @@ static BOOL MMDRV_InitPerType(LPWINE_MM_DRIVER lpDrv, UINT type, UINT wMsg) ...@@ -549,7 +549,7 @@ static BOOL MMDRV_InitPerType(LPWINE_MM_DRIVER lpDrv, UINT type, UINT wMsg)
} else if (!lpDrv->bIs32 && part->u.fnMessage16 && pFnCallMMDrvFunc16) { } else if (!lpDrv->bIs32 && part->u.fnMessage16 && pFnCallMMDrvFunc16) {
ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16, ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16,
0, DRVM_INIT, 0L, 0L, 0L); 0, DRVM_INIT, 0L, 0L, 0L);
TRACE("DRVM_INIT => %08lx\n", ret); TRACE("DRVM_INIT => %s\n", WINMM_ErrorToString(ret));
#if 0 #if 0
ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16, ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16,
0, DRVM_ENABLE, 0L, 0L, 0L); 0, DRVM_ENABLE, 0L, 0L, 0L);
...@@ -795,7 +795,7 @@ static BOOL MMDRV_ExitPerType(LPWINE_MM_DRIVER lpDrv, UINT type) ...@@ -795,7 +795,7 @@ static BOOL MMDRV_ExitPerType(LPWINE_MM_DRIVER lpDrv, UINT type)
TRACE("DRVM_DISABLE => %08lx\n", ret); TRACE("DRVM_DISABLE => %08lx\n", ret);
#endif #endif
ret = part->u.fnMessage32(0, DRVM_EXIT, 0L, 0L, 0L); ret = part->u.fnMessage32(0, DRVM_EXIT, 0L, 0L, 0L);
TRACE("DRVM_EXIT => %08lx\n", ret); TRACE("DRVM_EXIT => %s\n", WINMM_ErrorToString(ret));
} else if (!lpDrv->bIs32 && part->u.fnMessage16 && pFnCallMMDrvFunc16) { } else if (!lpDrv->bIs32 && part->u.fnMessage16 && pFnCallMMDrvFunc16) {
#if 0 #if 0
ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16, ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16,
...@@ -804,7 +804,7 @@ static BOOL MMDRV_ExitPerType(LPWINE_MM_DRIVER lpDrv, UINT type) ...@@ -804,7 +804,7 @@ static BOOL MMDRV_ExitPerType(LPWINE_MM_DRIVER lpDrv, UINT type)
#endif #endif
ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16, ret = pFnCallMMDrvFunc16((DWORD)part->u.fnMessage16,
0, DRVM_EXIT, 0L, 0L, 0L); 0, DRVM_EXIT, 0L, 0L, 0L);
TRACE("DRVM_EXIT => %08lx\n", ret); TRACE("DRVM_EXIT => %s\n", WINMM_ErrorToString(ret));
} else { } else {
return FALSE; return FALSE;
} }
......
...@@ -256,6 +256,7 @@ DWORD MCI_SendCommandFrom16(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwP ...@@ -256,6 +256,7 @@ DWORD MCI_SendCommandFrom16(UINT wDevID, UINT16 wMsg, DWORD dwParam1, DWORD dwP
UINT MCI_SetCommandTable(void *table, UINT uDevType); UINT MCI_SetCommandTable(void *table, UINT uDevType);
BOOL WINMM_CheckForMMSystem(void); BOOL WINMM_CheckForMMSystem(void);
const char* WINMM_ErrorToString(MMRESULT error);
UINT MIXER_Open(LPHMIXER lphMix, UINT uDeviceID, DWORD dwCallback, UINT MIXER_Open(LPHMIXER lphMix, UINT uDeviceID, DWORD dwCallback,
DWORD dwInstance, DWORD fdwOpen, BOOL bFrom32); DWORD dwInstance, DWORD fdwOpen, BOOL bFrom32);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
* 99/9 added support for loadable low level drivers * 99/9 added support for loadable low level drivers
*/ */
#include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
...@@ -135,6 +136,36 @@ BOOL WINMM_CheckForMMSystem(void) ...@@ -135,6 +136,36 @@ BOOL WINMM_CheckForMMSystem(void)
return loaded > 0; return loaded > 0;
} }
/******************************************************************
* WINMM_ErrorToString
*/
const char* WINMM_ErrorToString(MMRESULT error)
{
#define ERR_TO_STR(dev) case dev: return #dev
static char unknown[32];
switch (error) {
ERR_TO_STR(MMSYSERR_NOERROR);
ERR_TO_STR(MMSYSERR_ERROR);
ERR_TO_STR(MMSYSERR_BADDEVICEID);
ERR_TO_STR(MMSYSERR_NOTENABLED);
ERR_TO_STR(MMSYSERR_ALLOCATED);
ERR_TO_STR(MMSYSERR_INVALHANDLE);
ERR_TO_STR(MMSYSERR_NODRIVER);
ERR_TO_STR(MMSYSERR_NOMEM);
ERR_TO_STR(MMSYSERR_NOTSUPPORTED);
ERR_TO_STR(MMSYSERR_BADERRNUM);
ERR_TO_STR(MMSYSERR_INVALFLAG);
ERR_TO_STR(MMSYSERR_INVALPARAM);
ERR_TO_STR(WAVERR_BADFORMAT);
ERR_TO_STR(WAVERR_STILLPLAYING);
ERR_TO_STR(WAVERR_UNPREPARED);
ERR_TO_STR(WAVERR_SYNC);
}
sprintf(unknown, "Unknown(0x%08x)", error);
return unknown;
#undef ERR_TO_STR
}
/************************************************************************** /**************************************************************************
* DllMain (WINMM.init) * DllMain (WINMM.init)
* *
...@@ -2469,6 +2500,7 @@ UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType, ...@@ -2469,6 +2500,7 @@ UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType,
dwRet = MMDRV_Open(wmld, (uType == MMDRV_WAVEOUT) ? WODM_OPEN : WIDM_OPEN, dwRet = MMDRV_Open(wmld, (uType == MMDRV_WAVEOUT) ? WODM_OPEN : WIDM_OPEN,
(DWORD)&wod, dwFlags); (DWORD)&wod, dwFlags);
TRACE("dwRet = %s\n", WINMM_ErrorToString(dwRet));
if (dwRet != WAVERR_BADFORMAT || if (dwRet != WAVERR_BADFORMAT ||
(dwFlags & (WAVE_MAPPED|WAVE_FORMAT_DIRECT)) != 0) break; (dwFlags & (WAVE_MAPPED|WAVE_FORMAT_DIRECT)) != 0) break;
/* if we ask for a format which isn't supported by the physical driver, /* if we ask for a format which isn't supported by the physical driver,
...@@ -2485,7 +2517,7 @@ UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType, ...@@ -2485,7 +2517,7 @@ UINT WAVE_Open(HANDLE* lphndl, UINT uDeviceID, UINT uType,
} }
if (lphndl != NULL) *lphndl = handle; if (lphndl != NULL) *lphndl = handle;
TRACE("=> %ld hWave=%p\n", dwRet, handle); TRACE("=> %s hWave=%p\n", WINMM_ErrorToString(dwRet), handle);
return dwRet; return dwRet;
} }
...@@ -2867,12 +2899,15 @@ UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage, ...@@ -2867,12 +2899,15 @@ UINT WINAPI waveOutMessage(HWAVEOUT hWaveOut, UINT uMessage,
if ((wmld = MMDRV_Get(hWaveOut, MMDRV_WAVEOUT, TRUE)) != NULL) { if ((wmld = MMDRV_Get(hWaveOut, MMDRV_WAVEOUT, TRUE)) != NULL) {
return MMDRV_PhysicalFeatures(wmld, uMessage, dwParam1, dwParam2); return MMDRV_PhysicalFeatures(wmld, uMessage, dwParam1, dwParam2);
} }
WARN("invalid handle\n");
return MMSYSERR_INVALHANDLE; return MMSYSERR_INVALHANDLE;
} }
/* from M$ KB */ /* from M$ KB */
if (uMessage < DRVM_IOCTL || (uMessage >= DRVM_IOCTL_LAST && uMessage < DRVM_MAPPER)) if (uMessage < DRVM_IOCTL || (uMessage >= DRVM_IOCTL_LAST && uMessage < DRVM_MAPPER)) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM; return MMSYSERR_INVALPARAM;
}
return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2, TRUE); return MMDRV_Message(wmld, uMessage, dwParam1, dwParam2, TRUE);
} }
......
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