0
andll's Avatar, Join Date: Jul 2007
Light Poster
This class library uses windows API, too
0
rhaazy's Avatar, Join Date: Jul 2007
Go4Expert Member
Uhhh, ok?

If you still don't have an answer perhaps try asking a better question.

Go to google and do a search for "alternate file streams .NET"
0
andll's Avatar, Join Date: Jul 2007
Light Poster
Do i ask bad question?
I ask how to work with AFS without importing WinAPI, is it hard to understantd?
0
rhaazy's Avatar, Join Date: Jul 2007
Go4Expert Member
I admit I did not notice at first glance the part of your inquiry where you stated "without API" , however if you would have just said what you just said which is: "how do I work with AFS without using API?" then that would have been the appropriate question.

Code:
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 look around for ideas of more to use
 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"); 
 } 



}
0
rhaazy's Avatar, Join Date: Jul 2007
Go4Expert Member
forgot to add this little bit of information that may also help.

Check the MSDN doc's on deatail about PInvoke.