fonic / wcdatool

Watcom Disassembly Tool (wcdatool) - Tool to aid disassembling DOS applications created with the Watcom toolchain
69 stars 7 forks source link

Question about recompiling #14

Open abdulahmad opened 10 months ago

abdulahmad commented 10 months ago

So is this code in a state to be recompiled once it has been decompiled? I'm not really an assembler programmer so I can't immediately tell.

Was surprised to see the output ad the line numbers/binary code as well-- is there a way to disable that? I assume you can't recompile the code with that in the code.

Also, I've noticed comments about "bad code" or "misplaced" code-- I assume this is something your script does? Would that affect trying to recompile the code?

fonic commented 10 months ago

Also, I've noticed comments about "bad code" or "misplaced" code-- I assume this is something your script does? Would that affect trying to recompile the code?

Yes, that would greatly affect the ability to recompile the code. All of those need to be eliminated first. See step 8 of the README.

Was surprised to see the output ad the line numbers/binary code as well-- is there a way to disable that? I assume you can't recompile the code with that in the code.

Since the main purpose when creating this tool was readability, I decided to keep this information as it is quite handy when investigating code. There's currently no option to turn that off, but a simple regex can be used to remove that, e.g. sed -i -E 's|^[0-9a-f ]+: [0-9a-f ]+ | |g' <file>

So is this code in a state to be recompiled once it has been decompiled? I'm not really an assembler programmer so I can't immediately tell.

No, it isn't. Recompilation is actually way harder than it sounds, as lots of necessary information (e.g. alignment) is lost when compiling sources to an executable (and thus that information is not available when reverse engineering, which is what wcdatool does).

I've had moderate success in recompiling MK1.EXE, but its structure is way simpler than MKTRIL.EXE. Plus, prior to refining wcdatool's output (again, step 8 of the README) it's not even worth trying.

fonic commented 10 months ago

You might also want to browse through #9 and #11, which contain answers to lots of questions regarding what the output means, what can be done with it and so on.