Drive letter for a GPT partition

Hi,

I am trying to mount a file system on a GPT partition. I can see the IRP_MN_MOUNT_VOLUME at the file system driver (already implemented) and I report STATUS_SUCCESS, but I don’t get any drive letter for the volume.

Can anyone tell me the sequence of steps that Windows uses to generate a drive letter, and what is the starting point of building a driver (pref. in the WDK samples) to tell Windows to create a drive letter? Ideally I would like it to work with Mount Manager, but that’s not really a priority.

Regards,
Mridul.

> Can anyone tell me the sequence of steps that Windows uses to generate a drive letter

  • the PnP interface instance of MOUNTDEV_MOUNTED_DEVICE_GUID is created
  • MountMgr listens for them and fires its code path after it is created
  • in the MountMgr code path, it queries the “mountdev ID” from the arrived device using an IOCTL
  • the arrived device returns the value
  • MountMgr looks at SYSTEM\MountedDevices registry and finds/creates the entry there
  • according to this entry, the volume GUID symlink is assigned (\?\Volume{guid}), and the drive letter.
  • the mapping of (MountDevID -> DriveLetter) or (MountDevID -> GUID) is persistent in SYSTEM\MountedDevices

For non-DynDisk volume on standard MBR disk device (dumb partition or NT4-style software RAID), the “mountdev ID” is 12 bytes (MBRSignature4B;PartitionOffset8B) tuple.

DynDisk uses its own layout.

Don’t know the GPT layout.

Standard disk removable media device uses the PnP interface name (a long undocumented PnP string with HW ID and other stuff) as mountdev ID.

create a drive letter?

Since you have standard disk partition below you, everything should work.

I would suggest to first solve the bug with mount failure, and only then return to drive letter stuff if it will still persist.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

Hi,
Thanks for the response. Sorry for the late reply but I was out sick.

Just clarifying:

So, if I have a file system driver that works correctly (as tested using a removable disk with just the volume header), then I do not need to do anything special to have Windows generate a drive letter for me if the volume is mounted on a GPT partition with a custom GUID?

In the past, I had to fake a Basic Windows Partition GUID for the GPT partition type to get a drive letter for my volume.

Regards,
Mridul.

> In the past, I had to fake a Basic Windows Partition GUID for the GPT partition type to get a drive

This is really a possibility, since, for MBR, for some MBR type values, the drive letters are not assigned. This is widely used by all kinds of vendor’s recovery partitions.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

This is useful for anyone following this discussion:

Only partitions of this type (PARTITION_BASIC_DATA_GUID) can be assigned drive letters, receive volume GUID paths, host mounted folders (also called volume mount points), and be enumerated by calls to FindFirstVolume and FindNextVolume.

Documentation for PARTITION_INFORMATION_GPT structure: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365449(v=vs.85).aspx

Regards,
Mridul.