Decrypts an encrypted file or directory.
#Include <WinAPIEx.au3>
_WinAPI_DecryptFile ( $sFile )
$sFile | The name of the file or directory to be decrypted. If $sFile specifies a read-only file, the function fails and the last error code is ERROR_FILE_READ_ONLY (6009). If $sFile specifies a directory that contains a read-only file, the functions succeeds but the directory is not decrypted. |
成功: | 返回 1. |
失败: | 返回 0 并设置 @error 标志为非 0 值. |
在MSDN中搜索
#Include <APIConstants.au3>
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $File = FileOpenDialog('Select File', @ScriptDir, 'All Files (*.*)', 1 + 2)
If Not $File Then
Exit
EndIf
Switch _WinAPI_FileEncryptionStatus($File)
Case $FILE_ENCRYPTABLE
If _WinAPI_EncryptFile($File) Then
MsgBox(64, 'Encryption File', 'The file encrypted is successfully.')
Else
MsgBox(16, 'Encryption File', 'Unable to encrypt file.')
EndIf
Case $FILE_IS_ENCRYPTED
If MsgBox(36, 'Encryption File', 'The file is already encrypted.' & @CR & @CR & 'Decrypt?') = 6 Then
If _WinAPI_DecryptFile($File) Then
MsgBox(64, 'Encryption File', 'The file decrypted is successfully.')
Else
MsgBox(16, 'Encryption File', 'Unable to decrypt file.')
EndIf
EndIf
Case Else
MsgBox(16, 'Encryption File', 'Unable to perform operation.')
EndSwitch