Jump to content
Sign in to follow this  
GordonShumway

Feature request. Support for EFS (Encrypting File System)

Recommended Posts

GordonShumway

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

Share this post


Link to post
Share on other sites
GordonShumway

@JohnOne.

Thank you. I've corrected my typo.

Sorry for polluting the forum. I'll have a look into the tracker.

Share this post


Link to post
Share on other sites
orbs

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)

Share this post


Link to post
Share on other sites
GordonShumway

@Universalist. Thank you for your Melmac-copy!

Share this post


Link to post
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
Sign in to follow this  

×