How do I open \Device\HarddiskVolume1\test.txt in userspace?

I just can’t figure this out. My minifilter is shooting my userspace
service the filename ‘\Device\HarddiskVolume1\test.txt in userspace’ … But
I cannot figure out any way to open the file up. Is there a way to open
the file with this name? If not is there a way to reliably translate
‘\Device\HarddiskVolume1\test.txt in userspace’ into ‘c:\test.txt’

Thankyou for any help.

David

An unfortunate cut-and-paste mishap there. What I meant to say was:

I just can’t figure this out. My minifilter is shooting my userspace

service the filename ‘\Device\HarddiskVolume1\test.txt’ … But I cannot
figure out any way to open the file up. Is there a way to open the file
with this name? If not is there a way to reliably translate
‘\Device\HarddiskVolume1\test.txt in’ into ‘c:\test.txt’

Thankyou for any help.

David

On 4/4/06, David Hinkle wrote:
>
> I just can’t figure this out. My minifilter is shooting my userspace
> service the filename ‘\Device\HarddiskVolume1\test.txt in userspace’ … But
> I cannot figure out any way to open the file up. Is there a way to open
> the file with this name? If not is there a way to reliably translate
> ‘\Device\HarddiskVolume1\test.txt in userspace’ into ‘c:\test.txt’
>
> Thankyou for any help.
>
> David
>

Lookup on QueryDosDevice

I’m am reading up on QueryDosDevice to try and use it but it seems like it
fails in alot of cases, for example on dynamic disks people are complaing
that it is returning strings that do not match the strings the driver is
using. Are there work arounds for these problems?

David

On 4/4/06, Satya Das wrote:
>
> Lookup on QueryDosDevice
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
>
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Have a look in the Platform SDK for the Volume Management Functions,
there is a useful block of sample code hidden under a link on the
page describing FindFirstVolume().

One function you will be interested in that this sample code calls is
GetVolumeNameForVolumeMountPoint(). You should be able to map your
volume device string to a user mode drive letter using this function.

Mark.

At 11:37 PM 4/4/2006, David Hinkle wrote:

I’m am reading up on QueryDosDevice to try and use it but it seems
like it fails in alot of cases, for example on dynamic disks people
are complaing that it is returning strings that do not match the
strings the driver is using. Are there work arounds for these problems?

David

On 4/4/06, Satya Das
<mailto:xxxxxxxxxx@appstream.com> wrote:
>
>Lookup on QueryDosDevice
>
>—
>Questions? First check the IFS FAQ at
>https:https://www.osronline.com/article.cfm?id=17
>
>
>You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
>To unsubscribe send a blank email to
>mailto:xxxxxxxxxx@lists.osr.com
>
>
>— Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17 You are currently
>subscribed to ntfsd as: unknown lmsubst tag argument: ‘’ To
>unsubscribe send a blank email to xxxxx@lists.osr.com</mailto:xxxxx></https:></mailto:xxxxx>

Since this is a Windows FILESYSTEM mailing list, I’m going to suggest you fix the problem in your minifilter, instead of in your luser mode code.

If you return the volume GUID name instead of the kernel device name, you can use that in your service, and it will work with dynamic volumes, mount points, volumes without drive letters, etc.

I don’t know if the volume GUID name will be acceptable to fopen, but this is a WINDOWS filesystem mailing list.

  • Dan.

----- Original Message -----
From: David Hinkle
To: Windows File Systems Devs Interest List
Sent: Tuesday, April 04, 2006 4:05 PM
Subject: Re:[ntfsd] How do I open \Device\HarddiskVolume1\test.txt in userspace?

An unfortunate cut-and-paste mishap there. What I meant to say was:

I just can’t figure this out. My minifilter is shooting my userspace service the filename ‘\Device\HarddiskVolume1\test.txt’ … But I cannot figure out any way to open the file up. Is there a way to open the file with this name? If not is there a way to reliably translate ‘\Device\HarddiskVolume1\test.txt in’ into ‘c:\test.txt’

Thankyou for any help.

David

On 4/4/06, David Hinkle wrote:
I just can’t figure this out. My minifilter is shooting my userspace service the filename ‘\Device\HarddiskVolume1\test.txt in userspace’ … But I cannot figure out any way to open the file up. Is there a way to open the file with this name? If not is there a way to reliably translate ‘\Device\HarddiskVolume1\test.txt in userspace’ into ‘c:\test.txt’

Thankyou for any help.

David

— Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17 You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’ To unsubscribe send a blank email to xxxxx@lists.osr.com

How would I return the GUID name? And after I did that… Could I open it
with CreateFile in usermode?

