Commit 1ca67c8b authored by Luke Deller's avatar Luke Deller Committed by Alexandre Julliard

msvcrt: Translate file open access pattern hints.

Translate access pattern hints supplied to fopen / _open into the corresponding attributes for the lower level CreateFileW call. Signed-off-by: 's avatarLuke Deller <luke@deller.id.au> Signed-off-by: 's avatarPiotr Caban <piotr@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent ae01a6f6
......@@ -22,8 +22,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* TODO
* Use the file flag hints O_SEQUENTIAL, O_RANDOM, O_SHORT_LIVED
*/
#include <direct.h>
......@@ -1609,8 +1607,12 @@ static int msvcrt_get_flags(const wchar_t* mode, int *open_flags, int* stream_fl
case 'w':
break;
case 'S':
if (!(*open_flags & _O_RANDOM))
*open_flags |= _O_SEQUENTIAL;
break;
case 'R':
FIXME("ignoring cache optimization flag: %c\n", mode[-1]);
if (!(*open_flags & _O_SEQUENTIAL))
*open_flags |= _O_RANDOM;
break;
default:
ERR("incorrect mode flag: %c\n", mode[-1]);
......@@ -2269,6 +2271,13 @@ int CDECL _wsopen_dispatch( const wchar_t* path, int oflags, int shflags, int pm
sharing |= FILE_SHARE_DELETE;
}
if (oflags & _O_RANDOM)
attrib |= FILE_FLAG_RANDOM_ACCESS;
if (oflags & _O_SEQUENTIAL)
attrib |= FILE_FLAG_SEQUENTIAL_SCAN;
if (oflags & _O_SHORT_LIVED)
attrib |= FILE_ATTRIBUTE_TEMPORARY;
sa.nLength = sizeof( SECURITY_ATTRIBUTES );
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = !(oflags & _O_NOINHERIT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment