?
Solved

Send arbitrary SCSI command

Posted on 1997-03-07
2
Medium Priority
?
1,411 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
Schmelnik earned 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

801 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