Check sharing in DeleteFile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog:
	files/file.c: DeleteFile
	Check for Sharing violations by using CreateFile
-- 
Uwe Bonnes                bon@elektron.ikp.physik.tu-darmstadt.de

Free Software: If you contribute nothing, expect nothing
--
Index: wine/files/file.c
===================================================================
RCS file: /home/wine/wine/files/file.c,v
retrieving revision 1.145
diff -u -r1.145 file.c
--- wine/files/file.c	26 Apr 2002 18:31:19 -0000	1.145
+++ wine/files/file.c	9 May 2002 20:15:46 -0000
@@ -2179,6 +2179,7 @@
 BOOL WINAPI DeleteFileA( LPCSTR path )
 {
     DOS_FULL_NAME full_name;
+    HANDLE ret;
 
     if (!path)
     {
@@ -2198,8 +2199,17 @@
         SetLastError( ERROR_FILE_NOT_FOUND );
         return FALSE;
     }
+    
+    if (!DOSFS_GetFullName( path, TRUE, &full_name )) 
+      return FALSE; /* File if file doesn't exist */
+    ret = CreateFileA(path,GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,0,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0);
+    if (ret == INVALID_HANDLE_VALUE)
+    {
+      SetLastError( ERROR_ACCESS_DENIED );
+      return FALSE;
+    }
+    CloseHandle(ret);
 
-    if (!DOSFS_GetFullName( path, TRUE, &full_name )) return FALSE;
     if (unlink( full_name.long_name ) == -1)
     {
         FILE_SetDosError();


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux