cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jgkenned
Level 4

LaunchAppAndWait causes 740 error in windows 7

I have an old install shield project that worked fine for older versions of windows including XP and WinSrv 2003. I'm trying now to get this project working for Windows 7 (and I guess Vista as well). My problem is with a call to a win32 application that I wrote in CPP. I'm using the LaunchAppAndWait function and I get a 740 error from LAAW_PARAMETERS.nLaunchResult. I researched this and it has something to do with privilege elevation.

My install shield project is a Basic MIS project with some InstallScript of course. In the General Information section I have an install condition of AdminUser so that I am sure an administrator only runs this install. I have also signed the install. The executable that the LaunchAppAndWait function is trying to call does request elevated privileges and that level is "requireAdministrator". I believe I have everything in place that makes sense but it does not work. Oh and the executable is also digitally signed.

Here is a code snippet:

function LaunchPIDriver_Install(hMSI)   
STRING svInstallDir;
NUMBER nvSize, nResponse, nRC, nType;
STRING svProgramPath;
STRING svMessage;
STRING svRC;
begin


svProgramPath = svInstallDir ^ "Win32\\PrinterInstaller\\PIDriver.exe";

// Invoke PIDriver
if (LaunchAppAndWait(svProgramPath,"",LAAW_OPTION_WAIT | LAAW_OPTION_HIDDEN | LAAW_OPTION_SHOW_HOURGLASS) < 0) then
// LaunchAppAndWait Failed...Return Error...
svMessage = "LaunchPIDriver_Install - LaunchAppAndWait() Failed";
NumToStr(svRC, LAAW_PARAMETERS.nLaunchResult);
MessageBox(svRC,INFORMATION);
SprintfMsiLog(svMessage);
SprintfMsiLog("Installation UNSUCCESSFUL!!!");
return ERROR_INSTALL_FAILURE;
else
// LaunchAppAndWait Successful...
// Was PIDriver Install Successful?
if (LAAW_PARAMETERS.nLaunchResult = 0) then
// Yes - Return Success
NumToStr(svRC, LAAW_PARAMETERS.nLaunchResult);
return ERROR_SUCCESS;
else
// No - Return Error
NumToStr(svRC, LAAW_PARAMETERS.nLaunchResult);
svMessage = "LaunchPIDriver_Install - PIDriver.exe Failed RC: " + svRC;
SprintfMsiLog(svMessage);
SprintfMsiLog("Installation UNSUCCESSFUL!!!");
return ERROR_INSTALL_FAILURE;
endif;
endif;
end;


Ideas?
thanks for any help
Labels (1)
0 Kudos
(2) Replies
DebbieL
Level 17

The LaunchAppAndWait function has been superseded by the LaunchApplication function, which has support for launching applications with elevated privileges. To learn how to use LaunchApplication, see LaunchApplication, and note the first bullet point in the Additional Information section near the bottom of the help topic.
0 Kudos
jgkenned
Level 4

I seemed to have found a solution for this. There is a setting under the Release section, for a configuration, for a release, on the setup.exe tab. I set "Required Execution Level" to Administrator. This setting seems to propagate and thus allows my executable to be called correctly. Not sure if this helps installs that do not use a setup.exe.

Additionally, I found an article that suggested a switch from LaunchAppAndWait to LaunchApplication.
0 Kudos