Drive letter assignment on Win7

Is there any way to suppress the auto drive letter assignment in Win7, so that I can provide my own drive letters for the devices that i create? In xp/2k3 the letters are not assigned to me, and I can assign my own with either IoCreateSymboicLink or DefineDosDevice.

You could do it from an user application by using Virtual Disk service (Vds). IvdsVolumeMF Interface contains methods for working with AccessPath, which could be a driver letter. They are DeleteAccessPath and AddAccessPath.

Igor Sharovar

thanks for the reply Igor… so is this the proper way to assign drive letters to a virtual disk?

Vds could be used not only for virtual disk but also for real hardware storage including hard drive, CD ROM ect. You could also try to use Volume Management Functions - DeleteVolumeMountPoint and
SetVolumeMountPoint.

Igor Sharovar

Thanks for the reply Igor. How is it that the ramdisk sample can get away with using a symbolic link to create a drive letter then? I happen to be using IoCreateSymbolicLink, does WdfDeviceCreateSymbolicLink perhaps do something extra?

or could it be because they format themself… the extra drive letter assignment seens to be triggered when i attempt to format the drive…

>How is it that the ramdisk sample can get away with using a symbolic link to create a drive letter then?
You could use one of the methods which we discuss.

I happen to be using IoCreateSymbolicLink,
MSDN does not recommend to use IoCreateSymbolicLink
http://msdn.microsoft.com/en-us/library/aa490622.aspx
Try to use IoRegisterDeviceInterface as the documentation says.

Igor Sharovar

> -----Original Message-----

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@hotmail.com
Sent: Wednesday, January 20, 2010 12:58 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Drive letter assignment on Win7

>I happen to be using IoCreateSymbolicLink,
MSDN does not recommend to use IoCreateSymbolicLink
http://msdn.microsoft.com/en-us/library/aa490622.aspx
Try to use IoRegisterDeviceInterface as the documentation says.

It depends on driver type. Which is completely unclear from OP posts.
Above applies for PnP driver only which may not be the case.

Best regards,

Michal Vodicka
UPEK, Inc.
[xxxxx@upek.com, http://www.upek.com]

> or could it be because they format themself… the extra drive letter assignment seens to be

triggered when i attempt to format the drive…

Please read again my reply to you on the earlier thread - driver letter is associated with volume/partition, rather than disk. Once, in your particular case, formatting implies creation of partitions, the system (i.e. DISK.SYS)that creates a DO for every partition you report. As I already told you, creation of DO by a call to ClassCreateDevice() with DISK.SYS’s DRIVER_OBJECT as a parameter (i.e. the way DISK.SYS creates partitions) alone is sufficient for new volume ID and drive letter to appear in the registry - even if the target “partition” is, in actuality, completely bogus one with nothing to back it up in the target disk’s partition table…

Anton Bassov

It’s a WDF disk device that is enumerated on a WDF bus. I’ve tried all combinations of registering device interfaces with GUID_DEVINTERFACE_DISK and MOUNTDEV_MOUNTED_DEVICE_GUID, but the mount manager seems to ignore my suggested link names.

Anton, I guess I didn’t completely understand your post. Do you mean to say that if I call ClassCreateDevice before the OS does that I can control the drive letter assignment? This would be great. If you could elaborate on what ClassCreateDevice is, I’d greatly appreciate it.

Is it even possible to write a virtual disk that keeps it’s drive letters straight? Every example i find online has it’s own format in one form or another…

A virtual disk works in the level of storage drivers which doesn’t not manage assigning driver letter.
Assigning is probably done somewhere in Volume Manager which located higher in the driver stack than your driver.
You could also try to use IrpTracker to see what kind of Irp come when you assign driver letter. Probably this could help you.

Igor Sharovar

A virtual disk driver is not enough to do that. You need a App tool to do that.

Thanks
wayne

-----Original Message-----
From: xxxxx@hotmail.com [mailto:xxxxx@hotmail.com]
Sent: Friday, January 22, 2010 12:42 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Drive letter assignment on Win7

Is it even possible to write a virtual disk that keeps it’s drive letters straight? Every example i find online has it’s own format in one form or another…


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I guess I am being unclear… I do have an app that helps to assign drive letters - it’s just that that OS assigns a secondary drive letter when i go to format the disk. This happens no matter which of several methods I use to assign the drive letter. I noticed that all virtual disk apps that I could find do their own disk format - perhaps avoiding my problem all together - but I wish to be able to format NTFS and thus can not format my own disks… I would use an IRP tracker tool, but whatever is happening to me seems to be happening behind the scenes.