My program (running as administrator) is calling GetFileAttributes() on a directory located in Program Files.
It fails, and GetLastError() returns 0x80070005 ("Access is Denied"). I'm not able to identify how users might end up in this scenario. This folder was created by my application previously. And it works for most of the users but not all.
Questions:
How can I simulate "access is denied" for a folder such that GetFileAttributes() function fails?
Will running the program with administrator and requesting se_backup_name and se_restore_name resolve this issue?
I tried removing users from security tab still GetFileAttributes did not fail.
Issue is reproduced on Win 7, 8, 10.
User contributions licensed under CC BY-SA 3.0