dlls/ntdll/cdrom.c breakage
Dmitry Timoshkov
dmitry at baikal.ru
Tue Jun 28 22:55:40 CDT 2005
"Gerald Pfeifer" <gerald at pfeifer.com> wrote:
> The following change to dlls/ntdll/cdrom.c
>
> revision 1.57
> date: 2005/06/27 12:07:49; author: julliard; state: Exp; lines: +13 -19
> Dmitry Timoshkov <dmitry at codeweavers.com>
> Add a check for sg_io_hdr_t and (not tested) check for scsireq_t
> presence.
>
> breaks on FreeBSD
>
> cdrom.c: In function `CDROM_ScsiPassThroughDirect':
> cdrom.c:1419: error: invalid application of `sizeof' to an incomplete type
> cdrom.c:1411: warning: unused variable `io'
> cdrom.c: In function `CDROM_ScsiPassThrough':
> cdrom.c:1534: error: invalid application of `sizeof' to an incomplete type
> cdrom.c:1526: warning: unused variable `io'
>
> which does not have struct request_sense, but does have struct
> scsi_request_sense in /usr/include/cam/scsi/scsi_all.h.
>
> I would have tried to cobble up a patch guard these by #ifdef linux,
> but I'm not sure whether the patch to cdrom.c really was correct as
> it currently looks: defining struct linux_cdrom_generic_command in
> cdrom.c seems like quite bad a hack, doesn't it?
Attached patch is a workaround for the problem. A correct approach is to add a test
for presence of the 'struct request_sense' to configure and add appropriate #ifdef's
in the code.
Changelog:
Dmitry Timoshkov <dmitry at codeweavers.com>
A workaround for missing struct request_sense on FreeBSD.
--
Dmitry.
-------------- next part --------------
--- cvs/hq/wine/dlls/ntdll/cdrom.c Tue Jun 28 03:35:32 2005
+++ wine/dlls/ntdll/cdrom.c Wed Jun 29 03:47:02 2005
@@ -1416,7 +1416,11 @@ static NTSTATUS CDROM_ScsiPassThroughDir
if (pPacket->CdbLength > 16)
return STATUS_INVALID_PARAMETER;
+#ifdef SENSEBUFLEN
+ if (pPacket->SenseInfoLength > SENSEBUFLEN)
+#else
if (pPacket->SenseInfoLength > sizeof(struct request_sense))
+#endif
return STATUS_INVALID_PARAMETER;
if (pPacket->DataTransferLength > 0 && !pPacket->DataBuffer)
@@ -1531,7 +1535,11 @@ static NTSTATUS CDROM_ScsiPassThrough(in
if (pPacket->CdbLength > 16)
return STATUS_INVALID_PARAMETER;
+#ifdef SENSEBUFLEN
+ if (pPacket->SenseInfoLength > SENSEBUFLEN)
+#else
if (pPacket->SenseInfoLength > sizeof(struct request_sense))
+#endif
return STATUS_INVALID_PARAMETER;
if (pPacket->DataTransferLength > 0 && pPacket->DataBufferOffset < sizeof(SCSI_PASS_THROUGH))
@@ -1575,15 +1583,6 @@ static NTSTATUS CDROM_ScsiPassThrough(in
ret = CDROM_GetStatusCode(io);
#elif defined HAVE_SCSIREQ_T_CMD
-
- if (pPacket->Length < sizeof(SCSI_PASS_THROUGH))
- return STATUS_BUFFER_TOO_SMALL;
-
- if (pPacket->CdbLength > 12)
- return STATUS_INVALID_PARAMETER;
-
- if (pPacket->SenseInfoLength > SENSEBUFLEN)
- return STATUS_INVALID_PARAMETER;
memset(&cmd, 0, sizeof(cmd));
memcpy(&(cmd.cmd), &(pPacket->Cdb), pPacket->CdbLength);
More information about the wine-patches
mailing list