SCSI miniport is not initialized

Hello people,

I’m developing a SCSI miniport in order to mount virtual CDs, but it is impossible to initialize it. This is the source in the DriverEntry:


CDDALogS(“SCSI Miniport Entry”);
//SCSI Miniport

RtlZeroMemory(&HwInitializationData, sizeof(HW_INITIALIZATION_DATA));
HwInitializationData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA);

HwInitializationData.HwInitialize = CDDAInitialize;
HwInitializationData.HwResetBus = CDDAResetBus;
HwInitializationData.HwStartIo = CDDAStartIo;
HwInitializationData.HwFindAdapter = CDDAFindAdapter;
HwInitializationData.HwAdapterControl = CDDAAdapterControl;
//HwInitializationData.HwInterrupt = NULL;
//HwInitializationData.HwAdapterState = NULL;
HwInitializationData.AdapterInterfaceType = Internal;
HwInitializationData.DeviceExtensionSize = sizeof( DEVICE_EXTENSION );
HwInitializationData.MapBuffers = TRUE;
HwInitializationData.ReceiveEvent = TRUE;
HwInitializationData.AutoRequestSense = TRUE;

status = ScsiPortInitialize( DriverObject, RegistryPath, &HwInitializationData, &HwContext );

if (!NT_SUCCESS(status))
{
return status;
DbgPrint(“It was impossible to initialize SCSI port”);
CDDALogS(“SCSI Miniport Initilizated WRONG”);
}

CDDALogS(“SCSI Miniport Initilizated OK”);

////////////////////
//
// Create extension for the driverobject to store driver specific
// information. Device specific information should be stored in
// Device Extension

status = IoAllocateDriverObjectExtension(DriverObject,
CDDA_DRIVER_EXTENSION_KEY,
sizeof(CDDA_DRIVER_EXTENSION),
&driverExtension);

I suppose there is something wrong when ScsiPortInitialize is called because after that no other message is logged. The message “SCSI Miniport Entry” is logged at the beginning, but neither “SCSI Miniport Initilizated WRONG” nor “SCSI Miniport Initilizated OK”. It seems to be that after ScsiPortInitialize the execution doesn’t go on any longer or is stopped because there are no logs and some symbolic links are not created.

The following are the miniport routines I use:

BOOLEAN CDDAInitialize( IN PVOID DeviceExtension )
{
CDDALogS(“CDDAInitialize OUT.”);
return TRUE;
}

BOOLEAN CDDAResetBus( IN PVOID DeviceExtension, IN ULONG PathId )
{
CDDALogS(“CDDAResetBus OUT.”);
return TRUE;
}

SCSI_ADAPTER_CONTROL_STATUS CDDAAdapterControl(
IN PVOID DeviceExtension,
IN SCSI_ADAPTER_CONTROL_TYPE ControlType,
IN PVOID Parameters
)
{
DbgPrint(“AdapterControl(%d)\n”, ControlType);
CDDALogS(“CDDAAdapterControl IN.”);
switch (ControlType) {
case ScsiQuerySupportedControlTypes:
{
SCSI_SUPPORTED_CONTROL_TYPE_LIST* ssctl = (SCSI_SUPPORTED_CONTROL_TYPE_LIST*)Parameters;
ZeroMemory(ssctl->SupportedTypeList, ssctl->MaxControlType);
if (ScsiQuerySupportedControlTypes < ssctl->MaxControlType)
ssctl->SupportedTypeList[ScsiQuerySupportedControlTypes] = TRUE;
if (ScsiStopAdapter < ssctl->MaxControlType)
ssctl->SupportedTypeList[ScsiStopAdapter] = TRUE;
if (ScsiRestartAdapter < ssctl->MaxControlType)
ssctl->SupportedTypeList[ScsiRestartAdapter] = TRUE;
}
// fall thru
CDDALogS(“CDDAAdapterControl OUT.”);
case ScsiStopAdapter:
case ScsiRestartAdapter:
return ScsiAdapterControlSuccess;
default:
return ScsiAdapterControlUnsuccessful;
}
}

