Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, i am Suaidh.

i want to make a button event to delete a system file ("%windir%\system32\sethc.exe").i figured out i need to take ownership first to do it.but even then an error."access denied " was alerted.
i want to delete it on click no other complications.


I am new to C# programming so i would like someone who already knows the language to help me
solve this problem.
and ... I'll make sure no user is affected by this.as i have already taken a backup.and also this is just to understand the method used in such cases. :)
thanks in advance.
Posted
Updated 15-Dec-13 1:05am
v2
Comments
Richard MacCutchan 15-Dec-13 6:49am    
I don't think Windows will let you delete system files; and why would you want to? If you do find a way to make this work you need to be aware that you can end up with an unusable system.
Suaidh 15-Dec-13 6:58am    
i am well aware of that. so i am using Microsoft hyper V to run the code in a virtual machine.
and also this is just for educational purposes.i am just 13yrs and want to be an intermediate programmer by 16. so please help me get over this lump.
BillWoodruff 15-Dec-13 7:46am    
Congratulations on your early start into what I hope is a lifelong pleasurable, and mind-expanding, journey in the technical world !

I am not sure how you define what being an "intermediate" programmer is, but, in my humble opinion, you will find much more educational value in mastering higher-level skills than how to essentially "hack" Windows.

May I suggest you consider a systematic study of algorithms, and design patterns, and hone your mathematical skills by solving problems on sites like projecteuler.net ?

As you progress in C# ... if that's your goal ... I think you'll find a valuable way to learn is to study ... and, as you are capable of, answer ... the problems posed by other programmers here on CodeProject QA, and on sites like StackOverFlow.

best wishes, Bill
Suaidh 15-Dec-13 7:01am    
and also .. . windows will let me delete the file if i have taken the ownership of it. I just want to replace the executable with another one.

In order to delete any file from the System32 folder, you need full admin permissions - which you probably don't and probably shouldn't have.

Why would you want to delete a part of Windows anyway: SETHC.EXE is a system app for controlling some of the accessibility options, and removing it may have undesired effects on your users.
 
Share this answer
 
Comments
Suaidh 15-Dec-13 7:06am    
I'll make sure no user is affected by this.as i have already taken a backup ( i don't actually need to,as i am using a virtual machine)and also this is just to understand the method used in such cases.
Suaidh 15-Dec-13 7:10am    
as for the admin permissions, Ive already embedded an application manifest to run as an administrator.
OriginalGriff 15-Dec-13 7:17am    
On your head be it...
http://www.howtogeek.com/howto/windows-vista/how-to-delete-a-system-file-in-windows-vista/
You have already taken ownership, now all you need to do is modify the discretionary access control list.
Suaidh 15-Dec-13 7:23am    
Thanks a Bunch!
OriginalGriff 15-Dec-13 7:33am    
You're welcome!
first check without coding go to sys32 dir and try to delete from there if it works then try from coding if u dont delete then u cant do it from coding
 
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