Commit 4d7b49ea authored by Alexandre Julliard's avatar Alexandre Julliard

kernelbase: Avoid depending on the mount manager in CopyFileExW().

parent 8724c37c
...@@ -499,7 +499,8 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT ...@@ -499,7 +499,8 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
{ {
static const int buffer_size = 65536; static const int buffer_size = 65536;
HANDLE h1, h2; HANDLE h1, h2;
BY_HANDLE_FILE_INFORMATION info; FILE_BASIC_INFORMATION info;
IO_STATUS_BLOCK io;
DWORD count; DWORD count;
BOOL ret = FALSE; BOOL ret = FALSE;
char *buffer; char *buffer;
...@@ -525,7 +526,7 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT ...@@ -525,7 +526,7 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
return FALSE; return FALSE;
} }
if (!GetFileInformationByHandle( h1, &info )) if (!set_ntstatus( NtQueryInformationFile( h1, &io, &info, sizeof(info), FileBasicInformation )))
{ {
WARN("GetFileInformationByHandle returned error for %s\n", debugstr_w(source)); WARN("GetFileInformationByHandle returned error for %s\n", debugstr_w(source));
HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
...@@ -553,7 +554,7 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT ...@@ -553,7 +554,7 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
if ((h2 = CreateFileW( dest, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, if ((h2 = CreateFileW( dest, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
(flags & COPY_FILE_FAIL_IF_EXISTS) ? CREATE_NEW : CREATE_ALWAYS, (flags & COPY_FILE_FAIL_IF_EXISTS) ? CREATE_NEW : CREATE_ALWAYS,
info.dwFileAttributes, h1 )) == INVALID_HANDLE_VALUE) info.FileAttributes, h1 )) == INVALID_HANDLE_VALUE)
{ {
WARN("Unable to open dest %s\n", debugstr_w(dest)); WARN("Unable to open dest %s\n", debugstr_w(dest));
HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
...@@ -575,7 +576,8 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT ...@@ -575,7 +576,8 @@ BOOL WINAPI CopyFileExW( const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUT
ret = TRUE; ret = TRUE;
done: done:
/* Maintain the timestamp of source file to destination file */ /* Maintain the timestamp of source file to destination file */
SetFileTime( h2, NULL, NULL, &info.ftLastWriteTime ); info.FileAttributes = 0;
NtSetInformationFile( h2, &io, &info, sizeof(info), FileBasicInformation );
HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, buffer );
CloseHandle( h1 ); CloseHandle( h1 );
CloseHandle( h2 ); CloseHandle( h2 );
......
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