On 4/4/06, Dan Kyler wrote:
>
> Since this is a Windows FILESYSTEM mailing list, I’m going to suggest
> you fix the problem in your minifilter, instead of in your luser mode code.
>
> If you return the volume GUID name instead of the kernel device name, you
> can use that in your service, and it will work with dynamic volumes, mount
> points, volumes without drive letters, etc.
>
> I don’t know if the volume GUID name will be acceptable to fopen, but this
> is a WINDOWS filesystem mailing list.
>
> - Dan.
>
>
> ----- Original Message -----
> From: David Hinkle
> To: Windows File Systems Devs Interest List
> Sent: Tuesday, April 04, 2006 4:05 PM
> Subject: Re:[ntfsd] How do I open \Device\HarddiskVolume1\test.txt in
> userspace?
>
> An unfortunate cut-and-paste mishap there. What I meant to say was:
>
> I just can’t figure this out. My minifilter is shooting my userspace
> > service the filename ‘\Device\HarddiskVolume1\test.txt’ … But I cannot
> > figure out any way to open the file up. Is there a way to open the file
> > with this name? If not is there a way to reliably translate
> > ‘\Device\HarddiskVolume1\test.txt in’ into ‘c:\test.txt’
> >
> > Thankyou for any help.
> >
> > David
> >
>
>
> On 4/4/06, David Hinkle wrote:
> >
> > I just can’t figure this out. My minifilter is shooting my userspace
> > service the filename ‘\Device\HarddiskVolume1\test.txt in userspace’ … But
> > I cannot figure out any way to open the file up. Is there a way to open
> > the file with this name? If not is there a way to reliably translate
> > ‘\Device\HarddiskVolume1\test.txt in userspace’ into ‘c:\test.txt’
> >
> > Thankyou for any help.
> >
> > David
> >
>
> — Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17 You are currently subscribed
> to ntfsd as: unknown lmsubst tag argument: ‘’ To unsubscribe send a blank
> email to xxxxx@lists.osr.com
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
>
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Get the volume GUID name with (of all things) FltGetVolumeGuidName. It will return something of the form:

??\Volume{big-hex-number}

Append the path without the \Device… crap to get:

??\Volume{big-hex-number}\test.txt

Pass the file name to your service the same way you do now.

Change the second character of the name from ? to \ and pass it to CreateFileW.

  • Dan.
    ----- Original Message -----
    From: David Hinkle
    To: Windows File Systems Devs Interest List
    Sent: Tuesday, April 04, 2006 5:24 PM
    Subject: Re: Re:[ntfsd] How do I open \Device\HarddiskVolume1\test.txt in userspace?

How would I return the GUID name? And after I did that… Could I open it with CreateFile in usermode?

On 4/4/06, Dan Kyler < xxxxx@privtek.com> wrote:
Since this is a Windows FILESYSTEM mailing list, I’m going to suggest you fix the problem in your minifilter, instead of in your luser mode code.

If you return the volume GUID name instead of the kernel device name, you can use that in your service, and it will work with dynamic volumes, mount points, volumes without drive letters, etc.

I don’t know if the volume GUID name will be acceptable to fopen, but this is a WINDOWS filesystem mailing list.

  • Dan.

----- Original Message -----
From: David Hinkle
To: Windows File Systems Devs Interest List
Sent: Tuesday, April 04, 2006 4:05 PM
Subject: Re:[ntfsd] How do I open \Device\HarddiskVolume1\test.txt in userspace?

An unfortunate cut-and-paste mishap there. What I meant to say was:

I just can’t figure this out. My minifilter is shooting my userspace service the filename ‘\Device\HarddiskVolume1\test.txt’ … But I cannot figure out any way to open the file up. Is there a way to open the file with this name? If not is there a way to reliably translate ‘\Device\HarddiskVolume1\test.txt in’ into ‘c:\test.txt’

Thankyou for any help.

David

On 4/4/06, David Hinkle wrote:
I just can’t figure this out. My minifilter is shooting my userspace service the filename ‘\Device\HarddiskVolume1\test.txt in userspace’ … But I cannot figure out any way to open the file up. Is there a way to open the file with this name? If not is there a way to reliably translate ‘\Device\HarddiskVolume1\test.txt in userspace’ into ‘c:\test.txt’

Thankyou for any help.

David

— Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17 You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’ To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’

To unsubscribe send a blank email to xxxxx@lists.osr.com

— Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17 You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’ To unsubscribe send a blank email to xxxxx@lists.osr.com

> service the filename ‘\Device\HarddiskVolume1\test.txt’ … But I cannot

In the kernel mode part, get the volume GUID name for the volume, and
substitute \Device\HarddiskVolume1 with this GUID name.

Then the user code should just use the FindNextVolumeMountPoint and similar
APIs.

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

>I don’t know if the volume GUID name will be acceptable to fopen

It will.

The name in the form of \?\Volume{guid}\path\file.ext is acceptable as a
pathname in any pathname-requiring function in Windows.

In fact, there was an MSDN Library chapter about file naming in Windows.

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