diff -urN wine-0.9.54_org/dlls/kernel32/path.c wine-0.9.54/dlls/kernel32/path.c
--- wine-0.9.54_org/dlls/kernel32/path.c	2008-01-25 17:05:38.000000000 +0100
+++ wine-0.9.54/dlls/kernel32/path.c	2008-01-28 22:59:19.000000000 +0100
@@ -1042,15 +1042,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 */
 
@@ -1061,7 +1052,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))
@@ -1070,6 +1061,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)
     {
