How can I decompile Windows EXE files to C or C++ code?

Any discussion of software that doesn't fit into any category goes here.
Post Reply
AlphaGameDeveloper
Posts: 4
Joined: Fri May 05, 2023 5:22 pm
Location: United states of America (Or my own imagination)
Contact:

How can I decompile Windows EXE files to C or C++ code?

Post by AlphaGameDeveloper »

I have a copy of Windows XP Minesweeper. Is there any software (ghidra?) that can decompile it to C or C++ code?

Thank you,
AlphaGameDeveloper
AlphaGameDeveloper
Certified Lunatic

My Links:
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Re: How can I decompile Windows EXE files to C or C++ code?

Post by MattKC »

If you just want a decompilation of Minesweeper, one was already completed over 3 years ago that you can download right now.

As for your actual question, the answer is no, there is no software that can just decompile an EXE into C/C++ code at this time.

But that's not to say decompilation is impossible - it is, and Ghidra is one of many tools that can help in doing so. It just can't be done automatically; it requires a tremendous amount of manual effort to achieve. Decompilation isn't like regular compilation where the code just passes through a program, it's more akin to manually translating a codebase from one language to another, where the original language happens to be heavily obfuscated and has no comments, variable names or function names.

Programs like Ghidra help because they try really hard to make sense of this "obfuscated" code (the compiled machine code) and represent it in C-like pseudocode that's easier for humans to read. However, it can only figure out so much on its own, it's up to you to figure out the rest. The more information you can give it, the better its pseudocode will be, and eventually you'll be able to reconstruct a compilable source tree from it. Like I said, it's all very possible, but extremely time consuming.

To put it in perspective, almost all of the most well-known decompilations like Super Mario 64 and GTA took years, even with a team of people. This Diablo decomp was done by one person, but reportedly took 3 years of their time while they were unemployed (presumably working on the decomp full time) to complete. But if you're not scared off by that kind of commitment, go for it!
Post Reply