Solved

Send arbitrary SCSI command

Posted on 1997-03-07
2
1,397 Views
Last Modified: 2013-12-28
Hello,

we need to be able to send an arbitrary SCSI command to any device attached to NT 4.0 Server through a SCSI miniport driver. Using DOS/ASPI will not work, because:

Background: Using Seagate Barracuda Fibre Channel drives connected to an Emulex LightPulse Fibre Channel host adapter. The Emulex works through a SCSI miniport driver, but no DOS ASPI drivers are available for it. We wish to enable the write cache on the Seagate drives, which can be done through a SCSI command (SCSI-3 sits "atop" Fibre Channel).

If you have written or know of an application that can send SCSI commands through a SCSI miniport driver (or rather, the Win32 API), we'd like to hear from you.

Soenke Behrens
0
Comment
Question by:sbehrens
2 Comments
 

Accepted Solution

by:
Schmelnik earned 200 total points
ID: 1776755
Hi!

There are two ways to solve your problem:
1. You write your code for the ASPI for Win32, but this is not included in Windows NT. As i knows only Adaptec supplies one for their controllers. You can find it even with the necessary documentation on Adaptec Web-Server.
But if you aren't sure that your program would always run on a NT system with an installed ASPI manager, i think you should prefer the second method:
2. You could send normal SCSI commands through the DeviceIOControl command. You can find an example for this in the Windows NT DDK at ddk\src\storage\class\spti
Below you find the interesting parts. But i think that this method has a disadvantage, because my tests have shown that each call with this parameters to DeviceIOControl will cause a memory leak of about 300 bytes. I don't know why, but i think this is a bug of NT.

If you need more info, simply ask.

regards,
Christoph Schmelnik



#include <devioctl.h>
#include <ntdddisk.h>
#include <ntddscsi.h>

    SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER sptdwb;
    ZeroMemory(&sptdwb, sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER));
    ZeroMemory(dataBuffer,sectorSize);

    sptdwb.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
    sptdwb.sptd.PathId = 0;
    sptdwb.sptd.TargetId = 1;
    sptdwb.sptd.Lun = 0;
    sptdwb.sptd.CdbLength = CDB10GENERIC_LENGTH;
    sptdwb.sptd.DataIn = SCSI_IOCTL_DATA_IN;
    sptdwb.sptd.SenseInfoLength = 24;
    sptdwb.sptd.DataTransferLength = sectorSize;
    sptdwb.sptd.TimeOutValue = 2;
    sptdwb.sptd.DataBuffer = dataBuffer;
    sptdwb.sptd.SenseInfoOffset =
       offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER,ucSenseBuf);
    sptdwb.sptd.Cdb[0] = SCSIOP_READ_DATA_BUFF;
    sptdwb.sptd.Cdb[1] = 2;                         // Data mode
    sptdwb.sptd.Cdb[7] = (UCHAR)(sectorSize >> 8);  // Parameter List length
    sptdwb.sptd.Cdb[8] = 0;
    length = sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER);
    status = DeviceIoControl(fileHandle,
                             IOCTL_SCSI_PASS_THROUGH_DIRECT,
                             &sptdwb,
                             length,
                             &sptdwb,
                             length,
                             &returned,
                             FALSE);



0
 

Expert Comment

by:Noatec
ID: 3480033
Schmelnik,

How would you do this on a WIN95 machine? Different headers?
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Deploying Windows 10 in MDT 18 67
do i need anti virus software with windows 10? 13 68
windows explorer default details view 10 56
Microsoft Word startup Issue 7 24
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question