I need to determine if a given .dll or .exe file is 32-bit or 64-bit
At the moment I have only one solution: read the PE-header from the specified file and from there take the "Machine" field.
(Specification: Microsoft Executable and Common Object File Specification file format specification (.docx file) in "3.3. COFF file header (object and image)")
This field can take up to 20 values. Three of them:
IMAGE_FILE_MACHINE_I386 ( == 32bit ) IMAGE_FILE_MACHINE_IA64 ( == 64bit ) IMAGE_FILE_MACHINE_AMD64 ( == 64bit )
My questions:
1) Is the "Machine" display in bitte correct or am I missing something? Are there any other reservations?
2) Is there an easier way to detect 32/64 bitness (perhaps some specific field in PE format that I did not notice or some special system function)?
c ++ x86 64bit winapi
inazaruk
source share