Hello,

I use CreateFile() and "PHYSICALDRIVEx" to list disk drives, but how do I find the driveletter (assuming each disk has one
partition) ?

thx

Re: finding the driveletter of a disk drive by Mark

Mark
Mon Jan 30 18:42:24 CST 2006

On Mon, 30 Jan 2006 18:03:21 +0100, "Mark" <saruman@telenet.be> wrote:

>Hello,
>
>I use CreateFile() and "PHYSICALDRIVEx" to list disk drives, but how do I find the driveletter (assuming each disk has one
>partition) ?
>
>thx
>


Physical disks do not have drive letters. Volumes have drive letters
(or more precisely they have mount points, one of which might be a
'drive letter'.)



=====================
Mark Roddy DDK MVP
Windows Vista/2003/XP/2000 Consulting
Device and Filesystem Drivers
Hollis Technology Solutions 603-321-1032
www.hollistech.com

RE: finding the driveletter of a disk drive by Geoff

Geoff
Thu Mar 30 21:07:01 CST 2006

I used "GetLogicalDrives()" and with the help of 'P G Toby' here i managed to
iterate through the bits inside the function.

He wrote:
<<<<<<<<<<<<<<<<<
It
seems to me that, if you're getting back a 32-bit integer and you want to
know if bit 0 is set, you'd just do:

if ( result & 0x00000001 )
{
// Set.
}

If you have to iterate, shift a 1 bit across the 32-bit range and use & to
check for set.

int i;
int b;
for ( i = 0x00000001, b = 0; b < 32; i <<= 1, b++ )
{
if ( result & i )
{
// Bit #b is set.
}
}
<<<<<<<<<<<<<<<<<<<

The Result will be "GetLogicalDrives()"

Hope thats helpful.