> How can I determine during calling my volume filter’s AddDevice() on which disk resides constructing
volume.
IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS returns you the disk number(s) of the partition(s) which constitute the volume.
But beginning from Windows 7 following symlinks created later
Yes. I think pre-Win7 they were created in FtDisk’s device creation path which is triggered by partition arrival notification from PartMgr, and in Win7, it is later.
Also note that at least in some older Windows (pre-Vista) the Harddisk%d\Partition%d were created by the Disk.sys itself initially, and then overwritten by FtDisk to point to HarddiskVolume%d.
This is not about Harddisk%d\Partition0, which is always created by Disk even in Win7 and is a synonim for \.\PhysicalDrive%d.
\ArcName is created even later, after the boot driver stacks start. The kernel’s loader block from the boot loader contains the table of (ArcName->MBR Signature), then the kernel enumerates all known disks, reads their MBR signatures and matches against the table. If the disk is found - then all existing partitions on it are registered in \ArcName too by using DiskArcName+partition(%d) format.
Then the boot ARC name (passed by the loader) is matched against \ArcName, and the matching volume is registered as \SystemRoot.
As about the boot drive letter creation - the drive-letter-based Win32 path of SystemRoot is kept in NtSystemRoot global, which references some absolute hardcoded address (I believe this to be the “shared user data” page which is shared with user processes).
Pre-Win7, this address is updated from IoAssignDriveLetters or something like, which seems to access \ArcName for this.
In Win7, it is updated by MountMgr in the undocumented IOCTL path, and updated by MountMgr scanning all known drive letters, opening each one and checking for DO_SYSTEM_BOOT_PARTITION.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com