> Thank you very much for the help. However, it will return me only Disk
number.
How I’m getting the PDEVICE_OBJECT of PDO?
\.\PhysicalDrive%d is a symlink to this PDO, substitute the disk number there.
Another way: get all Physical Disk device interfaces, open each of them,
call IOCTL_STORAGE_GET_DEVICE_NUMBER, and match to the number you learned from
the FtDisk’s volume device name.
More generally, how partition objects created by FtDisk and disk object
(created
by drivers like ATAPI, USB etc) are connected?
FtDisk is the so-called “volume manager”. Its device objects form a
separate PnP subtree not related to the disk’s subtree in any way. They are all
children of \Device\FtControl PDO, and \Device\FtControl PDO is created using
IoReportDetectedDevice.
So, you cannot use PnP to correlate the FtDisk’s \Device\HarddiskVolume%d
to, say, \Device\Harddisk%d\Partition%d.
Nevertheless, FtDisk is creating the \Device\HarddiskVolume%d device
objects on the basis of arrival notifications of the partition device objects
from PartMgr, and yes, FtDisk maintains the internal association (not a PnP
one) between \Device\HarddiskVolume%d and \Device\Harddisk%d\Partition%d.
Actually, read/write/IOCTL_DISK_xxx/IOCTL_STORAGE_xxx arrived to
\Device\HarddiskVolume%d are passed by FtDisk down to
\Device\Harddisk%d\Partition%d.
To discover this relation, query the disk number from
\Device\HarddiskVolume%d and then match to the disk/partition stacks.
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com