[Patch for Bug 8551] MoveFileWithProgressW unconditional fails for
directories with flag MOVEFILE_REPLACE_EXISTING
Jens Nestler
jn at nessi-online.de
Tue Jun 5 15:47:43 CDT 2007
http://bugs.winehq.org/show_bug.cgi?id=8551
Hello,
please find attached the patch for the bug mentioned above.
Jens Nestler
-------------- next part --------------
--- path.c 2007-06-01 19:49:52.000000000 +0200
+++ ../path.c 2007-06-04 19:00:20.000000000 +0200
@@ -1037,15 +1037,6 @@
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 */
@@ -1056,7 +1047,7 @@
}
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))
@@ -1065,6 +1056,11 @@
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-patches
mailing list