Made use of new 16/32 MCI message handling in mmsystem.c.
This commit is contained in:
parent
9b3801f2e9
commit
22c339fdff
|
@ -29,16 +29,10 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
|
|
||||||
extern struct WINE_MCIDRIVER mciDrv[MAXMCIDRIVERS];
|
extern struct WINE_MCIDRIVER mciDrv[MAXMCIDRIVERS];
|
||||||
|
|
||||||
#define mciGetDrv(wDevID) (&mciDrv[MMSYSTEM_DevIDToIndex(wDevID)])
|
#define MCI_GetDrv(wDevID) (&mciDrv[MCI_DevIDToIndex(wDevID)])
|
||||||
#define mciGetOpenDrv(wDevID) (&(mciGetDrv(wDevID)->mop))
|
#define MCI_GetOpenDrv(wDevID) (&(MCI_GetDrv(wDevID)->mop))
|
||||||
|
|
||||||
extern int MMSYSTEM_DevIDToIndex(UINT16 wDevID);
|
|
||||||
extern UINT16 MMSYSTEM_FirstDevID(void);
|
|
||||||
extern UINT16 MMSYSTEM_NextDevID(UINT16 wDevID);
|
|
||||||
extern BOOL32 MMSYSTEM_DevIDValid(UINT16 wDevID);
|
|
||||||
|
|
||||||
LONG WINAPI DrvDefDriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
|
LONG WINAPI DrvDefDriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
|
||||||
DWORD dwParam1, DWORD dwParam2);
|
DWORD dwParam1, DWORD dwParam2);
|
||||||
|
@ -65,31 +59,13 @@ LONG WINAPI DrvDefDriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
|
||||||
}\
|
}\
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
/* calling DriverProc. We need to pass the struct as linear pointer. */
|
/* calling DriverProc. */
|
||||||
#define _MCI_CALL_DRIVER(cmd,params) \
|
#define _MCI_CALL_DRIVER(cmd,params) \
|
||||||
switch(uDevTyp) {\
|
{ \
|
||||||
case MCI_DEVTYPE_CD_AUDIO:\
|
MCIPROC32 proc = MCI_GetProc32(uDevTyp); \
|
||||||
res=CDAUDIO_DriverProc32(mciGetDrv(wDevID)->modp.wDeviceID,0,cmd,dwFlags, (DWORD)(params));\
|
res = (proc) ? (*proc)(MCI_GetDrv(wDevID)->modp.wDeviceID, 0, cmd, dwFlags, (DWORD)(params)) : MCIERR_DEVICE_NOT_INSTALLED; \
|
||||||
break;\
|
|
||||||
case MCI_DEVTYPE_WAVEFORM_AUDIO:\
|
|
||||||
res=WAVE_DriverProc32(mciGetDrv(wDevID)->modp.wDeviceID,0,cmd,dwFlags,(DWORD)(params));\
|
|
||||||
break;\
|
|
||||||
case MCI_DEVTYPE_SEQUENCER:\
|
|
||||||
res=MIDI_DriverProc32(mciGetDrv(wDevID)->modp.wDeviceID,0,cmd,dwFlags,(DWORD)(params));\
|
|
||||||
break;\
|
|
||||||
case MCI_DEVTYPE_ANIMATION:\
|
|
||||||
res=ANIM_DriverProc32(mciGetDrv(wDevID)->modp.wDeviceID,0,cmd,dwFlags,(DWORD)(params));\
|
|
||||||
break;\
|
|
||||||
case MCI_DEVTYPE_DIGITAL_VIDEO:\
|
|
||||||
FIXME(mci,"_MCI_CALL_DRIVER: No DIGITAL_VIDEO yet !\n");\
|
|
||||||
res=MCIERR_DEVICE_NOT_INSTALLED;\
|
|
||||||
break;\
|
|
||||||
default:\
|
|
||||||
/*res = Callbacks->CallDriverProc(mciGetDrv(wDevID)->driverproc,mciGetDrv(wDevID)->modp.wDeviceID,mciGetDrv(wDevID)->hdrv,cmd,dwFlags,(DWORD)(params));\
|
|
||||||
break;*/\
|
|
||||||
res = MCIERR_DEVICE_NOT_INSTALLED;\
|
|
||||||
break;\
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print a DWORD in the specified timeformat */
|
/* print a DWORD in the specified timeformat */
|
||||||
static void
|
static void
|
||||||
_MCISTR_printtf(char *buf,UINT16 uDevType,DWORD timef,DWORD val) {
|
_MCISTR_printtf(char *buf,UINT16 uDevType,DWORD timef,DWORD val) {
|
||||||
|
@ -310,33 +286,24 @@ MCISTR_Open(_MCISTR_PROTO_) {
|
||||||
pU->openParams.lpstrElementName=strdup(s);
|
pU->openParams.lpstrElementName=strdup(s);
|
||||||
dwFlags |= MCI_OPEN_ELEMENT;
|
dwFlags |= MCI_OPEN_ELEMENT;
|
||||||
}
|
}
|
||||||
if (!STRCMP(dev,"cdaudio")) {
|
uDevTyp = MCI_GetDevType(dev);
|
||||||
uDevTyp=MCI_DEVTYPE_CD_AUDIO;
|
if (uDevTyp == 0) {
|
||||||
} else if (!STRCMP(dev,"waveaudio")) {
|
|
||||||
uDevTyp=MCI_DEVTYPE_WAVEFORM_AUDIO;
|
|
||||||
} else if (!STRCMP(dev,"sequencer")) {
|
|
||||||
uDevTyp=MCI_DEVTYPE_SEQUENCER;
|
|
||||||
} else if (!STRCMP(dev,"animation1")) {
|
|
||||||
uDevTyp=MCI_DEVTYPE_ANIMATION;
|
|
||||||
} else if (!STRCMP(dev,"avivideo")) {
|
|
||||||
uDevTyp=MCI_DEVTYPE_DIGITAL_VIDEO;
|
|
||||||
} else {
|
|
||||||
free(pU->openParams.lpstrElementName);
|
free(pU->openParams.lpstrElementName);
|
||||||
free(pU);
|
free(pU);
|
||||||
return MCIERR_INVALID_DEVICE_NAME;
|
return MCIERR_INVALID_DEVICE_NAME;
|
||||||
}
|
}
|
||||||
wDevID=MMSYSTEM_FirstDevID();
|
wDevID=MCI_FirstDevID();
|
||||||
while(mciGetDrv(wDevID)->modp.wType) {
|
while(MCI_GetDrv(wDevID)->modp.wType) {
|
||||||
wDevID = MMSYSTEM_NextDevID(wDevID);
|
wDevID = MCI_NextDevID(wDevID);
|
||||||
if (!MMSYSTEM_DevIDValid(wDevID)) {
|
if (!MCI_DevIDValid(wDevID)) {
|
||||||
TRACE(mci, "MAXMCIDRIVERS reached (%x) !\n", wDevID);
|
TRACE(mci, "MAXMCIDRIVERS reached (%x) !\n", wDevID);
|
||||||
free(pU->openParams.lpstrElementName);
|
free(pU->openParams.lpstrElementName);
|
||||||
free(pU);
|
free(pU);
|
||||||
return MCIERR_INTERNAL;
|
return MCIERR_INTERNAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mciGetDrv(wDevID)->modp.wType = uDevTyp;
|
MCI_GetDrv(wDevID)->modp.wType = uDevTyp;
|
||||||
mciGetDrv(wDevID)->modp.wDeviceID = 0; /* FIXME? for multiple devices */
|
MCI_GetDrv(wDevID)->modp.wDeviceID = 0; /* FIXME? for multiple devices */
|
||||||
pU->openParams.dwCallback = hwndCallback ;
|
pU->openParams.dwCallback = hwndCallback ;
|
||||||
pU->openParams.wDeviceID = wDevID;
|
pU->openParams.wDeviceID = wDevID;
|
||||||
pU->openParams.wReserved0 = 0;
|
pU->openParams.wReserved0 = 0;
|
||||||
|
@ -427,7 +394,7 @@ MCISTR_Open(_MCISTR_PROTO_) {
|
||||||
}
|
}
|
||||||
_MCI_CALL_DRIVER(MCI_OPEN, pU);
|
_MCI_CALL_DRIVER(MCI_OPEN, pU);
|
||||||
if (res==0)
|
if (res==0)
|
||||||
memcpy(mciGetOpenDrv(wDevID),&pU->openParams,sizeof(MCI_OPEN_PARMS16));
|
memcpy(MCI_GetOpenDrv(wDevID),&pU->openParams,sizeof(MCI_OPEN_PARMS16));
|
||||||
else {
|
else {
|
||||||
free(pU->openParams.lpstrElementName);
|
free(pU->openParams.lpstrElementName);
|
||||||
free(pU->openParams.lpstrDeviceType);
|
free(pU->openParams.lpstrDeviceType);
|
||||||
|
@ -1363,7 +1330,7 @@ MCISTR_Sysinfo(_MCISTR_PROTO_) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res = mciSendCommand(0, MCI_SYSINFO, dwFlags, (DWORD)&sysinfoParams);
|
res = mciSendCommand16(0, MCI_SYSINFO, dwFlags, (DWORD)&sysinfoParams);
|
||||||
|
|
||||||
if (dwFlags & MCI_SYSINFO_QUANTITY) {
|
if (dwFlags & MCI_SYSINFO_QUANTITY) {
|
||||||
char buf[100];
|
char buf[100];
|
||||||
|
@ -2085,8 +2052,9 @@ struct _MCISTR_cmdtable {
|
||||||
{"window", MCISTR_Window},
|
{"window", MCISTR_Window},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* mciSendString [MMSYSTEM.702]
|
* mciSendString16 [MMSYSTEM.702]
|
||||||
*/
|
*/
|
||||||
/* The usercode sends a string with a command (and flags) expressed in
|
/* The usercode sends a string with a command (and flags) expressed in
|
||||||
* words in it... We do our best to call aprobiate drivers,
|
* words in it... We do our best to call aprobiate drivers,
|
||||||
|
@ -2096,7 +2064,7 @@ struct _MCISTR_cmdtable {
|
||||||
/* FIXME: "all" is a valid devicetype and we should access all devices if
|
/* FIXME: "all" is a valid devicetype and we should access all devices if
|
||||||
* it is used. (imagine "close all"). Not implemented yet.
|
* it is used. (imagine "close all"). Not implemented yet.
|
||||||
*/
|
*/
|
||||||
DWORD WINAPI mciSendString (LPCSTR lpstrCommand, LPSTR lpstrReturnString,
|
DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrReturnString,
|
||||||
UINT16 uReturnLength, HWND16 hwndCallback)
|
UINT16 uReturnLength, HWND16 hwndCallback)
|
||||||
{
|
{
|
||||||
char *cmd,*dev,*args,**keywords,*filename;
|
char *cmd,*dev,*args,**keywords,*filename;
|
||||||
|
@ -2104,9 +2072,9 @@ DWORD WINAPI mciSendString (LPCSTR lpstrCommand, LPSTR lpstrReturnString,
|
||||||
DWORD dwFlags;
|
DWORD dwFlags;
|
||||||
int res=0,i,nrofkeywords;
|
int res=0,i,nrofkeywords;
|
||||||
|
|
||||||
TRACE(mci,"('%s', %p, %d, %X)\n", lpstrCommand,
|
TRACE(mci,"('%s', %p, %d, %X)\n",
|
||||||
lpstrReturnString, uReturnLength, hwndCallback
|
lpstrCommand, lpstrReturnString, uReturnLength, hwndCallback);
|
||||||
);
|
|
||||||
/* format is <command> <device> <optargs> */
|
/* format is <command> <device> <optargs> */
|
||||||
cmd=strdup(lpstrCommand);
|
cmd=strdup(lpstrCommand);
|
||||||
dev=strchr(cmd,' ');
|
dev=strchr(cmd,' ');
|
||||||
|
@ -2163,23 +2131,23 @@ DWORD WINAPI mciSendString (LPCSTR lpstrCommand, LPSTR lpstrReturnString,
|
||||||
|
|
||||||
/* determine wDevID and uDevTyp for all commands except "open" */
|
/* determine wDevID and uDevTyp for all commands except "open" */
|
||||||
if (STRCMP(cmd,"open")!=0) {
|
if (STRCMP(cmd,"open")!=0) {
|
||||||
wDevID = MMSYSTEM_FirstDevID();
|
wDevID = MCI_FirstDevID();
|
||||||
while (1) {
|
while (1) {
|
||||||
LPSTR dname;
|
LPSTR dname;
|
||||||
|
|
||||||
dname=mciGetOpenDrv(wDevID)->lpstrAlias;
|
dname=MCI_GetOpenDrv(wDevID)->lpstrAlias;
|
||||||
if (dname==NULL)
|
if (dname==NULL)
|
||||||
dname=mciGetOpenDrv(wDevID)->lpstrDeviceType;
|
dname=MCI_GetOpenDrv(wDevID)->lpstrDeviceType;
|
||||||
if (dname != NULL && !STRCMP(dname,dev))
|
if (dname != NULL && !STRCMP(dname,dev))
|
||||||
break;
|
break;
|
||||||
wDevID = MMSYSTEM_NextDevID(wDevID);
|
wDevID = MCI_NextDevID(wDevID);
|
||||||
if (!MMSYSTEM_DevIDValid(wDevID)) {
|
if (!MCI_DevIDValid(wDevID)) {
|
||||||
TRACE(mci, "MAXMCIDRIVERS reached!\n");
|
TRACE(mci, "MAXMCIDRIVERS reached!\n");
|
||||||
free(keywords);free(cmd);
|
free(keywords);free(cmd);
|
||||||
return MCIERR_INVALID_DEVICE_NAME;
|
return MCIERR_INVALID_DEVICE_NAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uDevTyp=mciGetDrv(wDevID)->modp.wType;
|
uDevTyp=MCI_GetDrv(wDevID)->modp.wType;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0;MCISTR_cmdtable[i].cmd!=NULL;i++) {
|
for (i=0;MCISTR_cmdtable[i].cmd!=NULL;i++) {
|
||||||
|
@ -2201,3 +2169,28 @@ DWORD WINAPI mciSendString (LPCSTR lpstrCommand, LPSTR lpstrReturnString,
|
||||||
free(keywords);free(cmd);
|
free(keywords);free(cmd);
|
||||||
return MCIERR_MISSING_COMMAND_STRING;
|
return MCIERR_MISSING_COMMAND_STRING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* mciSendString32A [MMSYSTEM.702][WINMM.51]
|
||||||
|
*/
|
||||||
|
DWORD WINAPI mciSendString32A(LPCSTR lpstrCommand, LPSTR lpstrReturnString,
|
||||||
|
UINT32 uReturnLength, HWND32 hwndCallback)
|
||||||
|
{
|
||||||
|
return mciSendString16(lpstrCommand, lpstrReturnString, uReturnLength, hwndCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* mciSendString32W [WINMM.52]
|
||||||
|
*/
|
||||||
|
DWORD WINAPI mciSendString32W(LPCWSTR lpwstrCommand, LPSTR lpstrReturnString,
|
||||||
|
UINT32 uReturnLength, HWND32 hwndCallback)
|
||||||
|
{
|
||||||
|
LPSTR lpstrCommand;
|
||||||
|
UINT32 ret;
|
||||||
|
|
||||||
|
/* FIXME: is there something to do with lpstrReturnString ? */
|
||||||
|
lpstrCommand = HEAP_strdupWtoA(GetProcessHeap(), 0, lpwstrCommand);
|
||||||
|
ret = mciSendString16(lpstrCommand, lpstrReturnString, uReturnLength, hwndCallback);
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpstrCommand);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue