CodeBlog.xyz

Determine if DLL is 32 or 64 bit

September 16, 2023 | by Meir Achildiev

Determine if DLL is 32 or 64 bit

To determine whether a DLL (Dynamic Link Library) is 32-bit (x86) or 64-bit (x64), you can use various methods and tools. Here are some common approaches:

File Properties:

  • Windows Explorer: Right-click on the DLL file, select “Properties,” and go to the “Details” tab. Look for the “File version” and “Product version” fields. Typically, 32-bit DLLs will have “x86” or “32-bit” mentioned, while 64-bit DLLs will have “x64” or “64-bit” in these fields.
  • Command Prompt: You can use the file command in the Command Prompt to check the file type. Open a Command Prompt and run: file path_to_your.dll
file path_to_your.dll
  • The output will indicate whether it’s a 32-bit or 64-bit DLL.

Dependency Walker (also known as Depends.exe):

  • Dependency Walker is a tool that can analyze dependencies and display whether a DLL is 32-bit or 64-bit.
  • Open Dependency Walker, and then open your DLL using “File” > “Open.”
  • Look at the “Modules” view to see whether it’s listed as “32-bit” or “64-bit.”

PE Viewer Tools:

  • There are various PE (Portable Executable) viewer tools available that can display information about DLLs. These tools often provide detailed information about the architecture.
  • Examples include PE Explorer and CFF Explorer.

Command Line:

  • You can use the dumpbin utility, which is part of Visual Studio’s Command Prompt or the Windows SDK. Open the Command Prompt and run: dumpbin /headers path_to_your.dll Look for the machine field in the output. A value of 0x14C indicates 32-bit (x86), while 0x8664 indicates 64-bit (x64).
  • Alternatively, you can use the objdump utility if you have it installed:
objdump -p path_to_your.dll | grep "machine"

Programming Languages:

  • If you’re working with a programming language like C# or .NET, you can use code to check the architecture of an assembly or DLL. For example, in C#:
using System;
using System.Reflection;

class Program
{
    static void Main()
    {
        Assembly assembly = Assembly.LoadFile("path_to_your.dll");
        string architecture = assembly.GetName().ProcessorArchitecture.ToString();
        Console.WriteLine("Architecture: " + architecture);
    }
}
  • The ProcessorArchitecture property will indicate whether it’s “X86” (32-bit) or “Amd64” (64-bit).

These methods should help you determine whether a DLL is 32-bit (x86) or 64-bit (x64) depending on your specific needs and the tools available to you.

RELATED POSTS

View all

view all