CVS: winex/files file.c,1.46,1.47

[email protected]
Newsgroups gmane.comp.emulators.winex.cvs
Message-ID <[email protected]>
Subject: winex/files file.c,1.46,1.47Update of /var/lib/cvsd/cvsroot/winex/files
In directory agravaine:/tmp/cvs-serv25001/files

Modified Files:
	file.c 
Log Message:
If MoveFile is called with an identical source and destination file name,
don't fail the call, just check for a sharing violation.


Index: file.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/files/file.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- file.c	30 Mar 2007 20:42:23 -0000	1.46
+++ file.c	30 Mar 2007 21:35:27 -0000	1.47
@@ -2834,7 +2834,21 @@
 
     if (!DOSFS_GetFullName( fn1, TRUE, &full_name1 )) return FALSE;
     if (DOSFS_GetFullName( fn2, TRUE, &full_name2 ))  {
+      if (!strcmp(full_name1.long_name, full_name2.long_name)) {
+        /* If the new name is identical to old, this is probably some
+         * program's funky way of checking for a sharing violation. */
+        HANDLE hFile;
+        hFile = FILE_CreateFile( full_name1.long_name, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_DELETE,
+                                 NULL, OPEN_EXISTING, 0, 0,
+                                 DRIVE_GetFlags(full_name1.drive) & DRIVE_FAIL_READ_ONLY,
+                                 DRIVE_GetType(full_name1.drive), full_name1.drive );
+        if (!hFile) return FALSE;
+        CloseHandle(hFile);
+        TRACE("doing nothing\n");
+        return TRUE;
+      }
       /* The new name must not already exist */
+      TRACE("destination exists\n");
       SetLastError(ERROR_ALREADY_EXISTS);
       return FALSE;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.