Error reporting from within a deferred CA - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

berlin
Posts: 4
Joined: Wed Mar 18, 2009 4:14 pm

Error reporting from within a deferred CA

I have a complex custom action (c++ within an attached DLL) that must run "Deferred with no impersonation" after InstallFiles. As I encounter errors, how do I report them back to the user? Normally, when I can runs these custom actions "Immediate execution", I set a property with the error message and I subsequentially use an "Error Message" built in custom action to present it. This is not working because not only I cannot set any property from within the deferred custom action, the "Error Message" is only executed immediatelly (not deferred).

While at it, what is the proper error code I should return so the installer rolls back and stops the installation?

Thanks!
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Error reporting from within a deferred CA

Hello,
I have a complex custom action (c++ within an attached DLL) that must run "Deferred with no impersonation" after InstallFiles. As I encounter errors, how do I report them back to the user? Normally, when I can runs these custom actions "Immediate execution", I set a property with the error message and I subsequentially use an "Error Message" built in custom action to present it. This is not working because not only I cannot set any property from within the deferred custom action, the "Error Message" is only executed immediatelly (not deferred).
A deferred custom action cannot set installer properties as it does not have access to them.
However you can report the errors back to the user directly from within your custom action for example by using a MessageBox, then returning an apropriate error code to the installer.
While at it, what is the proper error code I should return so the installer rolls back and stops the installation?
In order to initiate a rollback, your custom action should return one of these error codes:

Code: Select all

ERROR_INSTALL_FAILURE
ERROR_INSTALL_USEREXIT
ERROR_FUNCTION_NOT_CALLED
A full list of error codes can be found here

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”