There's nothing stopping you from having a file mapping object associated with a file that you're updating with normal file system functions (ReadFile
, WriteFile
, etc.). But you won't like the results. Windows guarantees that the file mapping view will be coherent if other processes update the file through the file mapping functions. It makes no such guarantees when the file is updated some other way. In fact, it pretty much guarantees that what the file mapping view shows will not match the actual contents of the file.
So, yes, you can do this. But you shouldn't, because there's no way you can guarantee that what the mapped view sees is what's actually in the file.