antivirus - how to block a access to any file or exe vb.net? -


i wondering if new how block , unblock file or executable being opened permanently , unblock file using code in vb.net in advance.

you can use code, , can use environment.username name of user, , lock type of file , lock folder :

dim fss filesystemsecurity = file.getaccesscontrol(application.startuppath & "\quarantine\" & newtextdoc.text) fss.addaccessrule(new filesystemaccessrule(environment.username, filesystemrights.fullcontrol, accesscontroltype.deny)) file.setaccesscontrol(application.startuppath & "\quarantine\" & newtextdoc.text, fss) 

and unlock file/folder remove accessrule :

dim fss filesystemsecurity = file.getaccesscontrol(application.startuppath & "\quarantine\" & newtextdoc.text) fss.removeaccessrule(new filesystemaccessrule(environment.username, filesystemrights.fullcontrol, accesscontroltype.deny)) file.setaccesscontrol(application.startuppath & "\quarantine\" & newtextdoc.text, fss) 

finally hope :)


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -