开发者

How to check in what language a program (.exe) has been written. How to view the code?

开发者 https://www.devze.com 2022-12-23 00:44 出处:网络
I\'ve got an .exe file and I 开发者_开发技巧need to know in what language the program has been developed. And also is there a trick to view the code (basing on that .exe file) ? I used the Reflector a

I've got an .exe file and I 开发者_开发技巧need to know in what language the program has been developed. And also is there a trick to view the code (basing on that .exe file) ? I used the Reflector and now I know it is not .NET


I come across this problem before. I just opened .exe file in notepad. I found compiler name and version. Hope this helps someone..


I've got an .exe file and I need to know in what language the program has been developed.

Generally speaking this is impossible. Every language could conceivably compile their version of "Hello, world!" targeting a given platform (or executable format) to the same executable (byte for byte).

And also is there a trick to view the code (basing on that .exe file) ?

No, see above. However you can try a decompiler of your choice.


Compilation of a high-level language into a low-level .EXE is typically a one-way process - it's almost impossible to reliably extract meaningful information from the executable regarding the original language once the process is complete. You might get lucky and find some identifiable cues left in the binary, or of course find an accompanying file (like a .pdb) which yields clues as to the original language.

However, what the .EXE contains is (typically) assembly language, and this can sometimes be decompiled back into a high-level representation of the program. Note that this is never going to give you an instruction-accurate source file - the result is likely to be very 'wordy' and difficult to follow, simply because of what the compiler did in the first place - which was turn a high-level 'conceptual' complex language into a stream of low-level instructions, throwing away most of the contextual cues which aren't needed for the CPU to execute the code.


I am going to have to contradict everyone stating anything along the lines of "Compilation of a high-level language into a low-level .EXE is typically a one-way process". As not all executable's are compiled to raw assembly.

As this is not always the case. A good example is C#(.net), where the file is compiled to IL rather than raw assembly. In the case of IL you can disassemble to source (even wile the process is running in memory, such as pulling from the Global Assembly Cache)

If the file was compiled straight to raw assembly then there is usually some indication of the original language in the syntax/structure. Though this is more so a byproduct of the compiler then the language it self.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号