Boost logo

Boost :

From: Dylan Trotter (trotterdylan_at_[hidden])
Date: 2005-08-24 23:05:14


Hi,

I just wanted to point out a fairly major flaw with the Windows
implementation of memory mapped files. In memory_mapped.cpp on line
205-207 a file mapping is created as follows:

         ::CreateFileMappingA( pimpl_->handle_, NULL,
                               readonly ? PAGE_READONLY : PAGE_READWRITE,
                               0, 0, p.path.c_str() );

The problem with this is that if p.path.c_str() has any backslashes in
it (very likely given that it's Windows), the call fails. From the MS
documentation:

"Windows NT: The name can contain any character except the backslash
character.
Windows Me/98/95: The name can contain any character except the
backslash character. The empty string ("") is a valid object name."

Also from the documentation:

"If this parameter is NULL, the mapping object is created without a name."

Given that there's no way to access named memory maps from the boost
interface anyway, it seems pointless to name the mapping. My suggestion
is to pass in NULL and avoid naming difficulties altogether.

Thanks,

Dylan Trotter


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk