NTFS备用数据流 - .NET数据流、NTFS、NET

由网友(很傻、很固执)分享简介:我将如何创建/删除/从.NET读/写/ NTFS备用数据流?How would I create/ delete/ read/ write/ NTFS alternate data streams from .NET?如果没有原生支持.NET,Win32 API中的我会用哪个?另外,我怎么会使用它们,因为我不认为这...

我将如何创建/删除/从.NET读/写/ NTFS备用数据流?

How would I create/ delete/ read/ write/ NTFS alternate data streams from .NET?

如果没有原生支持.NET,Win32 API中的我会用哪个?另外,我怎么会使用它们,因为我不认为这是记录?

If there is no native .NET support, which Win32 API's would I use? Also, how would I use them, as I don't think this is documented?

推荐答案

不要在.NET中:

http://support.microsoft.com/kb/105763

#include <windows.h>
   #include <stdio.h>

   void main( )
   {
      HANDLE hFile, hStream;
      DWORD dwRet;

      hFile = CreateFile( "testfile",
                       GENERIC_WRITE,
                    FILE_SHARE_WRITE,
                                NULL,
                         OPEN_ALWAYS,
                                   0,
                                NULL );
      if( hFile == INVALID_HANDLE_VALUE )
         printf( "Cannot open testfilen" );
      else
          WriteFile( hFile, "This is testfile", 16, &dwRet, NULL );

      hStream = CreateFile( "testfile:stream",
                                GENERIC_WRITE,
                             FILE_SHARE_WRITE,
                                         NULL,
                                  OPEN_ALWAYS,
                                            0,
                                         NULL );
      if( hStream == INVALID_HANDLE_VALUE )
         printf( "Cannot open testfile:streamn" );
      else
         WriteFile(hStream, "This is testfile:stream", 23, &dwRet, NULL);
   }
阅读全文

相关推荐

最新文章