Drive letter assignment to new disk partition

Hi,

I am trying to partition hard disks on Windows 2000. I need to assign
drive letters after
creating the partitions. The only known parameter is the device name i.
e.
\device\harddisk1\partition1. Which is the best way to achieve this?

I tried using DefineDosDevice and SetVolumeMountPoint. But it is
successful in setting the drive letter only if
GetVolumeNameForVolumeMountPoint function returns volume name of form
"\?\Volume{GUID}". I want to create a partition with totally new
drive letter.

Please suggest the a way or point to the links to the samples.

Thanking in anticipation,
Deepali

Hi Deepali,

             I feel u and varsh are looking for the answer of the same question i would suggest to both of u to look in to the WMI for the same.

Good luck.



From: Deepali Bhagvat

>Reply-To: “NT Developers Interest List”
>To: “NT Developers Interest List”
>Subject: [ntdev] Drive letter assignment to new disk partition
>Date: Fri, 2 May 2003 19:17:44 +0530
>
>Hi,
>
>I am trying to partition hard disks on Windows 2000. I need to
>assign drive letters after
>creating the partitions. The only known parameter is the device name
>i. e.
>\device\harddisk1\partition1. Which is the best way to achieve this?
>
>I tried using DefineDosDevice and SetVolumeMountPoint. But it is
>successful in setting the drive letter only if
>GetVolumeNameForVolumeMountPoint function returns volume name of
>form "\?\Volume{GUID}". I want to create a partition with totally
>new drive letter.
>
>Please suggest the a way or point to the links to the samples.
>
>Thanking in anticipation,
>Deepali
>
>
>
>—
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to
>xxxxx@lists.osr.com


Still unmarried? Not for long. Find a life partner now

Hi Deepali,

             The more simpler approach is given like as follows:

You can assign a drive letter (for example, x:) to a local volume using SetVolumeMountPoint, provided there is no volume already assigned to that drive letter. If the local volume already has a drive letter then SetVolumeMountPoint will fail. To handle this, first delete the drive letter using DeleteVolumeMountPoint.

Windows 2000/XP: Allows at most one drive letter per volume, so you cannot have C:\ and F:\ pointing to the same volume.

Caution   Deleting an existing drive letter and assigning a new one may break existing paths, such as those in desktop shortcuts. It may also break the path to the program making the drive letter changes. With Windows virtual memory management, this may break the application, leaving the system in an unstable and possibly unusable state. It is the program designer’s responsibility to avoid such potential catastrophes.

NOTE:::::First get the GUID of ur volume and use above function. I was just wondering the i have gone thru this, but i've given that approach because the WMI is the most advanced approach to use.

good luck,

 

From: Deepali Bhagvat

>Reply-To: “NT Developers Interest List”
>To: “NT Developers Interest List”
>Subject: [ntdev] Drive letter assignment to new disk partition
>Date: Fri, 2 May 2003 19:17:44 +0530
>
>Hi,
>
>I am trying to partition hard disks on Windows 2000. I need to
>assign drive letters after
>creating the partitions. The only known parameter is the device name
>i. e.
>\device\harddisk1\partition1. Which is the best way to achieve this?
>
>I tried using DefineDosDevice and SetVolumeMountPoint. But it is
>successful in setting the drive letter only if
>GetVolumeNameForVolumeMountPoint function returns volume name of
>form "\?\Volume{GUID}". I want to create a partition with totally
>new drive letter.
>
>Please suggest the a way or point to the links to the samples.
>
>Thanking in anticipation,
>Deepali
>
>
>
>—
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to
>xxxxx@lists.osr.com


Visit Latin America. Discover! Explore! Experience it!

Hi Yogi,

Thanks for a quick response.

In fact, SetVolumeMountPoint works if the local volume already has a
drive letter and fails if the drive letter is not assigned to any
volumes. Calling DeleteVolumeMountPoint has no effect.
Here are the steps that I am following-

  1. Get the current volume parameters using GetVolumeMountPoint
  2. If GetVolumeMountPoint succeeds, call SetVolumeMountPoint function
    with the same GUID but different drive letter.
    I am successful in renaming the partitions in this case.
  3. If GetVolumeMountPoint doesn’t succeed, create a new GUID using
    CreateUuid and call SetVolumeMountPoint function with this GUID and a
    drive letter.
    I am not successful in naming the partitions in this case.

I also tried using WMI calls but no success again.
I am getting all the information related to disk partitions and logical
disks and their map. When I am trying to modify the drive letter of one
of the logical disks (that I already got) using the put method, the
local copy gets updated. Now I called PutInstance method with
WMI_UDATE_ONLY to update the WMI repository but this fails again.

Could you think of any flaws and suggest workarounds?

Thanks,
Deepali

On Friday, May 2, 2003, at 08:00 PM, yatindra vaishnav wrote:

Hi Deepali,

??? The more simpler approach is given like as follows:

You can assign a drive letter (for example, x:) to a local volume
using SetVolumeMountPoint, provided there is no volume already
assigned to that drive letter. If the local volume already has a drive
letter then SetVolumeMountPoint will fail. To handle this, first
delete the drive letter using DeleteVolumeMountPoint.

Windows 2000/XP: Allows at most one drive letter per volume, so you
cannot have C:\ and F:\ pointing to the same volume.

Caution??Deleting an existing drive letter and assigning a new one may
break existing paths, such as those in desktop shortcuts. It may also
break the path to the program making the drive letter changes. With
Windows virtual memory management, this may break the application,
leaving the system in an unstable and possibly unusable state. It is
the program designer’s responsibility to avoid such potential
catastrophes.

NOTE:::::First get the GUID of ur volume and use above function. I was
just wondering the i have gone thru this, but i’ve given that approach
because the WMI is the most advanced approach to use.

good luck,


>
> ?
>
>
>
> >From: Deepali Bhagvat
>
> >Reply-To: “NT Developers Interest List”
>
> >To: “NT Developers Interest List”
>
> >Subject: [ntdev] Drive letter assignment to new disk partition
>
> >Date: Fri, 2 May 2003 19:17:44 +0530
>
> >
>
> >Hi,
>
> >
>
> >I am trying to partition hard disks on Windows 2000. I need to
>
> >assign drive letters after
>
> >creating the partitions. The only known parameter is the device name
>
> >i. e.
>
> >\device\harddisk1\partition1. Which is the best way to achieve this?
>
> >
>
> >I tried using DefineDosDevice and SetVolumeMountPoint. But it is
>
> >successful in setting the drive letter only if
>
> >GetVolumeNameForVolumeMountPoint function returns volume name of
>
> >form "\?\Volume{GUID}". I want to create a partition with totally
>
> >new drive letter.
>
> >
>
> >Please suggest the a way or point to the links to the samples.
>
> >
>
> >Thanking in anticipation,
>
> >Deepali
>
> >
>
> >
>
> >
>
> >—
>
> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
>
> >To unsubscribe send a blank email to
>
> >xxxxx@lists.osr.com
>

>
<image.tiff>
>
> Visit Latin America. Discover! Explore! Experience it! —
> You are currently subscribed to ntdev as: xxxxx@oas.co.in
> To unsubscribe send a blank email to xxxxx@lists.osr.com</image.tiff>

Hi Deepali,

             Sorry for being late in answaring u for ur questions. R u using SDK? If yes then i’ll suggest u to look into the samples of the SDK provided by the microsoft. You will get proper insight for the problem what you are getting.

 

Good Luck,



From: Deepali Bhagvat

