I want to give my application data folder kaspersky antivirus like security. Where I can add a folder but cant change any content or create any file. I even gave the current user full control security privilege but it just does not working only for this kaspersky data folder. I can only modify data when I turning off "Self protection option". I just want to give same type of security into my application data folder. I know how to give security to my folder or file but dont know the option by which option kaspersky doing it. If any one have any idea please share with me. Thanks.
Much of what you're looking for can be accomplished with NTFS directory permissions. Just deny Everyone (and SYSTEM, if you're feeling lucky) the permission to create files in the folder or write/append files in the folder. Make sure the permissions apply to "This folder only" and "Files only" respectively, though, or your folder will probably become rather useless til you remove said restriction.
The permissions you need probably won't be obvious. You'll need to be in the advanced permissions dialog in order to set them.
Anyway, you don't really need C# to do it. You could use code if you really wanted to, but you'd do it the same way you'd set any other permissions on files and folders.
Finaly I got it ... kaspersky protecting its folder by starting a Service. For that reason the Unlock software unable to track the process handle.