QueryDosDevice to kernel Mode

May be any QueryDosDevice equivalent for kernel mode ?

QueryDosDevice (user mode) converts C: to /devide/volume1 (example)

thanx in advance

What are you actually trying to accomplish by doing this?

  • S (Msft)

From: xxxxx@hotmail.commailto:xxxxx
Sent: ?1/?8/?2013 11:03
To: Windows File Systems Devs Interest Listmailto:xxxxx
Subject: [ntfsd] QueryDosDevice to kernel Mode

May be any QueryDosDevice equivalent for kernel mode ?

QueryDosDevice (user mode) converts C: to /devide/volume1 (example)

thanx in advance


NTFSD is sponsored by OSR

For our schedule of debugging and file system 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</mailto:xxxxx></mailto:xxxxx>

It?s useful to found what?s the real DOS path name

When i get ( /device/volume1/Progam Files/App ) i can convert to
( c:\program\files\app )

Using QueryDosDevice i can do any function to check what volume conrresponds to C-drive or D-drive , etc

see below, what is possible to do with QueryDosDevice:

( for user mode only )

if (QueryDosDevice(‘c:’, /dev/volume1’, 511) != 0) { // my drive is C: }

if (QueryDosDevice(‘d:’, /dev/volume1’, 511) != 0) { // my drive is D: }

if (QueryDosDevice(‘d:’, /dev/volume1’, 511) != 0) { // my drive is E: }

Hi Dorival,

I think you can just open a volume using its name by calling IoGetDeviceObjectPointer routine and then using RtlVolumeDeviceToDosName.

Regards,

Fernando Roberto da Silva
DriverEntry Kernel Development

What are you going to do with that information?

  • S (Msft)

From: xxxxx@hotmail.commailto:xxxxx
Sent: ?1/?8/?2013 11:21
To: Windows File Systems Devs Interest Listmailto:xxxxx
Subject: RE:[ntfsd] QueryDosDevice to kernel Mode

It?s useful to found what?s the real DOS path name

When i get ( /device/volume1/Progam Files/App ) i can convert to
( c:\program\files\app )

Using QueryDosDevice i can do any function to check what volume conrresponds to C-drive or D-drive , etc

see below, what is possible to do with QueryDosDevice:

( for user mode only )

if (QueryDosDevice(‘c:’, /dev/volume1’, 511) != 0) { // my drive is C: }

if (QueryDosDevice(‘d:’, /dev/volume1’, 511) != 0) { // my drive is D: }

if (QueryDosDevice(‘d:’, /dev/volume1’, 511) != 0) { // my drive is E: }


NTFSD is sponsored by OSR

For our schedule of debugging and file system 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</mailto:xxxxx></mailto:xxxxx>

I’m not sure why anyone in user mode would use this API in the first place. Why not use GetFinalPathNameByHandle? It’s a vastly better API for doing this - and provides you with unambiguous names that work in the presence of symbolic links, hard links, open by fileID and Object ID (and presumably people have noticed the new 256 bit file IDs for ReFS?)

Plus, it will give you volume GUID names that work independent of mount points - and it even works for volumes without drive letters. Or it will give you back some form of drive letter.

Tony
OSR

Break the first time he sees a mount point or symbolic link.

Tony
OSR