Exercise 1: Exploring User Account Control Virtualization
In this exercise, you will diagnose a broken native (Win32) C++ applicationthat exhibits file redirection to the VirtualStore folder.
You will then add a UAC manifest section and compile the application , thereby marking it as UAC-aware. You will observe that instead of being redirected, write operations to the Program Files folder will be blocked resulting in an “access denied” error.
Finally, you will fix the application by modifying it to store the file to the Application Data (ProgramData) folder.
Task 1 – Run the Application without a Manifest
In this task, you will run the application without a manifest, which simulates an older application and triggers the UAC virtualization mechanism. New applications created with Visual Studio 2008 automatically embed a manifest containing a UAC section by default.
Task 2 – Find the Problem
In this task, you will walk through the different steps to confirm that your application is experiencing UAC virtualization.
Task 3 – Add a UAC Manifest
In this task, you will add a manifest to the application to mark the application as UAC-aware. By marking your application as UAC-aware, you declare that the application does not require write access to protected locations. UAC virtualization will not apply to your application.
Task 4 – Correct the Access Denied Error
By embedding the manifest containing a UAC section, you declare to Windows 7 that your application is UAC-aware, and therefore will refrain from writing to any protected storage area. In this task you will change the location to which the text file will be saved and fix the access denied error.