Folder Protection for Personal Data Storage at Windows 7 Operating System

一般討論 Folder Protection for Personal Data Storage at Windows 7 Operating System

  • 22 Juli 2012 9:28
     
     

    Hi All,

    Sorry, my english not good. I wish my question quiet enough to be understood.

    The security access control code below can not work perfectly at Windows 7,  because  user accunt with administrator previlage still can change security permision for c:\documents and settings\owner\downloads at advanced security tab.

    I wish there is someone who don't mind to corect or resolve my problem, thank's.

    Imports System.Security.AccessControl
    Imports System.IO

    Public Class Form1
        ' Remove access from folder
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim FilePath As String = "C:\Documents and Settings\Owner\Desktop\downloads"
            Dim fs As FileSystemSecurity = File.GetAccessControl(FilePath)
            fs.AddAccessRule(New FileSystemAccessRule(My.user.name, FileSystemRights.FullControl, AccessControlType.Deny))
            File.SetAccessControl(FilePath, fs)
        End Sub

        ' Add access to folder
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Dim FilePath As String = "C:\Documents and Settings\Owner\Desktop\downloads"
            Dim fs As FileSystemSecurity = File.GetAccessControl(FilePath)
            fs.RemoveAccessRule(New FileSystemAccessRule(My.user.name FileSystemRights.FullControl, AccessControlType.Deny))
            File.SetAccessControl(FilePath, fs)
        End Sub
    End Class

    The code above can not work perfectly at Windows 7, because the security settings for download folder at owner administrator name account list, can be removed or midified by all administrator user account. 


Semua Balasan