Hello

I have creating an MSI Installer and writing custom actions in it.
As per the requirement while uninstallation I have check some conditions like registry keys
based on the condition message box to be displayed.

To achieve above requirement custom action (VC++ dll) is added in MSI Installer, after doing this MSI installer is able to

display message but after pressing OK button from the displayed message and even returning some error from the custom

action function processing of Installer is resumed again.

Based on some conditition and by by using custom action I need to display the a modal message and after pressing the OK

button from the displayed message, processing of MSI Installer should be terminated/stopped.

Please suggest by using custom action how to stop processing of MSI Installer.

Thank You

1 Comment   [ + ] Show Comment

Comments

  • I have to check version of the installed MSI from the registry and incase installed version [retrieved from registry] is old version and currently running installer is latest one then some message [Modal Window] to be displayed to the user and when user click the OK button then processing of installer will be terminated.

    Please suggest can this functionality be achieved without implementing custom actions or not.
    In case above functionality can be achieved without implementing custom actions then please suggest the way to achieve it.
Please log in to comment

Answers

0
AddRemovePrograms calls exactly the same APIs that MSIExec does so there is no means to tell which route has been selected for the uninstall request.

By the way, the fact that your users are allowed to run installs and uninstalls means that they have local administrative rights, correct? Dangerous territory...
Answered 07/08/2015 by: VBScab
Red Belt

Please log in to comment
0
Have you considered using the standard action "Terminate Installation" - this should work just as well on uninstall.

Answered 07/08/2015 by: EdT
Red Belt

Please log in to comment
0
This requirement, which I have read two or three times, makes no sense to me.
As VBScab indicates, the uninstall process started from Add/Remove programs is identical to any other method of starting uninstall and therefore you cannot differentiate between them. I think in your situation, if I understand correctly, you wish to prevent the user being able to trigger an uninstall operation if the MSI is run again after the application has been installed. Doing this opens a dialog box which offers the options of Modify or Repair or Remove (Uninstall).  You can suppress these options using the following public property settings:
ARPNOMODIFY=1
ARPNOREPAIR=1
ARPNOREMOVE=1

Setting one or more of these properties will stop users being able to uninstall, for example, and this may be a good solution if you want to prevent users being able to uninstall in ANY circumstances so that only you (as part of IT support) are able to change the version on the workstation.  It is also a good idea NOT to seek input from users as they are generally too stupid to know how to answer and this will lead to support calls being raised and therefore costs going up.

Finally, if your operating system is Windows 7 or higher, the user account runs in a different CPU session to a system process. If you are deploying your applications via SCCM or Altiris or any other service based installation system, you no longer have the option to interact with desktop. The only way for an application running in a system context to communicate with a user is either via named pipes or a similar interprocess communications method. Trying to force interaction with desktop just results in UAC messages that will further confuse your users.
Answered 07/08/2015 by: EdT
Red Belt

Please log in to comment
0
Use VBScript Custom action
Answered 07/28/2015 by: jagadeish
Red Belt

Please log in to comment
0
An MSI can natively check registry keys and pop up a message. Check out the various tables concerned: e.g. DrLocator, RegLocator, LaunchCondition.

Note that, if you want to persist in the custom-rolled approach, your MSI needs to cater for silent installations.
Answered 07/06/2015 by: VBScab
Red Belt

  • I have to check version of the installed MSI from the registry and incase installed version [retrieved from registry] is old version and currently running installer is latest one then some message [Modal Window] to be displayed to the user and when user click the OK button then processing of installer will be terminated.

    Please suggest can this functionality be achieved without implementing custom actions or not.
    In case above functionality can be achieved without implementing custom actions then please suggest the way to achieve it.
Please log in to comment
0
For upgrading, use the Upgrade table. That's what it's there for.

It seems, though, that you want to allow the user to abort the upgrade. Quite why isn't clear :-(
Answered 07/07/2015 by: VBScab
Red Belt

  • Hi VBScab,

    Thank you very much for you response.

    By using the following snippet I am able to display modal message from MSI installer and stop the processing of the installer.

    //code

    PMSIHANDLE hRec = MsiCreateRecord(2);
    MsiRecordSetString(hRec,0,pszMsg);
    UINT uiRet =
    MsiProcessMessage(hInstall,INSTALLMESSAGE(INSTALLMESSAGE_USER |dwOptions),hRec);
    return ERROR_INSTALL_USEREXIT;

    But As per our requirement I have to display the message to the user at the time of uninstall, when after installing the product user again run the installer then installer displays message to the user and based on user action uninstall processing should be cancelled.

    but when the user selects uninstall option from Add/remove program then no message should not be displayed and uninstall done successfully.

    By using custom actions and above code snippet, When uninstall is performed by using MSI installer then message is displayed to the user and based on user action processing of uninstall processing is terminated.

    But while trying to uninstall by using the Add/Remove program same behavior is observed, means message is displayed to the user and based on user action uninstall processing is terminated.

    Please suggest how to achieve above functionality, i.e. while trying to uninstall by using MSI installer some message should be displayed to the user and based on user action uninstall processing is terminated and while uninstall from Add/remove program no message should be displayed and product should uninstall successfully.

    Means how to differentiate between the processing while uninstalling using MSI installer and while uninstalling using Add/remove program.
Please log in to comment
Answer this question or Comment on this question for clarity