In short, a DLL is a collection of small executable code, which can be called upon when needed by a program that's running. The DLL lets the executable communicate with a specific device such as a printer or may contain code to do any number of particular functions. As there are several methods of implementations to do this, in this topic I'll be showing you how to register and unregister any DLL that your application calls for; and we'll be doing so using the RegSrv32.exe
command line.
${Register::DLL} "codec.ocx" "" $1 $0
${UnRegister::DLL} "volumeCtrl.cpl" /DISABLEFSR $1 $0
${RegisterDLL} "print.drv"
Switch | Discription |
---|---|
/u | Unregisters server. |
/s | Specifies regsvr32 to run silently and to not display any message boxes. |
/n | Specifies not to call DllRegisterServer. You must use this option with /i . |
/i :cmdline | Calls DllInstall passing it an optional [cmdline]. When used with /u , it calls dll uninstall. |
dllname | Specifies the name of the dll file that will be registered. |
/? | Displays help at the command prompt. |
Using the RegSvr32.exe
command line is my preferred method on getting you libraries registered so let's start here first. Windows PCs coupled with Internet Explorer 3.0 or later come stock with RegSvr32.exe
. So there's a good chance your PC comes standard with this utility. Now if you are running on a 64-bit machine, there are two variants you can consider. They can be found in either $WINDIR\system32
or $WINDIR\SysWow32
.
The parameters you can use with RegSrv32 are /u
/s
/i
/n
. The /u
command switch will unregister the file. The /i
switch can be used with /u
to call for DLL uninstallation. The /n
parameter will not call DllRegisterServer; it's used with /i
which is the install switch. If you use /s
, which means silent, no message boxes will be displayed on Windows XP or later.
When using RegSvr32.exe
from the command line you'll get message boxes after calling it. The DLLSelfRegister function will be invoked unless using the aforementioned switch of course; if successful an alert box will be shown denoting its success—as the same for failure which throws an error message.
It's been my experience that the x64
RegSvr32.exe
registers x86 DLL's properly on Windows Vista and above (excludes XP; visit this article for more) and above so I use it when installing on x64 systems even when registering a x86 file. Besides, Windows XP is a dying art; bless it's heart. =)