>Reply-To: “NT Developers Interest List”
>To: “NT Developers Interest List”
>Subject: [ntdev] Re: Drive letter assignment to new disk partition
>Date: Sat, 3 May 2003 18:45:52 +0530
>
>Hi Yogi,
>
>Thanks for a quick response.
>
>In fact, SetVolumeMountPoint works if the local volume already has a
>drive letter and fails if the drive letter is not assigned to any
>volumes. Calling DeleteVolumeMountPoint has no effect.
>Here are the steps that I am following-
>1. Get the current volume parameters using GetVolumeMountPoint
>2. If GetVolumeMountPoint succeeds, call SetVolumeMountPoint
>function with the same GUID but different drive letter.
>I am successful in renaming the partitions in this case.
>3. If GetVolumeMountPoint doesn’t succeed, create a new GUID using
>CreateUuid and call SetVolumeMountPoint function with this GUID and
>a drive letter.
>I am not successful in naming the partitions in this case.
>
>I also tried using WMI calls but no success again.
>I am getting all the information related to disk partitions and
>logical disks and their map. When I am trying to modify the drive
>letter of one of the logical disks (that I already got) using the
>put method, the local copy gets updated. Now I called PutInstance
>method with WMI_UDATE_ONLY to update the WMI repository but this
>fails again.
>
>Could you think of any flaws and suggest workarounds?
>
>Thanks,
>Deepali
>
>On Friday, May 2, 2003, at 08:00 PM, yatindra vaishnav wrote:
>
>>Hi Deepali,
>>
>> The more simpler approach is given like as follows:
>>
>>You can assign a drive letter (for example, x:) to a local volume
>>using SetVolumeMountPoint, provided there is no volume already
>>assigned to that drive letter. If the local volume already has a
>>drive letter then SetVolumeMountPoint will fail. To handle this,
>>first delete the drive letter using DeleteVolumeMountPoint.
>>
>>
>>
>>
>>
>>Windows 2000/XP: Allows at most one drive letter per volume, so you
>>cannot have C:\ and F:\ pointing to the same volume.
>>
>>Caution Deleting an existing drive letter and assigning a new one
>>may break existing paths, such as those in desktop shortcuts. It
>>may also break the path to the program making the drive letter
>>changes. With Windows virtual memory management, this may break the
>>application, leaving the system in an unstable and possibly
>>unusable state. It is the program designer’s responsibility to
>>avoid such potential catastrophes.
>>
>>
>>
>>NOTE:::::First get the GUID of ur volume and use above function. I
>>was just wondering the i have gone thru this, but i’ve given that
>>approach because the WMI is the most advanced approach to use.
>>
>>good luck,
>>
>>
>>
>>
>>
>>
>>
>> >From: Deepali Bhagvat
>>
>> >Reply-To: “NT Developers Interest List”
>>
>> >To: “NT Developers Interest List”
>>
>> >Subject: [ntdev] Drive letter assignment to new disk partition
>>
>> >Date: Fri, 2 May 2003 19:17:44 +0530
>>
>> >
>>
>> >Hi,
>>
>> >
>>
>> >I am trying to partition hard disks on Windows 2000. I need to
>>
>> >assign drive letters after
>>
>> >creating the partitions. The only known parameter is the device
>>name
>>
>> >i. e.
>>
>> >\device\harddisk1\partition1. Which is the best way to achieve
>>this?
>>
>> >
>>
>> >I tried using DefineDosDevice and SetVolumeMountPoint. But it is
>>
>> >successful in setting the drive letter only if
>>
>> >GetVolumeNameForVolumeMountPoint function returns volume name of
>>
>> >form "\?\Volume{GUID}". I want to create a partition with
>>totally
>>
>> >new drive letter.
>>
>> >
>>
>> >Please suggest the a way or point to the links to the samples.
>>
>> >
>>
>> >Thanking in anticipation,
>>
>> >Deepali
>>
>> >
>>
>> >
>>
>> >
>>
>> >—
>>
>> >You are currently subscribed to ntdev as: xxxxx@hotmail.com
>>
>> >To unsubscribe send a blank email to
>>
>> >xxxxx@lists.osr.com
>>
>
>>
><image.tiff>
>>
>>Visit Latin America. Discover! Explore! Experience it! —
>>You are currently subscribed to ntdev as: xxxxx@oas.co.in
>>To unsubscribe send a blank email to
>>xxxxx@lists.osr.com
>
>—
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to
>xxxxx@lists.osr.com
</image.tiff>


See the stars. Upclose! Bollywood photogallery.