From cb7de15ebe9c6fbe6e76bcc26aa91af25cab8055 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Wed, 29 Jun 2005 11:00:44 +0000 Subject: [PATCH] A workaround for missing struct request_sense on FreeBSD. --- dlls/ntdll/cdrom.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c index bc4e6de58e0..318551055b1 100644 --- a/dlls/ntdll/cdrom.c +++ b/dlls/ntdll/cdrom.c @@ -1416,7 +1416,11 @@ static NTSTATUS CDROM_ScsiPassThroughDirect(int fd, PSCSI_PASS_THROUGH_DIRECT pP 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(int fd, PSCSI_PASS_THROUGH pPacket) 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)) @@ -1576,15 +1584,6 @@ static NTSTATUS CDROM_ScsiPassThrough(int fd, PSCSI_PASS_THROUGH pPacket) #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);