We create a file for use as a memory file.
open with GENERIC_READ | GENERIC_WRITE GENERIC_READ | GENERIC_WRITE
we use share with FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE
we use file attributes FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE
We create the file successfully. We can reopen it as many times with the same flags as we want.
Once one handle has been closed, we can no longer open any handles, it returns with ERROR_ACCESS_DENIED. We can call this by closing any of the handles, either from CreateFile (ALWAYS_CREATE) or from CreateFile (OPEN_EXISTING).
Is there any way to avoid this? We use memoryMappedFile as a connection between different processes that need to share resources. these processes sometimes begin and stop. Right now, when we close one descriptor, we cannot open the file with memory.
I tried changing the open calls to use FILE_ATTRIBUTE_NORMAL, so only the create call uses CLOSE_ON_DELETE, but this does not affect this situation.
source share