Backs up (export) encrypted files. This is one of a group of Encrypted File System (EFS) functions that is intended to implement backup and restore functionality, while maintaining files in their encrypted state.
Syntax
DWORD WINAPI ReadEncryptedFileRaw(
__in PFE_EXPORT_FUNC pfExportCallback,
__in_opt PVOID pvCallbackContext,
__in PVOID pvContext
);
Parameters
- pfExportCallback [in]
-
A pointer to the export callback function. The system calls the
callback function multiple times, each time passing a block
of the file's data to the callback function until the entire file
has been read. For more information, see ExportCallback.
- pvCallbackContext [in, optional]
-
A pointer to an application-defined and allocated context block.
The system passes this pointer to the callback function as a
parameter so that the callback function can have access to
application-specific data. This can be a structure and can contain
any data the application needs, such as the handle to the file
that will contain the backup copy of the encrypted file.
- pvContext [in]
-
A pointer to a system-defined context block. The context block is
returned by the OpenEncryptedFileRaw function. Do not modify it.
Return Value
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, it returns a non-zero error code defined in
Winerror.h. You can use FormatMessage with the
FORMAT_MESSAGE_FROM_SYSTEM flag to get a generic text description of
the error.
Remarks
The file being backed up is not decrypted; it is backed up in its encrypted state.
To back up an encrypted file, call OpenEncryptedFileRaw to open the
file. Then call ReadEncryptedFileRaw, passing it the address of an
application-defined export callback function. The system calls this
callback function multiple times until the entire file's contents
have been read and backed up. When the backup is
complete, call CloseEncryptedFileRaw to free resources and close the file. See ExportCallback for details about how to declare the export
callback function.
To restore an encrypted file, call OpenEncryptedFileRaw, specifying
CREATE_FOR_IMPORT in the ulFlags parameter. Then call
WriteEncryptedFileRaw, passing it the address of
an application-defined import callback function. The system calls
this callback function multiple times until the entire file's
contents have been read and restored. When the restore is
complete, call CloseEncryptedFileRaw to free resources and close the file. See ImportCallback for details about how to declare the import
callback function.
This function is intended for the backup of only encrypted files; see BackupRead for backup of unencrypted files.
Requirements
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Header | WinBase.h (include Windows.h) |
| Library | Advapi32.lib |
| DLL | Advapi32.dll |
See Also
- BackupRead
- File Encryption
- File Management Functions
- CloseEncryptedFileRaw
- OpenEncryptedFileRaw
- WriteEncryptedFileRaw
Send comments about this topic to Microsoft
Build date: 11/12/2009