I am trying to add new functionality to a hard-coded exe of a game like adding new creatures and new spells and adding spells to creatures that did not have them before. For that I need to significantly modify the exe.

It should be theoretically possible to expand an exe file somehow by increasing its binary size. Browsing on the internet I have stumbled upon this tool:http://www.cgsoftlabs.ro/studpe.html

Since I am a RE and assembly newbie I do not get at all how this operates and how I could expand an exe using this.

I have heard about some tools that make this possible on Linux. Are there Windows equivalents?

Alternatively, maybe I could use some sort of dll injection to expand the .exe? Or maybe add functionality through some hooking?


Sure its possible to increase exe size (that's the trivial part) you just need to add new section to section table. I recommend CFF explorer IMHO the best PE view/edit tool. Invoke context menu from section headers (on the right side) to add new section then fill it with the code, data you want. Next you need to reverse the game and see how its structured and where to patch the code so it will jump to your code. For dll injection you could use Cheat engine they have a very nice tutorial but you still need to reverse the game and write injection code.dll.

| improve this answer | |
  • I tested it on a test.exe file that was written in c++. After realigning the file, it lost its libraries and was reduced to base PE size. How do I avoid losing libs when realigning? – Stanislaw T Nov 26 '15 at 13:10
  • I dont understand, why do you realign. Do you use CFF explorer ? it will do everything for you – krusty Nov 26 '15 at 13:37
  • Because I was trying to add a big chunk (8000h). I am using CFF explorer. – Stanislaw T Nov 26 '15 at 15:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.