PSCSI_PORT_LUN_EXTENSION LunExtension;
PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
- DPRINT ("SpiSendInquiry() called\n");
+ DPRINT("SpiSendInquiry() called\n");
DeviceExtension = (PSCSI_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
SenseBuffer = ExAllocatePoolWithTag(NonPagedPool, SENSE_BUFFER_SIZE, TAG_SCSIPORT);
if (SenseBuffer == NULL)
{
- ExFreePool(InquiryBuffer);
+ ExFreePoolWithTag(InquiryBuffer, TAG_SCSIPORT);
return STATUS_INSUFFICIENT_RESOURCES;
}
if (Irp == NULL)
{
DPRINT("IoBuildDeviceIoControlRequest() failed\n");
- return STATUS_INSUFFICIENT_RESOURCES;
+
+ /* Quit the loop */
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ KeepTrying = FALSE;
+ continue;
}
/* Prepare SRB */
InquiryBuffer,
INQUIRYDATABUFFERSIZE);
+ /* Quit the loop */
Status = STATUS_SUCCESS;
KeepTrying = FALSE;
continue;
(Srb.DataTransferLength > INQUIRYDATABUFFERSIZE) ?
INQUIRYDATABUFFERSIZE : Srb.DataTransferLength);
+ /* Quit the loop */
Status = STATUS_SUCCESS;
KeepTrying = FALSE;
}
/* LUN is not valid, but some device responds there.
Mark it as invalid anyway */
+ /* Quit the loop */
Status = STATUS_INVALID_DEVICE_REQUEST;
KeepTrying = FALSE;
}
}
else
{
- /* That's all, go to exit */
+ /* That's all, quit the loop */
KeepTrying = FALSE;
/* Set status according to SRB status */
}
/* Free buffers */
- ExFreePool(InquiryBuffer);
- ExFreePool(SenseBuffer);
+ ExFreePoolWithTag(InquiryBuffer, TAG_SCSIPORT);
+ ExFreePoolWithTag(SenseBuffer, TAG_SCSIPORT);
DPRINT("SpiSendInquiry() done with Status 0x%08X\n", Status);
}
/* Set 'Type' (REG_SZ) value */
+ /*
+ * See https://docs.microsoft.com/en-us/windows-hardware/drivers/install/identifiers-for-ide-devices
+ * and https://docs.microsoft.com/en-us/windows-hardware/drivers/install/identifiers-for-scsi-devices
+ * for a list of types with their human-readable forms.
+ */
switch (LunExtension->InquiryData.DeviceType)
{
case 0:
case 2:
TypeName = L"PrinterPeripheral";
break;
+ // case 3: "ProcessorPeripheral", classified as 'other': fall back to default case.
case 4:
TypeName = L"WormPeripheral";
break;
TypeName = L"MediumChangerPeripheral";
break;
case 9:
- TypeName = L"CommunicationPeripheral";
+ TypeName = L"CommunicationsPeripheral";
+ break;
+
+ /* New peripheral types (SCSI only) */
+ case 10: case 11:
+ TypeName = L"ASCPrePressGraphicsPeripheral";
break;
+ case 12:
+ TypeName = L"ArrayPeripheral";
+ break;
+ case 13:
+ TypeName = L"EnclosurePeripheral";
+ break;
+ case 14:
+ TypeName = L"RBCPeripheral";
+ break;
+ case 15:
+ TypeName = L"CardReaderPeripheral";
+ break;
+ case 16:
+ TypeName = L"BridgePeripheral";
+ break;
+
default:
TypeName = L"OtherPeripheral";
break;