Removed last dependancies between MCI drivers and WINMM/MMSYSTEM
DLLs.
This commit is contained in:
parent
c26cccbe4b
commit
d19d25a0ea
|
@ -353,14 +353,6 @@ BOOL16 WINAPI DriverCallback16(DWORD dwCallBack, UINT16 uFlags, HANDLE16 hDev,
|
||||||
BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HANDLE hDev,
|
BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HANDLE hDev,
|
||||||
UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
|
UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
|
||||||
|
|
||||||
/* FIXME: the Wine builtin MCI drivers still use those winmm internal functions
|
|
||||||
* remove them ASAP
|
|
||||||
*/
|
|
||||||
extern DWORD MCI_WriteString(LPSTR lpDstStr, DWORD dstSize, LPCSTR lpSrcStr);
|
|
||||||
extern const char* MCI_MessageToString(UINT16 wMsg);
|
|
||||||
extern DWORD MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2, UINT size);
|
|
||||||
|
|
||||||
|
|
||||||
#include "poppack.h"
|
#include "poppack.h"
|
||||||
|
|
||||||
#endif /* __MMDDK_H */
|
#endif /* __MMDDK_H */
|
||||||
|
|
|
@ -2362,82 +2362,6 @@ DWORD MCI_SendCommand(UINT wDevID, UINT16 wMsg, DWORD dwParam1,
|
||||||
return dwRet;
|
return dwRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: should be using the new mmThreadXXXX functions from WINMM
|
|
||||||
* instead of those
|
|
||||||
* it would require to add a wine internal flag to mmThreadCreate
|
|
||||||
* in order to pass a 32 bit function instead of a 16 bit
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct SCA {
|
|
||||||
UINT wDevID;
|
|
||||||
UINT wMsg;
|
|
||||||
DWORD dwParam1;
|
|
||||||
DWORD dwParam2;
|
|
||||||
BOOL allocatedCopy;
|
|
||||||
};
|
|
||||||
|
|
||||||
DWORD WINAPI mciSendCommandA(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2);
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* MCI_SCAStarter [internal]
|
|
||||||
*/
|
|
||||||
static DWORD CALLBACK MCI_SCAStarter(LPVOID arg)
|
|
||||||
{
|
|
||||||
struct SCA* sca = (struct SCA*)arg;
|
|
||||||
DWORD ret;
|
|
||||||
|
|
||||||
TRACE("In thread before async command (%08x,%s,%08lx,%08lx)\n",
|
|
||||||
sca->wDevID, MCI_MessageToString(sca->wMsg), sca->dwParam1, sca->dwParam2);
|
|
||||||
ret = mciSendCommandA(sca->wDevID, sca->wMsg, sca->dwParam1 | MCI_WAIT, sca->dwParam2);
|
|
||||||
TRACE("In thread after async command (%08x,%s,%08lx,%08lx)\n",
|
|
||||||
sca->wDevID, MCI_MessageToString(sca->wMsg), sca->dwParam1, sca->dwParam2);
|
|
||||||
if (sca->allocatedCopy)
|
|
||||||
HeapFree(GetProcessHeap(), 0, (LPVOID)sca->dwParam2);
|
|
||||||
HeapFree(GetProcessHeap(), 0, sca);
|
|
||||||
ExitThread(ret);
|
|
||||||
WARN("Should not happen ? what's wrong \n");
|
|
||||||
/* should not go after this point */
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
* MCI_SendCommandAsync [internal]
|
|
||||||
*/
|
|
||||||
DWORD MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1,
|
|
||||||
DWORD dwParam2, UINT size)
|
|
||||||
{
|
|
||||||
struct SCA* sca = HeapAlloc(GetProcessHeap(), 0, sizeof(struct SCA));
|
|
||||||
|
|
||||||
if (sca == 0)
|
|
||||||
return MCIERR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
sca->wDevID = wDevID;
|
|
||||||
sca->wMsg = wMsg;
|
|
||||||
sca->dwParam1 = dwParam1;
|
|
||||||
|
|
||||||
if (size) {
|
|
||||||
sca->dwParam2 = (DWORD)HeapAlloc(GetProcessHeap(), 0, size);
|
|
||||||
if (sca->dwParam2 == 0) {
|
|
||||||
HeapFree(GetProcessHeap(), 0, sca);
|
|
||||||
return MCIERR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
sca->allocatedCopy = TRUE;
|
|
||||||
/* copy structure passed by program in dwParam2 to be sure
|
|
||||||
* we can still use it whatever the program does
|
|
||||||
*/
|
|
||||||
memcpy((LPVOID)sca->dwParam2, (LPVOID)dwParam2, size);
|
|
||||||
} else {
|
|
||||||
sca->dwParam2 = dwParam2;
|
|
||||||
sca->allocatedCopy = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CreateThread(NULL, 0, MCI_SCAStarter, sca, 0, NULL) == 0) {
|
|
||||||
WARN("Couldn't allocate thread for async command handling, sending synchonously\n");
|
|
||||||
return MCI_SCAStarter(&sca);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* MCI_CleanUp [internal]
|
* MCI_CleanUp [internal]
|
||||||
*
|
*
|
||||||
|
|
|
@ -325,6 +325,7 @@ static DWORD ANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpPar
|
||||||
{
|
{
|
||||||
WINE_MCIANIM* wma = ANIM_mciGetOpenDrv(wDevID);
|
WINE_MCIANIM* wma = ANIM_mciGetOpenDrv(wDevID);
|
||||||
LPSTR str = 0;
|
LPSTR str = 0;
|
||||||
|
DWORD ret = 0;
|
||||||
|
|
||||||
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
|
@ -351,7 +352,17 @@ static DWORD ANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpPar
|
||||||
return MCIERR_UNRECOGNIZED_COMMAND;
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
return MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
|
if (str) {
|
||||||
|
if (lpParms->dwRetSize <= strlen(str)) {
|
||||||
|
lstrcpynA(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
|
||||||
|
ret = MCIERR_PARAM_OVERFLOW;
|
||||||
|
} else {
|
||||||
|
strcpy(lpParms->lpstrReturn, str);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*lpParms->lpstrReturn = 0;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -661,14 +672,14 @@ LONG CALLBACK MCIANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
|
||||||
case MCI_CUT:
|
case MCI_CUT:
|
||||||
case MCI_DELETE:
|
case MCI_DELETE:
|
||||||
case MCI_PASTE:
|
case MCI_PASTE:
|
||||||
FIXME("Unsupported message=%s\n", MCI_MessageToString(wMsg));
|
FIXME("Unsupported message [%lu]\n", wMsg);
|
||||||
break;
|
break;
|
||||||
case MCI_OPEN:
|
case MCI_OPEN:
|
||||||
case MCI_CLOSE:
|
case MCI_CLOSE:
|
||||||
ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
TRACE("Sending msg=%s to default driver proc\n", MCI_MessageToString(wMsg));
|
TRACE("Sending msg [%lu] to default driver proc\n", wMsg);
|
||||||
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
||||||
}
|
}
|
||||||
return MCIERR_UNRECOGNIZED_COMMAND;
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
|
|
|
@ -502,7 +502,8 @@ static DWORD AVI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSA lpP
|
||||||
{
|
{
|
||||||
LPSTR str = 0;
|
LPSTR str = 0;
|
||||||
WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
|
WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
|
||||||
|
DWORD ret = 0;
|
||||||
|
|
||||||
TRACE("(%04X, %08lX, %p) : stub;\n", wDevID, dwFlags, lpParms);
|
TRACE("(%04X, %08lX, %p) : stub;\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (lpParms == NULL || lpParms->lpstrReturn == NULL)
|
if (lpParms == NULL || lpParms->lpstrReturn == NULL)
|
||||||
|
@ -529,7 +530,17 @@ static DWORD AVI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSA lpP
|
||||||
WARN("Don't know this info command (%lu)\n", dwFlags);
|
WARN("Don't know this info command (%lu)\n", dwFlags);
|
||||||
return MCIERR_UNRECOGNIZED_COMMAND;
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
}
|
}
|
||||||
return MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
|
if (str) {
|
||||||
|
if (lpParms->dwRetSize <= strlen(str)) {
|
||||||
|
lstrcpynA(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
|
||||||
|
ret = MCIERR_PARAM_OVERFLOW;
|
||||||
|
} else {
|
||||||
|
strcpy(lpParms->lpstrReturn, str);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*lpParms->lpstrReturn = 0;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
@ -1025,14 +1036,14 @@ LONG CALLBACK MCIAVI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
|
||||||
|
|
||||||
case MCI_SPIN:
|
case MCI_SPIN:
|
||||||
case MCI_ESCAPE:
|
case MCI_ESCAPE:
|
||||||
WARN("Unsupported command=%s\n", MCI_MessageToString(wMsg));
|
WARN("Unsupported command [%lu]\n", wMsg);
|
||||||
break;
|
break;
|
||||||
case MCI_OPEN:
|
case MCI_OPEN:
|
||||||
case MCI_CLOSE:
|
case MCI_CLOSE:
|
||||||
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
TRACE("Sending msg=%s to default driver proc\n", MCI_MessageToString(wMsg));
|
TRACE("Sending msg [%lu] to default driver proc\n", wMsg);
|
||||||
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
||||||
}
|
}
|
||||||
return MCIERR_UNRECOGNIZED_COMMAND;
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
|
|
|
@ -338,7 +338,8 @@ static DWORD CDAUDIO_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpPar
|
||||||
{
|
{
|
||||||
LPSTR str = 0;
|
LPSTR str = 0;
|
||||||
WINE_MCICDAUDIO* wmcda = CDAUDIO_mciGetOpenDrv(wDevID);
|
WINE_MCICDAUDIO* wmcda = CDAUDIO_mciGetOpenDrv(wDevID);
|
||||||
|
DWORD ret = 0;
|
||||||
|
|
||||||
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (lpParms == NULL || lpParms->lpstrReturn == NULL)
|
if (lpParms == NULL || lpParms->lpstrReturn == NULL)
|
||||||
|
@ -355,7 +356,17 @@ static DWORD CDAUDIO_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpPar
|
||||||
WARN("Don't know this info command (%lu)\n", dwFlags);
|
WARN("Don't know this info command (%lu)\n", dwFlags);
|
||||||
return MCIERR_UNRECOGNIZED_COMMAND;
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
}
|
}
|
||||||
return MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
|
if (str) {
|
||||||
|
if (lpParms->dwRetSize <= strlen(str)) {
|
||||||
|
lstrcpynA(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
|
||||||
|
ret = MCIERR_PARAM_OVERFLOW;
|
||||||
|
} else {
|
||||||
|
strcpy(lpParms->lpstrReturn, str);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*lpParms->lpstrReturn = 0;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -417,7 +428,7 @@ static DWORD CDAUDIO_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lp
|
||||||
return CDAUDIO_mciGetError(wmcda);
|
return CDAUDIO_mciGetError(wmcda);
|
||||||
lpParms->dwReturn = (wmcda->wcda.nTracks == 0) ?
|
lpParms->dwReturn = (wmcda->wcda.nTracks == 0) ?
|
||||||
MAKEMCIRESOURCE(FALSE, MCI_FALSE) : MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
MAKEMCIRESOURCE(FALSE, MCI_FALSE) : MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
||||||
TRACE("MCI_STATUS_MEDIA_PRESENT =%s!\n", LOWORD(lpParms->dwReturn) ? "Y" : "N");
|
TRACE("MCI_STATUS_MEDIA_PRESENT =%c!\n", LOWORD(lpParms->dwReturn) ? 'Y' : 'N');
|
||||||
ret = MCI_RESOURCE_RETURNED;
|
ret = MCI_RESOURCE_RETURNED;
|
||||||
break;
|
break;
|
||||||
case MCI_STATUS_NUMBER_OF_TRACKS:
|
case MCI_STATUS_NUMBER_OF_TRACKS:
|
||||||
|
@ -751,18 +762,18 @@ LONG CALLBACK MCICDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
|
||||||
case MCI_CUT:
|
case MCI_CUT:
|
||||||
case MCI_DELETE:
|
case MCI_DELETE:
|
||||||
case MCI_PASTE:
|
case MCI_PASTE:
|
||||||
FIXME("Unsupported yet command=%s\n", MCI_MessageToString(wMsg));
|
FIXME("Unsupported yet command [%lu]\n", wMsg);
|
||||||
break;
|
break;
|
||||||
/* commands that should report an error */
|
/* commands that should report an error */
|
||||||
case MCI_WINDOW:
|
case MCI_WINDOW:
|
||||||
FIXME("Unsupported command=%s\n", MCI_MessageToString(wMsg));
|
FIXME("Unsupported command [%lu]\n", wMsg);
|
||||||
break;
|
break;
|
||||||
case MCI_OPEN:
|
case MCI_OPEN:
|
||||||
case MCI_CLOSE:
|
case MCI_CLOSE:
|
||||||
ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
TRACE("Sending msg=%s to default driver proc\n", MCI_MessageToString(wMsg));
|
TRACE("Sending msg [%lu] to default driver proc\n", wMsg);
|
||||||
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
||||||
}
|
}
|
||||||
return MCIERR_UNRECOGNIZED_COMMAND;
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
|
|
|
@ -61,6 +61,85 @@ typedef struct tagWINE_MCIMIDI {
|
||||||
DWORD dwStartTicks;
|
DWORD dwStartTicks;
|
||||||
} WINE_MCIMIDI;
|
} WINE_MCIMIDI;
|
||||||
|
|
||||||
|
/* ===================================================================
|
||||||
|
* ===================================================================
|
||||||
|
* FIXME: should be using the new mmThreadXXXX functions from WINMM
|
||||||
|
* instead of those
|
||||||
|
* it would require to add a wine internal flag to mmThreadCreate
|
||||||
|
* in order to pass a 32 bit function instead of a 16 bit
|
||||||
|
* ===================================================================
|
||||||
|
* =================================================================== */
|
||||||
|
|
||||||
|
struct SCA {
|
||||||
|
UINT wDevID;
|
||||||
|
UINT wMsg;
|
||||||
|
DWORD dwParam1;
|
||||||
|
DWORD dwParam2;
|
||||||
|
BOOL allocatedCopy;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* EPP DWORD WINAPI mciSendCommandA(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2); */
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* MCI_SCAStarter [internal]
|
||||||
|
*/
|
||||||
|
static DWORD CALLBACK MCI_SCAStarter(LPVOID arg)
|
||||||
|
{
|
||||||
|
struct SCA* sca = (struct SCA*)arg;
|
||||||
|
DWORD ret;
|
||||||
|
|
||||||
|
TRACE("In thread before async command (%08x,%u,%08lx,%08lx)\n",
|
||||||
|
sca->wDevID, sca->wMsg, sca->dwParam1, sca->dwParam2);
|
||||||
|
ret = mciSendCommandA(sca->wDevID, sca->wMsg, sca->dwParam1 | MCI_WAIT, sca->dwParam2);
|
||||||
|
TRACE("In thread after async command (%08x,%u,%08lx,%08lx)\n",
|
||||||
|
sca->wDevID, sca->wMsg, sca->dwParam1, sca->dwParam2);
|
||||||
|
if (sca->allocatedCopy)
|
||||||
|
HeapFree(GetProcessHeap(), 0, (LPVOID)sca->dwParam2);
|
||||||
|
HeapFree(GetProcessHeap(), 0, sca);
|
||||||
|
ExitThread(ret);
|
||||||
|
WARN("Should not happen ? what's wrong \n");
|
||||||
|
/* should not go after this point */
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* MCI_SendCommandAsync [internal]
|
||||||
|
*/
|
||||||
|
static DWORD MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1,
|
||||||
|
DWORD dwParam2, UINT size)
|
||||||
|
{
|
||||||
|
struct SCA* sca = HeapAlloc(GetProcessHeap(), 0, sizeof(struct SCA));
|
||||||
|
|
||||||
|
if (sca == 0)
|
||||||
|
return MCIERR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
sca->wDevID = wDevID;
|
||||||
|
sca->wMsg = wMsg;
|
||||||
|
sca->dwParam1 = dwParam1;
|
||||||
|
|
||||||
|
if (size) {
|
||||||
|
sca->dwParam2 = (DWORD)HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
|
if (sca->dwParam2 == 0) {
|
||||||
|
HeapFree(GetProcessHeap(), 0, sca);
|
||||||
|
return MCIERR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
sca->allocatedCopy = TRUE;
|
||||||
|
/* copy structure passed by program in dwParam2 to be sure
|
||||||
|
* we can still use it whatever the program does
|
||||||
|
*/
|
||||||
|
memcpy((LPVOID)sca->dwParam2, (LPVOID)dwParam2, size);
|
||||||
|
} else {
|
||||||
|
sca->dwParam2 = dwParam2;
|
||||||
|
sca->allocatedCopy = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CreateThread(NULL, 0, MCI_SCAStarter, sca, 0, NULL) == 0) {
|
||||||
|
WARN("Couldn't allocate thread for async command handling, sending synchonously\n");
|
||||||
|
return MCI_SCAStarter(&sca);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*======================================================================*
|
/*======================================================================*
|
||||||
* MCI MIDI implemantation *
|
* MCI MIDI implemantation *
|
||||||
*======================================================================*/
|
*======================================================================*/
|
||||||
|
@ -835,7 +914,7 @@ static DWORD MIDI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
|
||||||
|
|
||||||
doPlay = (wmm->dwPositionMS >= dwStartMS && wmm->dwPositionMS <= dwEndMS);
|
doPlay = (wmm->dwPositionMS >= dwStartMS && wmm->dwPositionMS <= dwEndMS);
|
||||||
|
|
||||||
TRACE("wmm->dwStatus=%d, doPlay=%s\n", wmm->dwStatus, doPlay ? "T" : "F");
|
TRACE("wmm->dwStatus=%d, doPlay=%c\n", wmm->dwStatus, doPlay ? 'T' : 'F');
|
||||||
|
|
||||||
if ((mmt = MIDI_mciFindNextEvent(wmm, &hiPulse)) == NULL)
|
if ((mmt = MIDI_mciFindNextEvent(wmm, &hiPulse)) == NULL)
|
||||||
break; /* no more event on tracks */
|
break; /* no more event on tracks */
|
||||||
|
@ -1416,7 +1495,8 @@ static DWORD MIDI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
|
||||||
{
|
{
|
||||||
LPCSTR str = 0;
|
LPCSTR str = 0;
|
||||||
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
WINE_MCIMIDI* wmm = MIDI_mciGetOpenDev(wDevID);
|
||||||
|
DWORD ret = 0;
|
||||||
|
|
||||||
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
|
||||||
|
|
||||||
if (lpParms == NULL || lpParms->lpstrReturn == NULL)
|
if (lpParms == NULL || lpParms->lpstrReturn == NULL)
|
||||||
|
@ -1443,7 +1523,17 @@ static DWORD MIDI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
|
||||||
WARN("Don't know this info command (%lu)\n", dwFlags);
|
WARN("Don't know this info command (%lu)\n", dwFlags);
|
||||||
return MCIERR_UNRECOGNIZED_COMMAND;
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
}
|
}
|
||||||
return MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
|
if (str) {
|
||||||
|
if (lpParms->dwRetSize <= strlen(str)) {
|
||||||
|
lstrcpynA(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
|
||||||
|
ret = MCIERR_PARAM_OVERFLOW;
|
||||||
|
} else {
|
||||||
|
strcpy(lpParms->lpstrReturn, str);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*lpParms->lpstrReturn = 0;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -1534,18 +1624,18 @@ LONG CALLBACK MCIMIDI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
|
||||||
case MCI_CUT:
|
case MCI_CUT:
|
||||||
case MCI_DELETE:
|
case MCI_DELETE:
|
||||||
case MCI_PASTE:
|
case MCI_PASTE:
|
||||||
WARN("Unsupported command=%s\n", MCI_MessageToString(wMsg));
|
WARN("Unsupported command [%lu]\n", wMsg);
|
||||||
break;
|
break;
|
||||||
/* commands that should report an error */
|
/* commands that should report an error */
|
||||||
case MCI_WINDOW:
|
case MCI_WINDOW:
|
||||||
TRACE("Unsupported command=%s\n", MCI_MessageToString(wMsg));
|
TRACE("Unsupported command [%lu]\n", wMsg);
|
||||||
break;
|
break;
|
||||||
case MCI_OPEN:
|
case MCI_OPEN:
|
||||||
case MCI_CLOSE:
|
case MCI_CLOSE:
|
||||||
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
TRACE("Sending msg=%s to default driver proc\n", MCI_MessageToString(wMsg));
|
TRACE("Sending msg [%lu] to default driver proc\n", wMsg);
|
||||||
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
||||||
}
|
}
|
||||||
return MCIERR_UNRECOGNIZED_COMMAND;
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
|
|
|
@ -39,6 +39,85 @@ typedef struct {
|
||||||
DWORD dwPosition; /* position in bytes in chunk for playing */
|
DWORD dwPosition; /* position in bytes in chunk for playing */
|
||||||
} WINE_MCIWAVE;
|
} WINE_MCIWAVE;
|
||||||
|
|
||||||
|
/* ===================================================================
|
||||||
|
* ===================================================================
|
||||||
|
* FIXME: should be using the new mmThreadXXXX functions from WINMM
|
||||||
|
* instead of those
|
||||||
|
* it would require to add a wine internal flag to mmThreadCreate
|
||||||
|
* in order to pass a 32 bit function instead of a 16 bit
|
||||||
|
* ===================================================================
|
||||||
|
* =================================================================== */
|
||||||
|
|
||||||
|
struct SCA {
|
||||||
|
UINT wDevID;
|
||||||
|
UINT wMsg;
|
||||||
|
DWORD dwParam1;
|
||||||
|
DWORD dwParam2;
|
||||||
|
BOOL allocatedCopy;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* EPP DWORD WINAPI mciSendCommandA(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2); */
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* MCI_SCAStarter [internal]
|
||||||
|
*/
|
||||||
|
static DWORD CALLBACK MCI_SCAStarter(LPVOID arg)
|
||||||
|
{
|
||||||
|
struct SCA* sca = (struct SCA*)arg;
|
||||||
|
DWORD ret;
|
||||||
|
|
||||||
|
TRACE("In thread before async command (%08x,%u,%08lx,%08lx)\n",
|
||||||
|
sca->wDevID, sca->wMsg, sca->dwParam1, sca->dwParam2);
|
||||||
|
ret = mciSendCommandA(sca->wDevID, sca->wMsg, sca->dwParam1 | MCI_WAIT, sca->dwParam2);
|
||||||
|
TRACE("In thread after async command (%08x,%u,%08lx,%08lx)\n",
|
||||||
|
sca->wDevID, sca->wMsg, sca->dwParam1, sca->dwParam2);
|
||||||
|
if (sca->allocatedCopy)
|
||||||
|
HeapFree(GetProcessHeap(), 0, (LPVOID)sca->dwParam2);
|
||||||
|
HeapFree(GetProcessHeap(), 0, sca);
|
||||||
|
ExitThread(ret);
|
||||||
|
WARN("Should not happen ? what's wrong \n");
|
||||||
|
/* should not go after this point */
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* MCI_SendCommandAsync [internal]
|
||||||
|
*/
|
||||||
|
static DWORD MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1,
|
||||||
|
DWORD dwParam2, UINT size)
|
||||||
|
{
|
||||||
|
struct SCA* sca = HeapAlloc(GetProcessHeap(), 0, sizeof(struct SCA));
|
||||||
|
|
||||||
|
if (sca == 0)
|
||||||
|
return MCIERR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
sca->wDevID = wDevID;
|
||||||
|
sca->wMsg = wMsg;
|
||||||
|
sca->dwParam1 = dwParam1;
|
||||||
|
|
||||||
|
if (size) {
|
||||||
|
sca->dwParam2 = (DWORD)HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
|
if (sca->dwParam2 == 0) {
|
||||||
|
HeapFree(GetProcessHeap(), 0, sca);
|
||||||
|
return MCIERR_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
sca->allocatedCopy = TRUE;
|
||||||
|
/* copy structure passed by program in dwParam2 to be sure
|
||||||
|
* we can still use it whatever the program does
|
||||||
|
*/
|
||||||
|
memcpy((LPVOID)sca->dwParam2, (LPVOID)dwParam2, size);
|
||||||
|
} else {
|
||||||
|
sca->dwParam2 = dwParam2;
|
||||||
|
sca->allocatedCopy = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CreateThread(NULL, 0, MCI_SCAStarter, sca, 0, NULL) == 0) {
|
||||||
|
WARN("Couldn't allocate thread for async command handling, sending synchonously\n");
|
||||||
|
return MCI_SCAStarter(&sca);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*======================================================================*
|
/*======================================================================*
|
||||||
* MCI WAVE implemantation *
|
* MCI WAVE implemantation *
|
||||||
*======================================================================*/
|
*======================================================================*/
|
||||||
|
@ -1009,17 +1088,17 @@ LONG CALLBACK MCIWAVE_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
|
||||||
case MCI_CUT:
|
case MCI_CUT:
|
||||||
case MCI_DELETE:
|
case MCI_DELETE:
|
||||||
case MCI_PASTE:
|
case MCI_PASTE:
|
||||||
FIXME("Unsupported yet command=%s\n", MCI_MessageToString(wMsg));
|
FIXME("Unsupported yet command [%lu]\n", wMsg);
|
||||||
break;
|
break;
|
||||||
case MCI_WINDOW:
|
case MCI_WINDOW:
|
||||||
TRACE("Unsupported command=%s\n", MCI_MessageToString(wMsg));
|
TRACE("Unsupported command [%lu]\n", wMsg);
|
||||||
break;
|
break;
|
||||||
case MCI_OPEN:
|
case MCI_OPEN:
|
||||||
case MCI_CLOSE:
|
case MCI_CLOSE:
|
||||||
ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FIXME("is probably wrong msg=%s\n", MCI_MessageToString(wMsg));
|
FIXME("is probably wrong msg [%lu]\n", wMsg);
|
||||||
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
||||||
}
|
}
|
||||||
return MCIERR_UNRECOGNIZED_COMMAND;
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
||||||
|
|
Loading…
Reference in New Issue