The Regsvr32 tool (Regsvr32.exe)

Home Browsers Microsoft Office 97 Site Search Windows

You can use the Regsvr32 tool (Regsvr32.exe) to register and unregister object linking and embedding (OLE) controls such as dynamic-link library (DLL) or ActiveX Controls (OCX) files that are self-registerable. This may be necessary to troubleshoot some issues with Windows, Microsoft Internet Explorer, or other programs.

For example, the following article in the Microsoft Knowledge Base requires you to use Regsvr32.exe to unregister the Wuv3is.dll control before you reinstall it from the Windows Update site:

If the registration of a control is unsuccessful or you need developer information about troubleshooting unsuccessful OLE control registration attempts, please see the following article in the Microsoft Knowledge Base:

140346 Possible Reasons for OLE Control Registration Failure

MORE INFORMATION
Regsvr32.exe is included with

Microsoft Internet Explorer 3.0 or later,
Windows 95 OEM Service Release 2 (OSR2) or later,
Windows NT 4.0 Service Pack 5 (SP5) or later.
Regsvr32.exe is installed in the System (Windows Me/98/95) or System32 (Windows NT) folder
Windows XP Home and Pro.

Regsvr32.exe Usage
RegSvr32.exe has the following command-line options:

Regsvr32 [/u] [/n] [/i[:cmdline]] dllname

/u - Unregister server<BR/>
/i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll uninstall
/n - do not call DllRegisterServer; this option must be used with /i

When you use Regsvr32.exe, it attempts to load the component and call its DLLSelfRegister function. If this attempt is successful, Regsvr32.exe displays a dialog indicating success. If the attempt is unsuccessful, Regsvr32.exe returns an error message, which may include a Win32 error code.

For a list of Win32 error codes, refer to the following Microsoft Web site:
http://msdn.microsoft.com/library/en-us/netdir/adsi/win32_error_codes.asp

For example, to manually register a Sample.ocx ActiveX control, type the following command at an MS-DOS prompt:

c:\regsvr32.exe sample.ocx

Regsvr32.exe Error Messages
The following list contains RegSvr32 error messages and possible causes.

Unrecognized flag: /invalid_flag

You typed an invalid combination of flags or switches (refer to the "Regsvr32.exe Usage" section in this article).

No DLL name specified.

You did not include a .dll file name (refer to the "Regsvr32.exe Usage" section in this article).

Dllname was loaded, but the DllRegisterServer or DllUnregisterServer entry point was not found.

Dllname is not a .dll or .ocx file.

For example, typing regsvr32 wjview.exe generates this error message.

Dllname is not an executable file and no registration helper is registered for this file type.

Dllname is not an executable file (.exe, .dll, or .ocx).

For example, typing regsvr32 autoexec.bat generates this error message.

Dllname was loaded, but the DllRegisterServer or DllUnregisterServer entry point was not found.

Dllname may not be exported, or a corrupted version of Dllname may be in memory. Consider using Pview to detect the file and remove it.

Dllname is not self-registerable or a corrupted version is in memory.

For example,

typing regsvr32 icwdial.dll

returns this error message because the Icwdial.dll file is not self-registerable. If you suspect a corrupted version of Dllname is in memory, try restarting your computer or re-extract the original version of the file. If you are running Windows NT, you may need to use the Kill or Pview tool (The Pview Tool is not supported in Windows XP) from the Microsoft Windows NT Server 4.0 Resource Kit. For additional information, click to view the following article in the Microsoft Knowledge Base:

197155 How to Kill an Orphaned Process

OleInitialize failed (or OleUninitialize failed).

Regsvr32 must initialize the COM library before it can call needed COM library functions and uninitialize the library when it shuts down. These error messages occur if an attempt to initialize or uninitialize the COM library is unsuccessful. For example, the Ole32.dll file may be corrupted or may be the wrong version.

LoadLibrary("Dllname") failed. GetlastError returns 0x00000485

From Winerror.h, 0x00000485 = 1157 (ERROR_DLL_NOT_FOUND), which means "One of the library files needed to run this application cannot be found." For example, typing regsvr32 missing.dll returns this error message if the Missing.dll file is not found.

LoadLibrary("Dllname") failed. GetLastError returns 0x00000002

From Winerror.h, 0x00000002 = 2 (ERROR_FILE_NOT_FOUND), which means "The system cannot find the file specified." In other words, a dependent DLL was not found. For example, typing regsvr32 icwdial.dll with Tapi32.dll (a dependency) missing, returns this error message.

LoadLibrary("dskmaint.dll") failed. GetLastError returns 0x000001f

From Winerror.h, 0x000001f = 31 (ERROR_GEN_FAILURE), which means "A device attached to the system is not functioning." This behavior can occur if you try to register a Win16 .dll file. For example, typing regsvr32 dskmaint.dll returns this error message.

DllRegisterServer (or DllUnregisterServer)in Dllname failed. Return code was: string

Search Winerror.h for string.
Regsvr32.exe and Dependencies

RegSvr32.exe depends on the Kernel32.dll, User32.dll, and Ole32.dll files (and the Msvcrt.dll and Advapi32.dll files in Windows NT). Regsvr32.exe loads the file you are trying to register or un-register, along with all of its dependencies. The process may be unsuccessful if a required file is missing or damaged.

You can use Depends.exe to determine dependencies for the file you are trying to register or un-register. Depends.exe is included with the Microsoft Windows 98 Resource Kit and the Microsoft Windows NT 4.0 Resource Kit support tools.
Depends.exe is not supported in Windows XP

247024 Tools Included with the Microsoft Windows 98 Resource Kit