Jens Nestler : kernel32: Don' t fail unconditionally in MoveFile for directories with flag MOVEFILE_REPLACE_EXISTING .
Alexandre Julliard
julliard at winehq.org
Wed Feb 6 07:27:51 CST 2008
Module: wine
Branch: master
Commit: 6d59ddf67b6beb8862a4b784c9a52e8a34b5c13d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6d59ddf67b6beb8862a4b784c9a52e8a34b5c13d
Author: Jens Nestler <nessi at nessi-online.de>
Date: Tue Jan 29 09:37:53 2008 +0100
kernel32: Don't fail unconditionally in MoveFile for directories with flag MOVEFILE_REPLACE_EXISTING.
---
dlls/kernel32/path.c | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index 7681880..f0f713f 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1042,15 +1042,6 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
goto error;
}
- if (info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- {
- if (flag & MOVEFILE_REPLACE_EXISTING) /* cannot replace directory */
- {
- SetLastError( ERROR_INVALID_PARAMETER );
- goto error;
- }
- }
-
/* we must have write access to the destination, and it must */
/* not exist except if MOVEFILE_REPLACE_EXISTING is set */
@@ -1061,7 +1052,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
}
status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE, &attr, &io, 0,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
- if (status == STATUS_SUCCESS)
+ if (status == STATUS_SUCCESS) /* destination exists */
{
NtClose( dest_handle );
if (!(flag & MOVEFILE_REPLACE_EXISTING))
@@ -1070,6 +1061,11 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
RtlFreeUnicodeString( &nt_name );
goto error;
}
+ else if (info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) /* cannot replace directory */
+ {
+ SetLastError( ERROR_ACCESS_DENIED );
+ goto error;
+ }
}
else if (status != STATUS_OBJECT_NAME_NOT_FOUND)
{
More information about the wine-cvs
mailing list