Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
How to access NTFS streams?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.sdk.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Rado Mroz
On Beta 2 I was able to access NTFS streams. I.e.,
File.Exists("d:\\filename:AFP_Resource") returned true.

:AFP_Resource, :AFP_AfpInfo and :Comments are 3 streams where Mac File
Services store Macintosh file forks. The file I check is on NTFS partition
and has given stream (I checked in command prompt with 'more
<filename:AFP_Resource')

However, in final version of SDK I cannot access NTFS streams. File,
FileInfo and FileStream classes throw System.NotSupportedException
('Additional information: The given path's format is not supported').

Is there any way to access those NTFS streams (preferably C#)?

Thanks,

Rado

Reply to this message...
Vote that this is a GOOD answer...
 
Auto-following on Twitter
Ubuntu and XP on one “desktop”
 
    
Willy Denoyette [MVP] (VIP)
NTFS Streams are not supported, but you can get access to them using PInvoke.

Willy.

"Rado Mroz" <Click here to reveal e-mail address> wrote in message news:ON7T$XeuBHA.1892@tkmsftngp03...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Rado Mroz
Just one more question - how do you know NTFS streams are not supported?
They were supported in Beta 2 and the list of API changes doesn't mention
it.

Rado

"Willy Denoyette [MVP]" <Click here to reveal e-mail address> wrote in message
news:u480RmiuBHA.1596@tkmsftngp07...
> NTFS Streams are not supported, but you can get access to them using
PInvoke.
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Willy Denoyette [MVP] (VIP)
This is a quote from Chris Anderson (FX DEV) Microsoft.
<<
Due to our string based file name comparison model, file name aliasing presents a major and complicated issue. This complexity is
increased by the operating system's ability to use pluggable file systems. Therefore, to reduce the scope of this issue we do not
support some features of certain file systems. This currently includes NTFS streams. The full range of OS supported file
operations is still available via P/Invoke to the appropriate APIs.

Chris Anderson
This posting is provided "AS IS" with no warranties, and confers no rights.
>>

Willy.

"Rado Mroz" <Click here to reveal e-mail address> wrote in message news:e7rj43kuBHA.1020@tkmsftngp07...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Rado Mroz
Thanks,

Rado

"Willy Denoyette [MVP]" <Click here to reveal e-mail address> wrote in message
news:evMiJDsuBHA.1608@tkmsftngp04...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
Outlook interop - stopping user properties appearing on Outlook message print
Seriously, why is “cut and paste” majorly newsworthy???
 
    
Rado Mroz
How? Where can I find more info?

Rado

"Willy Denoyette [MVP]" <Click here to reveal e-mail address> wrote in message
news:u480RmiuBHA.1596@tkmsftngp07...
> NTFS Streams are not supported, but you can get access to them using
PInvoke.
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Willy Denoyette [MVP] (VIP)
Here is a small sample how to check for the presence of a Multi stream file.

Check the MSDN doc's on deatail about PInvoke.

using System;
using System.Runtime.InteropServices;
class TestNTFSStream
{
[DllImport("kernel32.dll")]
public static extern IntPtr CreateFile( string lpFileName, int dwDesiredAccess, int dwShareMode,
IntPtr lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, IntPtr hTemplateFile );
// some constants see Platform-SDK for others

private const int FILE_SHARE_READ = 1;
private const int OPEN_EXISTING = 3;
private const int INVALID_HANDLE_VALUE = -1;

static void Main(string[] args)
{
//Try to open the file for read only
IntPtr hflp = CreateFile( @"c:\filename:AFP_Resource", 0, FILE_SHARE_READ, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero );
if( (int)hflp == INVALID_HANDLE_VALUE )
Console.WriteLine("No such file/stream");
else
Console.WriteLine("File found");
}

}

Willy.

"Rado Mroz" <Click here to reveal e-mail address> wrote in message news:enGdIFjuBHA.2156@tkmsftngp02...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Rado Mroz
I've got it working again.

Thanks,

Rado

"Willy Denoyette [MVP]" <Click here to reveal e-mail address> wrote in message
news:Owm#u6kuBHA.1460@tkmsftngp05...
> Here is a small sample how to check for the presence of a Multi stream
file.
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
Email Archiving and Email Filing - what’s the difference?
Web-based task/todo list management
 
 
System.Console
System.IntPtr
System.IO.File
System.IO.FileInfo
System.IO.FileStream
System.NotSupportedException




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734