Click here to Skip to main content
14,325,629 members
Rate this:
Please Sign up or sign in to vote.
See more:
expert:
if you want to delete a file in vista/win7 system dir like c:\windows\winsxs\xxx.dat,
you must change the file's owner to administrator and add an allow ace with it.but i want to create or
delete file in system dir in my program by calling api like CreateFile or DeleteFile, but its return value
is 5, can not access. how can i do?
Posted
Comments
Jochen Arndt 3-Mar-13 5:39am
   
Please don't repost questions. You already got the answer (add a manifest to your application).
cd_JoeWang 3-Mar-13 21:55pm
   
i'm sorry. but it doesn't work:(
Rate this:
Please Sign up or sign in to vote.

Solution 2

You should never, never modify system folders. Period.
   
Rate this:
Please Sign up or sign in to vote.

Solution 1

As you say: you must have the appropriate permissions to create, modify or delete files from system folders.

So either elevate your application: Elevating during runtime[^] or (better) find an different folder to store you files!
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100