Tech Off Post

Single Post Permalink

View Thread: Can't modify file in system root despite giving My acc/USER group Full access?
  • User profile image

    I made a program back in XP days that modifies an existing file in the system root (eg. C:\). (first run to create the file of course would need full Admin or uac promotion)  Since Vista the program hasn't been able to modify the file, despite manually adding the Full Access ACL for myself or anyone in USER to the file (neither worked).


    My "solution" since Vista has been to run the program as Admin but I'd like some good explanation why the ACL's seem to be entirely ignored in this case and is there anything besides running as admin or some down right hacking to get around this? I could special case the system drive for writing somewhere else (eg. isolated storage) but without going into what the app does that's not an intuitive fix. I didn't choose the drive root without much consideration.




    var f2 = new FileIOPermission(FileIOPermissionAccess.AllAccess, "c:\\thefile");


    gives no error or exception. But upon write or SetAttributes I get UnauthorizedAccessException. This is Win7RC and to me something here seems to be a bit broken or unintuitive. Expert opinions?