Categories
Tools

DLL: 32-bit or 64-bit ?

If you’re developing on a 64-bit machine, you might need to check whether a Windows DLL is 32-bit or 64 bit and this is how you can do a quick check using the dumpbin utility.

This utility  provides information about the format and symbols provided in executable, library, and DLL files.

usage:

DUMPBIN [options] [files]

options:

/ALL
/ARCHIVEMEMBERS
/CLRHEADER
/DEPENDENTS
/DIRECTIVES
/DISASM[:{BYTES|NOBYTES}]
/ERRORREPORT:{NONE|PROMPT|QUEUE|SEND}
/EXPORTS
/FPO
/HEADERS
/IMPORTS[:filename]
/LINENUMBERS
/LINKERMEMBER[:{1|2}]
/LOADCONFIG
/OUT:filename
/PDATA
/PDBPATH[:VERBOSE]
/RANGE:vaMin[,vaMax]
/RAWDATA[:{NONE|1|2|4|8}[,#]]
/RELOCATIONS
/SECTION:name
/SUMMARY
/SYMBOLS
/TLS
/UNWINDINFO

By examining the headers of a DLL you will be able to determine whether you have a 32-bit or 64-bit dll as shown below:

dumpbin /HEADESR 64bit.dll

PE signature found

File Type: DLL

FILE HEADER VALUES
            8664 machine (x64)
               7 number of sections
        4F297E71 time date stamp Wed Feb 01 18:03:29 2012
               0 file pointer to symbol table
               0 number of symbols
              F0 size of optional header
            2022 characteristics
                   Executable
                   Application can handle large (>2GB) addresses
                   DLL

OPTIONAL HEADER VALUES
             20B magic # (PE32+)
           10.00 linker version

and with a 32-bit DLL

Dumpbin /HEADERS 32bit.dll

PE signature found

File Type: DLL

FILE HEADER VALUES
             14C machine (x86)
               7 number of sections
        4F295CB4 time date stamp Wed Feb 01 15:39:32 2012
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
            2102 characteristics
                   Executable
                   32 bit word machine
                   DLL

OPTIONAL HEADER VALUES
             10B magic # (PE32)
           10.00 linker version

Further information can be found at http://support.microsoft.com/kb/177429