Windows Vista Changes

Win32 No Comments »

The next version of Windows, Windows Vista, has a new security feature called User Account Control (UAC) (nee User Account Protection (UAP) nee Least-privileged User Account (LUA)), which basically means that users will no longer have full Administrator privileges by default. Microsoft has produced an overview of the new security features, a Developer Best Practices guide, and a blog to help inform developers about the upcoming changes.

If your application currently runs correctly as a non-Administrator, no development effort should be required for Vista. If you perform any privileged operations (such as writing to Program Files\ or opening a HKEY_LOCAL_MACHINE key in the registry with write privileges), your application will likely continue to work but the user experience may be suboptimal.

Here is how to perform some common development tasks while working in a least-privileged environment:

  • Need to read from a HKEY_LOCAL_MACHINE key in the registry? Use RegOpenKeyEx() (not RegOpenKey()) and request KEY_READ (not KEY_ALL_ACCESS) privileges.
  • Need to save per-user data which will roam with the user (i.e. may be replicated to the network)? Get the path to the Application Data\ folder by either retrieving the value of the environment variable %APPDATA% or calling SHGetFolderPath() with the parameter CSIDL_APPDATA. The recommended directory in which to store files appears to be %APPDATA%\<Vendor>\<Product>\, e.g. %APPDATA%\Microsoft\Office\.
  • Need to save per-user data which will not roam with the user (e.g. a web browser cache)? Call SHGetFolderPath() with the parameter CSIDL_LOCAL_APPDATA.
  • Need to save per-machine data (e.g. machine-wide game high scores)? Use %ALLUSERSPROFILE% or SHGetFolderPath() with the parameter CSIDL_COMMON_APPDATA.
  • Need a place to store a temporary file? Use %TEMP% or GetTempPath(). GetTempFileName() may also be useful.

To help with the transition, Microsoft’s Application Verifier may prove a useful tool.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in