Search code examples
c#systemprivileges

C# Can't Access System Files even with administrator privileges


My application needs to alter with some system files. (Like deleting Windows Event Logs from "C:\Windows\System32\winevt\Logs" directory. (Somewhat same as Ccleaner does)

But i can't even see these log files from application even with administrator privileges.

My application manifest file have this line:

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

and i run my application with "Run as Administrator".

How can my application have "System" privileges or is there any way to accomplish this.

There are lots of applications that can alter with system files when they are run with admin rights.

Thanks..

Note: Owner of the files that i need to alter seems like "Local Service".


Solution

  • If you can't see the files, I wonder if this is an x86 vs x64 thing; there is a lot of magic that happens with system folder redirection depending on whether your program is 32-bit or 64-bit. Whichever it is: try compiling it as "the other", and see if it works. For example, if your program is currently 32-bit, compile it explicitly for 64-bit.