Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

NTFS file stream operations with ahk

  • Please log in to reply
1 reply to this topic
  • Members
  • 107 posts
  • Last active: Feb 01 2014 11:14 PM
  • Joined: 15 Oct 2006
After quite some digging (I would post a .zip with everything but I'm stuck with ~5 kbps modem link)and some experimenting, here's what I've got:
You CAN:) operate on NTFS file streams (streams are appended on file using name like this name:stream, google the web and you'll find plenty of articles).
Here's an example code, and it worked for me (please ignore uppercases, it's only for clarity of a comment):
SendMode Input 
;_____IfNotExist, c:\fproba 

lokacija1:="c:\a.txt:proba1.txt" ; ___FILE LOCATION, NTFS STREAM 1
lokacija2:="c:\a.txt:proba2" ; ___FILE LOCATION, NTFS STREAM 2
flokacija:="c:\fproba:f1a" ;; ___FOLDER LOCATION, NTFS STREAM for folder

; IfExist, %npr%:Summary* ;__________DETECT NTFS STREAM
; msgbox Stream X Detected! ;________THIS  I HAVENT

IfExist, %lokacija1% ;__________DETECT NTFS STREAM
msgbox File Stream 1 Detected!

IfExist, %lokacija2% ;__________DETECT NTFS STREAM
msgbox File Stream 2 Detected!

fileread, sadrzaj, %lokacija1%  ;_________________READ STREAM 1
	 if not ErrorLevel
       	    msgbox, File succesfully loaded!`nSize: %velicina% KB
	    msgbox, Loading stream 1 error!
	    ; ____exitapp

fileappend, ekstra1, %lokacija1% ;_________________WRITE CONTENTS IN STREAM 1
	if errorlevel
	msgbox, Stream 1 write error!

fileread, sadrzaj, %lokacija1%
msgbox stream1: %sadrzaj% ;_________________SEE CONTENTS OF STREAM 1

fileappend, ekstra2, %lokacija2% ;_________________WRITE CONTENTS IN STREAM 2
	if errorlevel
	msgbox, Stream 2 write error!

fileread, sadrzaj, %lokacija2%
msgbox stream2: %sadrzaj% ;_________________SEE CONTENTS OF STREAM 2

fileappend, ekstraF, %flokacija% ;_________________WRITE FOLDER'S STREAM!!!
	if errorlevel
	msgbox, F Stream write error!

msgbox, Stream 2 will now be deleted!

filedelete, %lokacija2%  ;_________________DELETE STREAM 2
	if errorlevel
	msgbox, Stream 2 delete error!

;loc:="c:\a.txt:1.exe" ;_____________EXE FILE EMBEDDED IN STREAM CAN BE RUN!!!
;run, %loc% 
I've used Stream explorer (freeware) to monitor file's streams.
Unfortunately, I haven't been able to detect or load SummaryInformation stream (summary tab in file properties right-click, it has some weird CLSID-named 0-byte stream attached with it also) with something like this
IfExist, %npr% 
 msgbox Stream X Detected!
(help! :( )
I hope this helps to get the whole thing cracked! :)

[Moderator's note: even if related to wish Setting-File-Attributes Function, not in right section, moved to Ask for Help.]

  • Members
  • 212 posts
  • Last active: Jan 06 2016 07:36 AM
  • Joined: 24 Dec 2011

how can I embed and exe file using this?