|  |
06-12-2006, 05:48 PM
|
#1 (permalink)
|
Newb Techie Join Date: Nov 2004 Posts: 7
| C++ If you have an executable file that was compiled, is there a way to view the source code? |
| |
06-12-2006, 11:00 PM
|
#2 (permalink)
|
Software Developer Join Date: Mar 2006 Location: Columbus, OH Posts: 569
| You'll have to find a decompiler. |
| |
06-14-2006, 03:39 PM
|
#3 (permalink)
|
CECS Major Join Date: Jul 2005 Location: Louisville, KY Posts: 387
| To undo it a decompiler is necessary as jaeusm said, !!but!! good programmers always save a ".cpp" file so they do not have to go through this hassel. Remembering to always save your source code is a good practice when programming. (Of course, if you didn't create the file then this would be not be possible unless an "open source" version was up for grabs).
::-Chase-:: |
| |
06-15-2006, 12:47 PM
|
#4 (permalink)
|
Junior Techie Join Date: Dec 2004 Posts: 88
| Can a decompiler decompile anything, including obfuscated and protected exes and dlls? I am not sure but i dont think that a decompiler will help in most case where the code has been made by a good developer and copyrighted.
__________________ Somewhere I Belong... |
| |
06-15-2006, 03:25 PM
|
#5 (permalink)
|
Ultra Techie Join Date: Jul 2005 Posts: 530
| A decompiler will be completely useless, for the most part, on a C++ executable. Unless, that is, you are a pro at deciphering assembly language with no semantic information.
__________________ Desktop machine: 2 x Opteron 246, Asus K8N-DL, 2GB PC3200 ECC Reg., XFX GeForce 6600GT, 74gb WD Raptor, 2 x 19\" LCDs, Windows XP x64
Server machine: Intel P4 3.0GHz 2MB EM64T, ECS i865pe, 1GB PC3200, 36gb WD Raptor, Windows Server 2003
Laptop: Dell Inspiron 9100 (Intel P4 3.2GHz 1MB Prescott, i865pe, 512MB PC3200, Mobility Radeon 9700, DVD+R/DL Burner), Windows XP
Linux: P3 450Mhz, 386MB ram, Slackware 10.1 (Running mySQL/Apache) |
| |
06-15-2006, 06:42 PM
|
#6 (permalink)
|
Software Developer Join Date: Mar 2006 Location: Columbus, OH Posts: 569
| Quote: |
A decompiler will be completely useless, for the most part, on a C++ executable.
| Not quite. A .NET assembly created with managed C++ can easily be translated back to source. I've used Spices .NET for this. Older executables (from the mid to late 90's) can be decompiled into C source code using dcc. Quote: |
Unless, that is, you are a pro at deciphering assembly language with no semantic information.
| I like disasm for generating assembly from an executable. If you've spent even a small amount of time working with assembly, it's really not that hard to figure out. |
| |
06-17-2006, 05:21 AM
|
#7 (permalink)
|
Ultra Techie Join Date: Jul 2005 Posts: 530
| The source code generated by a program like dcc will have almost no similarity to the original code. Most code is so highly optimized by the compiler that even a debugger will report incorrect line numbers, etc. In other words it bears almost no resemblance.
He didn't specify .NET. People are still making C++ executables that do not use .NET, this isn't something that is "mid to late 90s". In fact, I would wager a guess that the majority of developers who are using C++ are NOT using .NET.
What do you consider "not that hard"? Anything with a GUI is likely to have high-level calls that generate hundreds to thousands of assembly language statements and you won't have the benefit of any symbolic information.
__________________ Desktop machine: 2 x Opteron 246, Asus K8N-DL, 2GB PC3200 ECC Reg., XFX GeForce 6600GT, 74gb WD Raptor, 2 x 19\" LCDs, Windows XP x64
Server machine: Intel P4 3.0GHz 2MB EM64T, ECS i865pe, 1GB PC3200, 36gb WD Raptor, Windows Server 2003
Laptop: Dell Inspiron 9100 (Intel P4 3.2GHz 1MB Prescott, i865pe, 512MB PC3200, Mobility Radeon 9700, DVD+R/DL Burner), Windows XP
Linux: P3 450Mhz, 386MB ram, Slackware 10.1 (Running mySQL/Apache) |
| |
06-17-2006, 12:30 PM
|
#8 (permalink)
|
Software Developer Join Date: Mar 2006 Location: Columbus, OH Posts: 569
| Quote: |
The source code generated by a program like dcc will have almost no similarity to the original code.
| That depends on the complexity of the program. Besides that, of course it won't have similarity to the original "C++ source", as the OP asked. I said it produces C source. No, but I did. I gave a specific answer to a general question. I don't see the problem. Quote: |
People are still making C++ executables that do not use .NET, this isn't something that is "mid to late 90s".
| I never said it was. Quote: |
What do you consider "not that hard"?
| Reading assembly. As someone who has written several thousand lines of asm for a single project, I can tell you that it's not that difficult. If you're coming from OOP in a high-level language, it may take a week or two before you begin "thinking in assembly", but once you do, it's no more difficult than reading any other source code. |
| |
06-20-2006, 07:23 AM
|
#9 (permalink)
|
Ultra Techie Join Date: Jul 2005 Posts: 530
| I personally have no problem reading assembly language code. As far as determining the semantic meaning of a block of assembly code... without the benefit of any symbolic information... I would be surprised if you could get very far. Maybe if you knew what the code was supposed to be doing before you looked at it.... but otherwise, its a real task.
__________________ Desktop machine: 2 x Opteron 246, Asus K8N-DL, 2GB PC3200 ECC Reg., XFX GeForce 6600GT, 74gb WD Raptor, 2 x 19\" LCDs, Windows XP x64
Server machine: Intel P4 3.0GHz 2MB EM64T, ECS i865pe, 1GB PC3200, 36gb WD Raptor, Windows Server 2003
Laptop: Dell Inspiron 9100 (Intel P4 3.2GHz 1MB Prescott, i865pe, 512MB PC3200, Mobility Radeon 9700, DVD+R/DL Burner), Windows XP
Linux: P3 450Mhz, 386MB ram, Slackware 10.1 (Running mySQL/Apache) |
| |  | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | |