Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Custom Action and VISTA

I have included an EXE as a Custom Action in the following way:

In InstallUISequnce - AND InstallExecuteSequnce ->MigrateFeatureStates:
General Properties:
Type : Exe with working directory and path given by a Formatted
Full Path: [&skupdate.exe]
Execution Properties:
Synchronous execution, chck return code
Execution options:
Immediate execution
Scheduling Options:
Execute only once if present in both sequence tables
Execution Condition:
Expression : OLDPRODUCTS<>""

This works perfectly with XP :D but not with VISTA :cry:

Searching the forum I found that I might have to set in Execution Options the option Deferred with no impersonation. Unfortunatey this option is grayed out and therefore not available.

How can I make my Custom Action work with VISTA?

Thanks in advance.
Ulli

PS: I am working with AI 6.8 and the project is an Enterprise project.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Custom Action and VISTA

Hi,

On Vista the custom actions which need Administrator privileges to run should be set as "Deferred with no impersonation". This way they will run under the local system account with full privileges. Unfortunately deferred custom actions can be scheduled only between the "InstallInitilize" and "InstallFinalize" standard actions (under "InstallExecuteSequence"). Therefore, you can use this option only for the custom action in "InstallExecuteSequence".

However, for the "InstallUISequence" custom action you can try using a Launch file as Administrator custom action.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Re: Custom Action and VISTA

Hello,
thanks for your answer, which unfortunately does not help me. :(
Your proposal only gives me the chance to start my EXE at a time when it is too late.

My task is the following:
In case of an update-installation I want to start my EXE.
I got this all to work on XP. With VISTA (and Windows 7) it does not work.

So my question still is:
Can I start an EXE on VISTA when the setup detects that it is an update (OLDPRODUCTS<>"") BEFORE the installation begins?

Thanks in advance.
Ulli
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Custom Action and VISTA

Hi,
Can I start an EXE on VISTA when the setup detects that it is an update (OLDPRODUCTS<>"") BEFORE the installation begins?
Yes, you can use a custom action for this. However, there are two cases:
1) If the EXE needs Administrator privileges you can use a Launch file as Administrator custom action.
2) If the EXE doesn't need Administrator privileges you can use any type of custom action which supports EXE files ("EXE with working Dir" or "New Attached Custom Action" for example).

Unfortunately the Vista UAC doesn't offer Administrator privileges to processes very easy.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Re: Custom Action and VISTA

Hi,
1) If the EXE needs Administrator privileges you can use a Launch file as Administrator custom action.
BUT: in InstallUISequnce - MigrateFeatureStates this option (Launch file as Adminsistrator) is not available.

And from an ealier thread I have learned, that I must use MigrateFeatureStates because I want to launch the file in case of an update-Installation (OLDPRODUCTS<>"") BEFORE the installation starts.

So the question is still open.

Regards
Ulli
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Custom Action and VISTA

Hi,

Please note that the "Launch file as Administrator" custom action can be used only as an "UI Custom Action" through a DoAction control event (it requires the Dialog Editor feature). Also, the control event which launches the custom action can be conditioned with the OLDPRODUCTS property to run only if an older version is found on the machine.
And from an ealier thread I have learned, that I must use MigrateFeatureStates because I want to launch the file in case of an update-Installation (OLDPRODUCTS<>"") BEFORE the installation starts.
Please note that scheduling a custom action under "MigrateFeatureStates" will not make it run only during an upgrade. The condition of the custom action determines when it will run.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Re: Custom Action and VISTA

Soory, but I am rather confused now. :?

In the thread here
http://www.advancedinstaller.com/forums ... lli#p20949
you helped me, so that my EXE started BEFORE the installation. This is what you wrote and this helped me.
You can try this improvement:
- go to the "Custom Actions" page and show the "InstallUISequence" -> "MigrateFeatureStates" standard action
- select your custom action
- while the SHIFT key is pressed drag it over "InstallUISequence" -> "MigrateFeatureStates"
- in its "Custom Action Properties" page select the "Execute only once if present in both sequence tables" option

This way the custom action will be shared between the UI Sequence (when the dialogs are shown) and the Execute Sequence (when the actual installation is performed). If the installation uses an UI, the EXE will be launched by the first instance of the custom action, right before the "WelcomeDlg" dialog is shown.
The solution you provide me now seems to be something completely new. And I am not sure if I understand it. Sorry!

Could you explain your last answer a little bit?

The following questions came up with your anwer:
1. I think I will have to add a new dialog to the setup. Is this right?
2. On this dialog I could start my custom action. Is this right?
3. I succeeded in adding a new dialog as the first dialog. But how can I show the dialog only when OLDPRODUCTS<>"" (in case of an update)?

Regards
Ulli

PS: My task that I want to fulfill: I want to start an EXE before the installation if it is an update (OLDPRODUCTS<>""). Only on VISTA (and Windows 7) my solution up to now does not work.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Custom Action and VISTA

Hi,
The solution you provide me now seems to be something completely new.
Yes, instead of scheduling the custom action under "InstallUISequence" -> "MigrateFeatureStates" you can use an "UI Custom Action".
1. I think I will have to add a new dialog to the setup. Is this right?
If you want, you can use a new custom dialog. However, you can also modify an existing dialog (instead of creating a new one).
2. On this dialog I could start my custom action. Is this right?
Yes, you can use a "DoAction" control event like explained in the Execute custom action on button push how-to.
how can I show the dialog only when OLDPRODUCTS<>"" (in case of an update)?
Please note that the User Guide contains the Conditionally show "StartMenuShortcutsDlg" and Conditionally show the "UpgradeDlg" dialog how-to's which explain how to conditionally show a dialog.

Basically, you can use a "Launch file as Administrator" custom action for a custom button on an installation dialog. When the user clicks that button an elevation prompt will be shown, allowing the user to run the custom action as an Administrator.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Re: Custom Action and VISTA

Hi Cosmin,
Yes, you can use a "DoAction" control event like explained in the Execute custom action on button push how-to.
OK, I succeeded in that.
BUT: the same EXE which worked as my CustomAction described earlier, does not work any more.
The problem seems to be, that my EXE depends on some DLLs. When I tried with an EXE without DLLs it worked.
Unfortunately I depend on the DLLs. I included the EXE and the DLLs as Temporary Files with a target in CommonAppData.

So my question is: Is it possible to make my EXE with DLLs work with "DoAction"?
And if yes: How?

Thanks in advance.
Ulli
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Custom Action and VISTA

Hi,

If the DLLs are in the same folder as the EXE you are launching, then the EXE should be able to find them. Does the EXE require anything else besides the DLLs next to it? If not, can you please send us the AIP you are using to support at advancedinstaller dot com so we can investigate it?

I didn't know that the EXE had dependencies. For this case a solution would be to use an "EXE with working Dir" custom action and to elevate the installation by using the bootstrapper. In the "Bootstrapper" tab of the "Media" page you can set the execution level of the bootstrapper to require Administrator privileges.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Ulli
Posts: 17
Joined: Tue Dec 30, 2008 12:44 pm

Re: Custom Action and VISTA

Hello,
If the DLLs are in the same folder as the EXE you are launching, then the EXE should be able to find them.
The DLLs are in the same folder.
Does the EXE require anything else besides the DLLs next to it?
No.
If not, can you please send us the AIP you are using to support at advancedinstaller dot com so we can investigate it?
I sent you the AIP.

Regards,
Ulli

Return to “Common Problems”