2

I would like to make a simple windows installer to copy some files into the client's file system -that's all-. However, I would like to edit the main binary and insert the license code directly into it. Is there a way to do so from Innosetup? Sort like ....

sed -i 's/needle/replacement/g' targetfile

It is a Metatrader4 indicator.

Thank you!

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
flaab
  • 543
  • 9
  • 19

1 Answers1

2

You can do a simple string replace on the installed executable using LoadStringFromFile(), StringChange() and SaveStringToFile(). Note that your needle and the replacement have to be the exact same length otherwise the executable will be corrupted.

Deanna
  • 23,876
  • 7
  • 71
  • 156
  • Thank you! Is the replacement hexadecimal? Just for the record, it won't be corrupted since it's an .ex4 metatrader executable. All strings can be replaced without corruption, unlike other binaries. Anyway, I will be extremely careful to make the replacement precise. – flaab Mar 07 '12 at 13:56
  • No, it's ANSI characters but you can specify literal hex values in code. – Deanna Mar 07 '12 at 14:19