kernel32: Add support for MOVEFILE_WRITE_THROUGH to MoveFile.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-08-02 14:04:38 +08:00 committed by Alexandre Julliard
parent 88d52edcc4
commit 97d2d9bf60
1 changed files with 6 additions and 5 deletions

View File

@ -1283,6 +1283,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
NTSTATUS status;
HANDLE source_handle = 0, dest_handle;
ANSI_STRING source_unix, dest_unix;
DWORD options;
TRACE("(%s,%s,%p,%p,%04x)\n",
debugstr_w(source), debugstr_w(dest), fnProgress, param, flag );
@ -1293,9 +1294,6 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
if (!dest)
return DeleteFileW( source );
if (flag & MOVEFILE_WRITE_THROUGH)
FIXME("MOVEFILE_WRITE_THROUGH unimplemented\n");
/* check if we are allowed to rename the source */
if (!RtlDosPathNameToNtPathName_U( source, &nt_name, NULL, NULL ))
@ -1336,8 +1334,11 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
SetLastError( ERROR_PATH_NOT_FOUND );
goto error;
}
status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, &attr, &io, 0,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
options = FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT;
if (flag & MOVEFILE_WRITE_THROUGH)
options |= FILE_WRITE_THROUGH;
status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, &attr, &io, 0, options );
if (status == STATUS_SUCCESS) /* destination exists */
{
NtClose( dest_handle );