Developer Guidelines for Designing Applications for Windows Vista
Created: 28 Sep 2007 | Updated: 30 Sep 2007
Here are few basic guidelines for designing applications for Windows Vista.
This article is intended for a developer, however an application packager will also find this information useful.
- Do not assume the end user as an admin when we develop a .NET application. We will need to ensure normal users can be fully productive.
- Do design the application such that administrative intervention is limited. Identify tasks which needs elevation with a "shield" button.. This shield icon will be an entry point for all administrative operations for the application.
- Always test your application as a normal user.
- Do not use the registry as an IPC mechanism.
- Automatic updates and patches for an application should be done using Windows Installer. The patches will require a certificate from the MSI for installation or updations.
- Do not write per-user information or user-writable information to Program Files or Program directories.
- Ensure that processes running as standard user do not write to global namespaces like %systemroot% and to other sensitive system areas..Instead use %alluserprofile%.
- Check where the settings are stored in the registry. If any settings are stored in HKEY_LOCAL_MACHINE, the application or control panel will most likely require an administrator access token.
- Users should have to elevate only to perform tasks that require an administrator access token. All other tasks should be designed to eliminate the need for elevation. Pre-Windows Vista software often requires an administrator access token unnecessarily by writing to the HKEY_LOCAL_MACHINE or HKEY_CLASSES_ROOT registry sections or to the Program Files or Windows system folders.
- Redirect some write operations (system folders and HKLM\Software) to per- user virtual stores.
- Do not perform administrative actions on first run. All the administrative actions should be taken care during installation of the exe or MSI. This will avoid the user being annoyed by UAC.
- Do not write custom actions to copy files to Windows folder.
- Do write application data to a location that the standard user has access to,
(C:\Users\username\Appdata) : user specific data (C:\Users\All Users\Application Data) : not user-specific data.
- Command line tools run AsInvoker
- Do not register components with rundll32. This feature is not supported in Windows Vista. Calling directly into Rundll32 results in UAC compatibility issues. When an application relies on the Rundll32 executables to perform its execution, Rundll32 calls AIS on behalf of the application to initiate the UAC elevation prompt. As a result, the UAC elevation prompt has no knowledge of the original application and displays the application requesting elevation as "Windows host process (Rundll32)". If there are some existing applications, then register dll using a custom developed exe and call that exe while executing the program/application.
- Use application manifests to make the existing applications run on Vista. One can run the application either as a invoker, highest privilege or as an admin.