User Account Control Helpers Library
I've just released a preliminary version of the User Account Control Helpers Library, a bunch of code meant to assist developers targeting Windows Vista with the inevitable adaptation to UAC.
This preliminary release addresses two major hurdles in porting applications to Vista:
- Embedding an application manifest in each and every executable to specify a requested execution level;
- Interacting with the UAC mechanism for application compatibility purposes.
UAC in a Nutshell
The primary goal of the UAC mechanism is improving security in the Windows operating system. This worthy objective is achieved on two axes:
- Making more actions in the operating system standard user-friendly (i.e. not requiring administrative privileges);
- Filtering the user token for users who have administrative privileges on the machine so that most of their operations are not performed under the full administrative token.
An application (EXE) may require elevation to administrative privileges if the user is a standard user or if the user is an administrator but runs under a filtered token. This elevation presents a UAC consent prompt if the user is an admin with a filtered token, or presents a credential prompt if the user is a standard user. An application does that by embedding a manifest into the executable, which specifies the requested execution level for that application. This also prevents virtualization for the application, which is usually undesirable if you are porting to Vista and have the ability to modify the application configuration and installation.
Download and Examples
The preliminary release is available for download in 32-bit and 64-bit flavors from CodePlex. The source code is also available. You're more than welcome to contribute ideas or code to the project by signing up on CodePlex or leaving a comment on the contact form.
Some usage examples to whet your appetite:
For more information on UAC and manifests, consult the following resources:
- TechNet: Understanding and Configuring User Account Control in Windows Vista
- C. Heller: How to Embed a Manifest in an Assembly: Let Me Count the Ways
- KB: How to Disable the User Account Control Prompt for Certain Application
- Daniel Moth: Blog, UAC Category