cancel the uninstaller after a deferred custom action

V

Viviana Vc

Hi all,

I have a deferred custom action that has to show a UI to the user and
then the custom action takes action depending on what the user has
selected. That UI has a Cancel. If the user choses this Cancel I would
like right away to abort the uninstaller. So I have to abort the
uninstaller as soon as the custom action returned a specific value. Is
this somehow possible?

If it's of any help I am using InstallShield Premier 11.

Thanks,
Viv
 
R

Rob Hamflett

You can disable rollback (not sure how in InstallShield), but it's really not advised. You could
leave your machine in an unknown state.

Rob
 
V

Viviana Vc

Hi Rob,

Thx for you answer. Actually my problem is not the rollback. Let's say
that I have a custom action that in some cases needs to make the
uninstaller to stop simulating the same behaviour like the user pressed
Cancel, so rollback should be run. So let's say if my exe returns -1 the
uninstaller should react like the user has chosen cancel on the MSI
dialog.

I thought about returning from that exe a value diff than 0 let's say -1
for the cases when I want the uninstaller to be canceled, but then I get
the dialog: "Error 1722. There is a problem with Windows Installer
package. a program run as part of the setup did not finish as expected.
Contact your support personnel or package vendor". After that the
rollback is done and the "Wizard was interrupted ..." dialog is shown.
The only thing I would want to change in this behaviour is that the
dialog with "Error 1722: ..." not to be shown.

Or any other suggestion on how could I do this: in some cases after I
run the custom action I want the uninstaller to abort exactly as it
would do when the user presses cancel". Is this possible?

Thx,
Viv
 
K

Kalle Olavi Niemitalo

Viviana Vc said:
Thx for you answer. Actually my problem is not the rollback. Let's say
that I have a custom action that in some cases needs to make the
uninstaller to stop simulating the same behaviour like the user pressed
Cancel, so rollback should be run. So let's say if my exe returns -1 the
uninstaller should react like the user has chosen cancel on the MSI
dialog.

You cannot do this with an EXE custom action.
In a DLL custom action [1], return ERROR_INSTALL_USEREXIT = 1602.
In a script custom action [2], return IDCANCEL = 2.

References:

[1] Custom Action Return Values [Windows Installer]
http://msdn.microsoft.com/library/en-us/msi/setup/custom_action_return_values.asp

[2] Return Values of JScript and VBScript Custom Actions [Windows Installer]
http://msdn.microsoft.com/library/e...es_of_jscript_and_vbscript_custom_actions.asp
 
J

Johan Johansson

Viviana said:
I have a deferred custom action that has to show a UI to the user and
then the custom action takes action depending on what the user has
selected.

Why can't you do it in your UI sequence?

Johan
 
V

Viviana Vc

Thanks for your answer. I'll give it a try.

Viv

Viviana Vc said:
Thx for you answer. Actually my problem is not the rollback. Let's say
that I have a custom action that in some cases needs to make the
uninstaller to stop simulating the same behaviour like the user pressed
Cancel, so rollback should be run. So let's say if my exe returns -1 the
uninstaller should react like the user has chosen cancel on the MSI
dialog.

You cannot do this with an EXE custom action.
In a DLL custom action [1], return ERROR_INSTALL_USEREXIT = 1602.
In a script custom action [2], return IDCANCEL = 2.

References:

[1] Custom Action Return Values [Windows Installer]
http://msdn.microsoft.com/library/en-us/msi/setup/custom_action_return_values.asp

[2] Return Values of JScript and VBScript Custom Actions [Windows Installer]
http://msdn.microsoft.com/library/e...es_of_jscript_and_vbscript_custom_actions.asp
 
V

Viviana Vc

AFAIK, all the custom action that are defined in the UI secquence are
skiped if the (un)installer is run in silent mode. I need to run my
custom action so I need to have it in the execute sequence.

Then my custom action needs to talk to the server for some things and if
this communication fails I am asking the user if he wants to continue or
to abort the uninstaller. So I need at this point to show him an UI.

Viv
 
V

Viviana Vc

Taking in account your suggestion can I do the following?:
- run my exe and this exe will set a specific MSI property in case
cancel was selected
- add a new VBScript custom action that will be executed right after the
above one
- this one checks that property and in case it was cancel it will return
IDCANCEL=2
Would something like this be ok?

Or creating a VBSCript CA that itself runs my exe (this is available on
the target system) and checks the return value and if it was cancel it
will itself return IDCANCEL=2?

Thanks,
Viv


Viviana Vc said:
Thx for you answer. Actually my problem is not the rollback. Let's say
that I have a custom action that in some cases needs to make the
uninstaller to stop simulating the same behaviour like the user pressed
Cancel, so rollback should be run. So let's say if my exe returns -1 the
uninstaller should react like the user has chosen cancel on the MSI
dialog.

You cannot do this with an EXE custom action.
In a DLL custom action [1], return ERROR_INSTALL_USEREXIT = 1602.
In a script custom action [2], return IDCANCEL = 2.

References:

[1] Custom Action Return Values [Windows Installer]
http://msdn.microsoft.com/library/en-us/msi/setup/custom_action_return_values.asp

[2] Return Values of JScript and VBScript Custom Actions [Windows Installer]
http://msdn.microsoft.com/library/e...es_of_jscript_and_vbscript_custom_actions.asp
 
K

Kalle Olavi Niemitalo

Viviana Vc said:
Taking in account your suggestion can I do the following?:
- run my exe and this exe will set a specific MSI property in case
cancel was selected

No, you can't do that, at least not easily. To set a property,
you'd have to call MsiSetProperty, but it requires a MSIHANDLE
parameter, which you cannot get to the process running the exe.

(There probably are sneaky ways around this, e.g. by making the
exe attach itself as a debugger to the process that started it,
but a DLL custom action will certainly be easier.)
Or creating a VBSCript CA that itself runs my exe (this is available on
the target system) and checks the return value and if it was cancel it
will itself return IDCANCEL=2?

This sounds doable. However, I recall reading a horror story
about an anti-virus program that blocked all scripts, including
script custom actions. If you suspect your customers may be
using such things, a DLL custom action may be more reliable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top