How to retrieve a custom action exit code when registering files using Regsrv32.exe
|Article:HOWTO5021|||||Created: 2006-09-14|||||Updated: 2008-01-31|||||Article URL http://www.symantec.com/docs/HOWTO5021|
I would like to be able to check an exit code for files that are getting registered and have been using a custom action to call Regsvr32.exe. If an action to register a file fails, Wise puts up a message that says "Install ended prematurely," which does not describe why it failed. I would like to be able to check the exit code of this action and be able to put up a meaningful error message if this registration fails.
How can I do this?
Some of the custom actions in the Windows Installer Editor do not provide a return property option, so there is no way to retrieve a return code from these custom action. Windows Installer triggers the error message when the .exe returns a value other than 0.
To be able to retrieve an exit code, you can use a Wisescript to execute regsrv32.exe. The Execute Program action in a WiseScript returns an Install_Result value which indicates whether the .exe succeeded. Then, you can pass the return value back to your .msi to a property. Use this value to determine whether to display an error to customer as a condition around a Display message action.
You can also use the Call Custom DLL action in the .msi to call a .dll that handles registering the files in your .msi package. The Call Custom DLL custom action allows you to return a value into a Return Property. Then, you can use a Return Property in a condition that will display a message to your end user.
Article URL http://www.symantec.com/docs/HOWTO5021