Getting "Access is Denied" on calling GetFileAttributes() for a folder

0

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:

  1. How can I simulate "access is denied" for a folder such that GetFileAttributes() function fails?

  2. 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.

windows
winapi
asked on Stack Overflow Jun 25, 2018 by Sam

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0