Saving application data in Windows XP when “Run As” is 'protecting the computer from unauthorized activity'
-
19-09-2019 - |
Question
I'm trying to make it so I can save data from my program when the user is running the applicaiton through run as like through this dialogue box. I'm finding I cant actually write to any folder and read back from it later on. i've tried 'All Users', Application data, My Documents, etc but to no avail.
Any ideas how and where I am supposed to save and read data when Windows XP is keeping my application from performing 'unauthorized activity'?
Solution
When the "protect" checkbox is checked, you can't really write anywhere (registry or filesystem) and that is sort of the point. Most programs don't even run with this option checked. Under the hood it uses the SAFER API. For more info, check this blog
OTHER TIPS
If you're not an administrator, you might not have the right to work with other users' folders. If you want to work with the folders that belong to the user who has launched your app, try using the APPDATA environment variable, which should hold the path of that user's application data folder. Environment variables are accessible via Win32 API or other methods, depending on your programming language.