This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: LaunchAppandWait Windows 7 Custom Action.
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 06, 2010
10:53 AM
LaunchAppandWait Windows 7 Custom Action.
Ok my last thread was bust.
This is a much simpler question.
I'm running a custom action with:
LaunchAppAndWait(C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe, PathToOurDll, wait, minimized)
On Windows 7, this doesn't execute. I've tried to set it to Deferred Action in the system context as suggested. But it still doesn't work.
Is anyone getting this to work?
This is a much simpler question.
I'm running a custom action with:
LaunchAppAndWait(C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe, PathToOurDll, wait, minimized)
On Windows 7, this doesn't execute. I've tried to set it to Deferred Action in the system context as suggested. But it still doesn't work.
Is anyone getting this to work?
(9) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 06, 2010
03:37 PM
To debug this issue, what is the return value from LaunchAppAndWait? If it is not zero, what is the value contained in LAAW_PARAMETERS.nLaunchResult? This will provide a Win32 error indicating why the exe did not launch. (Note that if LaunchAppAndWait returned zero, this value will be set to the return code of the launched executable once it has exited.)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 06, 2010
03:41 PM
It doesn't fail. It doesn't return 0.
For reference, i created a setup.exe and right clicked as administrator, instead of using our MSI and it worked...
I think it's purely a rights thing.
But we want to use an MSI and in windows 7, we lost the Right Click on MSI and get 'Run as Administrator' shield thing.
Can i get back the shield to run my msi? or should i be running my custom actions differently?
For reference, i created a setup.exe and right clicked as administrator, instead of using our MSI and it worked...
I think it's purely a rights thing.
But we want to use an MSI and in windows 7, we lost the Right Click on MSI and get 'Run as Administrator' shield thing.
Can i get back the shield to run my msi? or should i be running my custom actions differently?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 07, 2010
02:12 PM
If LaunchAppAndWait successfully launches the executable when run as administrator, this would imply that elevated privileges are necessary to launch this executable.
What is the value of LAAW_PARAMETERS.nLaunchResult after LaunchAppAndWait returns and the exe wasn't launched?
What is the value of LAAW_PARAMETERS.nLaunchResult after LaunchAppAndWait returns and the exe wasn't launched?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 07, 2010
02:19 PM
joshstechnij wrote:
If LaunchAppAndWait successfully launches the executable when run as administrator, this would imply that elevated privileges are necessary to launch this executable.
What is the value of LAAW_PARAMETERS.nLaunchResult after LaunchAppAndWait returns and the exe wasn't launched?
nResult = LaunchAppAndWait(CMD, "/c" + szApp, LAAW_OPTION_WAIT|LAAW_OPTION_MINIMIZED);
where szApp is as in the above post. It just runs through. I even set it to check exit code, nothing. Just keeps going as if it worked.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 07, 2010
02:26 PM
I apologize for any misunderstanding, but the code provided does not read the value of LAAW_PARAMETERS.nLaunchResult. Please try adding a line similar to the following after the LaunchAppAndWait call:
What does the message box display when the exe fails to launch?
Note that if you are launching cmd.exe, you may want to replace /c with /k so that the command prompt stays open after the batch or command file passed to it has exited. This will at least allow for viewing any errors that occurred.
SprintfBox(0, "test", "launch result: %d", LAAW_PARAMETERS.nLaunchResult);
What does the message box display when the exe fails to launch?
Note that if you are launching cmd.exe, you may want to replace /c with /k so that the command prompt stays open after the batch or command file passed to it has exited. This will at least allow for viewing any errors that occurred.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 07, 2010
02:28 PM
joshstechnij wrote:
I apologize for any misunderstanding, but the code provided does not read the value of LAAW_PARAMETERS.nLaunchResult. Please try adding a line similar to the following after the LaunchAppAndWait call:
SprintfBox(0, "test", "launch result: %d", LAAW_PARAMETERS.nLaunchResult);
What does the message box display when the exe fails to launch?
Note that if you are launching cmd.exe, you may want to replace /c with /k so that the command prompt stays open after the batch or command file passed to it has exited. This will at least allow for viewing any errors that occurred.
I'll try that right now. But speaking of using cmd.exe, is this even the preferred way to do such an action? Or should i be calling regasm.exe directly?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 07, 2010
02:37 PM
RegAsm : error RA0000 : An error occurred while writing the registration information to the registry. You must have administrative
credentials to perform this task. Contact your system administrator for assistance
And the box states: launchresult -1073741510
So here's the thing. I knew this was the reason it wouldn't complete... so my beef isn't with getting launchappandwait to work.
It's more about what do i need to do to get my custom action to run with elevated privileges.
Now, i've set my packge 'RequireAdministrativePrivileges' = yes. I've tried running this custom action with;
1. Deferred Execution
2. Deferrred Execution int he system context.
Neither works. However, when i create a setup.exe and right click as administrator it all works.
What am i missing in the MSI scenario?
credentials to perform this task. Contact your system administrator for assistance
And the box states: launchresult -1073741510
So here's the thing. I knew this was the reason it wouldn't complete... so my beef isn't with getting launchappandwait to work.
It's more about what do i need to do to get my custom action to run with elevated privileges.
Now, i've set my packge 'RequireAdministrativePrivileges' = yes. I've tried running this custom action with;
1. Deferred Execution
2. Deferrred Execution int he system context.
Neither works. However, when i create a setup.exe and right click as administrator it all works.
What am i missing in the MSI scenario?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 08, 2010
03:20 PM
Regasm.exe should be launched directly instead of through cmd.exe.
Assuming that this action depends on a file installed with the product, sequencing your custom action after InstallFiles with an in-script execution setting of "deferred in system context" should run the action late enough that the files it needs are installed, and it should run with elevated privileges Note that for deferred in system context actions to run elevated, the package being installed needs to be installed per-machine (ALLUSERS=1). Setup.exe should not be required for system context actions to run elevated.
Assuming that this action depends on a file installed with the product, sequencing your custom action after InstallFiles with an in-script execution setting of "deferred in system context" should run the action late enough that the files it needs are installed, and it should run with elevated privileges Note that for deferred in system context actions to run elevated, the package being installed needs to be installed per-machine (ALLUSERS=1). Setup.exe should not be required for system context actions to run elevated.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 08, 2010
03:41 PM
joshstechnij wrote:
Regasm.exe should be launched directly instead of through cmd.exe.
Assuming that this action depends on a file installed with the product, sequencing your custom action after InstallFiles with an in-script execution setting of "deferred in system context" should run the action late enough that the files it needs are installed, and it should run with elevated privileges Note that for deferred in system context actions to run elevated, the package being installed needs to be installed per-machine (ALLUSERS=1). Setup.exe should not be required for system context actions to run elevated.
Yes, it does depend on files installed with product.
Interesting, ALLUSERS=1 and i do run that after installfiles. Alas, i'm calling cmd.exe and not regasm.exe directly though.
My file is installed, it just never registers with regasm.exe. That's the ultimate problem.
Since several people in here are essentially having the same problem, is it possible to attach an example basic MSI project, which calls regasm.exe and runs on Vista and Windows 7? Maybe it's just a matter of people finding different way's to cure the problem and we don't know what the right way to do it is...
Any chance?