Please help me to make source code from exe

M

Michael Dekson

Hello,
Can I exe file made in Microsoft Visual C++ decompile into source code.
If it is possibly please tell me how.
Thanks
 
L

lilburne

Michael said:
Hello,
Can I exe file made in Microsoft Visual C++ decompile into source code.
If it is possibly please tell me how.

What did MS technical support say?
 
N

Nils Petter Vaskinn

Can I exe file made in Microsoft Visual C++ decompile into source code.
If it is possibly please tell me how.

Offtopic here but:

For almost any compiler the answer is no. There could theoretically be a
compiler out there that leaves enough unnessesary data in the executable
to be able to reconstruct the source, but I don't know of any.

What you probably could get out is the assembly. And then maybe that could
be converted to C code that does the same job as the original code, but
I've seen such assembly -> C and it's not pretty, and it doesn't resemble
the original code much.

If it had been possible don't you think a google search would have given
you a ton of utilities to do it. If it had been possible do you think
anyone would even have bothered with copy protection?
 
T

Thomas Matthews

Michael said:
Hello,
Can I exe file made in Microsoft Visual C++ decompile into source code.
If it is possibly please tell me how.
Thanks

Here is how to do it:
1. Find the format of the executable file.
Try http://www.wotsit.org
2. Parse the header section of the executable file. Extract
and retain important information.
3. Point to the first instruction data.
4. Read in the instruction data and convert into an assembly
language statement. Display all numeric quantities in hex.
Also, keep track of the addresses. You will need this
information for creating labels for all the loops, function
calls.
5. Output the instruction into a text file.
6. Repeat steps 4 & 5 for all executable bytes in the file.
7. Once the assembly language file is created, parse it looking
for patterns, such as for-loops, while and do-while loops.
Also scan for function prologue (i.e. parameter passing,
local variable allocation) and function epilog.
Once a pattern is found, output it to another text file,
which will be your C source file.

Some notes:
1. Devise some scheme for nameing variables and functions.
2. Recognize the difference between char, int, float and
double representations in memory.
3. Research the operating system. Create a table of
operating system call sequences and their function
names. This will come in handy as you improve your
program to list operating system calls.
4. Along the same lines, research the call sequences for
the C and C++ library routines. You'll need this to
translate the calls to offsets into more readable
function names.
5. The resultant code has a high probability of looking
nothing like your original source code; or an readable
source code.
6. Always test your utility by running your assembly language
output through an assembler and compiling your source
program.
7. Some operating systems have dynamic libraries. Learn how
to recognize the activation of dynamic library functions.
8. Let nobody fool you about turning hamburger back into a
cow. That analogy doesn't apply; as one _can_ convert an
executable into a source file.

This is an excellent project. I personally have other projects
to work on, which is why I'm not doing this.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 
H

Howard

Thomas Matthews said:
cow. That analogy doesn't apply; as one _can_ convert an
executable into a source file.

This is an excellent project. I personally have other projects
to work on, which is why I'm not doing this.

Excellent project? It's a fool's project!

The "source code" you produce will in no way resemble the original source
code. You have no way to know how the original objects were distributed
amonst the various compilation units, what any of the objects were named,
what namespaces were defined, what was statically linked against, etc. Any
number of variations of code might produce a given snippet of assembler.
Especially after optimizations have taken place!

It would probably be easier and quicker to write your own program that
imitated the actions and appearance of the one you're trying to hack. Just
look at all the work involved in what you've described.

What possible use would it be to do all that? To get around
copy-protection? Good luck...some of what you'll try to disassemble will be
encoded and you won't even notice it until you analyze every last bit of the
"source" you've supposedly generated, only to realize that, once run, some
of that source itself would have been decoded into something entirely
different!

Do you want to change the behavior of some program to fit your desires?
Write your own program to do what you want. If you're capable of all the
analysis and work needed to make the "source code" as described in this
post, you're quite capable of writing the whole app yourself.

But of course, it's your time. Try doing what was described on a simple
"Hello world" console app. Or better yet, go a step beyond that and try the
same thing on a "Hello world" Windows app using VC++ and MFC objects and a
dialog resource. Then come back and let us know what your re-created source
looks like. See you in six months...

-Howard
 
T

Thomas Matthews

Howard said:
Excellent project? It's a fool's project!

The "source code" you produce will in no way resemble the original source
code. You have no way to know how the original objects were distributed
amonst the various compilation units, what any of the objects were named,
what namespaces were defined, what was statically linked against, etc. Any
number of variations of code might produce a given snippet of assembler.
Especially after optimizations have taken place!

It would probably be easier and quicker to write your own program that
imitated the actions and appearance of the one you're trying to hack. Just
look at all the work involved in what you've described.

What possible use would it be to do all that? To get around
copy-protection? Good luck...some of what you'll try to disassemble will be
encoded and you won't even notice it until you analyze every last bit of the
"source" you've supposedly generated, only to realize that, once run, some
of that source itself would have been decoded into something entirely
different!

Do you want to change the behavior of some program to fit your desires?
Write your own program to do what you want. If you're capable of all the
analysis and work needed to make the "source code" as described in this
post, you're quite capable of writing the whole app yourself.

But of course, it's your time. Try doing what was described on a simple
"Hello world" console app. Or better yet, go a step beyond that and try the
same thing on a "Hello world" Windows app using VC++ and MFC objects and a
dialog resource. Then come back and let us know what your re-created source
looks like. See you in six months...

-Howard

I agree that this is a huge task, far beyond what the
OP has imagined. I was just answering his/her question.
Perhaps the OP will consider other alternatives, rather
than keep posting the same question.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 
M

Mike Wahler

Howard said:
Excellent project? It's a fool's project!

If attempted by a novice with the objective of reverse engineering,
I agree. But I think it *is* a good intellectual exercise.

-Mike
 
J

jeffc

Howard said:
Excellent project? It's a fool's project!

The "source code" you produce will in no way resemble the original source
code.

Dude, relax. He said the same thing himself. Nonetheless, he's obviously
put a lot of thought into it and it sounds like a very interesting project
to me to.
What possible use would it be to do all that? To get around
copy-protection?

Who said it has anything to do with getting around copy protection? Some
people just have more active minds than others.
 
A

Albert van der Horst

Hello,
Can I exe file made in Microsoft Visual C++ decompile into source code.

It is easy to see that you never can have the original source back.
The most important parts, the comment and the informative names
the programmer gave to local variables, are lost. With inlining,
also the division of the work over modules is lost.

If all you want to do is get rid of the wormholes in Internet Explorer:
1. disassemble to machine code
2. fix wormholes
3. reassemble

The 80i86 assembler is much easier to understand than any extremely
contorted C++ code that results from going one step further.

Aka IE, it is much easier to install an alternative program
without the wormholes.
If it is possibly please tell me how.

It would help if you tell us your perspective on this.
Is it one of climbing the Mount Everest, having a good time,
doing home work or ripping off software vendors?

Groetjes Albert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,161
Messages
2,570,892
Members
47,428
Latest member
RosalieQui

Latest Threads

Top