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

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.
 
G

Guest

Call CreateFile with FILE_ATTRIBUTE_SYSTEM and remove the system attribute
later.

Thanks.
Pat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top