I’m a newbie on driver development, but !!! My boss ask me to develop a virtual harddisk driver… this is terrible…
Now I had a question about virtual disk drver :
there are three GUID defined by Microsoft:
(https://msdn.microsoft.com/en-us/library/windows/hardware/ff553426(v=vs.85).aspx)
Disk Drives
Class = DiskDrive
ClassGuid = {4d36e967-e325-11ce-bfc1-08002be10318}
This class includes hard disk drives. See also the HDC and SCSIAdapter classes.
Hard Disk Controllers
Class = HDC
ClassGuid = {4d36e96a-e325-11ce-bfc1-08002be10318}
This class includes hard disk controllers, including ATA/ATAPI controllers but not SCSI and RAID disk controllers.
SCSI and RAID Controllers
Class = SCSIAdapter
ClassGuid = {4d36e97b-e325-11ce-bfc1-08002be10318}
This class includes SCSI HBAs (Host Bus Adapters) and disk-array controllers.
I don’t know what is the difference between these GUIDs , which one should I use in the INF file?
Use the first (DiskDrive) but set the hardware ID on your own. Look at the Toaster sample inf file to have an example:
https://github.com/Microsoft/Windows-driver-samples/blob/master/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx
HDC and SCSIAdapter class members are bus drivers for disk drives. They enumerate disk drives that are connected on their slots.
You don’t need a bus driver, you can use the PNP Manager as your bus driver. Just have a wizard kind of application that ask the user for disk properties (like the size and path to the file on real disk) and then this wizard would create the devnode (virtual device) just like DEVCON does and then your driver is loaded with disk filter drivers like the partition manager (PARTMGR.SYS).
The VS2015 KMDF Template Driver is a perfect starting point for that purpose. Just edit the class GUID and the hardware ID in the generated inf file.
Once this is done, you can focus on disk specific I/O processing like IOCTLs and Read/Write operations. The template provides a general purpose I/O queue with an IOCTL handler. I think you will have to add an EvtIoRead and an EvtIoWrite handler to the queue configuration.
>My boss ask me to develop a virtual harddisk driver
There are MANY architectural choices that are possible, depending on the TYPE of virtual harddisk driver you need to write.
Your best choice MAY be to write a Virtual StorPort Miniport. If that’s possible, that would DEFINITELY be the approach I recommend.
Peter
OSR
@OSRDrivers