App blocked by UAC

G

Guest

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
 
A

Andrew McLaren

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/inn.../ISV Windows Vista Compatibility Cookbook.doc
Pages 6 and 7 describe this last option a bit more.

Other folks may have better ideas. Hope this helps a bit,

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top