Sign in to follow this  
Followers 0
HyperVista

Self-Modifying EXE

6 posts in this topic

#1 ·  Posted (edited)

I want to reserve a data area within a script's exe, to define special variables (memory locations) within the exe that the script can read and write to, so that the script can update the variables and re-save itself as an .exe, such that the new values of these variables would be seen on subsequent execution(s) of the exe.

How to do this?

Edited by HyperVista

Share this post


Link to post
Share on other sites



There is no simple or effecient way to do this.

The only way I could think up was to FileInstall() the compiler within the executable and have it recompile the script and restart every time it needs to repack the variables.

Share this post


Link to post
Share on other sites

Why not just use a file to save your data, or the registry?

Lots of program use the registry, and it's really easy to create an ini file in the @Temp directory with the necessary information...


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Because it would be nice to only have to copy one file instead of two, and if (s)he used the registry, it would be harder to transport the variables to another computer.

I was there was an easier way.. :D

Share this post


Link to post
Share on other sites

Correct. Basically I want to execute a "use count" mechanism to determine how many times the script has been executed, without using a file or registry that can be tampered with. It would also allow the user to transfer the exe to another computer and still get credit for number of uses left. Another mechanism would be the date that the file was downloaded and provide an expiration date in combination with use count. To have this embedded within a compresses or obfuscated .exe would discourage piracy and avoid additional impact (registry and files) to the client's machine.

After reviewing current responses, one possible strategy might be to identify how to make a "hole" in the exe, for example, a string of spaces someplace; disassemble the exe and identify the address within the exe of the "data area"; and then do a binary read/write of the exe within the script to get and update the information when needed.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Correct. Basically I want to execute a "use count" mechanism to determine how many times the script has been executed, without using a file or registry that can be tampered with. It would also allow the user to transfer the exe to another computer and still get credit for number of uses left. Another mechanism would be the date that the file was downloaded and provide an expiration date in combination with use count. To have this embedded within a compressed or obfuscated .exe would discourage piracy and avoid additional impact (registry and files) to the client's machine.

After reviewing current responses, one possible strategy might be to identify how to make a "hole" in the exe, for example, a string of spaces someplace; disassemble the exe and identify the address within the exe of the "data area"; and then do a binary read/write of the exe within the script to get and update the information when needed.

Any help from the AutoIT honchos with regard to executables, compression, or obfuscation relevant here would be appreciated. I think such an API would be useful, perhaps someone can think of a stronger solution. Thanks.

(Sorry, there doesn't appear to be a way to delete posts you just made; so sorry for the duplication.)

Edited by HyperVista

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  
Followers 0