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
eacd0626
Commit
eacd0626
authored
Jun 14, 2005
by
Ivan Leo Puoti
Committed by
Alexandre Julliard
Jun 14, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reimplement IOCTL_SCSI_PASS_THROUGH_DIRECT and
IOCTL_SCSI_PASS_THROUGH on top of the linux scsi driver.
parent
8272074b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
69 deletions
+62
-69
cdrom.c
dlls/ntdll/cdrom.c
+62
-69
No files found.
dlls/ntdll/cdrom.c
View file @
eacd0626
...
...
@@ -4,6 +4,7 @@
* Copyright 1994 Martin Ayotte
* Copyright 1999, 2001, 2003 Eric Pouech
* Copyright 2000 Andreas Mohr
* Copyright 2005 Ivan Leo Puoti
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -1397,62 +1398,61 @@ static NTSTATUS CDROM_RawRead(int fd, const RAW_READ_INFO* raw, void* buffer, DW
}
/******************************************************************
*
CDROM_ScsiPassThroughDirect
*
*
CDROM_ScsiPassThroughDirect
*
Implements IOCTL_SCSI_PASS_THROUGH_DIRECT
*
*/
static
NTSTATUS
CDROM_ScsiPassThroughDirect
(
int
fd
,
PSCSI_PASS_THROUGH_DIRECT
pPacket
)
{
int
ret
=
STATUS_NOT_SUPPORTED
;
#if defined(linux) && defined(CDROM_SEND_PACKET)
struct
linux_cdrom_generic_command
cmd
;
s
truct
request_sense
sense
;
#if defined(linux)
s
g_io_hdr_t
cmd
;
int
io
;
if
(
pPacket
->
Length
<
sizeof
(
SCSI_PASS_THROUGH_DIRECT
))
return
STATUS_BUFFER_TOO_SMALL
;
return
STATUS_BUFFER_TOO_SMALL
;
if
(
pPacket
->
CdbLength
>
1
2
)
if
(
pPacket
->
CdbLength
>
1
6
)
return
STATUS_INVALID_PARAMETER
;
if
(
pPacket
->
SenseInfoLength
>
sizeof
(
sense
))
if
(
pPacket
->
SenseInfoLength
>
sizeof
(
s
truct
request_s
ense
))
return
STATUS_INVALID_PARAMETER
;
memset
(
&
cmd
,
0
,
sizeof
(
cmd
));
memset
(
&
sense
,
0
,
sizeof
(
sense
))
;
if
(
pPacket
->
DataTransferLength
>
0
&&
!
pPacket
->
DataBuffer
)
return
STATUS_INVALID_PARAMETER
;
memcpy
(
&
(
cmd
.
cmd
),
&
(
pPacket
->
Cdb
),
pPacket
->
CdbLength
);
RtlZeroMemory
(
&
cmd
,
sizeof
(
cmd
)
);
cmd
.
buffer
=
pPacket
->
DataBuffer
;
cmd
.
buflen
=
pPacket
->
DataTransferLength
;
cmd
.
sense
=
&
sense
;
cmd
.
quiet
=
0
;
cmd
.
timeout
=
pPacket
->
TimeOutValue
*
HZ
;
cmd
.
interface_id
=
'S'
;
cmd
.
cmd_len
=
pPacket
->
CdbLength
;
cmd
.
mx_sb_len
=
pPacket
->
SenseInfoLength
;
cmd
.
dxfer_len
=
pPacket
->
DataTransferLength
;
cmd
.
dxferp
=
pPacket
->
DataBuffer
;
cmd
.
cmdp
=
pPacket
->
Cdb
;
cmd
.
sbp
=
(
char
*
)
pPacket
+
pPacket
->
SenseInfoOffset
;
cmd
.
timeout
=
pPacket
->
TimeOutValue
*
1000
;
switch
(
pPacket
->
DataIn
)
{
case
SCSI_IOCTL_DATA_OUT
:
cmd
.
data_direction
=
CGC_DATA_WRITE
;
break
;
case
SCSI_IOCTL_DATA_IN
:
cmd
.
data_direction
=
CGC_DATA_READ
;
break
;
cmd
.
dxfer_direction
=
SG_DXFER_TO_DEV
;
break
;
case
SCSI_IOCTL_DATA_OUT
:
cmd
.
dxfer_direction
=
SG_DXFER_FROM_DEV
;
break
;
case
SCSI_IOCTL_DATA_UNSPECIFIED
:
cmd
.
d
ata_direction
=
CGC_DATA
_NONE
;
break
;
cmd
.
d
xfer_direction
=
SG_DXFER
_NONE
;
break
;
default:
return
STATUS_INVALID_PARAMETER
;
}
io
=
ioctl
(
fd
,
CDROM_SEND_PACKET
,
&
cmd
);
io
=
ioctl
(
fd
,
SG_IO
,
&
cmd
);
if
(
pPacket
->
SenseInfoLength
!=
0
)
{
memcpy
((
char
*
)
pPacket
+
pPacket
->
SenseInfoOffset
,
&
sense
,
pPacket
->
SenseInfoLength
);
}
pPacket
->
ScsiStatus
=
cmd
.
stat
;
pPacket
->
ScsiStatus
=
cmd
.
status
;
pPacket
->
DataTransferLength
=
cmd
.
resid
;
pPacket
->
SenseInfoLength
=
cmd
.
sb_len_wr
;
ret
=
CDROM_GetStatusCode
(
io
);
...
...
@@ -1521,69 +1521,62 @@ static NTSTATUS CDROM_ScsiPassThroughDirect(int fd, PSCSI_PASS_THROUGH_DIRECT pP
}
/******************************************************************
*
CDROM_ScsiPassThrough
*
*
CDROM_ScsiPassThrough
*
Implements IOCTL_SCSI_PASS_THROUGH
*
*/
static
NTSTATUS
CDROM_ScsiPassThrough
(
int
fd
,
PSCSI_PASS_THROUGH
pPacket
)
{
int
ret
=
STATUS_NOT_SUPPORTED
;
#if defined(linux) && defined(CDROM_SEND_PACKET)
struct
linux_cdrom_generic_command
cmd
;
struct
request_sense
sense
;
#if defined(linux)
sg_io_hdr_t
cmd
;
int
io
;
if
(
pPacket
->
Length
<
sizeof
(
SCSI_PASS_THROUGH
))
return
STATUS_BUFFER_TOO_SMALL
;
return
STATUS_BUFFER_TOO_SMALL
;
if
(
pPacket
->
CdbLength
>
1
2
)
if
(
pPacket
->
CdbLength
>
1
6
)
return
STATUS_INVALID_PARAMETER
;
if
(
pPacket
->
SenseInfoLength
>
sizeof
(
sense
))
if
(
pPacket
->
SenseInfoLength
>
sizeof
(
s
truct
request_s
ense
))
return
STATUS_INVALID_PARAMETER
;
memset
(
&
cmd
,
0
,
sizeof
(
cmd
));
memset
(
&
sense
,
0
,
sizeof
(
sense
))
;
if
(
pPacket
->
DataTransferLength
>
0
&&
pPacket
->
DataBufferOffset
<
sizeof
(
SCSI_PASS_THROUGH
))
return
STATUS_INVALID_PARAMETER
;
memcpy
(
&
(
cmd
.
cmd
),
&
(
pPacket
->
Cdb
),
pPacket
->
CdbLength
);
RtlZeroMemory
(
&
cmd
,
sizeof
(
cmd
)
);
if
(
pPacket
->
DataBufferOffset
>
0x1000
)
{
cmd
.
buffer
=
(
void
*
)
pPacket
->
DataBufferOffset
;
}
else
{
cmd
.
buffer
=
(
char
*
)
pPacket
+
pPacket
->
DataBufferOffset
;
}
cmd
.
buflen
=
pPacket
->
DataTransferLength
;
cmd
.
sense
=
&
sense
;
cmd
.
quiet
=
0
;
cmd
.
timeout
=
pPacket
->
TimeOutValue
*
HZ
;
cmd
.
interface_id
=
'S'
;
cmd
.
dxfer_len
=
pPacket
->
DataTransferLength
;
cmd
.
dxferp
=
(
char
*
)
pPacket
+
pPacket
->
DataBufferOffset
;
cmd
.
cmd_len
=
pPacket
->
CdbLength
;
cmd
.
cmdp
=
pPacket
->
Cdb
;
cmd
.
mx_sb_len
=
pPacket
->
SenseInfoLength
;
cmd
.
timeout
=
pPacket
->
TimeOutValue
*
1000
;
if
(
cmd
.
mx_sb_len
>
0
)
cmd
.
sbp
=
(
char
*
)
pPacket
+
pPacket
->
SenseInfoOffset
;
switch
(
pPacket
->
DataIn
)
{
case
SCSI_IOCTL_DATA_OUT
:
cmd
.
data_direction
=
CGC_DATA_WRITE
;
break
;
case
SCSI_IOCTL_DATA_IN
:
cmd
.
data_direction
=
CGC_DATA_READ
;
break
;
cmd
.
dxfer_direction
=
SG_DXFER_TO_DEV
;
break
;
case
SCSI_IOCTL_DATA_OUT
:
cmd
.
dxfer_direction
=
SG_DXFER_FROM_DEV
;
break
;
case
SCSI_IOCTL_DATA_UNSPECIFIED
:
cmd
.
d
ata_direction
=
CGC_DATA
_NONE
;
break
;
cmd
.
d
xfer_direction
=
SG_DXFER
_NONE
;
break
;
default:
return
STATUS_INVALID_PARAMETER
;
}
io
=
ioctl
(
fd
,
CDROM_SEND_PACKET
,
&
cmd
);
if
(
pPacket
->
SenseInfoLength
!=
0
)
{
memcpy
((
char
*
)
pPacket
+
pPacket
->
SenseInfoOffset
,
&
sense
,
pPacket
->
SenseInfoLength
);
}
io
=
ioctl
(
fd
,
SG_IO
,
&
cmd
);
pPacket
->
ScsiStatus
=
cmd
.
stat
;
pPacket
->
ScsiStatus
=
cmd
.
status
;
pPacket
->
DataTransferLength
=
cmd
.
resid
;
pPacket
->
SenseInfoLength
=
cmd
.
sb_len_wr
;
ret
=
CDROM_GetStatusCode
(
io
);
...
...
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