You cannot take class driver, add IRP_MJ_SCSI handler and get fully functional SCSI port. There’s a long way to go…
Take a look at toaster sample from the DDK. This is the core driver you need to add IRP_MJ_SCSI processing and right
properties reporting thru the PnP handlers to get what you want.
-a
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com.ar
Sent: Saturday, August 04, 2007 11:09 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Gathering IRP_MJ_SCSI
Thanks for replying, but ScsiHandler is never called. I use some LOGs in order to be sure it is called or not, but the code there is never executed.
I developed a driver to mount a Virtual CDDA from a BIN file and I can play the sound in WMPlayer, PowerDVD, and some other programs that send IOCTL_CDROM_RAW_READ to my driver, but when I try to play the songs in Winamp, there is no sound. So, I suppose Winamp connect with some SCSI device which sends SRB commands, and that is why I want to get them in my driver, but ScsiHandler is never called.
Is it actually possible to get them if my driver is not a SCSI miniport? I cannot do it.
The code is the following:
…
DriverObject->MajorFunction[IRP_MJ_CREATE] = VikingCDCreateClose;
DriverObject->MajorFunction[IRP_MJ_SCSI] = VikingCDScsiHandler;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = VikingCDDeviceControl;
…
NTSTATUS VikingCDScsiHandler(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
PVIKINGCD_EXTENSION diskExtension;
PIO_STACK_LOCATION Stack;
PSCSI_REQUEST_BLOCK Srb;
NTSTATUS Status;
PIO_STACK_LOCATION irpSp;
NTSTATUS ntStatus;
diskExtension = DeviceObject->DeviceExtension;
irpSp = IoGetCurrentIrpStackLocation( Irp );
Stack = IoGetCurrentIrpStackLocation(Irp);
Srb = Stack->Parameters.Scsi.Srb;
VikingCDLogS(“SCSI HERE”);
if (Srb->Function == SRB_FUNCTION_EXECUTE_SCSI)
{
PCDB Cdb = (PCDB)Srb->Cdb;
VikingCDLogS(“SCSI EXECUTE”);
switch (Cdb->CDB10.OperationCode)
{
case SCSIOP_READ:
VikingCDLogS(“READING SCSI”);
break;
case SCSIOP_WRITE:
VikingCDLogS(“WRITING SCSI”);
break;
default:
VikingCDLogSL("Cdb->CDB10.OperationCode = ", (ULONG) irpSp->Parameters.DeviceIoControl.IoControlCode);
//DPRINT(“Cdb->CDB10.OperationCode = %x”, Cdb->CDB10.OperationCode);
IoSkipCurrentIrpStackLocation(Irp);
Status = IoCallDriver(diskExtension->DeviceObject, Irp);
}
}
return Status;
}
Does anyone have some idea?
Thanks in advance,
Christian D’Orazio
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer