From f2c89cd770baa3955f6a3ef56785dc3ba924b570 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 27 May 2012 18:17:51 +0000 Subject: [PATCH] merged fix from R_0_16 --- src/file.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);