I need to check whether the current user has write permissions inside the Program Files
folder.
The main problem occurs in Vista/7 - If I just try to create a temp file in this location I get an exception, even if the user can perform such an operation using the Windows Explorer (After allowing UAC elevation). Sounds reasonable, as the process itself was not ran with administrator privileges.
I then tried using this solution, but I always got back "true", even when I tried running it with a standard (non-admin) user.
What I eventually want to be able to answer, is in case the user tries to create a directory inside the Program Files
, would he need to supply an administrator credentials, or would a simple click on "continue" in the UAC suffice?
I am looking for a way to answer this question without raising the UAC pop-up (of any kind) myself. Is there a relevantly easy way to do it?
UPDATE
Thanks for offering me to use the UserData folder, but I just need to know if the user has write access in the folder so I can decide whether or not I should try to perform an auto-update (which runs an msi), or not.