What do the various regsvr32 exit codes mean?

Raymond Chen

The exit codes for the regsvr32 program are currently as follows:

Exit code Meaning
0 Success
1 Error parsing command line
2 OleInitialize failed
3 LoadLibrary failed
4 GetProcAddress failed
5 Registration function failed

This information is included for diagnostic and troubleshooting purposes. I don’t think the values are contractual.

The regsvr32 program basically does five things, and the exit codes correspond to each of those steps.

  1. Parse the command line to see what it’s being asked to do.
  2. Initialize OLE.
  3. Load the library.
  4. Find the function to be called. The command line options specify which function to look for. Could be Dll­Register­Server, Dll­Unregister­Server, or even Dll­Install.
  5. Call it.

Steps 4 and 5 may be repeated if the command line options indicate that multiple functions should be called.

If something goes wrong, the regsvr32 program reports the error details to the user, and the exit code summarizes which step it got stuck at. Future versions of regsvr32 may add additional steps, or change the order of the steps, which would trigger renumbering. The exit code is for diagnostic and troubleshooting purposes, so you can try to figure out why something went wrong.

We’ll put this information to use next time.


Discussion are closed.


Feedback usabilla icon