Open alternate NTFS stream

I have a handle to an open file, and I need to open another named NTFS
stream on that same file. At the point in the code where I need to do
this, I only know the handle, not the filename. I tried using
NtQueryInformationFile for FileNameInformation to get the name, but that
provides the path without the drive letter. I’m doing this in user
mode, so I can’t use the file object to find the parent volume.

Anybody have any ideas?

–John

i’m not sure if this works, but perhaps you could do a relative open and
use the alternate stream name as the remaining path.

use the file handle as the root object when you create the object
attributes and just put the stream name in for the file name. normally
NTFS treats alternate streams as seperate entities, but it might allow
this sort of operation.

again it’s just a guess. someone else might be able to tell you a plan
they know works.

-p

This posting is provided “AS IS” with no warranties, and confers no
rights.


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of McNamee, John
Sent: Wednesday, June 23, 2004 7:07 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Open alternate NTFS stream

I have a handle to an open file, and I need to open another named NTFS
stream on that same file. At the point in the code where I need to do
this, I only know the handle, not the filename. I tried using
NtQueryInformationFile for FileNameInformation to get the name, but that
provides the path without the drive letter. I’m doing this in user
mode, so I can’t use the file object to find the parent volume.

Anybody have any ideas?

–John


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

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

The relative open works great – Thanks!

-----Original Message-----
From: Peter Wieland
Sent: Wednesday, June 23, 2004 11:08 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Open alternate NTFS stream

i’m not sure if this works, but perhaps you could do a relative open and
use the alternate stream name as the remaining path.

use the file handle as the root object when you create the object
attributes and just put the stream name in for the file name. normally
NTFS treats alternate streams as seperate entities, but it might allow
this sort of operation.

again it’s just a guess. someone else might be able to tell you a plan
they know works.

-p

This posting is provided “AS IS” with no warranties, and confers no
rights.


From: McNamee, John
Sent: Wednesday, June 23, 2004 7:07 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Open alternate NTFS stream

I have a handle to an open file, and I need to open another named NTFS
stream on that same file. At the point in the code where I need to do
this, I only know the handle, not the filename. I tried using
NtQueryInformationFile for FileNameInformation to get the name, but that
provides the path without the drive letter. I’m doing this in user
mode, so I can’t use the file object to find the parent volume.

Anybody have any ideas?

–John