Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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:(

You should never, never modify system folders. Period.
 
Share this answer
 
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!
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900