Skip to main content
August 26, 2010
Question

NativeProcess fails to work correctly with UAC

  • August 26, 2010
  • 17 replies
  • 7805 views

Hi there,

I'm using AIR 2's NativeProcess API to run a downloaded update for my application.

On computers without UAC enabled, this works fine, when calling NativeProcess.start(), it starts the installer and runs absolutely fine.

On computers with UAC enabled however, after calling NativeProcess.start(), it stops, and does not run any of the lines of code after it within the function. (In my case, it creates a log message and then calls NativeApplication.nativeApplication.exit(), but I also tested with a trace statement before and after; the trace after calling NativeProcess.start never displayed.)

I am also elsewhere in the application starting javaw.exe to make use of the merapi bridge/amf messaging. Starting javaw works with UAC enabled. It seems this issue may be isolated to installation programs that come up with a UAC warning "This program is about to make changes to your computer" type message.

I also tried using File.openWithDefaultApplication to open the directory containing the installer, but this _also_ doesn't work on the machines with UAC enabled!

Is there any work-around for this problem as I can't use the applicationupdater (since it's targeted at .air only at the moment) and I can't execute the downloaded file nor navigate the user to the downloaded directory!

Any help would be greatly appreciated!

Adam

This topic has been closed for replies.

17 replies

chris.campbell
Legend
August 26, 2010

Hi Adam,

Thanks for bringing this issue up.  I'm looking into it now and will get back as soon as I have more info.  I believe other's have been able to accomplish native installer updates, but I haven't heard any discussion about UAC.  Does this only occur with installed applications or do you see this under the debugger too?

Thanks,

Chris

August 27, 2010

Hi Chris,

Thanks for the quick response! The machines which are having problems unfortunately don't have flex builder installed as they are just test machines, so I haven't been able to test if the problem also exists when run using adl through flex builder.

It seems to affect some machines with UAC enabled but not others, after testing three windows 7 machines today, all of them worked fine and exactly as intended, with or without UAC enabled, as did one machine running vista. A second vista machine and a windows 7 machine that has been upgraded from vista both have the problems described.

The problem also appears when downloading the Java JDK 7 through AIR and trying to execute the file on those machines. As with the download of the AppUpdater.exe, absolutely nothing happens, but manually executing the file works correctly, displaying the 'This file will make changed to your computer' dialog before installing.

Please let me know if there is anything else I can do to help diagnose the issue.

Regards,

Adam

chris.campbell
Legend
August 30, 2010

Hi Adam,

I played around with the new NativeApplicationUpdater API's released recently by Piotr Walczyszyn on Windows 7, but I didn't run into any problems with UAC.  However, it sounds like it might not be an issue with Win 7, but specific to Vista?

I asked one of the developers that worked on this feature and here's what he had to say:

On a machine with UAC you cannot use the NativeProcess API to launch an installer. The reason for this is because the NativeProcess API uses CreateProcess internally and the CreateProcess API is not able to elevate privileges. The windows API that does allow for privilege elevation is ShellExecute. You should be able to launch the installer directly using File.openWithDefaultApplication since internally it uses ShellExecute. If File.openWithDefaultApplication isn’t working it may be due one or more possible problems: If you are not in the ExtendedDesktop profile File.openWithDefaultApplication will not launch EXE files.  This seems unlikely since the forum post indicates that they were able to used NativeProcess (also requires ExtendedDesktop) to launch a Java process. The other issue might be the name of the installer. If the Installer is named Setup.exe, then the OS will attempt privilege elevation, but otherwise the installer must do this elevation itself. The Installer must run with elevated privilege in order to actually work on a UAC machine.

So the short answer is  NativeProcess won’t work on UAC machines by design, but File.openWithDefaultApplication should so. If it doesn’t then we need more info from the user.

After rereading that, I believe I might not have seen the issue because I named my installer "setup.exe" during my tests last friday.  I'll follow up with Piotr to see which API (native process or openWithDefaultApplication) he's using.  I'll also try using File.openWithDefaultApplication on a Vista machine.

Thanks,

Chris