LinuxQuestions.org
Help answer threads with 0 replies.
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 02-26-2005, 08:19 PM   #1
ksoma
Member
 
Registered: Jun 2003
Location: Austin,TX most of the year...in Euless,TX the rest of it
Distribution: RH 9.0
Posts: 154

Rep: Reputation: 30
Viewing source code for a program in Windows


Hey guys,

I was wondering if anyone knew how to view the source code for a program in Windows. I've used something called Dependency Walker which shows all the functions in the .dll and all the other functions necessary for the program to run. I was wondering if the source code is almost always hidden from the user and if it is, is there any way to get around that? I'm not too knowledgeable on this topic, so any feedback should help. I appreciate it.

Thanks,
Keerthan

Last edited by ksoma; 02-26-2005 at 08:20 PM.
 
Old 02-26-2005, 09:19 PM   #2
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 52
Re: Viewing source code for a program in Windows

Quote:
Originally posted by ksoma
Hey guys,

I was wondering if anyone knew how to view the source code for a program in Windows. I've used something called Dependency Walker which shows all the functions in the .dll and all the other functions necessary for the program to run. I was wondering if the source code is almost always hidden from the user and if it is, is there any way to get around that? I'm not too knowledgeable on this topic, so any feedback should help. I appreciate it.

Thanks,
Keerthan
No, you cannot view the source of a program by having the binaries. When you create a program you use the source and a special program called compiler, and the compiler creates assembly code out of the source and then another program the assembler created machine code out of assembly code. The machine code is actually assembly code, with every command being transformed into its opcode, which is a sequence of 1 and 0. The machine code is what the computer recognizes. The task that the assembler does is easy. if you have a command
<command> <value> <value>, what the assembler does is just put the corresponding opcode for the command and transform the hex values into binary values: e.x. 26 in decimal is FA in hex and 111111010 in binary. SO this task is reversible. You can see the assembly out of a binary (executable) file. But the task of creating assembly code out of source is a very hard and advanced task. Different compilers will create different code. This task is not reversible. This is why we talk about open sourced programs and close sourced programs. When a program is open sourced, it means that the source code is provided to anyone who cares to see it.
 
Old 02-26-2005, 10:16 PM   #3
ksoma
Member
 
Registered: Jun 2003
Location: Austin,TX most of the year...in Euless,TX the rest of it
Distribution: RH 9.0
Posts: 154

Original Poster
Rep: Reputation: 30
Ok, that all makes sense. I thought there might be some way to track down the source code even if it's a closed-source program. And yea, that would be quite impossible to reproduce the source code even if you were able to get the assembly from the binaries.

Well, thanks again for your help. I appreciate it.

-Keerthan
 
Old 02-27-2005, 04:05 AM   #4
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 46
You can use a disassembler to view an executable. But what you will see is in assembly language and not c or c++.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Viewing HTML Source in OpenOffice pre 2.0 slacker9876 Suse/Novell 1 07-01-2005 01:40 PM
login program source code czarherr Linux - Software 2 07-16-2004 03:01 PM
Thumbnail viewing program soujrnr Linux - Software 4 07-16-2004 11:22 AM
Viewing program messages when program isn't run from command line? Locura Linux - Software 1 09-27-2003 08:19 AM
Remove program which installed by source code cccc Linux - Software 3 09-09-2003 01:24 PM


All times are GMT -5. The time now is 09:27 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration