Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Send arbitrary SCSI command

Posted on 1997-03-07
2
Medium Priority
?
1,415 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
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.

597 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