In win32 App, NtQueryInformationFile only queried file name, how to get the volume name as well ?

Hello every one:
In my win32 app, I want to get the file name for a given file handle. I
tried to use the undocumented native api NtQueryInformationFile, but I
found, it can only get the full file name exclude the volume. then, how can
I get the obsolutely full path name for a given file handle by calling
NtQueryInformationFile? or is there another better way to do it ?

Thanks !

IoGetRelatedDeviceObject and then ObQueryNameString.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “OSR list” <tom_lyd>
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Wednesday, June 09, 2004 12:10 PM
Subject: [ntdev] In win32 App, NtQueryInformationFile only queried file name,
how to get the volume name as well ?

> Hello every one:
> In my win32 app, I want to get the file name for a given file handle. I
> tried to use the undocumented native api NtQueryInformationFile, but I
> found, it can only get the full file name exclude the volume. then, how can
> I get the obsolutely full path name for a given file handle by calling
> NtQueryInformationFile? or is there another better way to do it ?
>
> Thanks !
>
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com</tom_lyd>

But IoGetRelatedDeviceObject and then ObQueryNameString are exported by DDK,
so it can only be called in kernel mode, however, I must resolve i t in
application level.

Is there some problem with GetFullPathName?

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of OSR list
Sent: Wednesday, June 09, 2004 5:42 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] In win32 App, NtQueryInformationFile only
queried file name, how to get the volume name as well ?

But IoGetRelatedDeviceObject and then ObQueryNameString are
exported by DDK, so it can only be called in kernel mode,
however, I must resolve i t in application level.


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as:
xxxxx@hollistech.com To unsubscribe send a blank email to
xxxxx@lists.osr.com

I have only a file handle, not file name.

“OSR list” <tom_lyd> wrote in message news:xxxxx@ntdev…
> But IoGetRelatedDeviceObject and then ObQueryNameString
> are exported by DDK, so it can only be called in kernel
> mode, however, I must resolve i t in application level.

Errr - then you might be better off asking somewhere other
than a mailing list dedicated to kernel-mode programming …</tom_lyd>