Yochay Kiriaty has put together a series of posts to help you move your Windows XP application to Windows 7 on the Windows Team for Developers blog. The series began with Is Your Application Ready for Windows 7 RTM? and continues with User Account Control Data Redirection. Other posting are promised. But these two provide the keys to most issues.
With general availability of Windows 7 coming on October 22, now is the time to move those Windows XP applications to Windows 7. Almost all applications that run under Windows Vista will work well with Windows 7.
But what should you look for in those applications that just run on Windows XP or earlier?
The Windows Vista Application Compatibility Cookbook is still very relevant for Windows 7, as 99% of its topics apply to Windows 7. Kiriaty explains seven areas represent about a large number of the reported application compatibility problems and provides links to more in depth solutions.
For more information, see Is Your Application Ready for Windows 7 RTM?
User Account Control Data Redirection
Many XP applications are still designed to write files to the Program Files, Windows directories, or system root (typically the C drive) folders. Some applications update registry values, often in HKLM/Software. But the files or registry values are not created or updated.
Prior to Windows Vista, administrators typically ran applications. As a result, applications could freely read and write system files and registry keys. If standard users ran these applications, they would fail due to insufficient access.
Kiriaty’s posting, User Account Control Data Redirection, describes the symptoms that you’ll see in your applications when you run as a standard user in Windows Vista or Windows 7 and the remedies.
When updating existing code to run on Windows 7, you should:
- Ensure that during run-time, applications store data only in per-user locations or in computer locations within %alluserprofile% that have properly set access control list (ACL) settings. For more information about ACLs, see Access Control Lists.
- Determine the known folder to which you want to write the data files. Generic data used by all users should be written to a global public location that is shared by all users. All other data should be written to a per-user location.
- Ensure that you do not hard-code paths once you have determined the appropriate locations. Instead, use one of the following programming models and APIs to retrieve the correct paths of specific Windows known folders.
The posting goes on to explain the five tests you can use to test your application on Windows Vista or Windows 7. It also describes what you can do in your code.
For more information, see User Account Control Data Redirection. Also, you can download Data Redirection that includes a presentation describing UAC Virtualization, and two full hands on labs on this topic, one for managed code and one for native code.
You can see the series of videos on MSDEV, A Developer's First Look at Windows 7.