The documentation for CreateFile()
specifies that:
To open a directory using CreateFile, specify the FILE_FLAG_BACKUP_SEMANTICS flag as part of dwFlagsAndAttributes.
What I don't understand is why this flag is needed.
The documented meaning of the flag is:
The file is being opened or created for a backup or restore operation. The system ensures that the calling process overrides file security checks when the process has SE_BACKUP_NAME and SE_RESTORE_NAME privileges.
How is this related to directories?
I've been looking for an answer to this for a while now.
Look at the operations you can perform on a directory handle. They're all backup-related. This isn't Unix, you don't use a directory handle for readdir
or openat
It's used for BackupRead
, BackupWrite
, and change notification (which is also something a backup tool wants, to get a consistent snapshot).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With