-/* $Id: cleanup.c,v 1.14 2003/10/11 17:51:56 hbirr Exp $
+/* $Id: cleanup.c,v 1.15 2004/08/28 22:19:12 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
{
CcRosReleaseFileCache (FileObject);
}
+
+ pFcb->OpenHandleCount--;
+ IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
}
return STATUS_SUCCESS;
}
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: create.c,v 1.72 2004/08/05 02:48:18 navaraf Exp $
+/* $Id: create.c,v 1.73 2004/08/28 22:19:12 navaraf Exp $
*
* PROJECT: ReactOS kernel
* FILE: drivers/fs/vfat/create.c
VfatSetExtendedAttributes(FileObject,
Irp->AssociatedIrp.SystemBuffer,
Stack->Parameters.Create.EaLength);
- IoSetShareAccess(0 /*DesiredAccess*/,
- Stack->Parameters.Create.ShareAccess,
- FileObject,
- &pFcb->FCBShareAccess);
if (PagingFileCreate)
{
pFcb = FileObject->FsContext;
+ if (pFcb->OpenHandleCount != 0)
+ {
+ Status = IoCheckShareAccess(Stack->Parameters.Create.SecurityContext->DesiredAccess,
+ Stack->Parameters.Create.ShareAccess,
+ FileObject,
+ &pFcb->FCBShareAccess,
+ FALSE);
+ if (!NT_SUCCESS(Status))
+ {
+ VfatCloseFile (DeviceExt, FileObject);
+ return(Status);
+ }
+ }
+
/*
* Check the file has the requested attributes
*/
Irp->IoStatus.Information = FILE_SUPERSEDED;
}
else if (RequestedDisposition == FILE_OVERWRITE || RequestedDisposition == FILE_OVERWRITE_IF)
- {
- Irp->IoStatus.Information = FILE_OVERWRITTEN;
- }
+ {
+ Irp->IoStatus.Information = FILE_OVERWRITTEN;
+ }
else
- {
+ {
Irp->IoStatus.Information = FILE_OPENED;
}
}
-
- /* FIXME : test share access */
+
+ pFcb->OpenHandleCount++;
+ IoSetShareAccess(Stack->Parameters.Create.SecurityContext->DesiredAccess,
+ Stack->Parameters.Create.ShareAccess,
+ FileObject,
+ &pFcb->FCBShareAccess);
+
/* FIXME : test write access if requested */
return(Status);
-/* $Id: fcb.c,v 1.40 2004/08/01 21:57:17 navaraf Exp $
+/* $Id: fcb.c,v 1.41 2004/08/28 22:19:12 navaraf Exp $
*
*
* FILE: drivers/fs/vfat/fcb.c
Fcb->DirNameU.MaximumLength = Fcb->DirNameU.Length = 0;
Fcb->LongNameU.MaximumLength = Fcb->LongNameU.Length = 0;
}
+ RtlZeroMemory(&Fcb->FCBShareAccess, sizeof(SHARE_ACCESS));
+ Fcb->OpenHandleCount = 0;
}
PVFATFCB
-/* $Id: finfo.c,v 1.36 2004/08/01 21:57:18 navaraf Exp $
+/* $Id: finfo.c,v 1.37 2004/08/28 22:19:12 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
assert (DeviceExt->FatInfo.BytesPerCluster != 0);
assert (FCB != NULL);
+ if (FCB->entry.Attrib & FILE_ATTRIBUTE_READONLY)
+ {
+ return STATUS_CANNOT_DELETE;
+ }
+
if (vfatFCBIsRoot(FCB) ||
(FCB->LongNameU.Length == sizeof(WCHAR) && FCB->LongNameU.Buffer[0] == L'.') ||
(FCB->LongNameU.Length == 2 * sizeof(WCHAR) && FCB->LongNameU.Buffer[0] == L'.' && FCB->LongNameU.Buffer[1] == L'.'))
// we cannot delete a '.', '..' or the root directory
return STATUS_ACCESS_DENIED;
}
+
if (DispositionInfo->DoDeleteFile)
{
if (MmFlushImageSection (FileObject->SectionObjectPointer, MmFlushForDelete))
-/* $Id: vfat.h,v 1.67 2004/08/05 02:48:18 navaraf Exp $ */
+/* $Id: vfat.h,v 1.68 2004/08/28 22:19:12 navaraf Exp $ */
#include <ddk/ntifs.h>
/* Share access for the file object */
SHARE_ACCESS FCBShareAccess;
+ /* Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP */
+ ULONG OpenHandleCount;
+
/* Entry into the hash table for the path + long name */
HASHENTRY Hash;