what took me so much trouble is the value returned by backupread_() that doesn't return a zero when it is supposed to...
all that's left is figure out the relation between id and stream name, i don't see a 'deafult' stream named $data so i suppose stream id plays a role in there...
if you want to make multiple streams, try notepad from the prompt using: notepad test.txt:hidden_stream and have fun

Code: Select all
filename.s = "c:\test.txt"
file_h = CreateFile_(@filename, #GENERIC_READ, 0, 0, #OPEN_EXISTING, #FILE_FLAG_BACKUP_SEMANTICS, 0)
;
*buffer = AllocateMemory(4096)
*stream.WIN32_STREAM_ID = *buffer
;
context.l = 0
bytes_read.l = 0
;
Repeat
;
z = BackupRead_(file_h, *buffer, 20, @bytes_read, 0, 1, @context)
;
; dunno why, but sometimes backupread() returns a 1 when it should be zero, next if / endif fixes it
;
If bytes_read = 0
z = 0
EndIf
;
If z > 0
;
n+1
Debug ""
Debug "stream "+Str(n)
Debug "stream id "+Str( *stream\dwStreamID )
Debug "stream attributes %"+Bin( *stream\dwStreamAttributes )
;
size.l = *stream\dwStreamSizeLow + *stream\dwStreamSizeHigh *256*256*256*256
namesize.l = *stream\dwStreamNameSize
;
Debug "stream size "+Str(size)
Debug "name size "+Str(namesize)
;
If namesize > 0
BackupRead_(file_h, *buffer, namesize, @bytes_read, 0, 1, @context)
Debug "name... "+Str(bytes_read)
EndIf
If size > 0
BackupRead_(file_h, *buffer, size, @bytes_read, 0, 1, @context)
Debug "data..."+Str(bytes_read)
EndIf
EndIf
Until z = 0
;
BackupRead_(file_h, *buffer,0,@bytes_read,1,0,@context)
CloseHandle_(file_h)