November 11
The five 'W's of Virtualization
Welp I figure now that I have some time to update this thing I might as well do it! As most of you may know Vista is DONE!! after 5+ years of waiting, it's DONE!! It's game time now people and a lot of you have been responding to the call of getting your apps Vista compatibile. I have been seeing a lot of questions on Vista's new Virtualization feature, so much so that even I'm getting confused as to some of the details so I will be writing it out here for some clarity
.
Who does Virtualization affect?:
There is one simple answer to this....Everyone that is running Vista. Virtualization can potentialy affect every application if the application is writing to certain system directories and is not aware of what user context it is running in. This is especialy true if an application is multi-user and has some shared components amongst those many users (for both user experience and developers alike).
What is Virtualization?:
Virtualization is a technology that Microsoft has introduced into Windows Vista; I would like to state now that Microsoft intends to REMOVE this feature in future releases of Windows. Virtualization is the process of diverting writes to sensitive system areas to user-specific locations, these areas include both specific system directories and registry locations which are:
- C:\WINDOWS
- C:\Program Files
- C:\Program Data
- HKLM in the registry
These files and keys get virtualized into these locations:
- C:\Users\%username%\AppData\Local\VirtualStore\WINDOWS
- C:\Users\%username%\AppData\Local\VirtualStore\Program Files
- C:\Users\%username%\AppData\Local\VirutaliStore\ProgramData
- HKCU\Software\Classes\VirtualStore\MACHINE
When does Virtualization occur?:
Virtualization occurs whenever an appliation attempts to write a file to the directories or registry keys noted above and the application is running in a context that does not have permissions to access the resource. So if an application that is running under a standard user context writes a file to C:\Program Files, the write will succeed, however the file will be placed into the users virtual store: (C:\Users\%username\AppData\Local\VirtualStore\Program Files). If the same application, even while still running in the standard user context reads from C:\Program Files looking for a specified file, the read will FAIL because that file was not written to C:\Program Files but instead written to the users virtual store.
Where in my application do I need to correct this?:
This depends on your application, however a general place to start would be anywhere your application reads/writes to any of the above specified directories. To correct any potential issues, you should first look at the data your application is writing out and determine if this data is global to your application for all users and whether or not the users will need write access to it. Also, you should determine if the data being written is per user. Here are a couple of these scenarios and the steps you could take to fix them:
Data being written is application global and users need write access to it:
This data could be placed in C:\Program Data\<AppName> directory
Data being written is application global and users do not need write access to it:
This data could be placed in the C:\Program Files\<AppName> directory and if an update is needed should be done through an application updater that has been appropriately configured to elevate.
Data being written is user specific
This data could be placed in C:\Users\%username%\AppData\Local\<AppName> directory
Why did Microsoft impliment this feature into Vista?:
I have seen a lot of complaints about the UAC Virtualization feature. While I do agree some pain does slip through the cracks with it in place but Virtualization was implimented to buy developers some time to update their applications. If it weren't for Virtualization, things would be a lot worse.
Here are some links to some resources regarding Virtualization:
http://msdn.microsoft.com/windowsvista/reference/default.aspx?pull=/library/en-us/dnlong/html/AccProtVista.asp#accprotvista_topic4
http://msdn.microsoft.com/windowsvista/reference/default.aspx?pull=/library/en-us/dnlong/html/AppComp.asp#appcomp_topic4
http://msdn.microsoft.com/windowsvista/reference/appcompat/default.aspx
Also if you have any questions feel free to post a question in the App Compat MSDN Forums:
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=904&SiteID=1
Let’s get it done! Make your applications Clear, Confident, Connected!!!