开发者

UnauthorizedAccessException While Attempting to Change File Permissions

I trying to modify permissions programmatically using a C# windows service that is running under an administrator's account in windows XP.

Another program is saving and modifying files on the local file system, in way that, after that program touches something, only the "SYSTEM" account, there after, may access it (unless I manually change the permissions).

I'm trying to programmatically change these file's and folder's permissions back to what they would have been if this outside program hadn't have fooled with 开发者_运维百科them.

However, upon trying to recursively navigate the files in question, I running into a UnauthorizedAccessException:

For example: System.IO.Directory.GetDirectories("c:\FolderWithOnlySystemAccountAccess"); Will throw this exception.

What I don't understand is, how can't I escalate my programs ability to modify permissions (given that c# windows service is already running under an administrator's account that manually has the ability to modify these permission)?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