do not use hacked vfat drv revers the 25243

the hacked do not delete pendling or incomplte data 
and so on, 

svn path=/trunk/; revision=25246
This commit is contained in:
Magnus Olsen 2006-12-30 01:11:14 +00:00
parent f01a075e09
commit f67f7ee675
3 changed files with 22 additions and 82 deletions

View file

@ -29,50 +29,24 @@ VfatCleanupFile(PVFAT_IRP_CONTEXT IrpContext)
pFcb = (PVFATFCB) FileObject->FsContext;
if (pFcb)
{
if (pFcb->Flags & FCB_IS_VOLUME)
{
pFcb->OpenHandleCount--;
if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) &&
FsRtlAreThereCurrentFileLocks(&pFcb->FileLock))
{
/* remove all locks this process have on this file */
FsRtlFastUnlockAll(&pFcb->FileLock,
FileObject,
IoGetRequestorProcess(IrpContext->Irp),
NULL);
}
if (pFcb->OpenHandleCount != 0)
{
IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
}
}
else
{
if(!ExAcquireResourceExclusiveLite (&pFcb->MainResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
return STATUS_PENDING;
}
if(!ExAcquireResourceExclusiveLite (&pFcb->PagingIoResource,
(BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT)))
{
ExReleaseResourceLite (&pFcb->MainResource);
return STATUS_PENDING;
}
pFcb->OpenHandleCount--;
if (pFcb->Flags & FCB_IS_DIRTY)
{
VfatUpdateEntry (pFcb);
}
if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) &&
FsRtlAreThereCurrentFileLocks(&pFcb->FileLock))
{
/* remove all locks this process have on this file */
FsRtlFastUnlockAll(&pFcb->FileLock,
FileObject,
IoGetRequestorProcess(IrpContext->Irp),
NULL);
}
if (pFcb->Flags & FCB_IS_DIRTY)
{
VfatUpdateEntry (pFcb);
}
if (pFcb->Flags & FCB_DELETE_PENDING &&
pFcb->OpenHandleCount == 0)
{
DPRINT("'%wZ'\n", &pFcb->PathNameU);
if (pFcb->Flags & FCB_DELETE_PENDING &&
pFcb->OpenHandleCount == 1)
{
PFILE_OBJECT tmpFileObject;
tmpFileObject = pFcb->FileObject;
if (tmpFileObject != NULL)
@ -97,21 +71,10 @@ VfatCleanupFile(PVFAT_IRP_CONTEXT IrpContext)
#ifdef USE_ROS_CC_AND_FS
CcRosReleaseFileCache (FileObject);
#else
if (FileObject->SectionObjectPointer->SharedCacheMap)
{
CcUninitializeCacheMap (FileObject, &pFcb->RFCB.FileSize, NULL);
}
CcUninitializeCacheMap (FileObject, NULL, NULL);
#endif
if (pFcb->OpenHandleCount != 0)
{
IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
}
FileObject->Flags |= FO_CLEANUP_COMPLETE;
ExReleaseResourceLite (&pFcb->PagingIoResource);
ExReleaseResourceLite (&pFcb->MainResource);
}
pFcb->OpenHandleCount--;
IoRemoveShareAccess(FileObject, &pFcb->FCBShareAccess);
}
return STATUS_SUCCESS;
}
@ -141,11 +104,6 @@ NTSTATUS VfatCleanup (PVFAT_IRP_CONTEXT IrpContext)
ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
if (Status == STATUS_PENDING)
{
return VfatQueueRequest(IrpContext);
}
ByeBye:
IrpContext->Irp->IoStatus.Status = Status;
IrpContext->Irp->IoStatus.Information = 0;

View file

@ -30,8 +30,6 @@ VfatCloseFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject)
pCcb = (PVFATCCB) (FileObject->FsContext2);
pFcb = (PVFATFCB) (FileObject->FsContext);
FileObject->FsContext2 = NULL;
if (pFcb == NULL)
{
return STATUS_SUCCESS;
@ -45,7 +43,7 @@ VfatCloseFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject)
}
else
{
// if (FileObject->DeletePending)
if (FileObject->DeletePending)
{
if (pFcb->Flags & FCB_DELETE_PENDING)
{
@ -59,6 +57,7 @@ VfatCloseFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject)
vfatReleaseFCB (DeviceExt, pFcb);
}
FileObject->FsContext2 = NULL;
FileObject->FsContext = NULL;
FileObject->SectionObjectPointer = NULL;

View file

@ -656,24 +656,7 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp )
VfatCloseFile (DeviceExt, FileObject);
return(STATUS_NOT_A_DIRECTORY);
}
#ifndef USE_ROS_CC_AND_FS
if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY))
{
if (Stack->Parameters.Create.SecurityContext->DesiredAccess & FILE_WRITE_DATA ||
RequestedDisposition == FILE_OVERWRITE ||
RequestedDisposition == FILE_OVERWRITE_IF)
{
if (!MmFlushImageSection(&pFcb->SectionObjectPointers, MmFlushForWrite))
{
DPRINT1("%wZ\n", &pFcb->PathNameU);
DPRINT1("%d %d %d\n", Stack->Parameters.Create.SecurityContext->DesiredAccess & FILE_WRITE_DATA,
RequestedDisposition == FILE_OVERWRITE, RequestedDisposition == FILE_OVERWRITE_IF);
VfatCloseFile (DeviceExt, FileObject);
return STATUS_SHARING_VIOLATION;
}
}
}
#endif
if (PagingFileCreate)
{
/* FIXME: