I'd like to write a test script or program that asserts that all DLL files in a given directory are of a particular build type.
I would use this as a sanity check at the end of a build process on an SDK to make sure that the 64-bit version hasn't somehow got some 32-bit DLL files in it and vice versa.
Is there an easy way to look at a DLL file and determine its type?
The solution should work on both xp32 and xp64.
This question is related to
windows
dll
32bit-64bit
I have written a very simple tool that does exactly that - it's called PE Deconstructor.
Simply fire it up and load your DLL file:
In the example above, the loaded DLL is 32-bit.
You can download it here (I only have the 64-bit version compiled ATM):
http://files.quickmediasolutions.com/exe/pedeconstructor_0.1_amd64.exe
An older 32-bit version is available here:
http://dl.dropbox.com/u/31080052/pedeconstructor.zip
Dependency Walker tells all(well almost). http://www.dependencywalker.com/
It does not "install" -just get it, extract it and run the exec. It works for any x32 or x64 windows module|application.
As I recall it is fairly straightforward to see all dependencies, i.e. the dll modules, and since the appl. is a sum of the dependencies one can ascertain if it is full x64, x32(x86) or a bit of each.
Type of CPU that the module was built for is in the "CPU" column. Most 64-bit aps are still a bit of each but 32-bit ap w/b all x86.
Beautiful program for geeks/programmers and it is free...
A crude way would be to call dumpbin with the headers option from the Visual Studio tools on each DLL and look for the appropriate output:
dumpbin /headers my32bit.dll PE signature found File Type: DLL FILE HEADER VALUES 14C machine (x86) 1 number of sections 45499E0A time date stamp Thu Nov 02 03:28:10 2006 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)
You can see a couple clues in that output that it is a 32 bit DLL, including the 14C value that Paul mentions. Should be easy to look for in a script.
If you have Cygwin installed (which I strongly recommend for a variety of reasons), you could use the 'file' utility on the DLL
file <filename>
which would give an output like this:
icuuc36.dll: MS-DOS executable PE for MS Windows (DLL) (GUI) Intel 80386 32-bit
A crude way would be to call dumpbin with the headers option from the Visual Studio tools on each DLL and look for the appropriate output:
dumpbin /headers my32bit.dll PE signature found File Type: DLL FILE HEADER VALUES 14C machine (x86) 1 number of sections 45499E0A time date stamp Thu Nov 02 03:28:10 2006 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)
You can see a couple clues in that output that it is a 32 bit DLL, including the 14C value that Paul mentions. Should be easy to look for in a script.
Dependency Walker tells all(well almost). http://www.dependencywalker.com/
It does not "install" -just get it, extract it and run the exec. It works for any x32 or x64 windows module|application.
As I recall it is fairly straightforward to see all dependencies, i.e. the dll modules, and since the appl. is a sum of the dependencies one can ascertain if it is full x64, x32(x86) or a bit of each.
Type of CPU that the module was built for is in the "CPU" column. Most 64-bit aps are still a bit of each but 32-bit ap w/b all x86.
Beautiful program for geeks/programmers and it is free...
A crude way would be to call dumpbin with the headers option from the Visual Studio tools on each DLL and look for the appropriate output:
dumpbin /headers my32bit.dll PE signature found File Type: DLL FILE HEADER VALUES 14C machine (x86) 1 number of sections 45499E0A time date stamp Thu Nov 02 03:28:10 2006 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)
You can see a couple clues in that output that it is a 32 bit DLL, including the 14C value that Paul mentions. Should be easy to look for in a script.
If you have Cygwin installed (which I strongly recommend for a variety of reasons), you could use the 'file' utility on the DLL
file <filename>
which would give an output like this:
icuuc36.dll: MS-DOS executable PE for MS Windows (DLL) (GUI) Intel 80386 32-bit
If you have Cygwin installed (which I strongly recommend for a variety of reasons), you could use the 'file' utility on the DLL
file <filename>
which would give an output like this:
icuuc36.dll: MS-DOS executable PE for MS Windows (DLL) (GUI) Intel 80386 32-bit
A crude way would be to call dumpbin with the headers option from the Visual Studio tools on each DLL and look for the appropriate output:
dumpbin /headers my32bit.dll PE signature found File Type: DLL FILE HEADER VALUES 14C machine (x86) 1 number of sections 45499E0A time date stamp Thu Nov 02 03:28:10 2006 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)
You can see a couple clues in that output that it is a 32 bit DLL, including the 14C value that Paul mentions. Should be easy to look for in a script.
I have written a very simple tool that does exactly that - it's called PE Deconstructor.
Simply fire it up and load your DLL file:
In the example above, the loaded DLL is 32-bit.
You can download it here (I only have the 64-bit version compiled ATM):
http://files.quickmediasolutions.com/exe/pedeconstructor_0.1_amd64.exe
An older 32-bit version is available here:
http://dl.dropbox.com/u/31080052/pedeconstructor.zip
Source: Stackoverflow.com