Wednesday, 2 September 2015

Registering a .dll under Windows (solutions for 64-bit / 32-bit compatibility issues)

If you find yourself missing a .dll under the latest versions of Windows, you will have to download the missing DLL and register it in order to make it work. Also, due to the the 32-bit and 64-bit versions of Windows, you might end up with errors which you need to troubleshoot further. In this blog-post I am trying to give you a couple of hints on how to solve these compatibility issues when registering a .dll (32-bit/64-bit). 
First of all, you will need to use regsvr32.exe which is a command-line utility that allows you to register and unregister OLE controls, such as DLLs and ActiveX controls in the Windows Registry. 

The regsvr32.exe can be found under the %systemroot%\System32 folder. However, on a 64-bit version of the Windows Operating System there are two versions of the regsvr32.exe file. 
  1. The 32-bit is located: %systemroot%\SysWoW64\regsvr32.exe
  2. The 64-bit is located: %systemroot%\System32\regsvr32.exe
Use an elevated command prompt to run regsvr32.exe. You can either right-click on the command prompt and click Run as Administrator or if you are running one of the latest version of Windows, hit the Windows Key + X + A

In some cases, you might need to use the 32-bit version of regsvr32.exe to register a 32-bit .dll on a 64-bit version of Windows. In that case, open an elevated command prompt (as described above), move the 32-bit DLL from the %systemroot%\System32 folder to the %systemroot%\SysWoW64 folder, and run the following command to register the DLL. e.g.: %systemroot%\SysWoW64\regsvr32 <full path of the DLL>

Syntax: regSvr32.exe has the following command-line options:
regsvr32 [/u] [/n] [/i[:cmdline]] <dllname>

/u - Unregister server 
/i - Call DllInstall passing it an optional [cmdline]; when it is used with /u, it calls dll uninstall 
/n - do not call DllRegisterServer; this option must be used with /i 
/s – Silent; display no message boxes

No comments:

Post a Comment