----- Original Message -----From: Rémi AssaillySent: Friday, July 22, 2005 3:43 PMSubject: Move mcicda to the top-level dlls directoryHi all
I saw that WinXP kept mciseq.drv, mciwave.drv and mciavi.drv.
Should we do the same thing or just keep the dlls files ?
Changelog:
Moved mcicda to the top-level dlls directory.
diff -Nru wine/configure winedev/configure
--- wine/configure 2005-07-21 20:36:42.000000000 +0200
+++ winedev/configure 2005-07-22 14:45:10.000000000 +0200
@@ -20203,7 +20203,7 @@
MAKE_PROG_RULES=programs/Makeprog.rules
- ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/activeds/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/advpack/Makefile dlls/advpack/tests/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/crypt32/tests/Makefile dlls/cryptdll/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput/tests/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/itss/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/lzexpand/tests/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/midimap/Makefile dlls/mlang/Makefile dlls/mlang/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/mscms/Makefile dlls/mscms/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/mshtml/tests/Makefile dlls/msi/Makefile dlls/msi/tests/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/odbccp32/Makefile dlls/ole32/Makefile dlls/ole32/tests/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/powrprof/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/quartz/tests/Makefile dlls/rasapi32/Makefile dlls/riched20/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/rsabase/tests/Makefile dlls/rsaenh/Makefile dlls/rsaenh/tests/Makefile dlls/secur32/Makefile dlls/sensapi/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/stdole2.tlb/Makefile dlls/stdole32.tlb/Makefile dlls/sti/Makefile dlls/strmiids/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wldap32/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/wtsapi32/Makefile dlls/x11drv/Makefile documentation/Makefile fonts/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/hh/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
+ ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/activeds/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/advpack/Makefile dlls/advpack/tests/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/crypt32/tests/Makefile dlls/cryptdll/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput/tests/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/itss/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/lzexpand/tests/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mcicda/Makefile dlls/midimap/Makefile dlls/mlang/Makefile dlls/mlang/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/mscms/Makefile dlls/mscms/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/mshtml/tests/Makefile dlls/msi/Makefile dlls/msi/tests/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/odbccp32/Makefile dlls/ole32/Makefile dlls/ole32/tests/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/powrprof/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/quartz/tests/Makefile dlls/rasapi32/Makefile dlls/riched20/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/rsabase/tests/Makefile dlls/rsaenh/Makefile dlls/rsaenh/tests/Makefile dlls/secur32/Makefile dlls/sensapi/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/stdole2.tlb/Makefile dlls/stdole32.tlb/Makefile dlls/sti/Makefile dlls/strmiids/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wldap32/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/wtsapi32/Makefile dlls/x11drv/Makefile documentation/Makefile fonts/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/hh/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
cat >confcache <<\_ACEOF
@@ -20816,6 +20816,7 @@
"dlls/lzexpand/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/lzexpand/tests/Makefile" ;;
"dlls/mapi32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mapi32/Makefile" ;;
"dlls/mapi32/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mapi32/tests/Makefile" ;;
+ "dlls/mcicda/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mcicda/Makefile" ;;
"dlls/midimap/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/midimap/Makefile" ;;
"dlls/mlang/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mlang/Makefile" ;;
"dlls/mlang/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mlang/tests/Makefile" ;;
@@ -20926,7 +20927,6 @@
"dlls/winmm/joystick/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winmm/joystick/Makefile" ;;
"dlls/winmm/mcianim/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winmm/mcianim/Makefile" ;;
"dlls/winmm/mciavi/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winmm/mciavi/Makefile" ;;
- "dlls/winmm/mcicda/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winmm/mcicda/Makefile" ;;
"dlls/winmm/mciseq/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winmm/mciseq/Makefile" ;;
"dlls/winmm/mciwave/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winmm/mciwave/Makefile" ;;
"dlls/winmm/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winmm/tests/Makefile" ;;
diff -Nru wine/configure.ac winedev/configure.ac
--- wine/configure.ac 2005-07-21 20:36:42.000000000 +0200
+++ winedev/configure.ac 2005-07-22 14:44:01.000000000 +0200
@@ -1612,6 +1612,7 @@
dlls/lzexpand/tests/Makefile
dlls/mapi32/Makefile
dlls/mapi32/tests/Makefile
+dlls/mcicda/Makefile
dlls/midimap/Makefile
dlls/mlang/Makefile
dlls/mlang/tests/Makefile
@@ -1722,7 +1723,6 @@
dlls/winmm/joystick/Makefile
dlls/winmm/mcianim/Makefile
dlls/winmm/mciavi/Makefile
-dlls/winmm/mcicda/Makefile
dlls/winmm/mciseq/Makefile
dlls/winmm/mciwave/Makefile
dlls/winmm/tests/Makefile
diff -Nru wine/dlls/Makefile.in winedev/dlls/Makefile.in
--- wine/dlls/Makefile.in 2005-07-21 20:36:42.000000000 +0200
+++ winedev/dlls/Makefile.in 2005-07-22 14:43:11.000000000 +0200
@@ -70,6 +70,7 @@
kernel \
lzexpand \
mapi32 \
+ mcicda \
midimap \
mlang \
mmdevldr.vxd \
@@ -154,7 +155,6 @@
winmm/joystick \
winmm/mcianim \
winmm/mciavi \
- winmm/mcicda \
winmm/mciseq \
winmm/mciwave \
winmm/wavemap \
@@ -316,7 +316,7 @@
mapi32.dll.so \
mcianim.drv.so \
mciavi.drv.so \
- mcicda.drv.so \
+ mcicda.dll.so \
mciseq.drv.so \
mciwave.drv.so \
midimap.dll.so \
@@ -647,8 +647,8 @@
mciavi.drv.so: winmm/mciavi/mciavi.drv.so
$(RM) $@ && $(LN_S) winmm/mciavi/mciavi.drv.so $@
-mcicda.drv.so: winmm/mcicda/mcicda.drv.so
- $(RM) $@ && $(LN_S) winmm/mcicda/mcicda.drv.so $@
+mcicda.dll.so: winmm/mcicda/mcicda.dll.so
+ $(RM) $@ && $(LN_S) winmm/mcicda/mcicda.dll.so $@
mciseq.drv.so: winmm/mciseq/mciseq.drv.so
$(RM) $@ && $(LN_S) winmm/mciseq/mciseq.drv.so $@
@@ -1717,7 +1717,7 @@
mapi32/mapi32.dll.so: mapi32
winmm/mcianim/mcianim.drv.so: winmm/mcianim
winmm/mciavi/mciavi.drv.so: winmm/mciavi
-winmm/mcicda/mcicda.drv.so: winmm/mcicda
+mcicda/mcicda.dll.so: mcicda
winmm/mciseq/mciseq.drv.so: winmm/mciseq
winmm/mciwave/mciwave.drv.so: winmm/mciwave
midimap/midimap.dll.so: midimap
diff -Nru wine/dlls/mcicda/.cvsignore winedev/dlls/mcicda/.cvsignore
--- wine/dlls/mcicda/.cvsignore 1970-01-01 01:00:00.000000000 +0100
+++ winedev/dlls/mcicda/.cvsignore 2005-07-22 14:41:22.000000000 +0200
@@ -0,0 +1,2 @@
+Makefile
+mcicda.dll.dbg.c
diff -Nru wine/dlls/mcicda/Makefile.in winedev/dlls/mcicda/Makefile.in
--- wine/dlls/mcicda/Makefile.in 1970-01-01 01:00:00.000000000 +0100
+++ winedev/dlls/mcicda/Makefile.in 2005-07-22 14:41:07.000000000 +0200
@@ -0,0 +1,14 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR = @srcdir@
+VPATH = @srcdir@
+MODULE = mcicda.dll
+IMPORTS = winmm user32 kernel32
+EXTRALIBS = $(LIBUNICODE)
+
+C_SRCS = \
+ mcicda.c
+
+@MAKE_DLL_RULES@
+
+### Dependencies:
diff -Nru wine/dlls/mcicda/mcicda.c winedev/dlls/mcicda/mcicda.c
--- wine/dlls/mcicda/mcicda.c 1970-01-01 01:00:00.000000000 +0100
+++ winedev/dlls/mcicda/mcicda.c 2005-02-09 23:26:26.000000000 +0100
@@ -0,0 +1,1053 @@
+/* -*- tab-width: 8; c-basic-offset: 4 -*- */
+/*
+ * MCI driver for audio CD (MCICDA)
+ *
+ * Copyright 1994 Martin Ayotte
+ * Copyright 1998-99 Eric Pouech
+ * Copyright 2000 Andreas Mohr
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "config.h"
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "ntstatus.h"
+#include "wownt32.h"
+#include "mmddk.h"
+#include "winioctl.h"
+#include "ntddstor.h"
+#include "ntddcdrm.h"
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(mcicda);
+
+#define CDFRAMES_PERSEC 75
+#define CDFRAMES_PERMIN (CDFRAMES_PERSEC * 60)
+#define FRAME_OF_ADDR(a) ((a)[1] * CDFRAMES_PERMIN + (a)[2] * CDFRAMES_PERSEC + (a)[3])
+#define FRAME_OF_TOC(toc, idx) FRAME_OF_ADDR((toc).TrackData[idx - (toc).FirstTrack].Address)
+
+typedef struct {
+ UINT wDevID;
+ int nUseCount; /* Incremented for each shared open */
+ BOOL fShareable; /* TRUE if first open was shareable */
+ WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
+ HANDLE hCallback; /* Callback handle for pending notification */
+ DWORD dwTimeFormat;
+ HANDLE handle;
+} WINE_MCICDAUDIO;
+
+/*-----------------------------------------------------------------------*/
+
+/**************************************************************************
+ * MCICDA_drvOpen [internal]
+ */
+static DWORD MCICDA_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
+{
+ WINE_MCICDAUDIO* wmcda;
+
+ if (!modp) return 0xFFFFFFFF;
+
+ wmcda = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCICDAUDIO));
+
+ if (!wmcda)
+ return 0;
+
+ wmcda->wDevID = modp->wDeviceID;
+ mciSetDriverData(wmcda->wDevID, (DWORD)wmcda);
+ modp->wCustomCommandTable = MCI_NO_COMMAND_TABLE;
+ modp->wType = MCI_DEVTYPE_CD_AUDIO;
+ return modp->wDeviceID;
+}
+
+/**************************************************************************
+ * MCICDA_drvClose [internal]
+ */
+static DWORD MCICDA_drvClose(DWORD dwDevID)
+{
+ WINE_MCICDAUDIO* wmcda = (WINE_MCICDAUDIO*)mciGetDriverData(dwDevID);
+
+ if (wmcda) {
+ HeapFree(GetProcessHeap(), 0, wmcda);
+ mciSetDriverData(dwDevID, 0);
+ }
+ return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
+}
+
+/**************************************************************************
+ * MCICDA_GetOpenDrv [internal]
+ */
+static WINE_MCICDAUDIO* MCICDA_GetOpenDrv(UINT wDevID)
+{
+ WINE_MCICDAUDIO* wmcda = (WINE_MCICDAUDIO*)mciGetDriverData(wDevID);
+
+ if (wmcda == NULL || wmcda->nUseCount == 0) {
+ WARN("Invalid wDevID=%u\n", wDevID);
+ return 0;
+ }
+ return wmcda;
+}
+
+/**************************************************************************
+ * MCICDA_GetStatus [internal]
+ */
+static DWORD MCICDA_GetStatus(WINE_MCICDAUDIO* wmcda)
+{
+ CDROM_SUB_Q_DATA_FORMAT fmt;
+ SUB_Q_CHANNEL_DATA data;
+ DWORD br;
+ DWORD mode = MCI_MODE_NOT_READY;
+
+ fmt.Format = IOCTL_CDROM_CURRENT_POSITION;
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt, sizeof(fmt),
+ &data, sizeof(data), &br, NULL)) {
+ if (GetLastError() == STATUS_NO_MEDIA_IN_DEVICE) mode = MCI_MODE_OPEN;
+ } else {
+ switch (data.CurrentPosition.Header.AudioStatus)
+ {
+ case AUDIO_STATUS_IN_PROGRESS: mode = MCI_MODE_PLAY; break;
+ case AUDIO_STATUS_PAUSED: mode = MCI_MODE_PAUSE; break;
+ case AUDIO_STATUS_NO_STATUS:
+ case AUDIO_STATUS_PLAY_COMPLETE: mode = MCI_MODE_STOP; break;
+ case AUDIO_STATUS_PLAY_ERROR:
+ case AUDIO_STATUS_NOT_SUPPORTED:
+ default:
+ break;
+ }
+ }
+ return mode;
+}
+
+/**************************************************************************
+ * MCICDA_GetError [internal]
+ */
+static int MCICDA_GetError(WINE_MCICDAUDIO* wmcda)
+{
+ switch (GetLastError())
+ {
+ case STATUS_NO_MEDIA_IN_DEVICE: return MCIERR_DEVICE_NOT_READY;
+ case STATUS_IO_DEVICE_ERROR: return MCIERR_HARDWARE;
+ default:
+ FIXME("Unknown mode %lx\n", GetLastError());
+ }
+ return MCIERR_DRIVER_INTERNAL;
+}
+
+/**************************************************************************
+ * MCICDA_CalcFrame [internal]
+ */
+static DWORD MCICDA_CalcFrame(WINE_MCICDAUDIO* wmcda, DWORD dwTime)
+{
+ DWORD dwFrame = 0;
+ UINT wTrack;
+ CDROM_TOC toc;
+ DWORD br;
+ BYTE* addr;
+
+ TRACE("(%p, %08lX, %lu);\n", wmcda, wmcda->dwTimeFormat, dwTime);
+
+ switch (wmcda->dwTimeFormat) {
+ case MCI_FORMAT_MILLISECONDS:
+ dwFrame = ((dwTime - 1) * CDFRAMES_PERSEC + 500) / 1000;
+ TRACE("MILLISECONDS %lu\n", dwFrame);
+ break;
+ case MCI_FORMAT_MSF:
+ TRACE("MSF %02u:%02u:%02u\n",
+ MCI_MSF_MINUTE(dwTime), MCI_MSF_SECOND(dwTime), MCI_MSF_FRAME(dwTime));
+ dwFrame += CDFRAMES_PERMIN * MCI_MSF_MINUTE(dwTime);
+ dwFrame += CDFRAMES_PERSEC * MCI_MSF_SECOND(dwTime);
+ dwFrame += MCI_MSF_FRAME(dwTime);
+ break;
+ case MCI_FORMAT_TMSF:
+ default: /* unknown format ! force TMSF ! ... */
+ wTrack = MCI_TMSF_TRACK(dwTime);
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ &toc, sizeof(toc), &br, NULL))
+ return 0;
+ if (wTrack < toc.FirstTrack || wTrack > toc.LastTrack)
+ return 0;
+ TRACE("MSF %02u-%02u:%02u:%02u\n",
+ MCI_TMSF_TRACK(dwTime), MCI_TMSF_MINUTE(dwTime),
+ MCI_TMSF_SECOND(dwTime), MCI_TMSF_FRAME(dwTime));
+ addr = toc.TrackData[wTrack - toc.FirstTrack].Address;
+ TRACE("TMSF trackpos[%u]=%d:%d:%d\n",
+ wTrack, addr[1], addr[2], addr[3]);
+ dwFrame = CDFRAMES_PERMIN * (addr[1] + MCI_TMSF_MINUTE(dwTime)) +
+ CDFRAMES_PERSEC * (addr[2] + MCI_TMSF_SECOND(dwTime)) +
+ addr[3] + MCI_TMSF_FRAME(dwTime);
+ break;
+ }
+ return dwFrame;
+}
+
+/**************************************************************************
+ * MCICDA_CalcTime [internal]
+ */
+static DWORD MCICDA_CalcTime(WINE_MCICDAUDIO* wmcda, DWORD tf, DWORD dwFrame, LPDWORD lpRet)
+{
+ DWORD dwTime = 0;
+ UINT wTrack;
+ UINT wMinutes;
+ UINT wSeconds;
+ UINT wFrames;
+ CDROM_TOC toc;
+ DWORD br;
+
+ TRACE("(%p, %08lX, %lu);\n", wmcda, tf, dwFrame);
+
+ switch (tf) {
+ case MCI_FORMAT_MILLISECONDS:
+ dwTime = (dwFrame * 1000) / CDFRAMES_PERSEC + 1;
+ TRACE("MILLISECONDS %lu\n", dwTime);
+ *lpRet = 0;
+ break;
+ case MCI_FORMAT_MSF:
+ wMinutes = dwFrame / CDFRAMES_PERMIN;
+ wSeconds = (dwFrame - CDFRAMES_PERMIN * wMinutes) / CDFRAMES_PERSEC;
+ wFrames = dwFrame - CDFRAMES_PERMIN * wMinutes - CDFRAMES_PERSEC * wSeconds;
+ dwTime = MCI_MAKE_MSF(wMinutes, wSeconds, wFrames);
+ TRACE("MSF %02u:%02u:%02u -> dwTime=%lu\n",
+ wMinutes, wSeconds, wFrames, dwTime);
+ *lpRet = MCI_COLONIZED3_RETURN;
+ break;
+ case MCI_FORMAT_TMSF:
+ default: /* unknown format ! force TMSF ! ... */
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ &toc, sizeof(toc), &br, NULL))
+ return 0;
+ if (dwFrame < FRAME_OF_TOC(toc, toc.FirstTrack) ||
+ dwFrame > FRAME_OF_TOC(toc, toc.LastTrack + 1)) {
+ ERR("Out of range value %lu [%u,%u]\n",
+ dwFrame, FRAME_OF_TOC(toc, toc.FirstTrack),
+ FRAME_OF_TOC(toc, toc.LastTrack + 1));
+ *lpRet = 0;
+ return 0;
+ }
+ for (wTrack = toc.FirstTrack; wTrack <= toc.LastTrack; wTrack++) {
+ if (FRAME_OF_TOC(toc, wTrack) > dwFrame)
+ break;
+ }
+ wTrack--;
+ dwFrame -= FRAME_OF_TOC(toc, wTrack);
+ wMinutes = dwFrame / CDFRAMES_PERMIN;
+ wSeconds = (dwFrame - CDFRAMES_PERMIN * wMinutes) / CDFRAMES_PERSEC;
+ wFrames = dwFrame - CDFRAMES_PERMIN * wMinutes - CDFRAMES_PERSEC * wSeconds;
+ dwTime = MCI_MAKE_TMSF(wTrack, wMinutes, wSeconds, wFrames);
+ TRACE("%02u-%02u:%02u:%02u\n", wTrack, wMinutes, wSeconds, wFrames);
+ *lpRet = MCI_COLONIZED4_RETURN;
+ break;
+ }
+ return dwTime;
+}
+
+static DWORD MCICDA_Seek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms);
+static DWORD MCICDA_Stop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms);
+
+/**************************************************************************
+ * MCICDA_Open [internal]
+ */
+static DWORD MCICDA_Open(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSW lpOpenParms)
+{
+ DWORD dwDeviceID;
+ DWORD ret = MCIERR_HARDWARE;
+ WINE_MCICDAUDIO* wmcda = (WINE_MCICDAUDIO*)mciGetDriverData(wDevID);
+ WCHAR root[7], drive = 0;
+ int count;
+
+ TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpOpenParms);
+
+ if (lpOpenParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
+ if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
+
+ dwDeviceID = lpOpenParms->wDeviceID;
+
+ if (wmcda->nUseCount > 0) {
+ /* The driver is already open on this channel */
+ /* If the driver was opened shareable before and this open specifies */
+ /* shareable then increment the use count */
+ if (wmcda->fShareable && (dwFlags & MCI_OPEN_SHAREABLE))
+ ++wmcda->nUseCount;
+ else
+ return MCIERR_MUST_USE_SHAREABLE;
+ } else {
+ wmcda->nUseCount = 1;
+ wmcda->fShareable = dwFlags & MCI_OPEN_SHAREABLE;
+ }
+ if (dwFlags & MCI_OPEN_ELEMENT) {
+ if (dwFlags & MCI_OPEN_ELEMENT_ID) {
+ WARN("MCI_OPEN_ELEMENT_ID %8lx ! Abort\n", (DWORD)lpOpenParms->lpstrElementName);
+ return MCIERR_NO_ELEMENT_ALLOWED;
+ }
+ TRACE("MCI_OPEN_ELEMENT element name: %s\n", debugstr_w(lpOpenParms->lpstrElementName));
+ if (!isalpha(lpOpenParms->lpstrElementName[0]) || lpOpenParms->lpstrElementName[1] != ':' ||
+ (lpOpenParms->lpstrElementName[2] && lpOpenParms->lpstrElementName[2] != '\\'))
+ {
+ WARN("MCI_OPEN_ELEMENT unsupported format: %s\n",
+ debugstr_w(lpOpenParms->lpstrElementName));
+ ret = MCIERR_NO_ELEMENT_ALLOWED;
+ goto the_error;
+ }
+ drive = toupper(lpOpenParms->lpstrElementName[0]);
+ root[0] = drive; root[1] = ':'; root[2] = '\\'; root[3] = '\0';
+ if (GetDriveTypeW(root) != DRIVE_CDROM)
+ {
+ ret = MCIERR_INVALID_DEVICE_NAME;
+ goto the_error;
+ }
+ }
+ else
+ {
+ /* drive letter isn't passed... get the dwDeviceID'th cdrom in the system */
+ root[0] = 'A'; root[1] = ':'; root[2] = '\\'; root[3] = '\0';
+ for (count = 0; root[0] <= 'Z'; root[0]++)
+ {
+ if (GetDriveTypeW(root) == DRIVE_CDROM && ++count >= dwDeviceID)
+ {
+ drive = root[0];
+ break;
+ }
+ }
+ if (!drive)
+ {
+ ret = MCIERR_INVALID_DEVICE_ID;
+ goto the_error;
+ }
+ }
+
+ wmcda->wNotifyDeviceID = dwDeviceID;
+ wmcda->dwTimeFormat = MCI_FORMAT_MSF;
+
+ /* now, open the handle */
+ root[0] = root[1] = '\\'; root[2] = '.'; root[3] = '\\'; root[4] = drive; root[5] = ':'; root[6] = '\0';
+ wmcda->handle = CreateFileW(root, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
+ if (wmcda->handle != INVALID_HANDLE_VALUE)
+ return 0;
+
+ the_error:
+ --wmcda->nUseCount;
+ return ret;
+}
+
+/**************************************************************************
+ * MCICDA_Close [internal]
+ */
+static DWORD MCICDA_Close(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
+{
+ WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
+
+ TRACE("(%04X, %08lX, %p);\n", wDevID, dwParam, lpParms);
+
+ if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
+
+ if (--wmcda->nUseCount == 0) {
+ CloseHandle(wmcda->handle);
+ }
+ return 0;
+}
+
+/**************************************************************************
+ * MCICDA_GetDevCaps [internal]
+ */
+static DWORD MCICDA_GetDevCaps(UINT wDevID, DWORD dwFlags,
+ LPMCI_GETDEVCAPS_PARMS lpParms)
+{
+ DWORD ret = 0;
+
+ TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+
+ if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
+
+ if (dwFlags & MCI_GETDEVCAPS_ITEM) {
+ TRACE("MCI_GETDEVCAPS_ITEM dwItem=%08lX;\n", lpParms->dwItem);
+
+ switch (lpParms->dwItem) {
+ case MCI_GETDEVCAPS_CAN_RECORD:
+ lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ case MCI_GETDEVCAPS_HAS_AUDIO:
+ lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ case MCI_GETDEVCAPS_HAS_VIDEO:
+ lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ case MCI_GETDEVCAPS_DEVICE_TYPE:
+ lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_CD_AUDIO, MCI_DEVTYPE_CD_AUDIO);
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ case MCI_GETDEVCAPS_USES_FILES:
+ lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ case MCI_GETDEVCAPS_COMPOUND_DEVICE:
+ lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ case MCI_GETDEVCAPS_CAN_EJECT:
+ lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ case MCI_GETDEVCAPS_CAN_PLAY:
+ lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ case MCI_GETDEVCAPS_CAN_SAVE:
+ lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ default:
+ ERR("Unsupported %lx devCaps item\n", lpParms->dwItem);
+ return MCIERR_UNRECOGNIZED_COMMAND;
+ }
+ } else {
+ TRACE("No GetDevCaps-Item !\n");
+ return MCIERR_UNRECOGNIZED_COMMAND;
+ }
+ TRACE("lpParms->dwReturn=%08lX;\n", lpParms->dwReturn);
+ return ret;
+}
+
+static DWORD CDROM_Audio_GetSerial(CDROM_TOC* toc)
+{
+ unsigned long serial = 0;
+ int i;
+ WORD wMagic;
+ DWORD dwStart, dwEnd;
+
+ /*
+ * wMagic collects the wFrames from track 1
+ * dwStart, dwEnd collect the beginning and end of the disc respectively, in
+ * frames.
+ * There it is collected for correcting the serial when there are less than
+ * 3 tracks.
+ */
+ wMagic = toc->TrackData[0].Address[3];
+ dwStart = FRAME_OF_TOC(*toc, toc->FirstTrack);
+
+ for (i = 0; i <= toc->LastTrack - toc->FirstTrack; i++) {
+ serial += (toc->TrackData[i].Address[1] << 16) |
+ (toc->TrackData[i].Address[2] << 8) | toc->TrackData[i].Address[3];
+ }
+ dwEnd = FRAME_OF_TOC(*toc, toc->LastTrack + 1);
+
+ if (toc->LastTrack - toc->FirstTrack + 1 < 3)
+ serial += wMagic + (dwEnd - dwStart);
+
+ return serial;
+}
+
+
+/**************************************************************************
+ * MCICDA_Info [internal]
+ */
+static DWORD MCICDA_Info(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSW lpParms)
+{
+ LPCWSTR str = NULL;
+ WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
+ DWORD ret = 0;
+ WCHAR buffer[16];
+
+ TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+
+ if (lpParms == NULL || lpParms->lpstrReturn == NULL)
+ return MCIERR_NULL_PARAMETER_BLOCK;
+ if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
+
+ TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
+
+ if (dwFlags & MCI_INFO_PRODUCT) {
+ static const WCHAR wszAudioCd[] = {'W','i','n','e','\'','s',' ','a','u','d','i','o',' ','C','D',0};
+ str = wszAudioCd;
+ } else if (dwFlags & MCI_INFO_MEDIA_UPC) {
+ ret = MCIERR_NO_IDENTITY;
+ } else if (dwFlags & MCI_INFO_MEDIA_IDENTITY) {
+ DWORD res = 0;
+ CDROM_TOC toc;
+ DWORD br;
+ static const WCHAR wszLu[] = {'%','l','u',0};
+
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ &toc, sizeof(toc), &br, NULL)) {
+ return MCICDA_GetError(wmcda);
+ }
+
+ res = CDROM_Audio_GetSerial(&toc);
+ sprintfW(buffer, wszLu, res);
+ str = buffer;
+ } else {
+ WARN("Don't know this info command (%lu)\n", dwFlags);
+ ret = MCIERR_UNRECOGNIZED_COMMAND;
+ }
+ if (str) {
+ if (lpParms->dwRetSize <= strlenW(str)) {
+ lstrcpynW(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
+ ret = MCIERR_PARAM_OVERFLOW;
+ } else {
+ strcpyW(lpParms->lpstrReturn, str);
+ }
+ } else {
+ *lpParms->lpstrReturn = 0;
+ }
+ TRACE("=> %s (%ld)\n", debugstr_w(lpParms->lpstrReturn), ret);
+ return ret;
+}
+
+/**************************************************************************
+ * MCICDA_Status [internal]
+ */
+static DWORD MCICDA_Status(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
+{
+ WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
+ DWORD idx;
+ DWORD ret = 0;
+ CDROM_SUB_Q_DATA_FORMAT fmt;
+ SUB_Q_CHANNEL_DATA data;
+ CDROM_TOC toc;
+ DWORD br;
+
+ TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+
+ if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
+ if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
+
+ if (dwFlags & MCI_NOTIFY) {
+ TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
+ mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
+ wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
+ }
+ if (dwFlags & MCI_STATUS_ITEM) {
+ TRACE("dwItem = %lx\n", lpParms->dwItem);
+ 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),
+ &data, sizeof(data), &br, NULL))
+ {
+ return MCICDA_GetError(wmcda);
+ }
+ lpParms->dwReturn = data.CurrentPosition.TrackNumber;
+ TRACE("CURRENT_TRACK=%lu!\n", lpParms->dwReturn);
+ break;
+ case MCI_STATUS_LENGTH:
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ &toc, sizeof(toc), &br, NULL)) {
+ WARN("error reading TOC !\n");
+ return MCICDA_GetError(wmcda);
+ }
+ if (dwFlags & MCI_TRACK) {
+ TRACE("MCI_TRACK #%lu LENGTH=??? !\n", lpParms->dwTrack);
+ if (lpParms->dwTrack < toc.FirstTrack || lpParms->dwTrack > toc.LastTrack)
+ return MCIERR_OUTOFRANGE;
+ idx = lpParms->dwTrack - toc.FirstTrack;
+ lpParms->dwReturn = FRAME_OF_TOC(toc, lpParms->dwTrack + 1) -
+ FRAME_OF_TOC(toc, lpParms->dwTrack);
+ /* Windows returns one frame less than the total track length for the
+ last track on the CD. See CDDB HOWTO. Verified on Win95OSR2. */
+ if (lpParms->dwTrack == toc.LastTrack)
+ lpParms->dwReturn--;
+ } else {
+ /* Sum of the lengths of all of the tracks. Inherits the
+ 'off by one frame' behavior from the length of the last track.
+ See above comment. */
+ lpParms->dwReturn = FRAME_OF_TOC(toc, toc.LastTrack + 1) -
+ FRAME_OF_TOC(toc, toc.FirstTrack) - 1;
+ }
+ lpParms->dwReturn = MCICDA_CalcTime(wmcda,
+ (wmcda->dwTimeFormat == MCI_FORMAT_TMSF)
+ ? MCI_FORMAT_MSF : wmcda->dwTimeFormat,
+ lpParms->dwReturn,
+ &ret);
+ TRACE("LENGTH=%lu !\n", lpParms->dwReturn);
+ break;
+ case MCI_STATUS_MODE:
+ lpParms->dwReturn = MCICDA_GetStatus(wmcda);
+ TRACE("MCI_STATUS_MODE=%08lX !\n", lpParms->dwReturn);
+ lpParms->dwReturn = MAKEMCIRESOURCE(lpParms->dwReturn, lpParms->dwReturn);
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ case MCI_STATUS_MEDIA_PRESENT:
+ lpParms->dwReturn = (MCICDA_GetStatus(wmcda) == MCI_MODE_OPEN) ?
+ MAKEMCIRESOURCE(FALSE, MCI_FALSE) : MAKEMCIRESOURCE(TRUE, MCI_TRUE);
+ TRACE("MCI_STATUS_MEDIA_PRESENT =%c!\n", LOWORD(lpParms->dwReturn) ? 'Y' : 'N');
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ case MCI_STATUS_NUMBER_OF_TRACKS:
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ &toc, sizeof(toc), &br, NULL)) {
+ WARN("error reading TOC !\n");
+ return MCICDA_GetError(wmcda);
+ }
+ lpParms->dwReturn = toc.LastTrack - toc.FirstTrack + 1;
+ TRACE("MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n", lpParms->dwReturn);
+ if (lpParms->dwReturn == (WORD)-1)
+ return MCICDA_GetError(wmcda);
+ break;
+ case MCI_STATUS_POSITION:
+ if (dwFlags & MCI_STATUS_START) {
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ &toc, sizeof(toc), &br, NULL)) {
+ WARN("error reading TOC !\n");
+ return MCICDA_GetError(wmcda);
+ }
+ lpParms->dwReturn = FRAME_OF_TOC(toc, toc.FirstTrack);
+ TRACE("get MCI_STATUS_START !\n");
+ } else if (dwFlags & MCI_TRACK) {
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ &toc, sizeof(toc), &br, NULL)) {
+ WARN("error reading TOC !\n");
+ return MCICDA_GetError(wmcda);
+ }
+ if (lpParms->dwTrack < toc.FirstTrack || lpParms->dwTrack > toc.LastTrack)
+ return MCIERR_OUTOFRANGE;
+ lpParms->dwReturn = FRAME_OF_TOC(toc, lpParms->dwTrack);
+ TRACE("get MCI_TRACK #%lu !\n", lpParms->dwTrack);
+ } else {
+ fmt.Format = IOCTL_CDROM_CURRENT_POSITION;
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt, sizeof(fmt),
+ &data, sizeof(data), &br, NULL)) {
+ return MCICDA_GetError(wmcda);
+ }
+ lpParms->dwReturn = FRAME_OF_ADDR(data.CurrentPosition.AbsoluteAddress);
+ }
+ lpParms->dwReturn = MCICDA_CalcTime(wmcda, wmcda->dwTimeFormat, lpParms->dwReturn, &ret);
+ TRACE("MCI_STATUS_POSITION=%08lX !\n", lpParms->dwReturn);
+ break;
+ case MCI_STATUS_READY:
+ TRACE("MCI_STATUS_READY !\n");
+ switch (MCICDA_GetStatus(wmcda))
+ {
+ case MCI_MODE_NOT_READY:
+ case MCI_MODE_OPEN:
+ lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
+ break;
+ default:
+ lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
+ break;
+ }
+ TRACE("MCI_STATUS_READY=%u!\n", LOWORD(lpParms->dwReturn));
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ case MCI_STATUS_TIME_FORMAT:
+ lpParms->dwReturn = MAKEMCIRESOURCE(wmcda->dwTimeFormat, MCI_FORMAT_RETURN_BASE + wmcda->dwTimeFormat);
+ TRACE("MCI_STATUS_TIME_FORMAT=%08x!\n", LOWORD(lpParms->dwReturn));
+ ret = MCI_RESOURCE_RETURNED;
+ break;
+ case 4001: /* FIXME: for bogus FullCD */
+ case MCI_CDA_STATUS_TYPE_TRACK:
+ if (!(dwFlags & MCI_TRACK))
+ ret = MCIERR_MISSING_PARAMETER;
+ else {
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ &toc, sizeof(toc), &br, NULL)) {
+ WARN("error reading TOC !\n");
+ return MCICDA_GetError(wmcda);
+ }
+ if (lpParms->dwTrack < toc.FirstTrack || lpParms->dwTrack > toc.LastTrack)
+ ret = MCIERR_OUTOFRANGE;
+ else
+ lpParms->dwReturn = (toc.TrackData[lpParms->dwTrack - toc.FirstTrack].Control & 0x04) ?
+ MCI_CDA_TRACK_OTHER : MCI_CDA_TRACK_AUDIO;
+ }
+ TRACE("MCI_CDA_STATUS_TYPE_TRACK[%ld]=%ld\n", lpParms->dwTrack, lpParms->dwReturn);
+ break;
+ default:
+ FIXME("unknown command %08lX !\n", lpParms->dwItem);
+ return MCIERR_UNRECOGNIZED_COMMAND;
+ }
+ } else {
+ WARN("not MCI_STATUS_ITEM !\n");
+ }
+ return ret;
+}
+
+/**************************************************************************
+ * MCICDA_SkipDataTracks [internal]
+ */
+static DWORD MCICDA_SkipDataTracks(WINE_MCICDAUDIO* wmcda,DWORD *frame)
+{
+ int i;
+ DWORD br;
+ CDROM_TOC toc;
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ &toc, sizeof(toc), &br, NULL)) {
+ WARN("error reading TOC !\n");
+ return MCICDA_GetError(wmcda);
+ }
+ /* Locate first track whose starting frame is bigger than frame */
+ for(i=toc.FirstTrack;i<=toc.LastTrack+1;i++)
+ if ( FRAME_OF_TOC(toc, i) > *frame ) break;
+ if (i <= toc.FirstTrack && i>toc.LastTrack+1) {
+ i = 0; /* requested address is out of range: go back to start */
+ *frame = FRAME_OF_TOC(toc,toc.FirstTrack);
+ }
+ else
+ i--;
+ /* i points to last track whose start address is not greater than frame.
+ * Now skip non-audio tracks */
+ for(;i<=toc.LastTrack+1;i++)
+ if ( ! (toc.TrackData[i-toc.FirstTrack].Control & 4) )
+ break;
+ /* The frame will be an address in the next audio track or
+ * address of lead-out. */
+ if ( FRAME_OF_TOC(toc, i) > *frame )
+ *frame = FRAME_OF_TOC(toc, i);
+ return 0;
+}
+
+/**************************************************************************
+ * MCICDA_Play [internal]
+ */
+static DWORD MCICDA_Play(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
+{
+ WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
+ DWORD ret = 0, start, end;
+ DWORD br;
+ CDROM_PLAY_AUDIO_MSF play;
+ CDROM_SUB_Q_DATA_FORMAT fmt;
+ SUB_Q_CHANNEL_DATA data;
+ CDROM_TOC toc;
+
+ TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+
+ if (lpParms == NULL)
+ return MCIERR_NULL_PARAMETER_BLOCK;
+
+ if (wmcda == NULL)
+ return MCIERR_INVALID_DEVICE_ID;
+
+ if (dwFlags & MCI_FROM) {
+ start = MCICDA_CalcFrame(wmcda, lpParms->dwFrom);
+ if ( (ret=MCICDA_SkipDataTracks(wmcda, &start)) )
+ return ret;
+ TRACE("MCI_FROM=%08lX -> %lu \n", lpParms->dwFrom, start);
+ } else {
+ fmt.Format = IOCTL_CDROM_CURRENT_POSITION;
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt, sizeof(fmt),
+ &data, sizeof(data), &br, NULL)) {
+ return MCICDA_GetError(wmcda);
+ }
+ start = FRAME_OF_ADDR(data.CurrentPosition.AbsoluteAddress);
+ if ( (ret=MCICDA_SkipDataTracks(wmcda, &start)) )
+ return ret;
+ }
+ if (dwFlags & MCI_TO) {
+ end = MCICDA_CalcFrame(wmcda, lpParms->dwTo);
+ TRACE("MCI_TO=%08lX -> %lu \n", lpParms->dwTo, end);
+ } else {
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ &toc, sizeof(toc), &br, NULL)) {
+ WARN("error reading TOC !\n");
+ return MCICDA_GetError(wmcda);
+ }
+ end = FRAME_OF_TOC(toc, toc.LastTrack + 1) - 1;
+ }
+ TRACE("Playing from %lu to %lu\n", start, end);
+ play.StartingM = start / CDFRAMES_PERMIN;
+ play.StartingS = (start / CDFRAMES_PERSEC) % 60;
+ play.StartingF = start % CDFRAMES_PERSEC;
+ 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),
+ NULL, 0, &br, NULL)) {
+ ret = MCIERR_HARDWARE;
+ } else if (dwFlags & MCI_NOTIFY) {
+ TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
+ /*
+ mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
+ wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
+ */
+ }
+ return ret;
+}
+
+/**************************************************************************
+ * MCICDA_Stop [internal]
+ */
+static DWORD MCICDA_Stop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
+{
+ WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
+ DWORD br;
+
+ TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+
+ if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
+
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_STOP_AUDIO, NULL, 0, NULL, 0, &br, NULL))
+ return MCIERR_HARDWARE;
+
+ if (lpParms && (dwFlags & MCI_NOTIFY)) {
+ TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
+ mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
+ wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
+ }
+ return 0;
+}
+
+/**************************************************************************
+ * MCICDA_Pause [internal]
+ */
+static DWORD MCICDA_Pause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
+{
+ WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
+ DWORD br;
+
+ TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+
+ if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
+
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_PAUSE_AUDIO, NULL, 0, NULL, 0, &br, NULL))
+ return MCIERR_HARDWARE;
+
+ if (lpParms && (dwFlags & MCI_NOTIFY)) {
+ TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
+ mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
+ wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
+ }
+ return 0;
+}
+
+/**************************************************************************
+ * MCICDA_Resume [internal]
+ */
+static DWORD MCICDA_Resume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
+{
+ WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
+ DWORD br;
+
+ TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+
+ if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
+
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_RESUME_AUDIO, NULL, 0, NULL, 0, &br, NULL))
+ return MCIERR_HARDWARE;
+
+ if (lpParms && (dwFlags & MCI_NOTIFY)) {
+ TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
+ mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
+ wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
+ }
+ return 0;
+}
+
+/**************************************************************************
+ * MCICDA_Seek [internal]
+ */
+static DWORD MCICDA_Seek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
+{
+ DWORD at;
+ WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
+ CDROM_SEEK_AUDIO_MSF seek;
+ DWORD br, ret;
+ CDROM_TOC toc;
+
+ TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+
+ if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
+ if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
+
+ if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
+ &toc, sizeof(toc), &br, NULL)) {
+ WARN("error reading TOC !\n");
+ return MCICDA_GetError(wmcda);
+ }
+ switch (dwFlags & ~(MCI_NOTIFY|MCI_WAIT)) {
+ case MCI_SEEK_TO_START:
+ TRACE("Seeking to start\n");
+ at = FRAME_OF_TOC(toc,toc.FirstTrack);
+ if ( (ret=MCICDA_SkipDataTracks(wmcda, &at)) )
+ return ret;
+ break;
+ case MCI_SEEK_TO_END:
+ TRACE("Seeking to end\n");
+ at = FRAME_OF_TOC(toc, toc.LastTrack + 1) - 1;
+ if ( (ret=MCICDA_SkipDataTracks(wmcda, &at)) )
+ return ret;
+ break;
+ case MCI_TO:
+ TRACE("Seeking to %lu\n", lpParms->dwTo);
+ at = MCICDA_CalcFrame(wmcda, lpParms->dwTo);
+ if ( (ret=MCICDA_SkipDataTracks(wmcda, &at)) )
+ return ret;
+ break;
+ default:
+ TRACE("Unknown seek action %08lX\n",
+ (dwFlags & ~(MCI_NOTIFY|MCI_WAIT)));
+ return MCIERR_UNSUPPORTED_FUNCTION;
+ }
+ 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),
+ NULL, 0, &br, NULL))
+ return MCIERR_HARDWARE;
+
+ if (dwFlags & MCI_NOTIFY) {
+ TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
+ mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
+ wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
+ }
+ return 0;
+}
+
+/**************************************************************************
+ * MCICDA_SetDoor [internal]
+ */
+static DWORD MCICDA_SetDoor(UINT wDevID, BOOL open)
+{
+ WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
+ DWORD br;
+
+ TRACE("(%04x, %s) !\n", wDevID, (open) ? "OPEN" : "CLOSE");
+
+ if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
+
+ if (!DeviceIoControl(wmcda->handle,
+ (open) ? IOCTL_STORAGE_EJECT_MEDIA : IOCTL_STORAGE_LOAD_MEDIA,
+ NULL, 0, NULL, 0, &br, NULL))
+ return MCIERR_HARDWARE;
+
+ return 0;
+}
+
+/**************************************************************************
+ * MCICDA_Set [internal]
+ */
+static DWORD MCICDA_Set(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
+{
+ WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
+
+ TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
+
+ if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
+
+ if (dwFlags & MCI_SET_DOOR_OPEN) {
+ MCICDA_SetDoor(wDevID, TRUE);
+ }
+ if (dwFlags & MCI_SET_DOOR_CLOSED) {
+ MCICDA_SetDoor(wDevID, FALSE);
+ }
+
+ /* only functions which require valid lpParms below this line ! */
+ if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
+ /*
+ TRACE("dwTimeFormat=%08lX\n", lpParms->dwTimeFormat);
+ TRACE("dwAudio=%08lX\n", lpParms->dwAudio);
+ */
+ if (dwFlags & MCI_SET_TIME_FORMAT) {
+ switch (lpParms->dwTimeFormat) {
+ case MCI_FORMAT_MILLISECONDS:
+ TRACE("MCI_FORMAT_MILLISECONDS !\n");
+ break;
+ case MCI_FORMAT_MSF:
+ TRACE("MCI_FORMAT_MSF !\n");
+ break;
+ case MCI_FORMAT_TMSF:
+ TRACE("MCI_FORMAT_TMSF !\n");
+ break;
+ default:
+ WARN("bad time format !\n");
+ return MCIERR_BAD_TIME_FORMAT;
+ }
+ wmcda->dwTimeFormat = lpParms->dwTimeFormat;
+ }
+ if (dwFlags & MCI_SET_VIDEO) return MCIERR_UNSUPPORTED_FUNCTION;
+ if (dwFlags & MCI_SET_ON) return MCIERR_UNSUPPORTED_FUNCTION;
+ if (dwFlags & MCI_SET_OFF) return MCIERR_UNSUPPORTED_FUNCTION;
+ if (dwFlags & MCI_NOTIFY) {
+ TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n",
+ lpParms->dwCallback);
+ mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
+ wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
+ }
+ return 0;
+}
+
+/**************************************************************************
+ * DriverProc (MCICDA.@)
+ */
+LONG CALLBACK MCICDA_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
+ DWORD dwParam1, DWORD dwParam2)
+{
+ switch(wMsg) {
+ case DRV_LOAD: return 1;
+ case DRV_FREE: return 1;
+ case DRV_OPEN: return MCICDA_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
+ case DRV_CLOSE: return MCICDA_drvClose(dwDevID);
+ case DRV_ENABLE: return 1;
+ case DRV_DISABLE: return 1;
+ case DRV_QUERYCONFIGURE: return 1;
+ case DRV_CONFIGURE: MessageBoxA(0, "MCI audio CD driver !", "Wine Driver", MB_OK); return 1;
+ case DRV_INSTALL: return DRVCNF_RESTART;
+ case DRV_REMOVE: return DRVCNF_RESTART;
+ }
+
+ if (dwDevID == 0xFFFFFFFF) return MCIERR_UNSUPPORTED_FUNCTION;
+
+ switch (wMsg) {
+ case MCI_OPEN_DRIVER: return MCICDA_Open(dwDevID, dwParam1, (LPMCI_OPEN_PARMSW)dwParam2);
+ case MCI_CLOSE_DRIVER: return MCICDA_Close(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
+ case MCI_GETDEVCAPS: return MCICDA_GetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2);
+ case MCI_INFO: return MCICDA_Info(dwDevID, dwParam1, (LPMCI_INFO_PARMSW)dwParam2);
+ case MCI_STATUS: return MCICDA_Status(dwDevID, dwParam1, (LPMCI_STATUS_PARMS)dwParam2);
+ case MCI_SET: return MCICDA_Set(dwDevID, dwParam1, (LPMCI_SET_PARMS)dwParam2);
+ case MCI_PLAY: return MCICDA_Play(dwDevID, dwParam1, (LPMCI_PLAY_PARMS)dwParam2);
+ case MCI_STOP: return MCICDA_Stop(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
+ case MCI_PAUSE: return MCICDA_Pause(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
+ case MCI_RESUME: return MCICDA_Resume(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
+ case MCI_SEEK: return MCICDA_Seek(dwDevID, dwParam1, (LPMCI_SEEK_PARMS)dwParam2);
+ /* commands that should report an error as they are not supported in
+ * the native version */
+ case MCI_SET_DOOR_CLOSED:
+ case MCI_SET_DOOR_OPEN:
+ case MCI_LOAD:
+ case MCI_SAVE:
+ case MCI_FREEZE:
+ case MCI_PUT:
+ case MCI_REALIZE:
+ case MCI_UNFREEZE:
+ case MCI_UPDATE:
+ case MCI_WHERE:
+ case MCI_STEP:
+ case MCI_SPIN:
+ case MCI_ESCAPE:
+ case MCI_COPY:
+ case MCI_CUT:
+ case MCI_DELETE:
+ case MCI_PASTE:
+ case MCI_WINDOW:
+ TRACE("Unsupported command [0x%lx]\n", wMsg);
+ break;
+ case MCI_OPEN:
+ case MCI_CLOSE:
+ ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
+ break;
+ default:
+ TRACE("Sending msg [0x%lx] to default driver proc\n", wMsg);
+ return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
+ }
+ return MCIERR_UNRECOGNIZED_COMMAND;
+}
+
+/*-----------------------------------------------------------------------*/
diff -Nru wine/dlls/mcicda/mcicda.spec winedev/dlls/mcicda/mcicda.spec
--- wine/dlls/mcicda/mcicda.spec 1970-01-01 01:00:00.000000000 +0100
+++ winedev/dlls/mcicda/mcicda.spec 2002-06-21 21:15:50.000000000 +0200
@@ -0,0 +1 @@
+@ stdcall DriverProc(long long long long long) MCICDA_DriverProc
diff -Nru wine/dlls/winmm/mcicda/.cvsignore winedev/dlls/winmm/mcicda/.cvsignore
--- wine/dlls/winmm/mcicda/.cvsignore 2004-03-24 04:36:45.000000000 +0100
+++ winedev/dlls/winmm/mcicda/.cvsignore 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-Makefile
-mcicda.drv.dbg.c
diff -Nru wine/dlls/winmm/mcicda/Makefile.in winedev/dlls/winmm/mcicda/Makefile.in
--- wine/dlls/winmm/mcicda/Makefile.in 2005-02-09 23:26:26.000000000 +0100
+++ winedev/dlls/winmm/mcicda/Makefile.in 1970-01-01 01:00:00.000000000 +0100
@@ -1,14 +0,0 @@
-TOPSRCDIR = @top_srcdir@
-TOPOBJDIR = ../../..
-SRCDIR = @srcdir@
-VPATH = @srcdir@
-MODULE = mcicda.drv
-IMPORTS = winmm user32 kernel32
-EXTRALIBS = $(LIBUNICODE)
-
-C_SRCS = \
- mcicda.c
-
-@MAKE_DLL_RULES@
-
-### Dependencies:
diff -Nru wine/dlls/winmm/mcicda/mcicda.c winedev/dlls/winmm/mcicda/mcicda.c
--- wine/dlls/winmm/mcicda/mcicda.c 2005-02-09 23:26:26.000000000 +0100
+++ winedev/dlls/winmm/mcicda/mcicda.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,1053 +0,0 @@
-/* -*- tab-width: 8; c-basic-offset: 4 -*- */
-/*
- * MCI driver for audio CD (MCICDA)
- *
- * Copyright 1994 Martin Ayotte
- * Copyright 1998-99 Eric Pouech
- * Copyright 2000 Andreas Mohr
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "config.h"
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-#include "ntstatus.h"
-#include "wownt32.h"
-#include "mmddk.h"
-#include "winioctl.h"
-#include "ntddstor.h"
-#include "ntddcdrm.h"
-#include "wine/debug.h"
-#include "wine/unicode.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(mcicda);
-
-#define CDFRAMES_PERSEC 75
-#define CDFRAMES_PERMIN (CDFRAMES_PERSEC * 60)
-#define FRAME_OF_ADDR(a) ((a)[1] * CDFRAMES_PERMIN + (a)[2] * CDFRAMES_PERSEC + (a)[3])
-#define FRAME_OF_TOC(toc, idx) FRAME_OF_ADDR((toc).TrackData[idx - (toc).FirstTrack].Address)
-
-typedef struct {
- UINT wDevID;
- int nUseCount; /* Incremented for each shared open */
- BOOL fShareable; /* TRUE if first open was shareable */
- WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
- HANDLE hCallback; /* Callback handle for pending notification */
- DWORD dwTimeFormat;
- HANDLE handle;
-} WINE_MCICDAUDIO;
-
-/*-----------------------------------------------------------------------*/
-
-/**************************************************************************
- * MCICDA_drvOpen [internal]
- */
-static DWORD MCICDA_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
-{
- WINE_MCICDAUDIO* wmcda;
-
- if (!modp) return 0xFFFFFFFF;
-
- wmcda = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCICDAUDIO));
-
- if (!wmcda)
- return 0;
-
- wmcda->wDevID = modp->wDeviceID;
- mciSetDriverData(wmcda->wDevID, (DWORD)wmcda);
- modp->wCustomCommandTable = MCI_NO_COMMAND_TABLE;
- modp->wType = MCI_DEVTYPE_CD_AUDIO;
- return modp->wDeviceID;
-}
-
-/**************************************************************************
- * MCICDA_drvClose [internal]
- */
-static DWORD MCICDA_drvClose(DWORD dwDevID)
-{
- WINE_MCICDAUDIO* wmcda = (WINE_MCICDAUDIO*)mciGetDriverData(dwDevID);
-
- if (wmcda) {
- HeapFree(GetProcessHeap(), 0, wmcda);
- mciSetDriverData(dwDevID, 0);
- }
- return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
-}
-
-/**************************************************************************
- * MCICDA_GetOpenDrv [internal]
- */
-static WINE_MCICDAUDIO* MCICDA_GetOpenDrv(UINT wDevID)
-{
- WINE_MCICDAUDIO* wmcda = (WINE_MCICDAUDIO*)mciGetDriverData(wDevID);
-
- if (wmcda == NULL || wmcda->nUseCount == 0) {
- WARN("Invalid wDevID=%u\n", wDevID);
- return 0;
- }
- return wmcda;
-}
-
-/**************************************************************************
- * MCICDA_GetStatus [internal]
- */
-static DWORD MCICDA_GetStatus(WINE_MCICDAUDIO* wmcda)
-{
- CDROM_SUB_Q_DATA_FORMAT fmt;
- SUB_Q_CHANNEL_DATA data;
- DWORD br;
- DWORD mode = MCI_MODE_NOT_READY;
-
- fmt.Format = IOCTL_CDROM_CURRENT_POSITION;
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt, sizeof(fmt),
- &data, sizeof(data), &br, NULL)) {
- if (GetLastError() == STATUS_NO_MEDIA_IN_DEVICE) mode = MCI_MODE_OPEN;
- } else {
- switch (data.CurrentPosition.Header.AudioStatus)
- {
- case AUDIO_STATUS_IN_PROGRESS: mode = MCI_MODE_PLAY; break;
- case AUDIO_STATUS_PAUSED: mode = MCI_MODE_PAUSE; break;
- case AUDIO_STATUS_NO_STATUS:
- case AUDIO_STATUS_PLAY_COMPLETE: mode = MCI_MODE_STOP; break;
- case AUDIO_STATUS_PLAY_ERROR:
- case AUDIO_STATUS_NOT_SUPPORTED:
- default:
- break;
- }
- }
- return mode;
-}
-
-/**************************************************************************
- * MCICDA_GetError [internal]
- */
-static int MCICDA_GetError(WINE_MCICDAUDIO* wmcda)
-{
- switch (GetLastError())
- {
- case STATUS_NO_MEDIA_IN_DEVICE: return MCIERR_DEVICE_NOT_READY;
- case STATUS_IO_DEVICE_ERROR: return MCIERR_HARDWARE;
- default:
- FIXME("Unknown mode %lx\n", GetLastError());
- }
- return MCIERR_DRIVER_INTERNAL;
-}
-
-/**************************************************************************
- * MCICDA_CalcFrame [internal]
- */
-static DWORD MCICDA_CalcFrame(WINE_MCICDAUDIO* wmcda, DWORD dwTime)
-{
- DWORD dwFrame = 0;
- UINT wTrack;
- CDROM_TOC toc;
- DWORD br;
- BYTE* addr;
-
- TRACE("(%p, %08lX, %lu);\n", wmcda, wmcda->dwTimeFormat, dwTime);
-
- switch (wmcda->dwTimeFormat) {
- case MCI_FORMAT_MILLISECONDS:
- dwFrame = ((dwTime - 1) * CDFRAMES_PERSEC + 500) / 1000;
- TRACE("MILLISECONDS %lu\n", dwFrame);
- break;
- case MCI_FORMAT_MSF:
- TRACE("MSF %02u:%02u:%02u\n",
- MCI_MSF_MINUTE(dwTime), MCI_MSF_SECOND(dwTime), MCI_MSF_FRAME(dwTime));
- dwFrame += CDFRAMES_PERMIN * MCI_MSF_MINUTE(dwTime);
- dwFrame += CDFRAMES_PERSEC * MCI_MSF_SECOND(dwTime);
- dwFrame += MCI_MSF_FRAME(dwTime);
- break;
- case MCI_FORMAT_TMSF:
- default: /* unknown format ! force TMSF ! ... */
- wTrack = MCI_TMSF_TRACK(dwTime);
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
- &toc, sizeof(toc), &br, NULL))
- return 0;
- if (wTrack < toc.FirstTrack || wTrack > toc.LastTrack)
- return 0;
- TRACE("MSF %02u-%02u:%02u:%02u\n",
- MCI_TMSF_TRACK(dwTime), MCI_TMSF_MINUTE(dwTime),
- MCI_TMSF_SECOND(dwTime), MCI_TMSF_FRAME(dwTime));
- addr = toc.TrackData[wTrack - toc.FirstTrack].Address;
- TRACE("TMSF trackpos[%u]=%d:%d:%d\n",
- wTrack, addr[1], addr[2], addr[3]);
- dwFrame = CDFRAMES_PERMIN * (addr[1] + MCI_TMSF_MINUTE(dwTime)) +
- CDFRAMES_PERSEC * (addr[2] + MCI_TMSF_SECOND(dwTime)) +
- addr[3] + MCI_TMSF_FRAME(dwTime);
- break;
- }
- return dwFrame;
-}
-
-/**************************************************************************
- * MCICDA_CalcTime [internal]
- */
-static DWORD MCICDA_CalcTime(WINE_MCICDAUDIO* wmcda, DWORD tf, DWORD dwFrame, LPDWORD lpRet)
-{
- DWORD dwTime = 0;
- UINT wTrack;
- UINT wMinutes;
- UINT wSeconds;
- UINT wFrames;
- CDROM_TOC toc;
- DWORD br;
-
- TRACE("(%p, %08lX, %lu);\n", wmcda, tf, dwFrame);
-
- switch (tf) {
- case MCI_FORMAT_MILLISECONDS:
- dwTime = (dwFrame * 1000) / CDFRAMES_PERSEC + 1;
- TRACE("MILLISECONDS %lu\n", dwTime);
- *lpRet = 0;
- break;
- case MCI_FORMAT_MSF:
- wMinutes = dwFrame / CDFRAMES_PERMIN;
- wSeconds = (dwFrame - CDFRAMES_PERMIN * wMinutes) / CDFRAMES_PERSEC;
- wFrames = dwFrame - CDFRAMES_PERMIN * wMinutes - CDFRAMES_PERSEC * wSeconds;
- dwTime = MCI_MAKE_MSF(wMinutes, wSeconds, wFrames);
- TRACE("MSF %02u:%02u:%02u -> dwTime=%lu\n",
- wMinutes, wSeconds, wFrames, dwTime);
- *lpRet = MCI_COLONIZED3_RETURN;
- break;
- case MCI_FORMAT_TMSF:
- default: /* unknown format ! force TMSF ! ... */
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
- &toc, sizeof(toc), &br, NULL))
- return 0;
- if (dwFrame < FRAME_OF_TOC(toc, toc.FirstTrack) ||
- dwFrame > FRAME_OF_TOC(toc, toc.LastTrack + 1)) {
- ERR("Out of range value %lu [%u,%u]\n",
- dwFrame, FRAME_OF_TOC(toc, toc.FirstTrack),
- FRAME_OF_TOC(toc, toc.LastTrack + 1));
- *lpRet = 0;
- return 0;
- }
- for (wTrack = toc.FirstTrack; wTrack <= toc.LastTrack; wTrack++) {
- if (FRAME_OF_TOC(toc, wTrack) > dwFrame)
- break;
- }
- wTrack--;
- dwFrame -= FRAME_OF_TOC(toc, wTrack);
- wMinutes = dwFrame / CDFRAMES_PERMIN;
- wSeconds = (dwFrame - CDFRAMES_PERMIN * wMinutes) / CDFRAMES_PERSEC;
- wFrames = dwFrame - CDFRAMES_PERMIN * wMinutes - CDFRAMES_PERSEC * wSeconds;
- dwTime = MCI_MAKE_TMSF(wTrack, wMinutes, wSeconds, wFrames);
- TRACE("%02u-%02u:%02u:%02u\n", wTrack, wMinutes, wSeconds, wFrames);
- *lpRet = MCI_COLONIZED4_RETURN;
- break;
- }
- return dwTime;
-}
-
-static DWORD MCICDA_Seek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms);
-static DWORD MCICDA_Stop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms);
-
-/**************************************************************************
- * MCICDA_Open [internal]
- */
-static DWORD MCICDA_Open(UINT wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSW lpOpenParms)
-{
- DWORD dwDeviceID;
- DWORD ret = MCIERR_HARDWARE;
- WINE_MCICDAUDIO* wmcda = (WINE_MCICDAUDIO*)mciGetDriverData(wDevID);
- WCHAR root[7], drive = 0;
- int count;
-
- TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpOpenParms);
-
- if (lpOpenParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
- if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
-
- dwDeviceID = lpOpenParms->wDeviceID;
-
- if (wmcda->nUseCount > 0) {
- /* The driver is already open on this channel */
- /* If the driver was opened shareable before and this open specifies */
- /* shareable then increment the use count */
- if (wmcda->fShareable && (dwFlags & MCI_OPEN_SHAREABLE))
- ++wmcda->nUseCount;
- else
- return MCIERR_MUST_USE_SHAREABLE;
- } else {
- wmcda->nUseCount = 1;
- wmcda->fShareable = dwFlags & MCI_OPEN_SHAREABLE;
- }
- if (dwFlags & MCI_OPEN_ELEMENT) {
- if (dwFlags & MCI_OPEN_ELEMENT_ID) {
- WARN("MCI_OPEN_ELEMENT_ID %8lx ! Abort\n", (DWORD)lpOpenParms->lpstrElementName);
- return MCIERR_NO_ELEMENT_ALLOWED;
- }
- TRACE("MCI_OPEN_ELEMENT element name: %s\n", debugstr_w(lpOpenParms->lpstrElementName));
- if (!isalpha(lpOpenParms->lpstrElementName[0]) || lpOpenParms->lpstrElementName[1] != ':' ||
- (lpOpenParms->lpstrElementName[2] && lpOpenParms->lpstrElementName[2] != '\\'))
- {
- WARN("MCI_OPEN_ELEMENT unsupported format: %s\n",
- debugstr_w(lpOpenParms->lpstrElementName));
- ret = MCIERR_NO_ELEMENT_ALLOWED;
- goto the_error;
- }
- drive = toupper(lpOpenParms->lpstrElementName[0]);
- root[0] = drive; root[1] = ':'; root[2] = '\\'; root[3] = '\0';
- if (GetDriveTypeW(root) != DRIVE_CDROM)
- {
- ret = MCIERR_INVALID_DEVICE_NAME;
- goto the_error;
- }
- }
- else
- {
- /* drive letter isn't passed... get the dwDeviceID'th cdrom in the system */
- root[0] = 'A'; root[1] = ':'; root[2] = '\\'; root[3] = '\0';
- for (count = 0; root[0] <= 'Z'; root[0]++)
- {
- if (GetDriveTypeW(root) == DRIVE_CDROM && ++count >= dwDeviceID)
- {
- drive = root[0];
- break;
- }
- }
- if (!drive)
- {
- ret = MCIERR_INVALID_DEVICE_ID;
- goto the_error;
- }
- }
-
- wmcda->wNotifyDeviceID = dwDeviceID;
- wmcda->dwTimeFormat = MCI_FORMAT_MSF;
-
- /* now, open the handle */
- root[0] = root[1] = '\\'; root[2] = '.'; root[3] = '\\'; root[4] = drive; root[5] = ':'; root[6] = '\0';
- wmcda->handle = CreateFileW(root, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
- if (wmcda->handle != INVALID_HANDLE_VALUE)
- return 0;
-
- the_error:
- --wmcda->nUseCount;
- return ret;
-}
-
-/**************************************************************************
- * MCICDA_Close [internal]
- */
-static DWORD MCICDA_Close(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
-{
- WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
-
- TRACE("(%04X, %08lX, %p);\n", wDevID, dwParam, lpParms);
-
- if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
-
- if (--wmcda->nUseCount == 0) {
- CloseHandle(wmcda->handle);
- }
- return 0;
-}
-
-/**************************************************************************
- * MCICDA_GetDevCaps [internal]
- */
-static DWORD MCICDA_GetDevCaps(UINT wDevID, DWORD dwFlags,
- LPMCI_GETDEVCAPS_PARMS lpParms)
-{
- DWORD ret = 0;
-
- TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
-
- if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
-
- if (dwFlags & MCI_GETDEVCAPS_ITEM) {
- TRACE("MCI_GETDEVCAPS_ITEM dwItem=%08lX;\n", lpParms->dwItem);
-
- switch (lpParms->dwItem) {
- case MCI_GETDEVCAPS_CAN_RECORD:
- lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
- ret = MCI_RESOURCE_RETURNED;
- break;
- case MCI_GETDEVCAPS_HAS_AUDIO:
- lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
- ret = MCI_RESOURCE_RETURNED;
- break;
- case MCI_GETDEVCAPS_HAS_VIDEO:
- lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
- ret = MCI_RESOURCE_RETURNED;
- break;
- case MCI_GETDEVCAPS_DEVICE_TYPE:
- lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_CD_AUDIO, MCI_DEVTYPE_CD_AUDIO);
- ret = MCI_RESOURCE_RETURNED;
- break;
- case MCI_GETDEVCAPS_USES_FILES:
- lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
- ret = MCI_RESOURCE_RETURNED;
- break;
- case MCI_GETDEVCAPS_COMPOUND_DEVICE:
- lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
- ret = MCI_RESOURCE_RETURNED;
- break;
- case MCI_GETDEVCAPS_CAN_EJECT:
- lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
- ret = MCI_RESOURCE_RETURNED;
- break;
- case MCI_GETDEVCAPS_CAN_PLAY:
- lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
- ret = MCI_RESOURCE_RETURNED;
- break;
- case MCI_GETDEVCAPS_CAN_SAVE:
- lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
- ret = MCI_RESOURCE_RETURNED;
- break;
- default:
- ERR("Unsupported %lx devCaps item\n", lpParms->dwItem);
- return MCIERR_UNRECOGNIZED_COMMAND;
- }
- } else {
- TRACE("No GetDevCaps-Item !\n");
- return MCIERR_UNRECOGNIZED_COMMAND;
- }
- TRACE("lpParms->dwReturn=%08lX;\n", lpParms->dwReturn);
- return ret;
-}
-
-static DWORD CDROM_Audio_GetSerial(CDROM_TOC* toc)
-{
- unsigned long serial = 0;
- int i;
- WORD wMagic;
- DWORD dwStart, dwEnd;
-
- /*
- * wMagic collects the wFrames from track 1
- * dwStart, dwEnd collect the beginning and end of the disc respectively, in
- * frames.
- * There it is collected for correcting the serial when there are less than
- * 3 tracks.
- */
- wMagic = toc->TrackData[0].Address[3];
- dwStart = FRAME_OF_TOC(*toc, toc->FirstTrack);
-
- for (i = 0; i <= toc->LastTrack - toc->FirstTrack; i++) {
- serial += (toc->TrackData[i].Address[1] << 16) |
- (toc->TrackData[i].Address[2] << 8) | toc->TrackData[i].Address[3];
- }
- dwEnd = FRAME_OF_TOC(*toc, toc->LastTrack + 1);
-
- if (toc->LastTrack - toc->FirstTrack + 1 < 3)
- serial += wMagic + (dwEnd - dwStart);
-
- return serial;
-}
-
-
-/**************************************************************************
- * MCICDA_Info [internal]
- */
-static DWORD MCICDA_Info(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSW lpParms)
-{
- LPCWSTR str = NULL;
- WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
- DWORD ret = 0;
- WCHAR buffer[16];
-
- TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
-
- if (lpParms == NULL || lpParms->lpstrReturn == NULL)
- return MCIERR_NULL_PARAMETER_BLOCK;
- if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
-
- TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
-
- if (dwFlags & MCI_INFO_PRODUCT) {
- static const WCHAR wszAudioCd[] = {'W','i','n','e','\'','s',' ','a','u','d','i','o',' ','C','D',0};
- str = wszAudioCd;
- } else if (dwFlags & MCI_INFO_MEDIA_UPC) {
- ret = MCIERR_NO_IDENTITY;
- } else if (dwFlags & MCI_INFO_MEDIA_IDENTITY) {
- DWORD res = 0;
- CDROM_TOC toc;
- DWORD br;
- static const WCHAR wszLu[] = {'%','l','u',0};
-
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
- &toc, sizeof(toc), &br, NULL)) {
- return MCICDA_GetError(wmcda);
- }
-
- res = CDROM_Audio_GetSerial(&toc);
- sprintfW(buffer, wszLu, res);
- str = buffer;
- } else {
- WARN("Don't know this info command (%lu)\n", dwFlags);
- ret = MCIERR_UNRECOGNIZED_COMMAND;
- }
- if (str) {
- if (lpParms->dwRetSize <= strlenW(str)) {
- lstrcpynW(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
- ret = MCIERR_PARAM_OVERFLOW;
- } else {
- strcpyW(lpParms->lpstrReturn, str);
- }
- } else {
- *lpParms->lpstrReturn = 0;
- }
- TRACE("=> %s (%ld)\n", debugstr_w(lpParms->lpstrReturn), ret);
- return ret;
-}
-
-/**************************************************************************
- * MCICDA_Status [internal]
- */
-static DWORD MCICDA_Status(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
-{
- WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
- DWORD idx;
- DWORD ret = 0;
- CDROM_SUB_Q_DATA_FORMAT fmt;
- SUB_Q_CHANNEL_DATA data;
- CDROM_TOC toc;
- DWORD br;
-
- TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
-
- if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
- if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
-
- if (dwFlags & MCI_NOTIFY) {
- TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
- mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
- wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
- }
- if (dwFlags & MCI_STATUS_ITEM) {
- TRACE("dwItem = %lx\n", lpParms->dwItem);
- 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),
- &data, sizeof(data), &br, NULL))
- {
- return MCICDA_GetError(wmcda);
- }
- lpParms->dwReturn = data.CurrentPosition.TrackNumber;
- TRACE("CURRENT_TRACK=%lu!\n", lpParms->dwReturn);
- break;
- case MCI_STATUS_LENGTH:
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
- &toc, sizeof(toc), &br, NULL)) {
- WARN("error reading TOC !\n");
- return MCICDA_GetError(wmcda);
- }
- if (dwFlags & MCI_TRACK) {
- TRACE("MCI_TRACK #%lu LENGTH=??? !\n", lpParms->dwTrack);
- if (lpParms->dwTrack < toc.FirstTrack || lpParms->dwTrack > toc.LastTrack)
- return MCIERR_OUTOFRANGE;
- idx = lpParms->dwTrack - toc.FirstTrack;
- lpParms->dwReturn = FRAME_OF_TOC(toc, lpParms->dwTrack + 1) -
- FRAME_OF_TOC(toc, lpParms->dwTrack);
- /* Windows returns one frame less than the total track length for the
- last track on the CD. See CDDB HOWTO. Verified on Win95OSR2. */
- if (lpParms->dwTrack == toc.LastTrack)
- lpParms->dwReturn--;
- } else {
- /* Sum of the lengths of all of the tracks. Inherits the
- 'off by one frame' behavior from the length of the last track.
- See above comment. */
- lpParms->dwReturn = FRAME_OF_TOC(toc, toc.LastTrack + 1) -
- FRAME_OF_TOC(toc, toc.FirstTrack) - 1;
- }
- lpParms->dwReturn = MCICDA_CalcTime(wmcda,
- (wmcda->dwTimeFormat == MCI_FORMAT_TMSF)
- ? MCI_FORMAT_MSF : wmcda->dwTimeFormat,
- lpParms->dwReturn,
- &ret);
- TRACE("LENGTH=%lu !\n", lpParms->dwReturn);
- break;
- case MCI_STATUS_MODE:
- lpParms->dwReturn = MCICDA_GetStatus(wmcda);
- TRACE("MCI_STATUS_MODE=%08lX !\n", lpParms->dwReturn);
- lpParms->dwReturn = MAKEMCIRESOURCE(lpParms->dwReturn, lpParms->dwReturn);
- ret = MCI_RESOURCE_RETURNED;
- break;
- case MCI_STATUS_MEDIA_PRESENT:
- lpParms->dwReturn = (MCICDA_GetStatus(wmcda) == MCI_MODE_OPEN) ?
- MAKEMCIRESOURCE(FALSE, MCI_FALSE) : MAKEMCIRESOURCE(TRUE, MCI_TRUE);
- TRACE("MCI_STATUS_MEDIA_PRESENT =%c!\n", LOWORD(lpParms->dwReturn) ? 'Y' : 'N');
- ret = MCI_RESOURCE_RETURNED;
- break;
- case MCI_STATUS_NUMBER_OF_TRACKS:
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
- &toc, sizeof(toc), &br, NULL)) {
- WARN("error reading TOC !\n");
- return MCICDA_GetError(wmcda);
- }
- lpParms->dwReturn = toc.LastTrack - toc.FirstTrack + 1;
- TRACE("MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n", lpParms->dwReturn);
- if (lpParms->dwReturn == (WORD)-1)
- return MCICDA_GetError(wmcda);
- break;
- case MCI_STATUS_POSITION:
- if (dwFlags & MCI_STATUS_START) {
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
- &toc, sizeof(toc), &br, NULL)) {
- WARN("error reading TOC !\n");
- return MCICDA_GetError(wmcda);
- }
- lpParms->dwReturn = FRAME_OF_TOC(toc, toc.FirstTrack);
- TRACE("get MCI_STATUS_START !\n");
- } else if (dwFlags & MCI_TRACK) {
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
- &toc, sizeof(toc), &br, NULL)) {
- WARN("error reading TOC !\n");
- return MCICDA_GetError(wmcda);
- }
- if (lpParms->dwTrack < toc.FirstTrack || lpParms->dwTrack > toc.LastTrack)
- return MCIERR_OUTOFRANGE;
- lpParms->dwReturn = FRAME_OF_TOC(toc, lpParms->dwTrack);
- TRACE("get MCI_TRACK #%lu !\n", lpParms->dwTrack);
- } else {
- fmt.Format = IOCTL_CDROM_CURRENT_POSITION;
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt, sizeof(fmt),
- &data, sizeof(data), &br, NULL)) {
- return MCICDA_GetError(wmcda);
- }
- lpParms->dwReturn = FRAME_OF_ADDR(data.CurrentPosition.AbsoluteAddress);
- }
- lpParms->dwReturn = MCICDA_CalcTime(wmcda, wmcda->dwTimeFormat, lpParms->dwReturn, &ret);
- TRACE("MCI_STATUS_POSITION=%08lX !\n", lpParms->dwReturn);
- break;
- case MCI_STATUS_READY:
- TRACE("MCI_STATUS_READY !\n");
- switch (MCICDA_GetStatus(wmcda))
- {
- case MCI_MODE_NOT_READY:
- case MCI_MODE_OPEN:
- lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
- break;
- default:
- lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
- break;
- }
- TRACE("MCI_STATUS_READY=%u!\n", LOWORD(lpParms->dwReturn));
- ret = MCI_RESOURCE_RETURNED;
- break;
- case MCI_STATUS_TIME_FORMAT:
- lpParms->dwReturn = MAKEMCIRESOURCE(wmcda->dwTimeFormat, MCI_FORMAT_RETURN_BASE + wmcda->dwTimeFormat);
- TRACE("MCI_STATUS_TIME_FORMAT=%08x!\n", LOWORD(lpParms->dwReturn));
- ret = MCI_RESOURCE_RETURNED;
- break;
- case 4001: /* FIXME: for bogus FullCD */
- case MCI_CDA_STATUS_TYPE_TRACK:
- if (!(dwFlags & MCI_TRACK))
- ret = MCIERR_MISSING_PARAMETER;
- else {
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
- &toc, sizeof(toc), &br, NULL)) {
- WARN("error reading TOC !\n");
- return MCICDA_GetError(wmcda);
- }
- if (lpParms->dwTrack < toc.FirstTrack || lpParms->dwTrack > toc.LastTrack)
- ret = MCIERR_OUTOFRANGE;
- else
- lpParms->dwReturn = (toc.TrackData[lpParms->dwTrack - toc.FirstTrack].Control & 0x04) ?
- MCI_CDA_TRACK_OTHER : MCI_CDA_TRACK_AUDIO;
- }
- TRACE("MCI_CDA_STATUS_TYPE_TRACK[%ld]=%ld\n", lpParms->dwTrack, lpParms->dwReturn);
- break;
- default:
- FIXME("unknown command %08lX !\n", lpParms->dwItem);
- return MCIERR_UNRECOGNIZED_COMMAND;
- }
- } else {
- WARN("not MCI_STATUS_ITEM !\n");
- }
- return ret;
-}
-
-/**************************************************************************
- * MCICDA_SkipDataTracks [internal]
- */
-static DWORD MCICDA_SkipDataTracks(WINE_MCICDAUDIO* wmcda,DWORD *frame)
-{
- int i;
- DWORD br;
- CDROM_TOC toc;
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
- &toc, sizeof(toc), &br, NULL)) {
- WARN("error reading TOC !\n");
- return MCICDA_GetError(wmcda);
- }
- /* Locate first track whose starting frame is bigger than frame */
- for(i=toc.FirstTrack;i<=toc.LastTrack+1;i++)
- if ( FRAME_OF_TOC(toc, i) > *frame ) break;
- if (i <= toc.FirstTrack && i>toc.LastTrack+1) {
- i = 0; /* requested address is out of range: go back to start */
- *frame = FRAME_OF_TOC(toc,toc.FirstTrack);
- }
- else
- i--;
- /* i points to last track whose start address is not greater than frame.
- * Now skip non-audio tracks */
- for(;i<=toc.LastTrack+1;i++)
- if ( ! (toc.TrackData[i-toc.FirstTrack].Control & 4) )
- break;
- /* The frame will be an address in the next audio track or
- * address of lead-out. */
- if ( FRAME_OF_TOC(toc, i) > *frame )
- *frame = FRAME_OF_TOC(toc, i);
- return 0;
-}
-
-/**************************************************************************
- * MCICDA_Play [internal]
- */
-static DWORD MCICDA_Play(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
-{
- WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
- DWORD ret = 0, start, end;
- DWORD br;
- CDROM_PLAY_AUDIO_MSF play;
- CDROM_SUB_Q_DATA_FORMAT fmt;
- SUB_Q_CHANNEL_DATA data;
- CDROM_TOC toc;
-
- TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
-
- if (lpParms == NULL)
- return MCIERR_NULL_PARAMETER_BLOCK;
-
- if (wmcda == NULL)
- return MCIERR_INVALID_DEVICE_ID;
-
- if (dwFlags & MCI_FROM) {
- start = MCICDA_CalcFrame(wmcda, lpParms->dwFrom);
- if ( (ret=MCICDA_SkipDataTracks(wmcda, &start)) )
- return ret;
- TRACE("MCI_FROM=%08lX -> %lu \n", lpParms->dwFrom, start);
- } else {
- fmt.Format = IOCTL_CDROM_CURRENT_POSITION;
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_Q_CHANNEL, &fmt, sizeof(fmt),
- &data, sizeof(data), &br, NULL)) {
- return MCICDA_GetError(wmcda);
- }
- start = FRAME_OF_ADDR(data.CurrentPosition.AbsoluteAddress);
- if ( (ret=MCICDA_SkipDataTracks(wmcda, &start)) )
- return ret;
- }
- if (dwFlags & MCI_TO) {
- end = MCICDA_CalcFrame(wmcda, lpParms->dwTo);
- TRACE("MCI_TO=%08lX -> %lu \n", lpParms->dwTo, end);
- } else {
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
- &toc, sizeof(toc), &br, NULL)) {
- WARN("error reading TOC !\n");
- return MCICDA_GetError(wmcda);
- }
- end = FRAME_OF_TOC(toc, toc.LastTrack + 1) - 1;
- }
- TRACE("Playing from %lu to %lu\n", start, end);
- play.StartingM = start / CDFRAMES_PERMIN;
- play.StartingS = (start / CDFRAMES_PERSEC) % 60;
- play.StartingF = start % CDFRAMES_PERSEC;
- 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),
- NULL, 0, &br, NULL)) {
- ret = MCIERR_HARDWARE;
- } else if (dwFlags & MCI_NOTIFY) {
- TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
- /*
- mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
- wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
- */
- }
- return ret;
-}
-
-/**************************************************************************
- * MCICDA_Stop [internal]
- */
-static DWORD MCICDA_Stop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
-{
- WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
- DWORD br;
-
- TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
-
- if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
-
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_STOP_AUDIO, NULL, 0, NULL, 0, &br, NULL))
- return MCIERR_HARDWARE;
-
- if (lpParms && (dwFlags & MCI_NOTIFY)) {
- TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
- mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
- wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
- }
- return 0;
-}
-
-/**************************************************************************
- * MCICDA_Pause [internal]
- */
-static DWORD MCICDA_Pause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
-{
- WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
- DWORD br;
-
- TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
-
- if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
-
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_PAUSE_AUDIO, NULL, 0, NULL, 0, &br, NULL))
- return MCIERR_HARDWARE;
-
- if (lpParms && (dwFlags & MCI_NOTIFY)) {
- TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
- mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
- wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
- }
- return 0;
-}
-
-/**************************************************************************
- * MCICDA_Resume [internal]
- */
-static DWORD MCICDA_Resume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
-{
- WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
- DWORD br;
-
- TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
-
- if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
-
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_RESUME_AUDIO, NULL, 0, NULL, 0, &br, NULL))
- return MCIERR_HARDWARE;
-
- if (lpParms && (dwFlags & MCI_NOTIFY)) {
- TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
- mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
- wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
- }
- return 0;
-}
-
-/**************************************************************************
- * MCICDA_Seek [internal]
- */
-static DWORD MCICDA_Seek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
-{
- DWORD at;
- WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
- CDROM_SEEK_AUDIO_MSF seek;
- DWORD br, ret;
- CDROM_TOC toc;
-
- TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
-
- if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
- if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
-
- if (!DeviceIoControl(wmcda->handle, IOCTL_CDROM_READ_TOC, NULL, 0,
- &toc, sizeof(toc), &br, NULL)) {
- WARN("error reading TOC !\n");
- return MCICDA_GetError(wmcda);
- }
- switch (dwFlags & ~(MCI_NOTIFY|MCI_WAIT)) {
- case MCI_SEEK_TO_START:
- TRACE("Seeking to start\n");
- at = FRAME_OF_TOC(toc,toc.FirstTrack);
- if ( (ret=MCICDA_SkipDataTracks(wmcda, &at)) )
- return ret;
- break;
- case MCI_SEEK_TO_END:
- TRACE("Seeking to end\n");
- at = FRAME_OF_TOC(toc, toc.LastTrack + 1) - 1;
- if ( (ret=MCICDA_SkipDataTracks(wmcda, &at)) )
- return ret;
- break;
- case MCI_TO:
- TRACE("Seeking to %lu\n", lpParms->dwTo);
- at = MCICDA_CalcFrame(wmcda, lpParms->dwTo);
- if ( (ret=MCICDA_SkipDataTracks(wmcda, &at)) )
- return ret;
- break;
- default:
- TRACE("Unknown seek action %08lX\n",
- (dwFlags & ~(MCI_NOTIFY|MCI_WAIT)));
- return MCIERR_UNSUPPORTED_FUNCTION;
- }
- 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),
- NULL, 0, &br, NULL))
- return MCIERR_HARDWARE;
-
- if (dwFlags & MCI_NOTIFY) {
- TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
- mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
- wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
- }
- return 0;
-}
-
-/**************************************************************************
- * MCICDA_SetDoor [internal]
- */
-static DWORD MCICDA_SetDoor(UINT wDevID, BOOL open)
-{
- WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
- DWORD br;
-
- TRACE("(%04x, %s) !\n", wDevID, (open) ? "OPEN" : "CLOSE");
-
- if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
-
- if (!DeviceIoControl(wmcda->handle,
- (open) ? IOCTL_STORAGE_EJECT_MEDIA : IOCTL_STORAGE_LOAD_MEDIA,
- NULL, 0, NULL, 0, &br, NULL))
- return MCIERR_HARDWARE;
-
- return 0;
-}
-
-/**************************************************************************
- * MCICDA_Set [internal]
- */
-static DWORD MCICDA_Set(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
-{
- WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID);
-
- TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpParms);
-
- if (wmcda == NULL) return MCIERR_INVALID_DEVICE_ID;
-
- if (dwFlags & MCI_SET_DOOR_OPEN) {
- MCICDA_SetDoor(wDevID, TRUE);
- }
- if (dwFlags & MCI_SET_DOOR_CLOSED) {
- MCICDA_SetDoor(wDevID, FALSE);
- }
-
- /* only functions which require valid lpParms below this line ! */
- if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
- /*
- TRACE("dwTimeFormat=%08lX\n", lpParms->dwTimeFormat);
- TRACE("dwAudio=%08lX\n", lpParms->dwAudio);
- */
- if (dwFlags & MCI_SET_TIME_FORMAT) {
- switch (lpParms->dwTimeFormat) {
- case MCI_FORMAT_MILLISECONDS:
- TRACE("MCI_FORMAT_MILLISECONDS !\n");
- break;
- case MCI_FORMAT_MSF:
- TRACE("MCI_FORMAT_MSF !\n");
- break;
- case MCI_FORMAT_TMSF:
- TRACE("MCI_FORMAT_TMSF !\n");
- break;
- default:
- WARN("bad time format !\n");
- return MCIERR_BAD_TIME_FORMAT;
- }
- wmcda->dwTimeFormat = lpParms->dwTimeFormat;
- }
- if (dwFlags & MCI_SET_VIDEO) return MCIERR_UNSUPPORTED_FUNCTION;
- if (dwFlags & MCI_SET_ON) return MCIERR_UNSUPPORTED_FUNCTION;
- if (dwFlags & MCI_SET_OFF) return MCIERR_UNSUPPORTED_FUNCTION;
- if (dwFlags & MCI_NOTIFY) {
- TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n",
- lpParms->dwCallback);
- mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
- wmcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
- }
- return 0;
-}
-
-/**************************************************************************
- * DriverProc (MCICDA.@)
- */
-LONG CALLBACK MCICDA_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
- DWORD dwParam1, DWORD dwParam2)
-{
- switch(wMsg) {
- case DRV_LOAD: return 1;
- case DRV_FREE: return 1;
- case DRV_OPEN: return MCICDA_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
- case DRV_CLOSE: return MCICDA_drvClose(dwDevID);
- case DRV_ENABLE: return 1;
- case DRV_DISABLE: return 1;
- case DRV_QUERYCONFIGURE: return 1;
- case DRV_CONFIGURE: MessageBoxA(0, "MCI audio CD driver !", "Wine Driver", MB_OK); return 1;
- case DRV_INSTALL: return DRVCNF_RESTART;
- case DRV_REMOVE: return DRVCNF_RESTART;
- }
-
- if (dwDevID == 0xFFFFFFFF) return MCIERR_UNSUPPORTED_FUNCTION;
-
- switch (wMsg) {
- case MCI_OPEN_DRIVER: return MCICDA_Open(dwDevID, dwParam1, (LPMCI_OPEN_PARMSW)dwParam2);
- case MCI_CLOSE_DRIVER: return MCICDA_Close(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
- case MCI_GETDEVCAPS: return MCICDA_GetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2);
- case MCI_INFO: return MCICDA_Info(dwDevID, dwParam1, (LPMCI_INFO_PARMSW)dwParam2);
- case MCI_STATUS: return MCICDA_Status(dwDevID, dwParam1, (LPMCI_STATUS_PARMS)dwParam2);
- case MCI_SET: return MCICDA_Set(dwDevID, dwParam1, (LPMCI_SET_PARMS)dwParam2);
- case MCI_PLAY: return MCICDA_Play(dwDevID, dwParam1, (LPMCI_PLAY_PARMS)dwParam2);
- case MCI_STOP: return MCICDA_Stop(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
- case MCI_PAUSE: return MCICDA_Pause(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
- case MCI_RESUME: return MCICDA_Resume(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
- case MCI_SEEK: return MCICDA_Seek(dwDevID, dwParam1, (LPMCI_SEEK_PARMS)dwParam2);
- /* commands that should report an error as they are not supported in
- * the native version */
- case MCI_SET_DOOR_CLOSED:
- case MCI_SET_DOOR_OPEN:
- case MCI_LOAD:
- case MCI_SAVE:
- case MCI_FREEZE:
- case MCI_PUT:
- case MCI_REALIZE:
- case MCI_UNFREEZE:
- case MCI_UPDATE:
- case MCI_WHERE:
- case MCI_STEP:
- case MCI_SPIN:
- case MCI_ESCAPE:
- case MCI_COPY:
- case MCI_CUT:
- case MCI_DELETE:
- case MCI_PASTE:
- case MCI_WINDOW:
- TRACE("Unsupported command [0x%lx]\n", wMsg);
- break;
- case MCI_OPEN:
- case MCI_CLOSE:
- ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
- break;
- default:
- TRACE("Sending msg [0x%lx] to default driver proc\n", wMsg);
- return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
- }
- return MCIERR_UNRECOGNIZED_COMMAND;
-}
-
-/*-----------------------------------------------------------------------*/
diff -Nru wine/dlls/winmm/mcicda/mcicda.drv.spec winedev/dlls/winmm/mcicda/mcicda.drv.spec
--- wine/dlls/winmm/mcicda/mcicda.drv.spec 2002-06-21 21:15:50.000000000 +0200
+++ winedev/dlls/winmm/mcicda/mcicda.drv.spec 1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-@ stdcall DriverProc(long long long long long) MCICDA_DriverProc
diff -Nru wine/tools/winapi/win32.api winedev/tools/winapi/win32.api
--- wine/tools/winapi/win32.api 2005-07-21 20:36:44.000000000 +0200
+++ winedev/tools/winapi/win32.api 2005-07-22 14:47:09.000000000 +0200
@@ -1806,7 +1806,7 @@
HDRVR
LONG
-%%mcicda.drv
+%%mcicda.dll
%long
diff -Nru wine/tools/wine.inf winedev/tools/wine.inf
--- wine/tools/wine.inf 2005-06-29 20:29:00.000000000 +0200
+++ winedev/tools/wine.inf 2005-07-22 14:46:50.000000000 +0200
@@ -208,7 +208,7 @@
[MCI]
HKLM,%Mci32Str%,"AVIVideo",,"mciavi.drv"
-HKLM,%Mci32Str%,"CDAudio",,"mcicda.drv"
+HKLM,%Mci32Str%,"CDAudio",,"mcicda.dll"
HKLM,%Mci32Str%,"Sequencer",,"mciseq.drv"
HKLM,%Mci32Str%,"WaveAudio",,"mciwave.drv"
@@ -2065,7 +2065,7 @@
system.ini, mci,,"MPEGVideo=mciqtz.drv"
system.ini, mci,,"MPEGVideo2=mciqtz.drv"
system.ini, mci,,"avivideo=mciavi.drv"
-system.ini, mci,,"cdaudio=mcicda.drv"
+system.ini, mci,,"cdaudio=mcicda.dll"
system.ini, mci,,"sequencer=mciseq.drv"
system.ini, mci,,"vcr=mcivisca.drv"
system.ini, mci,,"; videodisc=mcipionr.drv"