Hi,
In my testing it looks like FILE_COMPLETE_IF_OPLOCKED flag is working fine on windows 7 but is being ignored on windows 10.
Simplified Scenario:
- Open a file with FILE_OPEN_REQUIRING_OPLOCK (desired access aren’t of much interest but I have tried with various combination of Read/Write flags)
- Without closing the file, in the same thread open another instance of same file with FILE_COMPLETE_IF_OPLOCKED flag. This open returns STATUS_OPLOCK_BREAK_IN_PROGRESS on windows 7 but returns STATUS_SUCCESS on windows 10. On Windows 7 Ntfs!NtfsFsdCreate returns STATUS_OPLOCK_BREAK_IN_PROGRESS and IoStatus.Status is also the same. In case of windows 10, both of those return a value of STATUS_SUCCESS.
- Try to read/write/delete on second handle, it hangs (as expected waiting on oplock to be broken, which will never happen)
Same behavior observed even when Oplock is requested using FSCTL_REQUEST_OPLOCK before attempt to open the file again and it still succeeds.
Is this change in behavior from windows 7 to windows 10 expected ?
It may not be always possible for a filter to know if any previous handles were opened with FILE_OPEN_REQUIRING_OPLOCK, so what is the best way to know if a file is already oplocked ?
Any help is much appreciated.
Thanks,
Arun