Welcome to WinForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Logical Drive Name

 
   Win 2000/NT/98/ME (Home) -> File System RSS
Next:  Automatic site link bridging  
Author Message
Monty

External


Since: Oct 25, 2006
Posts: 3



(Msg. 1) Posted: Wed Oct 25, 2006 5:26 am
Post subject: Logical Drive Name
Archived from groups: microsoft>public>win2000>file_system (more info?)

i opend the harddisk like this

sHardDisk.Format("\\\\.\\PhysicalDrive1");

HANDLE hDevice =
CreateFile(sHardDisk,GENERIC_READ,......,0,OPEN_EXISTING,0,0);


then i read the Partition table using ReadFile
Everything is fine i can read all the partitions and extended
partitions directly from harddisk but my questions is

How can i find out the logical drive name corresponding to the
Partitions and extended
partitions that i read directly from hard disk?

Thank you in advance.

 >> Stay informed about: Logical Drive Name 
Back to top
Login to vote
Marc Kupper

External


Since: Sep 26, 2006
Posts: 10



(Msg. 2) Posted: Wed Oct 25, 2006 11:04 am
Post subject: Re: Logical Drive Name [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Monty wrote:
> i opend the harddisk like this
>
> sHardDisk.Format("\\\\.\\PhysicalDrive1");
> <snip>
> How can i find out the logical drive name corresponding to the
> Partitions and extended
> partitions that i read directly from hard disk?

The main challenge is that a drive letter can span multiple
physical disks and that a single physical disk can contain two or
more volumes.

Take a look at GetLogicalDriveStrings() and QueryDosDevice() to
get the volume names. Use IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
to translate from the volume names into physical device device
numbers. Insert "\\.\PhysicalDrive" in front of the numbers to
read from that physical disk.

Marc

 >> Stay informed about: Logical Drive Name 
Back to top
Login to vote
Monty

External


Since: Oct 25, 2006
Posts: 3



(Msg. 3) Posted: Wed Oct 25, 2006 10:41 pm
Post subject: Re: Logical Drive Name [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thank you for such a prompt and accurate reply

i wanted to read the MFT of individual drives, i had some sample code
that does it without logical drive names but now it seems the correct
way is to iterate all the drive names through GetLogicalDriveNames and
the read through QueryDosDevice and read the MFT

but i don't know how to read the MFT using QueryDosDevice and then
CreateFile
can you guide me or point me to some material that would provide more
detailed info

Thank you so much for your precious time

Marc Kupper wrote:

> Monty wrote:
> > i opend the harddisk like this
> >
> > sHardDisk.Format("\\\\.\\PhysicalDrive1");
> > <snip>
> > How can i find out the logical drive name corresponding to the
> > Partitions and extended
> > partitions that i read directly from hard disk?
>
> The main challenge is that a drive letter can span multiple
> physical disks and that a single physical disk can contain two or
> more volumes.
>
> Take a look at GetLogicalDriveStrings() and QueryDosDevice() to
> get the volume names. Use IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
> to translate from the volume names into physical device device
> numbers. Insert "\\.\PhysicalDrive" in front of the numbers to
> read from that physical disk.
>
> Marc
 >> Stay informed about: Logical Drive Name 
Back to top
Login to vote
Monty

External


Since: Oct 25, 2006
Posts: 3



(Msg. 4) Posted: Thu Oct 26, 2006 4:55 am
Post subject: Re: Logical Drive Name [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Also is there any other way except the use of
IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
thanks

Marc Kupper wrote:
> Monty wrote:
> > i opend the harddisk like this
> >
> > sHardDisk.Format("\\\\.\\PhysicalDrive1");
> > <snip>
> > How can i find out the logical drive name corresponding to the
> > Partitions and extended
> > partitions that i read directly from hard disk?
>
> The main challenge is that a drive letter can span multiple
> physical disks and that a single physical disk can contain two or
> more volumes.
>
> Take a look at GetLogicalDriveStrings() and QueryDosDevice() to
> get the volume names. Use IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
> to translate from the volume names into physical device device
> numbers. Insert "\\.\PhysicalDrive" in front of the numbers to
> read from that physical disk.
>
> Marc
 >> Stay informed about: Logical Drive Name 
Back to top
Login to vote
Marc Kupper

External


Since: Sep 26, 2006
Posts: 10



(Msg. 5) Posted: Thu Oct 26, 2006 5:16 pm
Post subject: Re: Logical Drive Name [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Monty wrote:
> i wanted to read the MFT of individual drives, i had some
> sample code that does it without logical drive names but now it
> seems the correct way is to iterate all the drive names through
> GetLogicalDriveNames and the read through QueryDosDevice and
> read the MFT

That depends on what you want to do. If you know you want to
read the MFT for C: then use QueryDosDevice() to translate "C:"
into a logical volume name. (no iteration is needed). Once you
have the logical volume name you open it with CreateFile() and
then pass the handle to DeviceIoControl() with
IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS to get the list of physical
device numbers. You can then convert the physical device numbers
into physical device names and your existing sample code should
work for reading the MFT if there's just one physical device and
I have no idea if your code supports spanned volumes.

I'd just write the code and show you but don't have time at the moment.

> Also is there any other way except the use of
> IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS

I don't know off hand but Google for
IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS registry
seems to find interesting stuff and a quick look with regedit finds
HKEY_LOCAL_MACHINE \ SYSTEM \ MountedDevices
Those look like Unicode strings and I suspect you can bypass at
least the call to QueryDosDevice() with this.

Marc
 >> Stay informed about: Logical Drive Name 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Drive letter Names - Does anyone know how I can change the parition drive letter (name) on the root directory? Going thorugh the disk manager the option is there however the OS will not let me change the letter. I am reading an error that I cannot rename the parition..

###### C Drive not visible - For some reason, There is no way to map C: drive of DC1 from any machine on network. The DC1 is still operational. On DC2, I can remotely start the Event Log on DC1, Manage DC1 and map d$ but not c$ on DC1. Nobody can logon locally, it logs you out..

Win 2000 Pro - Want to read Fat 32 Drive - I have just installed Windows 2000 Pro on a new hard drive. How can I copy all my data from the old Windows 98 Fat 32 drive to the new Windows 2000 Pro NTFS drive? Thank you for your assistance. Have a great day ... Ian

about drive remap? - I have a device with two drive(par.) one is cdrom, the other is normal usb disk. now, how can determine the drive of normal usb disk by a App from the cdrom?

Two devices per drive - I am running Win2K/SP4. I have an 80 GB IDE drive connected as chanell 0 master. It is the boot disk with only one NTFS partition spanning the entire disk. The label is "Sysyem". When I look at My Computer, I see only 1 disk icon. The same ...
   Win 2000/NT/98/ME (Home) -> File System All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum

Categories:
 Windows XP
 Windows Vista!
  Win 2000/NT/98/ME


[ Contact us | Terms of Service/Privacy Policy ]