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

Recommended Answers

All 7 Replies

> 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.

>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.

>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.

Thanks to everyone for your input and explanations. -FastFred

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.).

commented: PEid - great resource! +6

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.