Let's sketch the picture.
Windows provides SCSI port (bus) driver. Driver creates FDO
for bus (FILE_DEVICE_BUS_EXTENDER
) and PDO
for each device connected to bus (FILE_DEVICE_MASS_STORAGE
). We "connect" mass storage devices to bus device inside PnP request handler.
Windows also provides class driver (for each device class) that is layered on top of port driver. It forms device stack with FDO
on top of PDO
for each child device.
Class driver sends internal ioctls to port driver; major function code is IRP_MJ_SCSI
, minor function code is IRP_MN_SCSI_CLASS
, SCSI_REQUEST_BLOCK
structure is filled in with request-specific information.
Port driver handles the communication with the device (move data from SRB to device/move data from device to SRB) and completes the request.
Now imagine we want to emulate scsi device. We need to develop "virtual SCSI port (bus)" driver. This driver will create FDO
for bus (FILE_DEVICE_BUS_EXTENDER
) and PDO
for each device that we will create (FILE_DEVICE_MASS_STORAGE
). We will handle internal ioctls, do irp queue management, move data to/from SRB, etc.
I want to understand what "condition" must be met in order to make Windows "think" that SCSI device is real (so that it will appear inside explorer, etc). Will class driver automatically send internal ioctls as soon as we create device or we need to emulate these requests either?
My questions might be silly but I need to grasp whats going on to understand more. Thank you for your help.