User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Computer Science and Software Design section within the Software Development category of DaniWeb, a massive community of 456,468 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,813 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Computer Science and Software Design advertiser: Programming Forums
Views: 2805 | Replies: 7 | Solved
Reply
Join Date: Aug 2007
Posts: 3
Reputation: fastfred is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
fastfred fastfred is offline Offline
Newbie Poster

How to determine a program's language?

  #1  
Sep 16th, 2007
I hope I phrased the question properly... I'm just curious if there is a way to determine what programming language was used for a particular .exe application. I'm a programming newbie starting to study VB and, like many others, I wonder if this is the best language to learn. My thought was that if I could determine what programming language(s) was used in constructing some of my favorite executables, then I could judge the capabilities of each and decide which is right for me. Also, just as in web design, where it's sometimes helpful to view a page's source code to determine how certain effects are achieved, I think it would be educational to study the source code of other programs. I've tried the obvious -- simply opening an .exe with a text program, but all I see is a mish-mash of symbols. Is this encoding designed to hide the programming?

I guess my basic questions are: How can I determine the programming language of an .exe file? And how can I view it? -Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,012
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 368
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: How to determine a program's language?

  #2  
Sep 16th, 2007
> I'm a programming newbie starting to study VB and, like many others, I wonder if this
> is the best language to learn.
Absolutely no. There are better languages out there like Java, Python etc.

> then I could judge the capabilities of each and decide which is right for me
You don't decide the merits of a programming language based on whether it generates and executable or not!!

> I think it would be educational to study the source code of other programs.
As far as learning from others' code is concerned, head over to sourceforge which is the home of numerous open source projects out there, just pick up your favorite programming language project and start studying / contributing.

> How can I determine the programming language of an .exe file? And how can I view it?
AFAIK, you can't, in both of the cases.
Last edited by ~s.o.s~ : Sep 16th, 2007 at 1:47 pm.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Sep 2004
Posts: 6,515
Reputation: Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of 
Rep Power: 31
Solved Threads: 488
Super Moderator
Narue's Avatar
Narue Narue is offline Offline
Expert Meanie

Re: How to determine a program's language?

  #3  
Sep 16th, 2007
>Is this encoding designed to hide the programming?
Compiled programs aren't like HTML. The source code is lost during compilation unless the executable format supports metadata that can reconstruct it, like .NET. Those symbols you saw were the text editor's attempt to turn binary into printable characters.

>How can I determine the programming language of an .exe file?
You can disassemble the executable and reconstruct the design of the program. From that it's sometimes possible to infer the original language that it was written in. However, this requires a great deal of experience and talent in reverse engineering, as well as intimacy with assembly language and any of the possible languages that the program could have been written in.

Short answer: You can't.

>And how can I view it?
This is a more plausible question because you can disassemble the executable and read the assembly, but if you have to ask how it's done, you're probably not capable of doing it at your current level.
I'm here to prove you wrong.
Reply With Quote  
Join Date: Jun 2005
Location: Cambridge, MA
Posts: 1,302
Reputation: Rashakil Fol has a spectacular aura about Rashakil Fol has a spectacular aura about 
Rep Power: 7
Solved Threads: 41
Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Salamander Man

Re: How to determine a program's language?

  #4  
Sep 17th, 2007
Originally Posted by Narue View Post
>How can I determine the programming language of an .exe file?
You can disassemble the executable and reconstruct the design of the program. From that it's sometimes possible to infer the original language that it was written in. However, this requires a great deal of experience and talent in reverse engineering, as well as intimacy with assembly language and any of the possible languages that the program could have been written in.


It's not that hard. First you can just grep the compiler name. For Haskell you can grep '.lhs'. If that fails, then for any compiled gc'd language you can just look at the garbage collector. That's, um, harder. But before that: If you see printf format strings, it's probably in C or C++. For example, you can know Firefox uses some amount of C++ by looking in its executable and searching for the string "::" until you come across a few error message strings, and by noting that it has a few format strings too.

