Partager via


Registry and File System Compatibility

4/19/2010

Windows Mobile 6.5 has a flexible security model that allows access to be restricted to parts of the file system and registry. Because devices from different manufacturers or mobile operators may have different security configurations, make sure that you follow these guidelines when you write files or registry settings to help make sure that the application will run on all devices.

Compatibility and File Paths

User files should be saved in the My Documents folder. This is both for security considerations and to create a consistent user experience for all applications. You should not hard code the path of the My Documents folder, as this can potentially change with new OS versions. Instead, in native code, you should discover the path dynamically using the SHGetSpecialFolderPath function. In managed code, use the System.Environment.GetFolderPath method.

Do not hard code paths to folders on storage cards. Instead, use the FindFirstFlashCard and FindNextFlashCard functions to enumerate the available flash cards. Then, after mounting the appropriate card, call SHGetDocumentsFolder to obtain the My Documents folder on the card.

Compatibility and Registry Key Locations

Applications should only write to registry keys under the HKEY_CURRENT_USER key. Attempts to write to other locations in the registry may fail on some devices.