While Microsoft has tried to protect dynamic-link library (DLL) files with Windows File Protection in Windows Me and 2000 and with Windows XP’s side-by-side component sharing technology, it’s still common to find DLL errors when troubleshooting application problems. Whether the DLL file was accidentally deleted or overwritten by an application installation, the results are the same: an application that doesn’t work. To make matters worse, DLL problems may not appear until some time after the file was deleted or the offending application was installed.

Such was the case for Charles Carroll, who posted his question in TechRepublic’s Technical Q&A. Carroll was troubleshooting two identical machines that were used to access an Oracle database; one couldn’t, while the other could. In solving the problem, Carroll discovered that two DLLs on the problem machine had been deactivated during the installation of an unrelated Windows application.

To solve his problem, Windows Registry entries for the two missing DLLs needed to be reregistered using Microsoft’s Regsvr32.exe tool. The command prompt entries looked like this:
C:\>regsvr32 “C:\program files\common files\system\ole db\msdasql.dll”
C:\>regsvr32 “C:\program files\common files\system\ole db\oledb32.dll”

Because DLL problems are so common, all support techs should learn how to use Regsvr32.

Using Regsvr32
TechRepublic Support Technician Ted Laun said he typically uses Regsvr32 two ways:

  • When troubleshooting an issue, Microsoft’s Knowledge Base will require him to reregister a DLL using the tool.
  • When searching the Knowledge Base for a solution he suspects is a DLL problem, he will use Regsvr32 as one of the search parameters.

Since TechRepublic upgraded to Windows 2000 more than a year ago, Laun hasn’t had to use the tool very often, but when he was supporting Windows 95, 98 and NT machines, he used the tool quite frequently.

“In Office 97, particularly Outlook 97, I had repeated problems with a few DLLs,” Laun said. He couldn’t remember which specific DLLs were problematic, but he remembers his usual fix. “I remember writing a DOS script that would reregister the DLLs using Regsvr32. When people had [these] specific problems, I’d just send them the script and have them run it.”

Laun still occasionally experiences problems where he needs to use Regsvr32. For example, a TechRepublic editor was unable to open new windows within Internet Explorer, no matter if he right-clicked a link or if the Web page’s code tried to open a new window.

Laun suspected an unregistered DLL was the problem so he went to Microsoft’s Knowledge Base, did a search under IE with Regsvr32 as the key word, and found the DLL that needed to be replaced. With this information in hand, it was a snap to reregister the DLL with Regsvr32.

What Regsvr32 does, and what to do if it breaks
Microsoft Knowledge Base article Q249873 says support techs can use Regsvr32 to register and unregister object linking and embedding (OLE) controls, including both DLL and/or ActiveX Controls (OCX). The article also describes some of the typical error messages you might receive if Regsvr32 doesn’t work.

Microsoft Knowledge Base article Q207132 goes into more detail about Regsvr32, saying it functions as a five-step program to register or unregister DLLs or OCXs. The process, in order, is:

  1. Oleinitialize
  2. LoadLibrary to load the DLL
  3. DllRegisterServer or DllUnregisterServer
  4. FreeLibrary
  5. OleUnitialize

If there is a problem when Regsvr32 runs, it is typically found in the second and third step of the program, according to Microsoft.

The two most common errors when LoadLibrary fails are that the DLL is not contained in the specified path or the path is wrong, or if a dependency of the DLL is not met. There is a tool available on the Microsoft Software Development Kit called Depends.exe that checks the dependencies of a DLL to see if they are met. It then reports anything that’s missing or corrupted.

Regsvr32 depends on the Kernel32.dll, User32.dll, and Ole32.dll (along with Msvcrt.dll and Advapi32.dll in Windows NT) to be present to work. Depends.exe also can be used to ensure these dependencies are met. Of course, if you must troubleshoot Regsvr32, it’s probably quicker and easier to simply reinstall the original problem program.

Troubleshooter’s tool
Regsvr32 is a tool that support techs should keep in mind when trying to resolve DLL problems. Once you locate the offending DLL file(s), you can enter a quick command line entry or two and the end user will be back up and running.