views:

95

answers:

0

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)?