What do the various regsvr32 exit codes mean?

Raymond Chen

Raymond

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

Exit codeMeaning
0Success
1Error parsing command line
2OleInitialize failed
3LoadLibrary failed
4GetProcAddress failed
5Registration 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.

0 comments

Comments are closed. Login to edit/delete your existing comments