Call to the function CreateFile() to create a file in an EFS encrypted directory.

  • Thread starter Thread starter devhil
  • Start date Start date
D

devhil

Hi,
I'am working on a backup/restore software, to backup and restore
encrypted files, I use the dedicated API (OpenEncryptedFileRaw,
ReadEncryptedFileRaw...).
My problem is to restore files not encrypted in a directory which has
the flag encrypted to ON.
I create my file with the system function CreateFile in a directory
with the encrypted flag to ON, and the file is automaticaly encrypted,
as it it say in documentation ( http://msdn2.microsoft.com/en-us/library/aa365005.aspx
). So to decrypt the file, before writting any data in it, I have to
close the file with the CloseHandle() function, decrypt the file with
the DecryptFile() function and reopen it with the CreateFile()
function.
I would prefer to be able to create the file not encrypted at the
first CreateFile() call, but I do not find any way to do it.
So is it possible ?

Note that the same thing appends using the CreateDirectory() function.

Thanks by advance.

Hilaire Verschuere.
 
Call CreateFile with FILE_ATTRIBUTE_SYSTEM and remove the system attribute
later.

Thanks.
Pat
 
Back
Top