Elisha Berns wrote:
Jonathan,
Thanks for the reply. I have found a fix for this problem. It consists of two things:
1) A small code change in mapped_file.cpp to make extra sure the correct flag is set:
//--------------Open underlying file------------------------------------
pimpl_->handle_ = ::CreateFileA( p.path.c_str(), readonly ? GENERIC_READ : GENERIC_ALL, FILE_SHARE_READ, NULL, (p.new_file_size != 0 && !readonly) ? CREATE_ALWAYS : OPEN_EXISTING, readonly ? FILE_ATTRIBUTE_READONLY : FILE_ATTRIBUTE_TEMPORARY, NULL );
if (pimpl_->handle_ == INVALID_HANDLE_VALUE) detail::cleanup_and_throw(*pimpl_, "failed opening file");
it's the line:
readonly ? FILE_ATTRIBUTE_READONLY : FILE_ATTRIBUTE_TEMPORARY,
To be honest, I'm not sure I understand why FILE_ATTRIBUTE_TEMPORARY is used here. I think Jonathan Graehl suggested it. Could you see if your code works with FILE_ATTRIBUTE_NORMAL?
2) My apologies about this second thing, since it's my problem, even if it is an issue of checking under the hood what assumptions are made by Boost.Iostreams. The issue is that the file names that I get from XercesC contain a mix of forward slashes and back slashes for directory separators. In Win32, the file mapping API CreateFileMapping doesn't accept back slashes except in a few cases.
This has been fixed in CVS. Thanks. Jonathan