Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Using this technique, you can actually virtually map the data file on the disk and create a
view of it as it is stored in RAM. There is no need to load the data file in to RAM.
Windows kernel automatically handles the buffering between memory and disk. It can be
implemented in the following three steps.
dwDesiredAccess
Access mode (read/write)
dwShareMode
Specify the share mode. (whether to share it with other processes or not).
lpSecurityAttributes
A pointer to security descriptor.
dwCreattionDistribution
Specify the action required if file exists or do not exists.
Saturn Software Mills
Visit for more technical article http://www.saturnsoftmills.com
dwFlagsAndAttributes
Specify file attributes and flags.
hTemplateFile
A handle to the file with attributes to copy.
The sample call of this function is shown below. We will assume that we would like to
memory map file “mydata.dat”.
hFile
File handle of the file to be mapped.
lpFileMappingAttributes
Security attributes for the mapping object.
flProtect
Protection attribute for the file when the file is mapped.
dwMaximumSizeHigh
High order 32 bits of maximum size of the file mapping object.
Saturn Software Mills
Visit for more technical article http://www.saturnsoftmills.com
dwMaximumSizeLow
Low order 32 bits of maximum size of the file mapping object.
lpName
A NULL terminated string to specify the name of the mapping object.
hFileMappingObject
An Open file mapping object handle.
dwDesiredAccess
Specify the type of file view access, like read only access or read-write access etc.
dwFileOffsetHigh
High order 32 bit position of the file offset to start the mapping.
dwFileOffsetLow
Low order 32 bit position of the file offset to start the mapping.
dwNumberOfBytesToMap
Number of file’s bytes that are mapped. Use zero to map the entire file.
Saturn Software Mills
Visit for more technical article http://www.saturnsoftmills.com
Now the process of creating a memory mapped file is over. The mapview pointer can be
used to access the data from the file assuming that it is stored in an array. So Simple!!!