One of the neat features of the NT File System is its capacity to work with file streams. File Streams are extensions of the File Contents. Right Click on a file in an NTFS Hard Disk and you will find a "Summary" tab which has fields such as "Title', "Author", "Comments". To read and write from these fields (streams), I have not been able to do so, yet. If any of you can or have an idea, please post in the following thread.

http://www.vbforums.com/showthread.p...hreadid=247931

However, the code below will create named streams and add/retrieve data to those streams. Usages could range from maintaining a "Folder" in a Single File, Storing Security Settings, "Piggy Back" hidden applications, etc. Note that incorrect file sizes (a zero byte file as displayed in Windows Explorer can have Y MB of data in various streams) is a drawback using such a technique.
VB Code:
  1. 'Stream are accessed as normal files
  2. 'but using FILENAME:STREAMNAME as the file's name
  3. Option Explicit
  4. Private Sub Command1_Click()
  5. Dim strFileName As String
  6. Dim intFN As Integer
  7. Dim strTemp As String
  8.  
  9. strFileName = "D:\text.txt"
  10.  
  11. intFN = FreeFile
  12. Open "D:\Winnt\notepad.exe" For Binary As #intFN
  13.     strTemp = Space(LOF(1))
  14.     Get #1, , strTemp
  15. Close #intFN
  16.  
  17. WriteStream strFileName, "Author", "Kaushik Janardhanan"
  18. WriteStream strFileName, "Category", "VB Code Snippets"
  19. WriteStream strFileName, "Comments", "This stuff is really usefull!"
  20. WriteStream strFileName, "Title", "NTFS File Streams"
  21. WriteStream strFileName, "Reference", "VBFORUMS-1234"
  22. WriteStream strFileName, "Executable", strTemp
  23.  
  24. MsgBox "Author" & vbCrLf & ReadStream(strFileName, "Author") & _
  25. vbCrLf & vbCrLf & _
  26. "Category" & vbCrLf & ReadStream(strFileName, "Category") & _
  27. vbCrLf & vbCrLf & _
  28. "Comments" & vbCrLf & ReadStream(strFileName, "Comments") & _
  29. vbCrLf & vbCrLf & _
  30. "Title" & vbCrLf & ReadStream(strFileName, "Title") & _
  31. vbCrLf & vbCrLf & _
  32. "Reference" & vbCrLf & ReadStream(strFileName, "Reference")
  33.  
  34. Shell strFileName & ":Executable", vbMaximizedFocus
  35. Unload Me
  36.  
  37. End Sub
  38.  
  39. Private Sub WriteStream(strFile As String, strStream As String, strContents As String)
  40. Dim intFN As Integer
  41.  
  42. intFN = FreeFile
  43.  
  44. Open strFile & ":" & strStream For Binary As #intFN
  45.     Put #intFN, , strContents
  46. Close #intFN
  47.  
  48. End Sub
  49.  
  50. Private Function ReadStream(strFile As String, strStream As String) As String
  51. Dim intFN As Integer
  52. Dim strTemp As String
  53.  
  54. intFN = FreeFile
  55.  
  56. Open strFile & ":" & strStream For Binary As #intFN
  57.     strTemp = Space(LOF(intFN))
  58.     Get #intFN, , strTemp
  59. Close #intFN
  60.  
  61. ReadStream = strTemp
  62.  
  63. End Function
This author has just recently encountered the above. Please do respond with details of any inaccuracies, inconsistencies and possible suggestions for improvements, usages, etc.

For a brief introduction to NTFS Filestreams, please visit http://www.msdnaa.net/Resources/Dis...sID=569#sample1

Thank you

Regards

Kaushik Janardhanan