id summary reporter owner description type status milestone component version severity resolution keywords cc 699 Changing size of memory-mapped file on Windows nobody Jonathan Turkanis "{{{ My email address is barrywhart@yahoo.com. There is a bug in mapped_file_source::open_impl(mapped_file_params p) This function does not correctly check for errors from SetFilePointer, as documented in the MSDN page below. (See ""Case Two: calling the function with lpDistanceToMoveHigh != NULL"") http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/setfilepointer.asp Current code: ::SetFilePointer(pimpl_->handle_, sizelow, &sizehigh, FILE_BEGIN); if (::GetLastError() != NO_ERROR || !::SetEndOfFile(pimpl_->handle_)) detail::cleanup_and_throw(*pimpl_, ""failed setting file size""); Should be: DWORD dwResult = ::SetFilePointer(pimpl_->handle_, sizelow, &sizehigh, FILE_BEGIN); if (dwResult == INVALID_SET_FILE_POINTER ::GetLastError() != NO_ERROR || !::SetEndOfFile(pimpl_->handle_)) detail::cleanup_and_throw(*pimpl_, ""failed setting file size""); -- Even after this fix, the ability to resize an existing file is not really useful because the file is apparently recreated rather than resized. I am working around this by resizing the file using system calls, but I wonder if this is how the function is supposed to work?! }}}" Bugs closed iostreams None Problem fixed