Hello.
I am writing a ramdisk WDM driver that should behave like a “physical disk”, so that disk.sys would recognize at is a disk, and part manager and ftdisk would be able to communicate with it, so I will be able to partition the disk, and do all the operations available on a real physical disk.
I wrote a bus driver, which creates a child PDO device representing a disk.
My problems are:
The device is created, and I can see that disk.sys has created a device
(\device\harddisk1\DRX) that attaches above it in the stack. I can also see it in the device manager as a new disk, but I can not see it through the “disk manager” application.
I have noticed several things:
I get IOCTL_SCSI_GET_ADDRESS several times, but because I am a ramdisk, I don’t have a “scsi” entry in the registry. I have looked into the classpnp source code that comes with the DDK, and it looks like it takes the results of IOCTL_SCSI_GET_ADDRESS, and opens “HKLM\HARDWARE\DEVICEMAP\Scsi\ScsiPortX…” according to the result I return. I have tried to manually add entries through regedit to “HKLM\HARDWARE\DEVICEMAP\Scsi\ScsiPortX…” in order to represent my device, but it fails with “Access Denied”.
Another thing I notice, is that when the device is created, and recognized by the pnp manager as a disk device, it starts getting initialized, I get IRP_MN_START_DEVICE,
After that I get IOCTL_DISK_GET_DRIVE_GEOMETRY, IOCTL_SCSI_GET_ADDRESS, and after that IRP_MN_REMOVE_DEVICE.
I am NOT deleting the PDO for my device with the remove request, because I am emulating a state where the physical disk is STILL PRESENT.
Next a new series of IRPs come like at the first time, but this time after the IRP_MN_START_DEVICE, i don’t get an IRP_MN_REMOVE_DEVICE.
Is this behavior normal? What can I understand from the device removal?
Does anybody know what are the requirements to interact with disk.sys and ftdisk, and being visible in the disk management utility as a disk?
Who manages the to “HKLM\HARDWARE\DEVICEMAP\Scsi\ScsiPortX…” keys? Who creates them?
Thanks -
John