diff --git a/src/file.cpp b/src/file.cpp index 24fa0c77b..83c066778 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -894,8 +894,12 @@ namespace libtorrent open_mode_t const& m = mode_array[mode & rw_mask]; DWORD a = attrib_array[(mode & attribute_mask) >> 12]; + // one might think it's a good idea to pass in FILE_FLAG_RANDOM_ACCESS. It + // turns out that it isn't. That flag will break your operating system: + // http://support.microsoft.com/kb/2549369 + DWORD flags - = ((mode & random_access) ? FILE_FLAG_RANDOM_ACCESS : 0) + = ((mode & random_access) ? 0 : FILE_FLAG_SEQUENTIAL_SCAN) | (a ? a : FILE_ATTRIBUTE_NORMAL) | ((mode & no_buffer) ? FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING : 0);