Export (0) Print
Expand All

Storing user-specific information

In a Remote Desktop Services environment, applications should store user-specific information in user-specific locations, separately from global information that applies to all users. This rule applies to information stored in the registry, as well as information stored in files. In general, do not assume that one computer is equivalent to one user.

Store user-specific registry information under the HKEY_CURRENT_USER registry key. Remote Desktop Services loads the current user's personal registry hive into HKEY_CURRENT_USER when the user logs on. Of course, Remote Desktop Services manages the registry to ensure that each of the logged-on clients detects the correct user hive under HKEY_CURRENT_USER. For more information about registry keys, see Registry Key Security and Access Rights and Registry Hives.

In contrast, all users share the HKEY_LOCAL_MACHINE hive. Use HKEY_LOCAL_MACHINE to store computer-specific information, not user-specific information.

Store user-preference files or other user-specific files in the user's root directory or in a user-specified directory. This consideration applies to temporary files used to store interim information (such as cached data) or to pass data on to another application. User-specific temporary files must also be stored on a per-user basis.

You can use the SHGetSpecialFolderLocation function with the CSIDL_PERSONAL flag to get the location of the user's personal files directory. You can also use the GetWindowsDirectory function to retrieve the path of the Windows directory. In a Remote Desktop Services environment, the Windows directory is guaranteed to be private for each user. Do not store user-specific files under the system directory, such as WINDOWS, or program directory, such as Program Files.

To avoid conflicts among users' information and preferences, applications should store per-user temporary information in user-specific temporary files. User-specific temporary files also prevent application failures caused by file-locking conflicts. To specify the path for storing temporary information, use the GetTempPath function.

 

 

Show:
© 2014 Microsoft