Enkryptovßnφ/dekryptovßnφ souboru Φi slo₧ky

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


'Jen pro Windows 2000 s NTFS 5
Function FileEncrypt(sFileOrPath As String) As Boolean

   On Error Resume Next
   FileEncrypt = EncryptFile(mFile)

End Function

Function FileDecrypt(sFileOrPath As String) As Boolean

   On Error Resume Next
   FileDecrypt = DecryptFile(mFile, 0)

End Function

P°φklad pou₧itφ
Sub Demonstration()

   If FileEncrypt("C:\bozena.txt") Then
      MsgBox "Sobor je nynφ zakryptovßn...", vbInformation
      Shell "notepad c:\bozena.txt"
      If FileDecrypt("C:\bozena.txt") Then
         MsgBox "Soubor je dekryptovßn...", vbInformation
      End If
   Else
      MsgBox "Tato funkce je dostupnß pouze pro W2k...", vbInformation
   End If

End Sub

Zp∞t

Autor: The Bozena