My software is still required to support Windows XP. In it I am calling SHGetKnownFolderPath API from the Windows service to obtain user-specific paths (such as FOLDERID_Desktop
) by hToken
. Since that API is not supported on XP, I'm curious if there are any alternative ways to do this on that OS?
The proper function to use would be SHGetFolderLocation, passing either NULL
or -1
as the access token:
hToken [in]
Type: HANDLE
An access token that can be used to represent a particular user. It is usually set to NULL, but it may be needed when there are multiple users for those folders that are treated as belonging to a single user. The most commonly used folder of this type is My Documents. The calling application is responsible for correct impersonation when hToken is non-NULL. It must have appropriate security privileges for the particular user, and the user's registry hive must be currently mounted. See Access Control for further discussion of access control issues.
Assigning the hToken parameter a value of -1 indicates the Default User. This allows clients of SHGetFolderLocation to find folder locations (such as the Desktop folder) for the Default User. The Default User user profile is duplicated when any new user account is created, and includes special folders such as My Documents and Desktop. Any items added to the Default User folder also appear in any new user account.