I need to copy and move files and keep all the file attributes
including the NT security attributes. Can anyone tell me how
to do this?
You've got a couple of possibilities. The most obvious is to copy
the file (e.g. with CopyFile) and then copy the security attributes
with GetFileSecurity and SetFileSecurity (after enabling the
A less obvious way would be to call BackupRead to read the old file,
and then use BackupWrite to write the new one. These are supposed to
copy the entire file, including security attributes, secondary file
streams, and so on.
The Universe is a figment of its own imagination.
On Fri, 3 Aug 2001 05:00:27 -0600, Jerry Coffin <jco...@taeus.com>
>You've got a couple of possibilities. The most obvious is to copy
>the file (e.g. with CopyFile) and then copy the security attributes
>with GetFileSecurity and SetFileSecurity (after enabling the
How can the SE_SECURITY_NAME privilege be set?
Check SHFileOperation() on MSDN.
You can copy/move more than one file by using this function.
You just have to set appropriate buffers and flags to do it right.
I think it copies security attributes by default, but there's a flag to disable it.
Note that there are some problems with BackupWrite in W2K, see
http://support.microsoft.com/support/kb/articles/Q259/3/93.ASP . I'm
also not sure that BackupRead/BackupWrite will process encrypted files
in W2K. See http://www.collakesoftware.com/files/efsraw10.zip for an
example on how to perform a "raw" copy of encrypted files.