Error message strings are your greatest friend.
You can adblock jbennet's avatar.
Reply With Quote  
Join Date: Aug 2007
Posts: 3
Reputation: fastfred is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
fastfred fastfred is offline Offline
Newbie Poster

Re: How to determine a program's language?

  #5  
Sep 17th, 2007
Thanks to everyone for your input and explanations. -FastFred
Reply With Quote  
Join Date: Oct 2007
Posts: 1
Reputation: someotherguy is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
someotherguy someotherguy is offline Offline
Newbie Poster

Solution Re: How to determine a program's language?

  #6  
Oct 17th, 2007
I'm afraid these folks are wrong in one respect.
In most cases, there is a way to determine a programming language (or at least a compiler) based on an exe's signature. Each compiler, packer, and exe modifying tool has a unique "fingerprint" that it leaves on a file. Most of these tools are found in the rather shady "underground" scene where the reversers and crackers hang out (since it's necessary to know what sort of packing has occurred on a file before you attempt to reverse engineer it). One such tool which I regularly use is called PEid. You can google it but make sure you run a thorough virus scan (http://virusscan.jotti.org/) on whatever you download since you'll almost certainly end up at some rather shady sites.

As for the other points, they are pretty much spot on. Almost any language can be used to do almost anything. Furthermore, most languages can be combined (through the use of inlined code, DLLs, etc.). It's really just a matter of what you want to do and how hard it will be in a given language. For most rally simple projects i can throw something together quickly in VB that will do the trick, but most (if not all) more complicated programs will be written in C or some variant of it (C++, C#, etc.).
Last edited by someotherguy : Oct 17th, 2007 at 12:54 am. Reason: Punctuation and clarification
Reply With Quote  
Join Date: Aug 2007
Posts: 3
Reputation: fastfred is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
fastfred fastfred is offline Offline
Newbie Poster

Re: How to determine a program's language?

  #7  
Oct 17th, 2007
Thanks someotherguy. I will look for and try PEid. Since starting this thread I have begun learning VB. I know a lot of people might say it is not the best choice of programming languages but I think it would be near impossible to get a 100% consensus on WHAT IS the best programming language. There are certainly those who are versed in all languages and therefore qualified to judge each on its respective merits, but I'm betting that a lot of programmers are simply partial to whatever language they are most familiar with. At least that holds true when debating computer brands, automobiles, sports teams, etc... So why should deciding the best programming language be any different. Regardless, in order for me to make my own decision about which language is best for me, I have to start somewhere. So I started with VB and I'm progressing quite well. Again thanks to all who have weighed in on this topic.
Reply With Quote  
Join Date: Sep 2004
Posts: 6,515
Reputation: Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of 
Rep Power: 31
Solved Threads: 488
Super Moderator
Narue's Avatar
Narue Narue is offline Offline
Expert Meanie

Re: How to determine a program's language?

  #8  
Oct 17th, 2007
I know a lot of people might say it is not the best choice of programming languages but I think it would be near impossible to get a 100% consensus on WHAT IS the best programming language. There are certainly those who are versed in all languages and therefore qualified to judge each on its respective merits, but I'm betting that a lot of programmers are simply partial to whatever language they are most familiar with. At least that holds true when debating computer brands, automobiles, sports teams, etc... So why should deciding the best programming language be any different. Regardless, in order for me to make my own decision about which language is best for me, I have to start somewhere. So I started with VB and I'm progressing quite well.
Heheh, it sounds like you're trying to justify the decision to yourself.

You're right, of course. There's nothing wrong with VB, and if you try to find the best language to start with, you'll never get anywhere. The general objective advice is just to pick a language and start learning. As you learn more, you'll find new directions to go, and good programmers will learn the same lessons regardless of where they started.
I'm here to prove you wrong.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Computer Science and Software Design Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Computer Science and Software Design Forum

All times are GMT -4. The time now is 2:24 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC