views:

155

answers:

2

I need to create files inside of a specific folder ("C:\Windows\System32\oobe\info\backgrounds") and possibly create said folder. When I try this with the File.Copy command windows won't grant the program permission, just throws an error. I am writing this in C# with VS2008.

EDIT: Windows 7, forgot about that part.

+8  A: 

UAC. Have you added a manifest that requests elevated access? One of (don't ask me which...):

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

or

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

in the manifest file (app.manifest). The settings are discussed on MSDN.

Marc Gravell
A: 

This isn't a matter of File.Copy not granting privileges as File.Copy doesn't control privileges. One way or another the user running the program has to be granted permissions to the correct directory.

jmoreno