I have a file that was opened with with the Windows API CreateFile() using the FILE_SHARE_DELETE flag so that I can delete it while the file handle is still open. But in the window between the first process deleting the file and the process ending, I want to be able to tell that the file is being deleted so that I can go into a retry loop.
I found error code 303 that looks exactly like what I'm looking for:
ERROR_DELETE_PENDING
303 (0x12F)
The file cannot be opened because it is in the process of being deleted.
But I can't find what I can use that will return this code for me. Does anyone know how I can determine that my file is in this state of being deleted but still has an open handle?