|
|
hi, we developed an application and want it to run on Vista, but crashes whenever UAC is on.
The error comes only When our App. trys to upgrate from trial to full Version.
When the App. is launched, UAC guesses that there is no need for "full administrator access token" and that is correct according to the new Vista architecture, but when our App. presents a form to registy the full version, the user doesn't have the administrator token, because the App was already launched as a Standar User App. (even if it is an Administrator)
We think that providing a manifest file with the "requireAdministrator" is not the solution because we want standard users to be able to access our App.
Instead we want to present a Message saying "You need to run this App. as an Administrator" when this error occurs. In order to do this, we want to know if there is a way to know the User Access token, or if there's a recommended way to do this.
Thanks, Najash
|
|
Hi Najash
To find out if the user is a standard user, you could call:
OpenProcessToken(GetCurrentProcess(), … )
then ...
GetTokenInformation( … TokenElevationType… );
then, if TokenElevationType is TokenElevationTypeDefault or TokenElevationTypeLimited, you have a standard user.
There are probably other ways to do it, as well :)
Once you know the user is a standard user, you could either: 1) display a message to restart the app as Administrator; or 2) create a separate process which has requireAdministrator in its manifest, to perform the upgrade (and possibly close the existing, standard user process).
The other "workaround" would be to use MSI to make the changes, with the user running as a Standard User.
Have you seen the ISV Vista cookbook, from Microsoft?: http://sharepoint.microsoft.com/innovateon/vistadeveloper/Developer%20Documents/ISV%20Windows%20Vista%20Compatibility%20Cookbook.doc Pages 6 and 7 describe this last option a bit more.
Other folks may have better ideas. Hope this helps a bit,
Andrew
|
|
Excellent!, Thanks again Andrew.
|
|
|