We need to determine whether a file we have open has an open file mapping handle or mapped view.
The only method I have found which should work is to use SetEndOfFile to attempt to add a few bytes to the end of the file, and remove these again, and test for failure + ERROR_USER_MAPPED_FILE.
While the documentation for SetEndOfFile explicitly requires the file to not be mapped, this still seems like a fairly convoluted workaround. Is there an easier way?