Everhart,Glenn From: Jeffrey S. Goldner [goldner@pathlight.com] Sent: Wednesday, April 01, 1998 9:16 AM To: 'Sampath Kawiratne'; ntdev@atria.com Subject: RE: [ntdev] Problems on SCSI optical disk In order to use SCSI Passthrough (SPTI), you need to obtain a handle to the actual physical device if a device is "claimed" by a class driver (disk, scsitape, cdrom, etc.) This is the case for your device, so... you must scan for yourself to find the device you want. You can do a IOCTL_SCSI_GET_INQUIRY_DATA on a handle to a bus (\\.\Scsi%d) to obtain (some of) the inquiry data for all devices on the bus, but you won't be able to talk to the device itself. Your options are: 1) using SPTI, open each PhysicalDrive, then create a SCSI Inquiry CDB, check the appropriate fields (which for you would probably involve device type, and maybe manufacturer and model). If it's your device, you can use Read and Write CDBs pretty easily (make sure your buffers are aligned properly - you can tell what the alignment requirement is by asking the bus driver using IOCTL_SCSI_GET_CAPABILITIES on a handle to Scsi%d). The problem with SPTI is low performance, single threaded, etc. That may not bother you. 2) You could use ASPI, but it isn't a standard part of NT. You need to obtain the aspi32 driver (you can try the Adaptec web site), but the latest version checks for adaptec controllers or previous ASPI installation. You also need to obtain the header and import library (or use LoadLibrary) and arrange to distribute it with your application. The advantages are: it's transportable, the same code will run on Win9X, which does have ASPI as a standard component, and other systems as well; it has much higher performance; it's a little easier to build the CDBs and code in general. It doesn't support timeouts however. Also, if you know the bus, target, lun you can get right to your device. In any case, you don't need to mess with the physicaldrive scanning, just scan by target. SPTI is documented in the DDK (and src\storage\class\spti has sample code). SPTI will support any arbitrary CDB that the device supports, but it doesn't handle any IOCTL codes. It only enters the SCSI miniports using SRB_FUNCTION_EXECUTE_SCSI. There is no support for symbolic links, which I don't see as appropriate here anyway. Your best bet is to write a DLL using either SPTI or ASPI and expose routines that are important to you. User programs then call into the DLL. A device driver would have to be a class driver and you'd have to attach to the device first before disk.sys gets there. Jeff Goldner Pathlight Technology -----Original Message----- From: Sampath Kawiratne [SMTP:dssk@sri.lanka.net] Sent: Monday, March 30, 1998 9:15 AM To: ntdev@atria.com Subject: [ntdev] Problems on SCSI optical disk Hello everybody, I am new to the NT device driver field and hope that you could be good enough to help me out with the following problems. My requirement is to provide sector level read/write access for user level programs to a SCSI optical disk (OD). Initially I thought that I would have to write a device driver for this but later onwards figured out that, it was possible to obtain a handle to the OD using something like hDeviceHandle = CreateFile("\\\\.\\PhysicalDrive1", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_W RITE, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL); The main problem I have with this approach is, programmatically identifying which physical drive the actual OD is attached to (e.g. PhysicalDrive0, PhysicalDrive1...Etc). Initially I tried using the IOCTL_DISK_GET_DRIVE_GEOMETRY IoCtrl but it can only tell that the device supports removable media other than floppy disk. Next I tried IOCTL_GET_CAPABILITIES call but this can only identify the device type as fixed. Could you please answer my following questions. 1. Are there any disadvantage/limitations of using DeviceIoControl rather than developing my own device driver? 2. What is the best way to identify the OD from user level programs? 3. What is SCSI passthrough and from where can I get more information about it. Could SCSI passthrough be used to access all the routines supported by a driver (other than those supported by IOCTRL codes)? For example can I use Scsi passthrough to create a symbolic link. Thanks & Regards, Sampath. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ]