cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
andyamstrad
Level 6

2008 Migration Issue....

Ive just migrated a basic msi installer from Installshield 11 to 2008, very few migration issues 🙂

However, within the migrated Installer I am attempting to launch another process using a wrapped up version LaunchAppAndWait. On all target operating systems with the exception of Vista this works fine. When using Vista the install fails to launch the process and the returns a code: 740(ERROR_ELEVATION_REQUIRED).

The workaround for this problem is to use the new LaunchApplication API with the LAAW_OPTION_USE_SHELLEXECUTE flag. This makes it use ShellExecute (which can show UAC prompts) instead of CreateProcess (which won't).

However, I need the exit code to check for reboots also - LaunchApplication does not offer this.

Any solutions to this problem??
Labels (1)
0 Kudos
(5) Replies
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

If you are waiting for the process to exit, you can use the LAAW_PARAMETERS.nLaunchResult variable:
LAAW_PARAMETERS - http://helpnet.macrovision.com/Robo/BIN/Robo.dll?tpc=/robo/projects/installshield14langref/LAAW_PARAMETERS.htm
0 Kudos
andyamstrad
Level 6

The help doesnt seem to mention LAAW_PARAMETERS.nLaunchResult for the function LaunchApplication.

Also LAAW_PARAMETERS.nLaunchResult returns whether or not the function was successful, not an exit code e.g. 3010 for a reboot.

Are there any example snippets for using the above function to retrieve the exit code?

Also should the function WaitForApplication be used instead of WaitForSingleObject???

The Installshield help is ntovery helpful.
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

LAAW_PARAMETERS.nLaunchResult applies to LaunchAppAndWait and LaunchApplication. If you pass the LAAW_OPTION_WAIT flag in the nOptions parameter to LaunchApplication, LaunchApplication will automatically wait for the created process to exit. Once the wait has completed, LaunchApplication sets LAAW_PARAMETERS.nLaunchResult to the process exit code by calling the GetExitCodeProcess Win32 API.

I you are trying to manually wait for the launched process, WaitForApplication should be used instead of WaitForSingleObject. You will need to manually retrieve the exit code in this case.
0 Kudos
andyamstrad
Level 6

Thanks for the reply

The help didnt seem to mention LaunchApplication.

So if I pass the LAAW_OPTION_WAIT flag LaunchApplication will automatically wait for the created process to exit and give me an exit code e.g. 310 for reboot?

And once the wait has completed, LaunchApplication calls the GetExitCodeProcess Win32 API?

And what do you mean manually wait and manually retrieve the exit code ?

All I want to do is launch the application in shell mode (to display UAC prompts) and handle the exit code for reboots.
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

Passing the LAAW_OPTION_WAIT flag to LaunchApplication or LaunchAppAndWait will automatically wait for the launched process to exit before continuing. Once the launched process has exited, the LAAW_PARAMETERS.nLaunchResult variable is set to indicate the exit code from the launched process.

Using LaunchApplication with the LAAW_OPTION_USE_SHELLEXECUTE flag and the LAAW_OPTION_WAIT flag should cause a UAC prompt to appear for the executable to be launched, and will then wait for it to exit if it successfully launched. Upon exit, LAAW_PARAMETERS.nLaunchResult should contain the exit code from the launched process.
0 Kudos