In XP and earlier versions of Windows you always had privileges equal to the Administrator account which made launching applications a pretty simple procedure. Vista and Windows 7 introduced a new security model (User Account Control) that restricted access to applications that could modify the system. These applications would now require approval from the user.

In Windows 7, Microsoft updated UAC in several ways. One that affects your SWF Studio applications directly is that UAC does not prompt when certain programs included with Windows make changes requiring elevated permissions while other programs still trigger a UAC prompt.

The end result is that some solutions that worked in Vista not work in Windows 7. Even though Windows 7 does not prompt for elevation, the call will still fail if you don't have the correct privilege level. I recently ran across this when a customer reported problems launching odbcad32.exe on Windows 7.



The Obvious, but Wrong, Way

The most obvious way to launch a system tool like odbcad32.exe is to use ssCore.Shell.execute (see below). And on Windows XP this works fine. On Vista and Windows 7 it fails miserably. The reason it fails is that odbcad32.exe requries Administrator privileges if it is not launched manually.

ssCore.Shell.execute({path:"winsys://odbcad32.exe"});
Since Shell.execute uses the Windows CreateProcess API function, the child process will inherit the privilege level of the caller (your SWF Studio application). If the caller has admin privileges everything works. If not, the call fails.

The Vista Solution

The way around this on Vista was to use ssCore.Shell.open (see below).

Shell.open uses the Windows ShellExecuteEx API function which did not associate the caller's privilege level with the child process and presented the user with a UAC prompt so they could decide whether to run the application or not.

ssCore.Shell.open({path:"winsys://odbcad32.exe"});
The Right Stuff

However, on Windows 7, this call will still fail. The solution is to use a verb that is documented for use in .NET but not with the ShellExecuteEx API function. The RunAs verb makes odbcad32.exe work the same as if you had just double clicked it, so on Windows 7 it just works without prompting for elevation.

ssCore.Shell.open({path:"winsys://odbcad32.exe", verb:"RunAs"});
On older operating systems this call will prompt for elevation, even if it's not strictly necessary. For example, using the RunAs verb on XP will ask you which user you want to run as. On Vista it will bring up the familar UAC prompt. If you want to avoid this prompt you can check the OS version and only use the RunAs verb on Windows 7.