Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9b13bb22
Commit
9b13bb22
authored
Jul 30, 2016
by
Bruno Jesus
Committed by
Alexandre Julliard
Jul 31, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mcicda: Use a helper to read the CD-ROM TOC.
Signed-off-by:
Bruno Jesus
<
00cpxxx@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b9f552cb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
32 deletions
+27
-32
mcicda.c
dlls/mcicda/mcicda.c
+27
-32
No files found.
dlls/mcicda/mcicda.c
View file @
9b13bb22
...
...
@@ -253,6 +253,18 @@ static void MCICDA_Notify(DWORD_PTR hWndCallBack, WINE_MCICDAUDIO* wmcda, UINT w
}
/**************************************************************************
* MCICDA_ReadTOC [internal]
*/
static
BOOL
MCICDA_ReadTOC
(
WINE_MCICDAUDIO
*
wmcda
,
CDROM_TOC
*
toc
,
DWORD
*
br
)
{
if
(
!
device_io
(
wmcda
->
handle
,
IOCTL_CDROM_READ_TOC
,
NULL
,
0
,
toc
,
sizeof
(
*
toc
),
br
,
NULL
))
{
WARN
(
"error reading TOC !
\n
"
);
return
FALSE
;
}
return
TRUE
;
}
/**************************************************************************
* MCICDA_GetStatus [internal]
*/
static
DWORD
MCICDA_GetStatus
(
WINE_MCICDAUDIO
*
wmcda
)
...
...
@@ -722,11 +734,9 @@ static DWORD MCICDA_Status(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParm
TRACE
(
"CURRENT_TRACK=%lu
\n
"
,
lpParms
->
dwReturn
);
break
;
case
MCI_STATUS_LENGTH
:
if
(
!
device_io
(
wmcda
->
handle
,
IOCTL_CDROM_READ_TOC
,
NULL
,
0
,
&
toc
,
sizeof
(
toc
),
&
br
,
NULL
))
{
WARN
(
"error reading TOC !
\n
"
);
if
(
!
MCICDA_ReadTOC
(
wmcda
,
&
toc
,
&
br
))
return
MCICDA_GetError
(
wmcda
);
}
if
(
dwFlags
&
MCI_TRACK
)
{
TRACE
(
"MCI_TRACK #%u LENGTH=??? !
\n
"
,
lpParms
->
dwTrack
);
if
(
lpParms
->
dwTrack
<
toc
.
FirstTrack
||
lpParms
->
dwTrack
>
toc
.
LastTrack
)
...
...
@@ -764,11 +774,9 @@ static DWORD MCICDA_Status(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParm
ret
=
MCI_RESOURCE_RETURNED
;
break
;
case
MCI_STATUS_NUMBER_OF_TRACKS
:
if
(
!
device_io
(
wmcda
->
handle
,
IOCTL_CDROM_READ_TOC
,
NULL
,
0
,
&
toc
,
sizeof
(
toc
),
&
br
,
NULL
))
{
WARN
(
"error reading TOC !
\n
"
);
if
(
!
MCICDA_ReadTOC
(
wmcda
,
&
toc
,
&
br
))
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
)
...
...
@@ -777,20 +785,16 @@ static DWORD MCICDA_Status(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParm
case
MCI_STATUS_POSITION
:
switch
(
dwFlags
&
(
MCI_STATUS_START
|
MCI_TRACK
))
{
case
MCI_STATUS_START
:
if
(
!
device_io
(
wmcda
->
handle
,
IOCTL_CDROM_READ_TOC
,
NULL
,
0
,
&
toc
,
sizeof
(
toc
),
&
br
,
NULL
))
{
WARN
(
"error reading TOC !
\n
"
);
if
(
!
MCICDA_ReadTOC
(
wmcda
,
&
toc
,
&
br
))
return
MCICDA_GetError
(
wmcda
);
}
lpParms
->
dwReturn
=
FRAME_OF_TOC
(
toc
,
toc
.
FirstTrack
);
TRACE
(
"get MCI_STATUS_START !
\n
"
);
break
;
case
MCI_TRACK
:
if
(
!
device_io
(
wmcda
->
handle
,
IOCTL_CDROM_READ_TOC
,
NULL
,
0
,
&
toc
,
sizeof
(
toc
),
&
br
,
NULL
))
{
WARN
(
"error reading TOC !
\n
"
);
if
(
!
MCICDA_ReadTOC
(
wmcda
,
&
toc
,
&
br
))
return
MCICDA_GetError
(
wmcda
);
}
if
(
lpParms
->
dwTrack
<
toc
.
FirstTrack
||
lpParms
->
dwTrack
>
toc
.
LastTrack
)
return
MCIERR_OUTOFRANGE
;
lpParms
->
dwReturn
=
FRAME_OF_TOC
(
toc
,
lpParms
->
dwTrack
);
...
...
@@ -835,11 +839,9 @@ static DWORD MCICDA_Status(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParm
if
(
!
(
dwFlags
&
MCI_TRACK
))
ret
=
MCIERR_MISSING_PARAMETER
;
else
{
if
(
!
device_io
(
wmcda
->
handle
,
IOCTL_CDROM_READ_TOC
,
NULL
,
0
,
&
toc
,
sizeof
(
toc
),
&
br
,
NULL
))
{
WARN
(
"error reading TOC !
\n
"
);
if
(
!
MCICDA_ReadTOC
(
wmcda
,
&
toc
,
&
br
))
return
MCICDA_GetError
(
wmcda
);
}
if
(
lpParms
->
dwTrack
<
toc
.
FirstTrack
||
lpParms
->
dwTrack
>
toc
.
LastTrack
)
ret
=
MCIERR_OUTOFRANGE
;
else
...
...
@@ -867,11 +869,9 @@ static DWORD MCICDA_SkipDataTracks(WINE_MCICDAUDIO* wmcda,DWORD *frame)
int
i
;
DWORD
br
;
CDROM_TOC
toc
;
if
(
!
device_io
(
wmcda
->
handle
,
IOCTL_CDROM_READ_TOC
,
NULL
,
0
,
&
toc
,
sizeof
(
toc
),
&
br
,
NULL
))
{
WARN
(
"error reading TOC !
\n
"
);
if
(
!
MCICDA_ReadTOC
(
wmcda
,
&
toc
,
&
br
))
return
MCICDA_GetError
(
wmcda
);
}
if
(
*
frame
<
FRAME_OF_TOC
(
toc
,
toc
.
FirstTrack
)
||
*
frame
>=
FRAME_OF_TOC
(
toc
,
toc
.
LastTrack
+
1
))
/* lead-out */
return
MCIERR_OUTOFRANGE
;
...
...
@@ -914,11 +914,8 @@ static DWORD MCICDA_Play(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
if
(
wmcda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
if
(
!
device_io
(
wmcda
->
handle
,
IOCTL_CDROM_READ_TOC
,
NULL
,
0
,
&
toc
,
sizeof
(
toc
),
&
br
,
NULL
))
{
WARN
(
"error reading TOC !
\n
"
);
if
(
!
MCICDA_ReadTOC
(
wmcda
,
&
toc
,
&
br
))
return
MCICDA_GetError
(
wmcda
);
}
if
(
dwFlags
&
MCI_FROM
)
{
start
=
MCICDA_CalcFrame
(
wmcda
,
lpParms
->
dwFrom
);
...
...
@@ -1198,11 +1195,9 @@ static DWORD MCICDA_Seek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
* then only checks the position flags, then stops and seeks. */
MCICDA_Stop
(
wDevID
,
MCI_WAIT
,
0
);
if
(
!
device_io
(
wmcda
->
handle
,
IOCTL_CDROM_READ_TOC
,
NULL
,
0
,
&
toc
,
sizeof
(
toc
),
&
br
,
NULL
))
{
WARN
(
"error reading TOC !
\n
"
);
if
(
!
MCICDA_ReadTOC
(
wmcda
,
&
toc
,
&
br
))
return
MCICDA_GetError
(
wmcda
);
}
switch
(
position
)
{
case
MCI_SEEK_TO_START
:
TRACE
(
"Seeking to start
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment