Author: akhaldi
Date: Sat Nov 21 09:26:27 2015
New Revision: 69975
URL:
http://svn.reactos.org/svn/reactos?rev=69975&view=rev
Log:
[MCICDA] Sync with Wine Staging 1.7.55. CORE-10536
Modified:
trunk/reactos/dll/win32/mcicda/mcicda.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/mcicda/mcicda.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mcicda/mcicda.c?…
==============================================================================
--- trunk/reactos/dll/win32/mcicda/mcicda.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/mcicda/mcicda.c [iso-8859-1] Sat Nov 21 09:26:27 2015
@@ -81,6 +81,31 @@
typedef HRESULT(WINAPI*LPDIRECTSOUNDCREATE)(LPCGUID,LPDIRECTSOUND*,LPUNKNOWN);
static LPDIRECTSOUNDCREATE pDirectSoundCreate;
+static BOOL device_io(HANDLE dev, DWORD code, void *inbuffer, DWORD insize, void
*outbuffer, DWORD outsize, DWORD *retsize, OVERLAPPED *overlapped)
+{
+ const char *str;
+ BOOL ret = DeviceIoControl(dev, code, inbuffer, insize, outbuffer, outsize, retsize,
overlapped);
+
+#define XX(x) case (x): str = #x; break
+ switch (code)
+ {
+ XX(IOCTL_CDROM_RAW_READ);
+ XX(IOCTL_CDROM_READ_TOC);
+ XX(IOCTL_CDROM_READ_Q_CHANNEL);
+ XX(IOCTL_CDROM_SEEK_AUDIO_MSF);
+ XX(IOCTL_CDROM_PLAY_AUDIO_MSF);
+ XX(IOCTL_CDROM_STOP_AUDIO);
+ XX(IOCTL_CDROM_PAUSE_AUDIO);
+ XX(IOCTL_CDROM_RESUME_AUDIO);
+ XX(IOCTL_STORAGE_EJECT_MEDIA);
+ XX(IOCTL_STORAGE_LOAD_MEDIA);
+ default: str = wine_dbg_sprintf("UNKNOWN (0x%x)", code);
+ };
+#undef XX
+ TRACE("Device %p, Code %s -> Return %d, Bytes %u\n", dev, str, ret,
*retsize);
+ return ret;
+}
+
static DWORD CALLBACK MCICDA_playLoop(void *ptr)
{
WINE_MCICDAUDIO *wmcda = (WINE_MCICDAUDIO*)ptr;
@@ -123,7 +148,7 @@
if (SUCCEEDED(hr)) {
if (rdInfo.SectorCount > 0) {
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_RAW_READ, &rdInfo,
sizeof(rdInfo), cdData, lockLen, &br, NULL))
+ if (!device_io(wmcda->handle, IOCTL_CDROM_RAW_READ, &rdInfo,
sizeof(rdInfo), cdData, lockLen, &br, NULL))
WARN("CD read failed at sector %d: 0x%x\n",
wmcda->start, GetLastError());
}
if (rdInfo.SectorCount*RAW_SECTOR_SIZE < lockLen) {
@@ -256,7 +281,7 @@
mode = MCI_MODE_PLAY;
}
}
- else if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt,
sizeof(fmt),
+ else if (!device_io(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt,
sizeof(fmt),
&data, sizeof(data), &br, NULL)) {
if (GetLastError() == ERROR_NOT_READY) mode = MCI_MODE_OPEN;
} else {
@@ -319,7 +344,7 @@
case MCI_FORMAT_TMSF:
default: /* unknown format ! force TMSF ! ... */
wTrack = MCI_TMSF_TRACK(dwTime);
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &br, NULL))
return 0;
if (wTrack < toc.FirstTrack || wTrack > toc.LastTrack)
@@ -370,7 +395,7 @@
break;
case MCI_FORMAT_TMSF:
default: /* unknown format ! force TMSF ! ... */
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &br, NULL))
return 0;
if (dwFrame < FRAME_OF_TOC(toc, toc.FirstTrack) ||
@@ -642,7 +667,7 @@
DWORD br;
static const WCHAR wszLu[] = {'%','l','u',0};
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &br, NULL)) {
return MCICDA_GetError(wmcda);
}
@@ -657,10 +682,9 @@
if (!ret) {
TRACE("=> %s\n", debugstr_w(str));
if (lpParms->dwRetSize) {
- WCHAR zero = 0;
/* FIXME? Since NT, mciwave, mciseq and mcicda set dwRetSize
* to the number of characters written, excluding \0. */
- lstrcpynW(lpParms->lpstrReturn, str ? str : &zero, lpParms->dwRetSize);
+ lstrcpynW(lpParms->lpstrReturn, str, lpParms->dwRetSize);
} else ret = MCIERR_PARAM_OVERFLOW;
}
if (MMSYSERR_NOERROR==ret && (dwFlags & MCI_NOTIFY))
@@ -690,7 +714,7 @@
switch (lpParms->dwItem) {
case MCI_STATUS_CURRENT_TRACK:
fmt.Format = IOCTL_CDROM_CURRENT_POSITION;
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt,
sizeof(fmt),
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt,
sizeof(fmt),
&data, sizeof(data), &br, NULL))
{
return MCICDA_GetError(wmcda);
@@ -700,7 +724,7 @@
TRACE("CURRENT_TRACK=%lu\n", lpParms->dwReturn);
break;
case MCI_STATUS_LENGTH:
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &br, NULL)) {
WARN("error reading TOC !\n");
return MCICDA_GetError(wmcda);
@@ -742,7 +766,7 @@
ret = MCI_RESOURCE_RETURNED;
break;
case MCI_STATUS_NUMBER_OF_TRACKS:
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &br, NULL)) {
WARN("error reading TOC !\n");
return MCICDA_GetError(wmcda);
@@ -755,7 +779,7 @@
case MCI_STATUS_POSITION:
switch (dwFlags & (MCI_STATUS_START | MCI_TRACK)) {
case MCI_STATUS_START:
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &br, NULL)) {
WARN("error reading TOC !\n");
return MCICDA_GetError(wmcda);
@@ -764,7 +788,7 @@
TRACE("get MCI_STATUS_START !\n");
break;
case MCI_TRACK:
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &br, NULL)) {
WARN("error reading TOC !\n");
return MCICDA_GetError(wmcda);
@@ -776,7 +800,7 @@
break;
case 0:
fmt.Format = IOCTL_CDROM_CURRENT_POSITION;
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL,
&fmt, sizeof(fmt),
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt,
sizeof(fmt),
&data, sizeof(data), &br, NULL)) {
return MCICDA_GetError(wmcda);
}
@@ -813,7 +837,7 @@
if (!(dwFlags & MCI_TRACK))
ret = MCIERR_MISSING_PARAMETER;
else {
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &br, NULL)) {
WARN("error reading TOC !\n");
return MCICDA_GetError(wmcda);
@@ -845,7 +869,7 @@
int i;
DWORD br;
CDROM_TOC toc;
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &br, NULL)) {
WARN("error reading TOC !\n");
return MCICDA_GetError(wmcda);
@@ -892,7 +916,7 @@
if (wmcda == NULL)
return MCIERR_INVALID_DEVICE_ID;
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &br, NULL)) {
WARN("error reading TOC !\n");
return MCICDA_GetError(wmcda);
@@ -905,7 +929,7 @@
TRACE("MCI_FROM=%08X -> %u\n", lpParms->dwFrom, start);
} else {
fmt.Format = IOCTL_CDROM_CURRENT_POSITION;
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt,
sizeof(fmt),
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt,
sizeof(fmt),
&data, sizeof(data), &br, NULL)) {
return MCICDA_GetError(wmcda);
}
@@ -997,7 +1021,7 @@
wmcda->end-wmcda->start);
rdInfo.TrackMode = CDDA;
- readok = DeviceIoControl(wmcda->handle, IOCTL_CDROM_RAW_READ,
+ readok = device_io(wmcda->handle, IOCTL_CDROM_RAW_READ,
&rdInfo, sizeof(rdInfo), cdData, lockLen,
&br, NULL);
IDirectSoundBuffer_Unlock(wmcda->dsBuf, cdData, lockLen, NULL, 0);
@@ -1047,7 +1071,7 @@
play.EndingM = end / CDFRAMES_PERMIN;
play.EndingS = (end / CDFRAMES_PERSEC) % 60;
play.EndingF = end % CDFRAMES_PERSEC;
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_PLAY_AUDIO_MSF, &play,
sizeof(play),
+ if (!device_io(wmcda->handle, IOCTL_CDROM_PLAY_AUDIO_MSF, &play,
sizeof(play),
NULL, 0, &br, NULL)) {
wmcda->hCallback = NULL;
ret = MCIERR_HARDWARE;
@@ -1087,7 +1111,7 @@
IDirectSound_Release(wmcda->dsObj);
wmcda->dsObj = NULL;
}
- else if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_STOP_AUDIO, NULL, 0, NULL, 0,
&br, NULL))
+ else if (!device_io(wmcda->handle, IOCTL_CDROM_STOP_AUDIO, NULL, 0, NULL, 0,
&br, NULL))
return MCIERR_HARDWARE;
if ((dwFlags & MCI_NOTIFY) && lpParms)
@@ -1117,7 +1141,7 @@
FAILED(IDirectSoundBuffer_Stop(wmcda->dsBuf)))
return MCIERR_HARDWARE;
}
- else if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_PAUSE_AUDIO, NULL, 0, NULL,
0, &br, NULL))
+ else if (!device_io(wmcda->handle, IOCTL_CDROM_PAUSE_AUDIO, NULL, 0, NULL, 0,
&br, NULL))
return MCIERR_HARDWARE;
if ((dwFlags & MCI_NOTIFY) && lpParms)
@@ -1143,7 +1167,7 @@
FAILED(IDirectSoundBuffer_Play(wmcda->dsBuf, 0, 0, DSBPLAY_LOOPING)))
return MCIERR_HARDWARE;
}
- else if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_RESUME_AUDIO, NULL, 0, NULL,
0, &br, NULL))
+ else if (!device_io(wmcda->handle, IOCTL_CDROM_RESUME_AUDIO, NULL, 0, NULL, 0,
&br, NULL))
return MCIERR_HARDWARE;
if ((dwFlags & MCI_NOTIFY) && lpParms)
@@ -1176,7 +1200,7 @@
* then only checks the position flags, then stops and seeks. */
MCICDA_Stop(wDevID, MCI_WAIT, 0);
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ if (!device_io(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
&toc, sizeof(toc), &br, NULL)) {
WARN("error reading TOC !\n");
return MCICDA_GetError(wmcda);
@@ -1210,7 +1234,7 @@
seek.M = at / CDFRAMES_PERMIN;
seek.S = (at / CDFRAMES_PERSEC) % 60;
seek.F = at % CDFRAMES_PERSEC;
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_SEEK_AUDIO_MSF, &seek,
sizeof(seek),
+ if (!device_io(wmcda->handle, IOCTL_CDROM_SEEK_AUDIO_MSF, &seek,
sizeof(seek),
NULL, 0, &br, NULL))
return MCIERR_HARDWARE;
}
@@ -1232,7 +1256,7 @@
if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
- if (!DeviceIoControl(wmcda->handle,
+ if (!device_io(wmcda->handle,
(open) ? IOCTL_STORAGE_EJECT_MEDIA : IOCTL_STORAGE_LOAD_MEDIA,
NULL, 0, NULL, 0, &br, NULL))
return MCIERR_HARDWARE;
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Nov 21 09:26:27 2015
@@ -94,7 +94,7 @@
reactos/dll/win32/lz32 # Synced to WineStaging-1.7.47
reactos/dll/win32/mapi32 # Synced to WineStaging-1.7.47
reactos/dll/win32/mciavi32 # Synced to WineStaging-1.7.55
-reactos/dll/win32/mcicda # Synced to WineStaging-1.7.47
+reactos/dll/win32/mcicda # Synced to WineStaging-1.7.55
reactos/dll/win32/mciqtz32 # Synced to WineStaging-1.7.47
reactos/dll/win32/mciseq # Synced to WineStaging-1.7.47
reactos/dll/win32/mciwave # Synced to WineStaging-1.7.47