[PATCH 1/3] kernel32: Added support for MOVEFILE_WRITE_THROUGH in MoveFileWithProgress

Oded Elisha oded123456 at gmail.com
Fri Feb 2 11:29:32 CST 2018


Signed-off-by: Oded Elisha <oded123456 at gmail.com>
---
 dlls/kernel32/path.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index a389743..81610a2 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1268,6 +1268,9 @@ BOOL WINAPI CopyFileExA(LPCSTR sourceFilename, LPCSTR destFilename,
     return ret;
 }
 
+extern int CDECL wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *unix_fd,
+                              unsigned int *options );
+
 
 /**************************************************************************
  *           MoveFileWithProgressW   (KERNEL32.@)
@@ -1283,6 +1286,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
     NTSTATUS status;
     HANDLE source_handle = 0, dest_handle;
     ANSI_STRING source_unix, dest_unix;
+    BOOL should_sync = FALSE;
 
     TRACE("(%s,%s,%p,%p,%04x)\n",
           debugstr_w(source), debugstr_w(dest), fnProgress, param, flag );
@@ -1293,8 +1297,9 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
     if (!dest)
         return DeleteFileW( source );
 
-    if (flag & MOVEFILE_WRITE_THROUGH)
-        FIXME("MOVEFILE_WRITE_THROUGH unimplemented\n");
+    if ((flag & MOVEFILE_WRITE_THROUGH) && !(flag & MOVEFILE_DELAY_UNTIL_REBOOT)) {
+        should_sync = TRUE;
+    }
 
     /* check if we are allowed to rename the source */
 
@@ -1404,6 +1409,10 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
         }
     }
 
+    if (should_sync) {
+        sync();
+    }
+
     NtClose( source_handle );
     RtlFreeAnsiString( &source_unix );
     RtlFreeAnsiString( &dest_unix );
-- 
2.16.1




More information about the wine-devel mailing list