Jump to content
Sign in to follow this  

Place picture's data in an exe through ini -> ADS

Recommended Posts



An idea came to mind that I wanted to try out.

When you open an JPG in Notepad, you see lots of garbled code that is the basis of the picture.

I read something about ADS (Alternate Data Stream) and streaming data into an compiled .exe.

I though about combining those two.

I wanted to copy the code of the JPG, put it in an virtual ini and then stream it into the exe.

This does work partially.

The data from the file if read correctly with the help of the all-powerfull Jon:




Now I got the data of the picture.

For the ADS part. (ADS was also one of Valik's posts :) )

Unfortunally I read in some post of Valik that ini's have an limited capacity. Someone else did manage to get rid of that capacity with an homebrewed script, but wasn't what I wanted.

Besides the limitation, cause my small picture of a few bytes isn't causing limitation problems, I have an strange problem.

When I put the ini in the exe and then pull it out again, some data is gone. And the strange thing this time is that it isn't even some NULL character... Go figure...

Anyway, can someone help me compare the input against the output and manage to understand what is causing it? Pretty please? :)

Attached the script reduced version (I have an heavely commented out version for own purposes) and an small test JPG with which I test.

Thanks in advance!


My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post

Link to post
Share on other sites

Messy and fragile: Your OS has to support ADS, and the alternate data is often stripped during certain file operations. Risky business to hide additional data there, as even some anti-nasty programs will detect it as suspicious. Won't work on a lot of setups, so possibly not worth deploying unless you are certain of the environment it is being run under (such as a corporate setup with a SOE).

Suggestion: You may wish to explore more robust alternatives.

Share this post

Link to post
Share on other sites

ADS's doesn't transfer from file to file if you for example upload it to somewhere/send it to someone. I'm not even sure it transfers when you do a normal FileCopy().

Anyway, to be able to read and write binary data (example is NULL bytes) you must use the Binary Read/Write mode available in the FileOpen() function.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this