Explanation of Regsvr32 Usage and Error Messages

ID: Q249873


The information in this article applies to:
  • Microsoft Windows 98
  • Microsoft Windows 98 Second Edition
  • Microsoft Windows 95
  • Microsoft Windows 95 OEM Service Release versions 1, 2, 2.1, 2.5
  • Microsoft Windows NT Workstation versions 4.0, 4.0 SP1, 4.0 SP2, 4.0 SP3, 4.0 SP4, 4.0 SP5, 4.0 SP6, 4.0 SP6a
  • Microsoft Windows NT Server versions 4.0, 4.0 SP1, 4.0 SP2, 4.0 SP3, 4.0 SP4, 4.0 SP5, 4.0 SP6, 4.0 SP6a
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Datacenter Server
  • Microsoft Windows 2000 Professional
  • Microsoft Windows 2000 Server


SUMMARY

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:

Q241122 WINUP- Invalid Page Fault in 'wuv3is.dll'
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:
Q140346 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, and Windows NT 4.0 Service Pack 5 (SP5) or later. Regsvr32.exe is installed in the System (Windows 98/95) or System32 (Windows NT) folder.

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 Regsrv32.exe, it attempts to load the component and call its DLLSelfRegister function. If this attempt is successful, Regsrv32.exe displays a dialog indicating success. If the attempt is unsuccessful, Regsrv32.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/psdk/psdkref/errlist_9usz.htm
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 from the Microsoft Windows NT Server 4.0 Resource Kit. For additional information, click to view the following article in the Microsoft Knowledge Base:
Q197155 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. For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
Q206848 Windows NT Service Pack 4.0 Tools Not Included on CD-ROM
Q247024 Tools Included with the Microsoft Windows 98 Resource Kit

Additional query words: fail fails failure failures

Keywords : kbenv kberrmsg kbtool osr1 osr2 win95 win98 win98se
Version : WINDOWS:2000,95; winnt:4.0,4.0 SP1,4.0 SP2,4.0 SP3,4.0 SP4,4.0 SP5,4.0 SP6,4.0 SP6a
Platform : WINDOWS winnt
Issue type : kbinfo


Last Reviewed: January 17, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.