In line with #906, #908 and related issues we should try to use file descriptor / handle based operations in favour of path-based operations to avoid various race conditions and inconsistencies when files are replaced during a backup run.
These changes should go into master.
Windows can then use the _get_osfhandle API to retrieve the object backing a file descriptor of the CRTs POSIX-like API (open etc). And that can be used with the usual object-oriented Windows functions (e.g. GetUserObjectSecurity instead of GetFileSecurity).