How to store temporary files for each user?

I sometimes need to store some temporary files from my program, currently I use the AppData path, which works. However, I just tried to use my program in a non Admin (guest) account on Windows. This leads to errors because Windows refuses to access the AppData folder.

What would be the most ideal way to use instead of AppData, which even the user with the least permissions can use?

I tried Google for this because I am sure I saw an article on the Microsoft website that lists different paths and requirements, but I cannot find it.

thanks

+4
source share
1 answer

If you want to store temporary files, use a subdirectory in a temporary directory. Use GetTempPath to find out where it is.

Please note that in all modern versions of Windows this folder is a folder for each user and is not used between different users. If you want the location to be shared by all users, you need the CSIDL_COMMON_APPDATA folder. However, as you discovered, standard users do not have write permissions to the folder. The standard approach is for the installer to create a subfolder with an allow ACL that provides sufficient write access for standard users.

+11
source

Source: https://habr.com/ru/post/1388754/


All Articles