Given the comments to my recent blog post on changes in Windows 7, it is worth clarifying how Virtual Store works in Windows. 

If a Windows application is themed (that is, it has a manifest file indicating it is a themed application), when it tries to save a file under Program Files (generally the installation folder of the application itself), it fails with an error. This happens even if the user has Admin privileges (as applications are executed with standard permissions anyway). However, if you use the "Run as Admin" command to start the program, it has full write permissions anywhere on the file system.

If a Windows application is not themed (that it, it is an old application), when it tries to save a file in the installation folder under Program Files, it succeeds... but nothing gets written in that folder. The operating system, instead, redirects the request to a Virtual Store area under the User documents folder. On my system this is: "C:\Users\Marco\AppData\Local\VirtualStore". In Vista, this was true for file operations under Program Files and Windows, in Windows 7 this is also true for operations under the root of the C: drive (which used to fail in Vista, even for non-themed applications). Again, if you use the "Run as Admin" command to start the program, it has full write permissions anywhere on the file system.

Of course, you might have the same file both under your regular file system and Virtual Store (for example, modified .ini files), which can cause a good amount of confusion. If you use Resource Explorer, you'll see only the real files but you'll have a "Compatibility" button in the toolbar indicating there are files in the corresponding area of Virtual Store. If the non-themed application uses a File Open dialog box, however, you'll see both native and Virtual Store files as if they were in the local folder. Very confusing!

The rationale behind all this seems to be that older applications can still run instead of failing on Vista and Windows 7, while newer application must follow the proper rules for user documents. I find is quite odd that not so many Windows developers know about the behevior of Virtual Store a few years after Vista has been released, but Microsoft certainly did a limited job covering it (here is some good coverage, though). On the other hand, my Delphi 2007 Handbook has a detailed session (and a specific example) focused on this topic.