Executable file modification.

Coders and would-be coders alike, this is the place to talk about programming.
Post Reply
Kneesnap
n00b
Posts: 12
Joined: Wed Apr 05, 2017 9:01 pm
Has thanked: 1 time
Been thanked: 1 time

Executable file modification.

Post by Kneesnap » Mon Jun 05, 2017 8:22 am

I'm working on making an editor for an old PC game. I have a import / exporter working, so I can create / modify the custom files to my liking, but I am now realizing a hole in my plan. The executable has a file inside of it with information on each file in the game. I figured since I could open the executable in 7zip I could just edit the file and drop the new file in there. Turns out, when I try to do that I get an "Unsupported Operation" error. I figure I can just have my editor modify the executable itself and replace the old data.

I have a few questions:
a) What potential problems could I come into doing this? I don't have any experience meddling with executables before.
b) Are there any better ways / tools of doing this?

Gh0stBlade
Moderator
Posts: 672
Joined: Mon Jul 05, 2010 8:55 pm
Has thanked: 20 times
Been thanked: 304 times

Re: Executable file modification.

Post by Gh0stBlade » Mon Jun 05, 2017 5:36 pm

You have to be more clear.

The data that is contained within the exe contains what exactly? Offsets into the main archive file hardcoded? checksums?
Click the thanks button if I helped!

Kneesnap
n00b
Posts: 12
Joined: Wed Apr 05, 2017 9:01 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Executable file modification.

Post by Kneesnap » Mon Jun 05, 2017 7:07 pm

Gh0stBlade wrote:You have to be more clear.

The data that is contained within the exe contains what exactly? Offsets into the main archive file hardcoded? checksums?
The file "104" in the exe (file in question) is structured like this:

For each file in the game archive,

int - nameOffset (Points below, to the name of this file.)
int - fileCategory (Unsure what the purpose of this is, but it appears to categorize file types.)
int - fileType (Determines what type of file this is)
int - offset (The offset in the main game archive where the file is found.)
int - zero
int - zero
int - Raw Size
int - Uncompressed Size (If applicable)

Then after all of this it has the filename of each file in the archive.

Post Reply