How to get file header information

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm looking for a way to programmtically identify if an executable image is
32 or 64 bit. I can do this from a DOS prompt using "dumpbin /headers
filex.exe | find /I machine". I need to what dumpbin does to get the header
of a file. What C call do I make to do that? Alternatively, if I could get
the source to the command dumpbin I could figure it out. But I'll take the
straight C call or any help. Thanks!

HR
 
HR said:
I'm looking for a way to programmtically identify if an executable image
is
32 or 64 bit. I can do this from a DOS prompt using "dumpbin /headers
filex.exe | find /I machine". I need to what dumpbin does to get the
header
of a file. What C call do I make to do that? Alternatively, if I could
get
the source to the command dumpbin I could figure it out. But I'll take
the
straight C call or any help. Thanks!

Check the docs for GetBinaryType()

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getbinarytype.asp

Regards,
Will
 
This works great for executables. Thanks for the pointer. Is there a similar
call to use on .dll files? dumpbin /header works on both .exe and .dll
files, so there must be a way!

Thanks.

HR
 
Back
Top