If file association is supported by the actual file, rather than the memory block, you can change the file size in one of two ways:
1) call CreateFileMapping() with a size larger than the current file size. The file will be modified to match the new mapping.
2) use SetFilePointer() and SetEndOfFile() to resize the file directly, then call CreateFileMapping() with the new size.
Both conditions are described in the documentation for CreateFileMapping() .
source share