As reported here: https://bugs.llvm.org/show_bug.cgi?id=48378#c0 and here: https://github.com/rust-lang/rust/issues/81051 since rG79657e2339b58bc01fe1b85a448bb073d57d90bb, some LLVM programs such as llvm-ar don't work properly on Windows 7.
The issue is shown in the snippet by Oleksandr Prodan: https://pastebin.com/v51m3uBU
In essence, once the 'Delete' flag has been set on a file, the file path can't be queried anymore with GetFinalPathNameByHandleW. This however works on Windows 10, GetFinalPathNameByHandleW returns sucessfully.
With this current patch, we simply prevent setting the flag on network files, but do not prevent from clearning it. All tests pass fine on Windows 7 & Windows 10. I've also tested @rdwampler 's case where I ran llvm-ar r empty.a something on a network mount. At the moment, we cannot specifically add a test coverage for this, since it requres mounting a network drive.
IIUC, realPathFromHandle() fails because FILE_DISPOSITION_INFO is already set to true, if so can you update the comment here to clarify. I think this would still fail if setDeleteDisposition() is called twice with Delete being true.