From eeb8ecada13734fc6c5b479d5f6e1db6a7fb2d40 Mon Sep 17 00:00:00 2001 From: rocky Date: Wed, 28 Jul 2004 16:51:15 +0000 Subject: [PATCH] Bug in generic run_scsi_cmd_win32ioctl: wasn't copying CDB in and wasn't setting length. --- lib/MSWindows/win32_ioctl.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/MSWindows/win32_ioctl.c b/lib/MSWindows/win32_ioctl.c index ad4cd9d1..0eeb840b 100644 --- a/lib/MSWindows/win32_ioctl.c +++ b/lib/MSWindows/win32_ioctl.c @@ -1,5 +1,5 @@ /* - $Id: win32_ioctl.c,v 1.31 2004/07/28 11:45:22 rocky Exp $ + $Id: win32_ioctl.c,v 1.32 2004/07/28 16:51:15 rocky Exp $ Copyright (C) 2004 Rocky Bernstein @@ -26,7 +26,7 @@ # include "config.h" #endif -static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.31 2004/07/28 11:45:22 rocky Exp $"; +static const char _rcsid[] = "$Id: win32_ioctl.c,v 1.32 2004/07/28 16:51:15 rocky Exp $"; #include #include @@ -155,18 +155,20 @@ run_scsi_cmd_win32ioctl( const void *p_user_data, bool success; DWORD dwBytesReturned; - sptd.Length=sizeof(sptd); - sptd.PathId=0; /* SCSI card ID will be filled in automatically */ - sptd.TargetId=0; /* SCSI target ID will also be filled in */ - sptd.Lun=0; /* SCSI lun ID will also be filled in */ - sptd.CdbLength=12; /* CDB size is 12 for ReadCD MMC1 command */ - sptd.SenseInfoLength=0; /* Don't return any sense data */ + sptd.Length = sizeof(sptd); + sptd.PathId = 0; /* SCSI card ID will be filled in automatically */ + sptd.TargetId= 0; /* SCSI target ID will also be filled in */ + sptd.Lun=0; /* SCSI lun ID will also be filled in */ + sptd.CdbLength = i_cdb; + sptd.SenseInfoLength = 0; /* Don't return any sense data */ sptd.DataIn = SCSI_MMC_DATA_READ == e_direction ? SCSI_IOCTL_DATA_IN : SCSI_IOCTL_DATA_OUT; sptd.DataTransferLength= i_buf; sptd.TimeOutValue = msecs2secs(i_timeout_ms); - sptd.DataBuffer= (void *) p_buf; - sptd.SenseInfoOffset=0; + sptd.DataBuffer = (void *) p_buf; + sptd.SenseInfoOffset = 0; + + memcpy(sptd.Cdb, p_cdb, i_cdb); /* Send the command to drive */ success=DeviceIoControl(p_env->h_device_handle,