kernel32: Implement CopyFileWithProgress.

This commit is contained in:
Mike McCormack 2007-01-02 11:40:00 +09:00 committed by Alexandre Julliard
parent 86d4a9e078
commit b9910cb36d
3 changed files with 36 additions and 9 deletions

View File

@ -795,8 +795,8 @@
@ stdcall MoveFileExA(str str long) @ stdcall MoveFileExA(str str long)
@ stdcall MoveFileExW(wstr wstr long) @ stdcall MoveFileExW(wstr wstr long)
@ stdcall MoveFileW(wstr wstr) @ stdcall MoveFileW(wstr wstr)
# @ stub MoveFileWithProgressA @ stdcall MoveFileWithProgressA(str str ptr ptr long)
# @ stub MoveFileWithProgressW @ stdcall MoveFileWithProgressW(wstr wstr ptr ptr long)
@ stdcall MulDiv(long long long) @ stdcall MulDiv(long long long)
@ stdcall MultiByteToWideChar(long long str long ptr long) @ stdcall MultiByteToWideChar(long long str long ptr long)
# @ stub NlsConvertIntegerToString # @ stub NlsConvertIntegerToString

View File

@ -982,9 +982,11 @@ BOOL WINAPI CopyFileExA(LPCSTR sourceFilename, LPCSTR destFilename,
/************************************************************************** /**************************************************************************
* MoveFileExW (KERNEL32.@) * MoveFileWithProgressW (KERNEL32.@)
*/ */
BOOL WINAPI MoveFileExW( LPCWSTR source, LPCWSTR dest, DWORD flag ) BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
LPPROGRESS_ROUTINE fnProgress,
LPVOID param, DWORD flag )
{ {
FILE_BASIC_INFORMATION info; FILE_BASIC_INFORMATION info;
UNICODE_STRING nt_name; UNICODE_STRING nt_name;
@ -994,7 +996,8 @@ BOOL WINAPI MoveFileExW( LPCWSTR source, LPCWSTR dest, DWORD flag )
HANDLE source_handle = 0, dest_handle; HANDLE source_handle = 0, dest_handle;
ANSI_STRING source_unix, dest_unix; ANSI_STRING source_unix, dest_unix;
TRACE("(%s,%s,%04x)\n", debugstr_w(source), debugstr_w(dest), flag); TRACE("(%s,%s,%p,%p,%04x)\n",
debugstr_w(source), debugstr_w(dest), fnProgress, param, flag );
if (flag & MOVEFILE_DELAY_UNTIL_REBOOT) if (flag & MOVEFILE_DELAY_UNTIL_REBOOT)
return add_boot_rename_entry( source, dest, flag ); return add_boot_rename_entry( source, dest, flag );
@ -1087,7 +1090,10 @@ BOOL WINAPI MoveFileExW( LPCWSTR source, LPCWSTR dest, DWORD flag )
NtClose( source_handle ); NtClose( source_handle );
RtlFreeAnsiString( &source_unix ); RtlFreeAnsiString( &source_unix );
RtlFreeAnsiString( &dest_unix ); RtlFreeAnsiString( &dest_unix );
return (CopyFileW( source, dest, TRUE ) && DeleteFileW( source )); if (!CopyFileExW( source, dest, fnProgress,
param, NULL, COPY_FILE_FAIL_IF_EXISTS ))
return FALSE;
return DeleteFileW( source );
} }
FILE_SetDosError(); FILE_SetDosError();
/* if we created the destination, remove it */ /* if we created the destination, remove it */
@ -1124,9 +1130,11 @@ error:
} }
/************************************************************************** /**************************************************************************
* MoveFileExA (KERNEL32.@) * MoveFileWithProgressA (KERNEL32.@)
*/ */
BOOL WINAPI MoveFileExA( LPCSTR source, LPCSTR dest, DWORD flag ) BOOL WINAPI MoveFileWithProgressA( LPCSTR source, LPCSTR dest,
LPPROGRESS_ROUTINE fnProgress,
LPVOID param, DWORD flag )
{ {
WCHAR *sourceW, *destW; WCHAR *sourceW, *destW;
BOOL ret; BOOL ret;
@ -1139,11 +1147,27 @@ BOOL WINAPI MoveFileExA( LPCSTR source, LPCSTR dest, DWORD flag )
else else
destW = NULL; destW = NULL;
ret = MoveFileExW( sourceW, destW, flag ); ret = MoveFileWithProgressW( sourceW, destW, fnProgress, param, flag );
HeapFree( GetProcessHeap(), 0, destW ); HeapFree( GetProcessHeap(), 0, destW );
return ret; return ret;
} }
/**************************************************************************
* MoveFileExW (KERNEL32.@)
*/
BOOL WINAPI MoveFileExW( LPCWSTR source, LPCWSTR dest, DWORD flag )
{
return MoveFileWithProgressW( source, dest, NULL, NULL, flag );
}
/**************************************************************************
* MoveFileExA (KERNEL32.@)
*/
BOOL WINAPI MoveFileExA( LPCSTR source, LPCSTR dest, DWORD flag )
{
return MoveFileWithProgressA( source, dest, NULL, NULL, flag );
}
/************************************************************************** /**************************************************************************
* MoveFileW (KERNEL32.@) * MoveFileW (KERNEL32.@)

View File

@ -1831,6 +1831,9 @@ BOOL WINAPI MoveFileW(LPCWSTR,LPCWSTR);
BOOL WINAPI MoveFileExA(LPCSTR,LPCSTR,DWORD); BOOL WINAPI MoveFileExA(LPCSTR,LPCSTR,DWORD);
BOOL WINAPI MoveFileExW(LPCWSTR,LPCWSTR,DWORD); BOOL WINAPI MoveFileExW(LPCWSTR,LPCWSTR,DWORD);
#define MoveFileEx WINELIB_NAME_AW(MoveFileEx) #define MoveFileEx WINELIB_NAME_AW(MoveFileEx)
BOOL WINAPI MoveFileWithProgressA(LPCSTR,LPCSTR,LPPROGRESS_ROUTINE,LPVOID,DWORD);
BOOL WINAPI MoveFileWithProgressW(LPCWSTR,LPCWSTR,LPPROGRESS_ROUTINE,LPVOID,DWORD);
#define MoveFileWithProgress WINELIB_NAME_AW(MoveFileWithProgress)
INT WINAPI MulDiv(INT,INT,INT); INT WINAPI MulDiv(INT,INT,INT);
BOOL WINAPI NotifyChangeEventLog(HANDLE,HANDLE); BOOL WINAPI NotifyChangeEventLog(HANDLE,HANDLE);
BOOL WINAPI ObjectCloseAuditAlarmA(LPCSTR,LPVOID,BOOL); BOOL WINAPI ObjectCloseAuditAlarmA(LPCSTR,LPVOID,BOOL);