Jump to content

Feature request. Support for EFS (Encrypting File System)


Recommended Posts

I've got my first Windows (8.1 Pro) with EFS support. I started using EFS and noticed  that some of the FileCopy commands in my AutoIt scripts were no longer functioning properly. 

If I FileCopy a "normal" (=no EFS) file, the FileCopy returns a 1=success.

But if I FileCopy an EFS encrypted file, the FileCopy returns a 0=failure.

The destination folder is located on my NAS (Network Attached Storage).

There are no problemens whilst copying/moving (EFS and non-EFS) files 

If I drag&drop the file with Windows I get this nice little popup: "you are copying the file to a destination that does not support encryption" (with the possibility to stop or continue).

I think my problems are not new and may go back some years when Microsoft first introduces EFS.

I would like AutoIt to support EFS.

My suggestions:

1) FileGetAttrib command. A new ReturnValueLetter. For example the "E" for Efs.

2) FileCopy/FileMove commands. A new flag allowing an EFS encrypted file to be copied whilst losing its encryption.

I hope I've explained my problem/feature request properly (english is not my native language).

Thank you for "listening".

Kind regards,

Gordon

from The Netherlands

My workaround for now looks like this:

$Source = "D:\Test.txt"
$Dest = "N:\"
$Result = FileCopy($Source, $Dest, 1)
If $Result = 0 Then
    $Result = RunWait(@ComSpec & " /c " & "Copy /D """ & $Source & """ """ & $Dest & """", "",  @SW_MAXIMIZE) ;"/D" means "Allow the destination file to be created decrypted".
    If $Result <> 0 Then
        MsgBox(0, "Fail", "Both 'AutoIt FileCopy' and 'DOS Command Copy' failt!" & @LF & "Source=" & $Source  & @LF & "Dest=" & $Dest)
        Exit
    EndIf
EndIf
Edited by GordonShumway
Link to comment
Share on other sites

the internal Windows "copy" function prompts the Windows warning; but copy is composed of 2 steps: 1) read data from original file to memory, 2) write data from memory to new file. each one of these actions does not prompt the warning. so...

MsgBox(0,'result:',MelmacFileCopy('C:\Temp\EFS\EFS.txt','\\NAS\SHARE\EFS.txt'))

Func MelmacFileCopy($sSrcFile,$sDstFile)
    Local $hFile,$sFileContent
    $hFile=FileOpen($sSrcFile,16)
    $sFileContent=FileRead($hFile)
    FileClose($hFile)
    $hFile=FileOpen($sDstFile,16+2)
    Local $result=FileWrite($hFile,$sFileContent)
    FileClose($hFile)
    Return $result
EndFunc

now this is only a basic implementation; it lacks the ability to create the folder structure if it does not exist, or even to accept a folder name as destination rather than full file name. also it requires some better error handling. but hey, it works! i'm sure you can do the rest if you need to implement it in production.

(Windows 7 x64 to Debian-based NAS, "C:tempEFS' is an encrypted folder)

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...