LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-04-2005, 10:31 AM   #1
purefan
Member
 
Registered: Aug 2003
Location: Sweden
Distribution: Ubuntu 10.04
Posts: 99

Rep: Reputation: Disabled
getting the source code out of a .exe


hi! I've been wondering if something like reversed compiling can be done to actually get the source code of a program. I tried win32 disassembler but got just lots of non understandable lines....
 
Old 03-04-2005, 11:35 AM   #2
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
When you disassemble an executable, the generated code is usually assembly language. There are some disassemblers which generate C, but a) it is not going to be the original code b) is not going to be object-oriented or well-organized c) will not be documented and d) will not be much more readable then assembly.

Source code is not included in an executable. Executables consist of either object code or machine code. Remember: when a compiler runs, it may take a reusable module, and compile it in such a way that for performance optimization the generated modules are repeated throughout the executable, to help the processor reduce cache misses. Also, loops are often flattened out ("unrolled") -- again, for the same reason - so the CPU(s') cache(s) can keep looking forward in a linear fashion rather than incur a cache miss and resultant pauses while the MMU goes out to main memory to fetch the required data.
 
Old 03-04-2005, 12:30 PM   #3
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
In linux try objdump - but you get assembly, not C or Basic.
 
Old 03-04-2005, 09:18 PM   #4
purefan
Member
 
Registered: Aug 2003
Location: Sweden
Distribution: Ubuntu 10.04
Posts: 99

Original Poster
Rep: Reputation: Disabled
ohh...well thank you both for answering. I thought it would be a good way of finding functions and answers to the famous 'how did they do this!??' for instance I have a free software to automatically shutdown the computer (power off; runs in windows xp) so I expected to read the actual lines where it sends this command but as you well said it, I only get assembly code...
Thanks again
 
Old 03-05-2005, 12:19 PM   #5
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
There is an API to shut down Windows - go to msdn.microsoft.com and you can look it up. Also there may be a package on codeproject which will do what you want. There are plenty of timer and alarm projects on there (some may even be VB!) so all you need do do is use one of the timers, store the time at which you want to shut down, and call the API at that time. It should be fairly straightforward.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
where is source code? agpev1 Ubuntu 3 11-23-2005 08:04 PM
How to convert Assembly code to "C" source code ssg14j Programming 2 08-01-2005 12:48 PM
sh source code? khucinx Programming 3 05-31-2004 04:14 AM
Source Code help palbox2003 Linux - Newbie 1 02-23-2004 04:10 AM
how will i run a exe from java code? ambuj Programming 6 01-24-2004 08:32 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration