Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get information about a Windows executable (.exe) using C++

I have to create a software that will scan several directories and extracts information about the executables found.

I need to do two things:

  • Determine if a given file is an executable (.exe, .dll, and so on) - Checking the extension is probably not good enough.
  • Get the information about this executable (the company name, the product name, and so on).

I never did this before and thus am not aware if there is a Windows API (or lightweight C/C++ library) to do that or if it is even possible. I guess it is, because explorer.exe does it.

Do you guys know anything that could point me in the right direction ?

Thank you very much for your help.

like image 396
ereOn Avatar asked May 07 '10 13:05

ereOn


People also ask

How can I see the code behind an EXE file?

Press alt+f2 to navigate to the file. Press enter to see its assembly / c++ code.

What does .EXE file contain in C?

An executable file (EXE file) is a computer file that contains an encoded sequence of instructions that the system can execute directly when the user clicks the file icon.

What's inside an EXE file?

Each EXE file contains data that Windows uses to recognize, read, and run the program the file contains. This data is saved in a compiled, binary format sometimes referred to as machine code. EXE files also often contain additional program resources, such as the program's icon and its GUI graphics assets.


1 Answers

You can verify as much of the PE File Format as you want. If you want to, you can also check for a PE file signature. You can then use the File Version API to retrieve the company name, product name, version numbers, etc.

like image 140
Jerry Coffin Avatar answered Oct 14 '22 02:10

Jerry Coffin