ULONG CDDAFindAdapter(
IN PVOID DeviceExtension,
IN PVOID Context,
IN PVOID BusInformation,
IN PCHAR ArgumentString,
IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo,
OUT PBOOLEAN Again)
{

ConfigInfo->AdapterInterfaceType = Internal;
ConfigInfo->InitiatorBusId[0] = 31; // set SCSI ID in the port
ConfigInfo->MaximumTransferLength = 0x30000; // single transfer size
ConfigInfo->NumberOfPhysicalBreaks = 0x30;
ConfigInfo->NumberOfBuses = 1; // set number of served buses
ConfigInfo->MaximumNumberOfTargets = 1;

ConfigInfo->ScatterGather = FALSE; // fuck off scatter/gather
ConfigInfo->Master = FALSE; // NOT bus master

*Again = FALSE; // indicate to SCSI port in have not call this entry once more

CDDALogS(“CDDAFindAdapter OUT.”);
return SP_RETURN_FOUND; // adapter IS here in any way
}

BOOLEAN CDDAStartIo ( IN PVOID ipDeviceExtension, IN PSCSI_REQUEST_BLOCK ipSRB)
{
//PSPECIFIC_DEVICE_EXTENSION deviceExtension = ipDeviceExtension;
//PSPECIFIC_LU_EXTENSION luExtension;
// Determine the logical unit that this request is for.
//deviceExtension->PathId = ipSRB->PathId;
//luExtension = ScsiPortGetLogicalUnit(deviceExtension, deviceExtension->PathId,
// ipSRB->TargetId, ipSRB->Lun);

PINQUIRYDATA Inq;
PREAD_CAPACITY_DATA pCapacityRead;
PDEVICE_EXTENSION deviceExtension;
ULONG FixBlockEnd;
ULONG FixBlockSize;
PFOUR_BYTE pEnd;
PFOUR_BYTE pSize;
PCDROM_TOC pToc;

deviceExtension = (PDEVICE_EXTENSION) ipDeviceExtension;
pEnd = (PFOUR_BYTE)&FixBlockEnd;
pSize = (PFOUR_BYTE)&FixBlockSize;

switch( ipSRB->Function)
{
case SRB_FUNCTION_ABORT_COMMAND:
ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
break;
case SRB_FUNCTION_RESET_BUS:
ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
break;
case SRB_FUNCTION_EXECUTE_SCSI:
/*
luExtension->ActiveLuRequest = ipSRB;
luExtension->LuState = LS_COMPLETE;
luExtension->SavedDataPointer = (ULONG) ipSRB->DataBuffer;
luExtension->SavedDataLength = ipSRB->DataTransferLength;
*/
switch( ipSRB->Cdb[0])
{
//case SCSIOP_READ_CD_MSF:
// Get CD-ROM Inquiry Data
case (SCSIOP_INQUIRY):
// Setup the context for this target/lun.
memset(ipSRB->DataBuffer, 0, ipSRB->DataTransferLength);
Inq =(PINQUIRYDATA)(ipSRB->DataBuffer);
Inq->DeviceType = DIRECT_ACCESS_DEVICE;
Inq->DeviceTypeQualifier = DEVICE_CONNECTED;
memcpy(Inq->VendorId, “Valhalla”, sizeof Inq->VendorId);
memcpy(Inq->ProductId, “CDDA v1.0”, sizeof Inq->ProductId);
ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
break;
// ReadCapacity: Hardwired data
case(SCSIOP_READ_CAPACITY):
memset(ipSRB->DataBuffer, 0, ipSRB->DataTransferLength);
pCapacityRead = (PREAD_CAPACITY_DATA) (ipSRB->DataBuffer);
FixBlockEnd = 270000;
FixBlockSize = 2048;
((PFOUR_BYTE)&(pCapacityRead->LogicalBlockAddress))->Byte3=
pEnd->Byte0;
((PFOUR_BYTE)&(pCapacityRead->LogicalBlockAddress))->Byte2=
pEnd->Byte1;
((PFOUR_BYTE)&(pCapacityRead->LogicalBlockAddress))->Byte1=
pEnd->Byte2;
((PFOUR_BYTE)&(pCapacityRead->LogicalBlockAddress))->Byte0=
pEnd->Byte3;
((PFOUR_BYTE)&(pCapacityRead->BytesPerBlock))->Byte3=
pSize->Byte0;
((PFOUR_BYTE)&(pCapacityRead->BytesPerBlock))->Byte2=
pSize->Byte1;
((PFOUR_BYTE)&(pCapacityRead->BytesPerBlock))->Byte2=
pSize->Byte2;
((PFOUR_BYTE)&(pCapacityRead->BytesPerBlock))->Byte0=
pSize->Byte3;
ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
break;
// Read Cd-ROM
case SCSIOP_READ_CD:
//…
//return BIN file audio data
//if NT_SUCCESS(CDDAReadCDRom(deviceExtension, luExtension))
// ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
//else
// ipSRB->SrbStatus = SRB_STATUS_ERROR;
//break;
case SCSIOP_READ_TOC:
memset(ipSRB->DataBuffer, 0, ipSRB->DataTransferLength);
pToc = (PCDROM_TOC) (ipSRB->DataBuffer);
CDDAFillAudioToc(pToc);
ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
break;
case SCSIOP_READ_HEADER:
//…
case SCSIOP_TEST_UNIT_READY:
ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
break;
// Invalid Scsi Op code
default:
ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
break;
}
CDDALogS(“ipSRB->Cdb[0] OUT.”);
ScsiPortNotification(RequestComplete, (PVOID) ipDeviceExtension, ipSRB);
break;
default:
ipSRB->SrbStatus = SRB_STATUS_INVALID_REQUEST;
ScsiPortNotification(RequestComplete, (PVOID) ipDeviceExtension, ipSRB);
break;
}

// Adapter ready for next request.
CDDALogS(“CDDAStartIo OUT.”);
ScsiPortNotification(NextRequest, ipDeviceExtension, NULL);
return TRUE;
}

The last but not least, the INF file:

;/*++
;
;Module Name:
;
; CDDA.INF
;
;Abstract:
; INF file for installing CDDA Virtual SCSI Port Device Driver
;
;–*/
[Version]
Signature=“$WINDOWS NT$”
Class=ScsiAdapter
ClassGUID={4d36e97b-e325-11ce-bfc1-08002be10318}
Provider=%VLH%
DriverVer=08/07/2007,1.00.2183.1

[DestinationDirs]
DefaultDestDir = 12

[ClassInstall32]
Addreg=SampleClassReg

[SampleClassReg]
HKR,0,%ClassName%

[DiskCopyfiles]
CDDA.sys

[SourceDisksNames]
1=%InstDisk%,

[SourceDisksFiles]
CDDA.sys=1

[Manufacturer]
%VLH% = DiskDevice

[DiskDevice]
%DiskDevDesc% = DiskInstall, CDDA

[DiskInstall.NT]
CopyFiles = DiskCopyfiles

;-------------- Service installation

[DiskInstall.NT.Services]
AddService = CDDA, %SPSVCINST_ASSOCSERVICE%, DiskServiceInst

[DiskServiceInst]
DisplayName = %DiskServiceDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 1 ; SERVICE_SYSTEM_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\CDDA.sys
LoadOrderGroup = SCSI Miniport
AddReg = DiskAddReg

[DiskAddReg]
HKR, Parameters, ConnectInfo, 0x00001
HKR, Parameters, ConnectionsInRegistry, 0x10001, 1
HKR, “Parameters”, “BreakOnEntry”, %REG_DWORD%, 0x00000000
HKR, “Parameters”, “DebugLevel”, %REG_DWORD%, 0x00000000
HKR, “Parameters”, “DebugComp”, %REG_DWORD%, 0xFFFFFFFF
HKR, “Parameters”, “DriveLetter”, %REG_SZ%, “Y:”

[Strings]
SPSVCINST_ASSOCSERVICE= 0x00000002
VLH = “Valhalla, Inc”
ClassName = “CDDA SCSI Port Driver”
InstDisk = “CDDA Virtual SCSI Port Device Driver Installation Disk #0
DiskDevDesc = “CDDA SCSI”
DiskServiceDesc = “CDDA Virtual SCSI Port Device Driver”

REG_DWORD = 0x00010001
REG_SZ = 0x00000000

Any idea what’s the problem?

Thanks in advance.

Christian D’Orazio

Have you stepped into FindAdapter? Does it get called? Set
Services<youdriver>\Parameters\PnpInterface to the bus type, typically 5
for PCI?


The personal opinion of
Gary G. Little

wrote in message news:xxxxx@ntdev…
> Hello people,
>
> I’m developing a SCSI miniport in order to mount virtual CDs, but it is
> impossible to initialize it. This is the source in the DriverEntry:
>
> …
> CDDALogS(“SCSI Miniport Entry”);
> //SCSI Miniport
>
> RtlZeroMemory(&HwInitializationData, sizeof(HW_INITIALIZATION_DATA));
> HwInitializationData.HwInitializationDataSize =
> sizeof(HW_INITIALIZATION_DATA);
>
> HwInitializationData.HwInitialize = CDDAInitialize;
> HwInitializationData.HwResetBus = CDDAResetBus;
> HwInitializationData.HwStartIo = CDDAStartIo;
> HwInitializationData.HwFindAdapter = CDDAFindAdapter;
> HwInitializationData.HwAdapterControl = CDDAAdapterControl;
> //HwInitializationData.HwInterrupt = NULL;
> //HwInitializationData.HwAdapterState = NULL;
> HwInitializationData.AdapterInterfaceType = Internal;
> HwInitializationData.DeviceExtensionSize = sizeof( DEVICE_EXTENSION );
> HwInitializationData.MapBuffers = TRUE;
> HwInitializationData.ReceiveEvent = TRUE;
> HwInitializationData.AutoRequestSense = TRUE;
>
> status = ScsiPortInitialize( DriverObject, RegistryPath,
> &HwInitializationData, &HwContext );
>
> if (!NT_SUCCESS(status))
> {
> return status;
> DbgPrint(“It was impossible to initialize SCSI port”);
> CDDALogS(“SCSI Miniport Initilizated WRONG”);
> }
>
> CDDALogS(“SCSI Miniport Initilizated OK”);
>
> ////////////////////
> //
> // Create extension for the driverobject to store driver specific
> // information. Device specific information should be stored in
> // Device Extension
>
> status = IoAllocateDriverObjectExtension(DriverObject,
> CDDA_DRIVER_EXTENSION_KEY,
> sizeof(CDDA_DRIVER_EXTENSION),
> &driverExtension);
> …
> …
>
> I suppose there is something wrong when ScsiPortInitialize is called
> because after that no other message is logged. The message “SCSI Miniport
> Entry” is logged at the beginning, but neither “SCSI Miniport Initilizated
> WRONG” nor “SCSI Miniport Initilizated OK”. It seems to be that after
> ScsiPortInitialize the execution doesn’t go on any longer or is stopped
> because there are no logs and some symbolic links are not created.
>
> The following are the miniport routines I use:
>
> BOOLEAN CDDAInitialize( IN PVOID DeviceExtension )
> {
> CDDALogS(“CDDAInitialize OUT.”);
> return TRUE;
> }
>
> BOOLEAN CDDAResetBus( IN PVOID DeviceExtension, IN ULONG PathId )
> {
> CDDALogS(“CDDAResetBus OUT.”);
> return TRUE;
> }
>
> SCSI_ADAPTER_CONTROL_STATUS CDDAAdapterControl(
> IN PVOID DeviceExtension,
> IN SCSI_ADAPTER_CONTROL_TYPE ControlType,
> IN PVOID Parameters
> )
> {
> DbgPrint(“AdapterControl(%d)\n”, ControlType);
> CDDALogS(“CDDAAdapterControl IN.”);
> switch (ControlType) {
> case ScsiQuerySupportedControlTypes:
> {
> SCSI_SUPPORTED_CONTROL_TYPE_LIST* ssctl =
> (SCSI_SUPPORTED_CONTROL_TYPE_LIST*)Parameters;
> ZeroMemory(ssctl->SupportedTypeList, ssctl->MaxControlType);
> if (ScsiQuerySupportedControlTypes < ssctl->MaxControlType)
> ssctl->SupportedTypeList[ScsiQuerySupportedControlTypes] = TRUE;
> if (ScsiStopAdapter < ssctl->MaxControlType)
> ssctl->SupportedTypeList[ScsiStopAdapter] = TRUE;
> if (ScsiRestartAdapter < ssctl->MaxControlType)
> ssctl->SupportedTypeList[ScsiRestartAdapter] = TRUE;
> }
> // fall thru
> CDDALogS(“CDDAAdapterControl OUT.”);
> case ScsiStopAdapter:
> case ScsiRestartAdapter:
> return ScsiAdapterControlSuccess;
> default:
> return ScsiAdapterControlUnsuccessful;
> }
> }
>
> ULONG CDDAFindAdapter(
> IN PVOID DeviceExtension,
> IN PVOID Context,
> IN PVOID BusInformation,
> IN PCHAR ArgumentString,
> IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo,
> OUT PBOOLEAN Again)
> {
>
> ConfigInfo->AdapterInterfaceType = Internal;
> ConfigInfo->InitiatorBusId[0] = 31; // set SCSI ID in the port
> ConfigInfo->MaximumTransferLength = 0x30000; // single transfer size
> ConfigInfo->NumberOfPhysicalBreaks = 0x30;
> ConfigInfo->NumberOfBuses = 1; // set number of served buses
> ConfigInfo->MaximumNumberOfTargets = 1;
>
> ConfigInfo->ScatterGather = FALSE; // fuck off scatter/gather
> ConfigInfo->Master = FALSE; // NOT bus master
>
>
> Again = FALSE; // indicate to SCSI port in have not call this entry once
> more
>
> CDDALogS(“CDDAFindAdapter OUT.”);
> return SP_RETURN_FOUND; // adapter IS here in any way
> }
>
> BOOLEAN CDDAStartIo ( IN PVOID ipDeviceExtension, IN PSCSI_REQUEST_BLOCK
> ipSRB)
> {
> //PSPECIFIC_DEVICE_EXTENSION deviceExtension = ipDeviceExtension;
> //PSPECIFIC_LU_EXTENSION luExtension;
> // Determine the logical unit that this request is for.
> //deviceExtension->PathId = ipSRB->PathId;
> //luExtension = ScsiPortGetLogicalUnit(deviceExtension,
> deviceExtension->PathId,
> // ipSRB->TargetId, ipSRB->Lun);
>
> PINQUIRYDATA Inq;
> PREAD_CAPACITY_DATA pCapacityRead;
> PDEVICE_EXTENSION deviceExtension;
> ULONG FixBlockEnd;
> ULONG FixBlockSize;
> PFOUR_BYTE pEnd;
> PFOUR_BYTE pSize;
> PCDROM_TOC pToc;
>
> deviceExtension = (PDEVICE_EXTENSION) ipDeviceExtension;
> pEnd = (PFOUR_BYTE)&FixBlockEnd;
> pSize = (PFOUR_BYTE)&FixBlockSize;
>
> switch( ipSRB->Function)
> {
> case SRB_FUNCTION_ABORT_COMMAND:
> ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
> break;
> case SRB_FUNCTION_RESET_BUS:
> ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
> break;
> case SRB_FUNCTION_EXECUTE_SCSI:
> /

> luExtension->ActiveLuRequest = ipSRB;
> luExtension->LuState = LS_COMPLETE;
> luExtension->SavedDataPointer = (ULONG) ipSRB->DataBuffer;
> luExtension->SavedDataLength = ipSRB->DataTransferLength;
> /
> switch( ipSRB->Cdb[0])
> {
> //case SCSIOP_READ_CD_MSF:
> // Get CD-ROM Inquiry Data
> case (SCSIOP_INQUIRY):
> // Setup the context for this target/lun.
> memset(ipSRB->DataBuffer, 0, ipSRB->DataTransferLength);
> Inq =(PINQUIRYDATA)(ipSRB->DataBuffer);
> Inq->DeviceType = DIRECT_ACCESS_DEVICE;
> Inq->DeviceTypeQualifier = DEVICE_CONNECTED;
> memcpy(Inq->VendorId, “Valhalla”, sizeof Inq->VendorId);
> memcpy(Inq->ProductId, “CDDA v1.0”, sizeof Inq->ProductId);
> ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
> break;
> // ReadCapacity: Hardwired data
> case(SCSIOP_READ_CAPACITY):
> memset(ipSRB->DataBuffer, 0, ipSRB->DataTransferLength);
> pCapacityRead = (PREAD_CAPACITY_DATA) (ipSRB->DataBuffer);
> FixBlockEnd = 270000;
> FixBlockSize = 2048;
> ((PFOUR_BYTE)&(pCapacityRead->LogicalBlockAddress))->Byte3=
> pEnd->Byte0;
> ((PFOUR_BYTE)&(pCapacityRead->LogicalBlockAddress))->Byte2=
> pEnd->Byte1;
> ((PFOUR_BYTE)&(pCapacityRead->LogicalBlockAddress))->Byte1=
> pEnd->Byte2;
> ((PFOUR_BYTE)&(pCapacityRead->LogicalBlockAddress))->Byte0=
> pEnd->Byte3;
> ((PFOUR_BYTE)&(pCapacityRead->BytesPerBlock))->Byte3=
> pSize->Byte0;
> ((PFOUR_BYTE)&(pCapacityRead->BytesPerBlock))->Byte2=
> pSize->Byte1;
> ((PFOUR_BYTE)&(pCapacityRead->BytesPerBlock))->Byte2=
> pSize->Byte2;
> ((PFOUR_BYTE)&(pCapacityRead->BytesPerBlock))->Byte0=
> pSize->Byte3;
> ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
> break;
> // Read Cd-ROM
> case SCSIOP_READ_CD:
> //…
> //return BIN file audio data
> //if NT_SUCCESS(CDDAReadCDRom(deviceExtension, luExtension))
> // ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
> //else
> // ipSRB->SrbStatus = SRB_STATUS_ERROR;
> //break;
> case SCSIOP_READ_TOC:
> memset(ipSRB->DataBuffer, 0, ipSRB->DataTransferLength);
> pToc = (PCDROM_TOC) (ipSRB->DataBuffer);
> CDDAFillAudioToc(pToc);
> ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
> break;
> case SCSIOP_READ_HEADER:
> //…
> case SCSIOP_TEST_UNIT_READY:
> ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
> break;
> // Invalid Scsi Op code
> default:
> ipSRB->SrbStatus = SRB_STATUS_SUCCESS;
> break;
> }
> CDDALogS(“ipSRB->Cdb[0] OUT.”);
> ScsiPortNotification(RequestComplete, (PVOID) ipDeviceExtension, ipSRB);
> break;
> default:
> ipSRB->SrbStatus = SRB_STATUS_INVALID_REQUEST;
> ScsiPortNotification(RequestComplete, (PVOID) ipDeviceExtension, ipSRB);
> break;
> }
>
> // Adapter ready for next request.
> CDDALogS(“CDDAStartIo OUT.”);
> ScsiPortNotification(NextRequest, ipDeviceExtension, NULL);
> return TRUE;
> }
>
> The last but not least, the INF file:
>
> ;/
++
> ;
> ;Module Name:
> ;
> ; CDDA.INF
> ;
> ;Abstract:
> ; INF file for installing CDDA Virtual SCSI Port Device Driver
> ;
> ;–*/
> [Version]
> Signature=“$WINDOWS NT$”
> Class=ScsiAdapter
> ClassGUID={4d36e97b-e325-11ce-bfc1-08002be10318}
> Provider=%VLH%
> DriverVer=08/07/2007,1.00.2183.1
>
> [DestinationDirs]
> DefaultDestDir = 12
>
>
> [ClassInstall32]
> Addreg=SampleClassReg
>
> [SampleClassReg]
> HKR,0,%ClassName%
>
> [DiskCopyfiles]
> CDDA.sys
>
> [SourceDisksNames]
> 1=%InstDisk%,
>
> [SourceDisksFiles]
> CDDA.sys=1
>
> [Manufacturer]
> %VLH% = DiskDevice
>
> [DiskDevice]
> %DiskDevDesc% = DiskInstall, CDDA
>
> [DiskInstall.NT]
> CopyFiles = DiskCopyfiles
>
> ;-------------- Service installation
>
> [DiskInstall.NT.Services]
> AddService = CDDA, %SPSVCINST_ASSOCSERVICE%, DiskServiceInst
>
> [DiskServiceInst]
> DisplayName = %DiskServiceDesc%
> ServiceType = 1 ; SERVICE_KERNEL_DRIVER
> StartType = 1 ; SERVICE_SYSTEM_START
> ErrorControl = 1 ; SERVICE_ERROR_NORMAL
> ServiceBinary = %12%\CDDA.sys
> LoadOrderGroup = SCSI Miniport
> AddReg = DiskAddReg
>
> [DiskAddReg]
> HKR, Parameters, ConnectInfo, 0x00001
> HKR, Parameters, ConnectionsInRegistry, 0x10001, 1
> HKR, “Parameters”, “BreakOnEntry”, %REG_DWORD%, 0x00000000
> HKR, “Parameters”, “DebugLevel”, %REG_DWORD%, 0x00000000
> HKR, “Parameters”, “DebugComp”, %REG_DWORD%, 0xFFFFFFFF
> HKR, “Parameters”, “DriveLetter”, %REG_SZ%, “Y:”
>
> [Strings]
> SPSVCINST_ASSOCSERVICE= 0x00000002
> VLH = “Valhalla, Inc”
> ClassName = “CDDA SCSI Port Driver”
> InstDisk = “CDDA Virtual SCSI Port Device Driver Installation Disk #0
> DiskDevDesc = “CDDA SCSI”
> DiskServiceDesc = “CDDA Virtual SCSI Port Device Driver”
>
> REG_DWORD = 0x00010001
> REG_SZ = 0x00000000
>
> Any idea what’s the problem?
>
> Thanks in advance.
>
> Christian D’Orazio
>
>

Hello,

Thanks Gary,

You were right. I added the key Services<youdriver>\Parameters\PnpInterface in INF file and it worked. Instead of 5 I had to change by 0, because the interface is Internal. Now SCSI miniport is initialized correctly. The only problem is that:

HwInitializationData.HwStartIo = CDDAStartIo;

is never called, so I’m not able to get SRB functions and SCSIOPs such as SRB_FUNCTION_EXECUTE_SCSI, SCSIOP_READ_CD, SCSIOP_READ_TOC, etc.

Does anyone have some idea why it happens?

Christian D’Orazio

Out of curiousity, did you try 5? It’s been about 5 years since I tried it
in early XP, but as I recall, NONE of the PnpInterfaces worked except PCI.
From recent postings on much the same subject, I would say it is still
b’orked. SCSI/STORPORT mini’s still run in their own little world and are
neither real WDM or WDF drivers.


The personal opinion of
Gary G. Little

wrote in message news:xxxxx@ntdev…
> Hello,
>
> Thanks Gary,
>
> You were right. I added the key
> Services<youdriver>\Parameters\PnpInterface in INF file and it worked.
> Instead of 5 I had to change by 0, because the interface is Internal. Now
> SCSI miniport is initialized correctly. The only problem is that:
>
> HwInitializationData.HwStartIo = CDDAStartIo;
>
> is never called, so I’m not able to get SRB functions and SCSIOPs such as
> SRB_FUNCTION_EXECUTE_SCSI, SCSIOP_READ_CD, SCSIOP_READ_TOC, etc.
>
> Does anyone have some idea why it happens?
>
> Christian D’Orazio
>
>

Hi Gary,

Yes, I tried 5 for the key PnpInterface in the INF file, but it didn’t work because I initialized INTERFACE_TYPE AdapterInterfaceType as “Internal”, so I have to use 0 instead of 5. As you can see in the enum INTERFACE_TYPE, “Internal” is 0 and PCIBus 5:

typedef enum _INTERFACE_TYPE
{
InterfaceTypeUndefined = -1,
Internal = 0,
Isa = 1,
Eisa = 2,
MicroChannel = 3,
TurboChannel = 4,
PCIBus = 5,
VMEBus = 6,
NuBus = 7,
PCMCIABus = 8,
CBus = 9,
MPIBus = 10,
MPSABus = 11,
ProcessorInternal = 12,
InternalPowerBus = 13,
PNPISABus = 14,
PNPBus = 15,
MaximumInterfaceType = 16
} INTERFACE_TYPE;

It seems to be that the value of PnpInterface must coincide with the field AdapterInterfaceType. That is why I have to use 0 in order to install and initialize the miniport in right way. Anyway, I cannot receive any SRB command and I don’t know why.

Thanks in advance.

Christian

IIRC PnPInterface is a bitmask and not the legacy bus type.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hi Gary,
>
> Yes, I tried 5 for the key PnpInterface in the INF file, but it didn’t work
because I initialized INTERFACE_TYPE AdapterInterfaceType as “Internal”, so I
have to use 0 instead of 5. As you can see in the enum INTERFACE_TYPE,
“Internal” is 0 and PCIBus 5:
>
> typedef enum _INTERFACE_TYPE
> {
> InterfaceTypeUndefined = -1,
> Internal = 0,
> Isa = 1,
> Eisa = 2,
> MicroChannel = 3,
> TurboChannel = 4,
> PCIBus = 5,
> VMEBus = 6,
> NuBus = 7,
> PCMCIABus = 8,
> CBus = 9,
> MPIBus = 10,
> MPSABus = 11,
> ProcessorInternal = 12,
> InternalPowerBus = 13,
> PNPISABus = 14,
> PNPBus = 15,
> MaximumInterfaceType = 16
> } INTERFACE_TYPE;
>
> It seems to be that the value of PnpInterface must coincide with the field
AdapterInterfaceType. That is why I have to use 0 in order to install and
initialize the miniport in right way. Anyway, I cannot receive any SRB command
and I don’t know why.
>
> Thanks in advance.
>
> Christian
>
>
>

No it is the legacy bus type.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:bounce-297124-
xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Saturday, August 11, 2007 3:54 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] SCSI miniport is not initialized

IIRC PnPInterface is a bitmask and not the legacy bus type.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> > Hi Gary,
> >
> > Yes, I tried 5 for the key PnpInterface in the INF file, but it
> didn’t work
> because I initialized INTERFACE_TYPE AdapterInterfaceType as
> “Internal”, so I
> have to use 0 instead of 5. As you can see in the enum INTERFACE_TYPE,
> “Internal” is 0 and PCIBus 5:
> >
> > typedef enum _INTERFACE_TYPE
> > {
> > InterfaceTypeUndefined = -1,
> > Internal = 0,
> > Isa = 1,
> > Eisa = 2,
> > MicroChannel = 3,
> > TurboChannel = 4,
> > PCIBus = 5,
> > VMEBus = 6,
> > NuBus = 7,
> > PCMCIABus = 8,
> > CBus = 9,
> > MPIBus = 10,
> > MPSABus = 11,
> > ProcessorInternal = 12,
> > InternalPowerBus = 13,
> > PNPISABus = 14,
> > PNPBus = 15,
> > MaximumInterfaceType = 16
> > } INTERFACE_TYPE;
> >
> > It seems to be that the value of PnpInterface must coincide with the
> field
> AdapterInterfaceType. That is why I have to use 0 in order to install
> and
> initialize the miniport in right way. Anyway, I cannot receive any SRB
> command
> and I don’t know why.
> >
> > Thanks in advance.
> >
> > Christian
> >
> >
> >
>
>
> —
> 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

Take a look a the “Question about virtual SCSI miniport” and Mark’s answer.
Change BOTH to PCI and then see if things start to work.

Gary G. Little

wrote in message news:xxxxx@ntdev…
> Hi Gary,
>
> Yes, I tried 5 for the key PnpInterface in the INF file, but it didn’t
> work because I initialized INTERFACE_TYPE AdapterInterfaceType as
> “Internal”, so I have to use 0 instead of 5. As you can see in the enum
> INTERFACE_TYPE, “Internal” is 0 and PCIBus 5:
>
> typedef enum _INTERFACE_TYPE
> {
> InterfaceTypeUndefined = -1,
> Internal = 0,
> Isa = 1,
> Eisa = 2,
> MicroChannel = 3,
> TurboChannel = 4,
> PCIBus = 5,
> VMEBus = 6,
> NuBus = 7,
> PCMCIABus = 8,
> CBus = 9,
> MPIBus = 10,
> MPSABus = 11,
> ProcessorInternal = 12,
> InternalPowerBus = 13,
> PNPISABus = 14,
> PNPBus = 15,
> MaximumInterfaceType = 16
> } INTERFACE_TYPE;
>
> It seems to be that the value of PnpInterface must coincide with the field
> AdapterInterfaceType. That is why I have to use 0 in order to install and
> initialize the miniport in right way. Anyway, I cannot receive any SRB
> command and I don’t know why.
>
> Thanks in advance.
>
> Christian
>
>
>

Hello Gary,

I aprreciate your help, but it work not entire at all. If I change both to PCIBus, SCSI miniport is also initialized correctly, but it still didn’t receive SRB commands from the system. I log strings at the entrance and at the end of the function but there is no LOG.

Something is but I don’t know what.

Any idea?

Thanks in advance,

Christian

If I understand correctly, you call ScsiportInitialize in DriverEntry
and your HwFindAdapter routine is called but your HwStartIo routine is
not called?

Also, this is a virtual scsiport, right? My experience is that
HwFindAdapter will not be called for a virtual miniport if there are no
hardware resources (port or memory registers) assigned to the device. If
there are resources assigned then HwFindAdapter will be called. Once
HwFindAdapter is called, and assuming you returned the appropriate
values, you should at least get called for inquiry data at HwStartIo.

My suggestion is to install a checked OS and turn on scsiport debug
prints and see if scsiport is complaining about anything, and then if
that doesn’t work try stepping through scsiport with the debugger.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@yahoo.com.ar
Sent: Monday, August 13, 2007 6:49 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] SCSI miniport is not initialized

Hello Gary,

I aprreciate your help, but it work not entire at all. If I change both
to PCIBus, SCSI miniport is also initialized correctly, but it still
didn’t receive SRB commands from the system. I log strings at the
entrance and at the end of the function but there is no LOG.

Something is but I don’t know what.

Any idea?

Thanks in advance,

Christian


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