I am looking for a good way to get the local application data folder for a specific user - without having to enter login information for that user.
SHGetFolderPath () can accept an access token for any user to whom I want to get the local appdata folder, but in order to get an access token, you must provide a user password. Also, according to docs , this is not supported on <= Windows 2000.
The HKCU \ Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ Shell Folder registry subkey contains the AppData value, which contains the local appdata folder for the current user ... so that I can technically mount the HKCU hive for a specific user and access this value; however, Microsoft seems to strongly discourage the use of this key, and I heard that it can sometimes be inaccurate.
Ironically, on Windows, an administrator account can easily access and change all the data in any user's appdata folder if they just open Explorer and go to the right place ... but there seems to be no easy way to programmatically get the location of the appdata folder for a specific user.
Do I have other options? Right now, accessing the registry (sigh) seems like the best option, but I would like to use something official and not discourage Microsoft, if possible.
Any suggestions would be appreciated.
source
share