Kryptování souborů na NTFS 5

Postup:
Private Declare Function EncryptFile Lib "ADVAPI32" Alias _
   "EncryptFileA" (ByVal lpFileName As String) As Boolean
Private Declare Function DecryptFile Lib "ADVAPI32" Alias _
    "DecryptFileA" (ByVal lpFileName As String, _
    ByVal dwReserved As Long) As Boolean

Const mFile = "c:\test.txt"

Private Sub Form_Load()

   Encrypt mFile

End Sub

Sub Encrypt(sFile As String)

   If EncryptFile(mFile) Then
      MsgBox "Soubor byl zakryptován. Zkuste přístup jako jiný uživatel."
   End If

End Sub

Sub Decrypt(sFile As String)

   If DecryptFile(mFile, 0) = True Then
      MsgBox "Soubor byl dekryptován."
   End If

End Sub

Zpět

Autor: The Bozena