_In_ PIRP Irp
);
-_Requires_lock_held_(_Global_critical_region_)
+_Requires_lock_held_(_Global_critical_region_)
NTSTATUS
FatGetRetrievalPointerBase (
_In_ PIRP_CONTEXT IrpContext,
Index++;
}
-
+
*Vbo = (VBO)llVbo;
-
+
return TRUE;
}
-\f
+
BOOLEAN
FatAddMcbEntry (
IN PVCB Vcb,
return Result;
}
-\f
+
BOOLEAN
FatLookupMcbEntry (
IN PVCB Vcb,
return Results;
}
-\f
+
BOOLEAN
FatGetNextMcbEntry (
IN PVCB Vcb,
return Results;
}
-\f
+
VOID
FatRemoveMcbEntry (
IN PVCB Vcb,
}
-\f
+
_Function_class_(IRP_MJ_FILE_SYSTEM_CONTROL)
_Function_class_(DRIVER_DISPATCH)
NTSTATUS
return Status;
}
-\f
-_Requires_lock_held_(_Global_critical_region_)
+
+_Requires_lock_held_(_Global_critical_region_)
NTSTATUS
FatCommonFileSystemControl (
IN PIRP_CONTEXT IrpContext,
return Status;
}
-\f
+
//
// Local Support Routine
//
return Status;
}
-
+
}
-
+
if (Iosb.Information != sizeof(ULONG)) {
//
}
//
- // If this is a CD class device, then check to see if there is a
+ // If this is a CD class device, then check to see if there is a
// 'data track' or not. This is to avoid issuing paging reads which will
// fail later in the mount process (e.g. CD-DA or blank CD media)
//
VolDo->DeviceObject.StackSize = (CCHAR)(TargetDeviceObject->StackSize + 1);
//
- // We must also set the sector size correctly in our device object
+ // We must also set the sector size correctly in our device object
// before clearing the device initializing flag.
//
-
+
Status = FatPerformDevIoCtrl( IrpContext,
IOCTL_DISK_GET_DRIVE_GEOMETRY,
TargetDeviceObject,
// Initialize the new vcb
//
- FatInitializeVcb( IrpContext,
- &VolDo->Vcb,
- TargetDeviceObject,
- Vpb,
+ FatInitializeVcb( IrpContext,
+ &VolDo->Vcb,
+ TargetDeviceObject,
+ Vpb,
FsDeviceObject);
//
// Get a reference to the Vcb hanging off the end of the device object
//
// We need to commute errors on CD so that CDFS will get its crack. Audio
- // and even data media may not be universally readable on sector zero.
+ // and even data media may not be universally readable on sector zero.
//
-
+
_SEH2_TRY {
-
+
FatReadVolumeFile( IrpContext,
Vcb,
0, // Starting Byte
sizeof(PACKED_BOOT_SECTOR),
&BootBcb,
(PVOID *)&BootSector );
-
+
} _SEH2_EXCEPT( Vpb->RealDevice->DeviceType == FILE_DEVICE_CD_ROM ?
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH ) {
if (BootBcb == NULL || !FatIsBootSectorFat( BootSector)) {
DebugTrace(0, Dbg, "Not a Fat Volume\n", 0);
-
+
//
// Complete the request and return to our caller
//
//
// Stash a copy away in the VCB.
//
-
+
RtlCopyMemory( &Vcb->VolumeGuid, &VolumeGuid, sizeof(GUID));
}
Vcb->Bpb.Sectors < 0x80)) {
DebugTrace( 0, Dbg, "OS/2 Boot Manager volume detected, volume not mounted. \n", 0 );
-
+
//
// Complete the request and return to our caller
//
-
+
try_return( Status = STATUS_UNRECOGNIZED_VOLUME );
}
// device currently reports it's sector size to be.
//
- if ( !NT_SUCCESS( Status) ||
+ if ( !NT_SUCCESS( Status) ||
(Geometry.BytesPerSector != Vcb->Bpb.BytesPerSector)) {
try_return( Status = STATUS_UNRECOGNIZED_VOLUME );
// enough of the Vcb to pull this off.
//
- FatCheckDirtyBit( IrpContext,
+ FatCheckDirtyBit( IrpContext,
Vcb );
-
+
//
// Set the dirty bit if it is not set already
//
if ( !FlagOn(Vcb->VcbState, VCB_STATE_FLAG_MOUNTED_DIRTY)) {
-
+
SetFlag( Vcb->VcbState, VCB_STATE_FLAG_MOUNT_IN_PROGRESS );
FatMarkVolume( IrpContext, Vcb, VolumeDirty );
ClearFlag( Vcb->VcbState, VCB_STATE_FLAG_MOUNT_IN_PROGRESS );
return Status;
}
-\f
+
//
// Local Support Routine
//
//
// Only send down IOCTL_DISK_CHECK_VERIFY if it is removable media.
//
-
+
if (FlagOn(Vcb->TargetDeviceObject->Characteristics, FILE_REMOVABLE_MEDIA)) {
//
FatNormalizeAndRaiseStatus( IrpContext, Status );
}
-
+
}
-
+
if (Iosb.Information != sizeof(ULONG)) {
//
Vcb->ChangeCount = ChangeCount;
//
- // If this is a CD class device, then check to see if there is a
+ // If this is a CD class device, then check to see if there is a
// 'data track' or not. This is to avoid issuing paging reads which will
// fail later in the mount process (e.g. CD-DA or blank CD media)
//
if (FatRootDirectorySize(&Bpb) > 0) {
RootDirectorySize = FatRootDirectorySize(&Bpb);
-
+
} else {
RootDirectorySize = FatBytesPerCluster(&Bpb);
FatAcquireExclusiveVolume( IrpContext, Vcb );
ReleaseEntireVolume = TRUE;
}
-
+
//
// Get rid of any cached data, without flushing
//
FatAcquireExclusiveVolume( IrpContext, Vcb );
ReleaseEntireVolume = TRUE;
}
-
+
//
// Get rid of any cached data, flushing first.
//
return Status;
}
-\f
+
//
// Local Support Routine
//
return Result;
}
-\f
+
//
// Local Support Routine
//
PAGED_CODE();
UNREFERENCED_PARAMETER( IrpContext );
-
+
//
// Query the partition table
//
return (BOOLEAN)(Status == STATUS_MEDIA_WRITE_PROTECTED);
}
-\f
+
//
// Local Support Routine
//
case FSCTL_SET_PURGE_FAILURE_MODE:
Status = FatSetPurgeFailureMode( IrpContext, Irp );
- break;
+ break;
#endif
}
-\f
+
//
// Local support routine
//
//
// Once we call FsRtlOplockFsctrl, we no longer own the IRP and we should not complete it.
//
-
+
Irp = NULL;
//
//
if (AcquiredVcb) {
-
+
FatReleaseVcb( IrpContext, Fcb->Vcb );
}
return Status;
}
-\f
+
//
// Local Support Routine
//
//
if (!_SEH2_AbnormalTermination() || ExIsResourceAcquiredExclusiveLite( &Vcb->Resource )) {
-
+
FatReleaseVcb( IrpContext, Vcb );
}
return Status;
}
-\f
+
//
// Local Support Routine
//
return Status;
}
-\f
-_Requires_lock_held_(_Global_critical_region_)
+
+_Requires_lock_held_(_Global_critical_region_)
NTSTATUS
FatLockVolumeInternal (
IN PIRP_CONTEXT IrpContext,
}
//
- // The act of closing and purging may have touched pages in various
+ // The act of closing and purging may have touched pages in various
// parent DCBs. We handle this by purging a second time.
//
return Status;
}
-\f
+
NTSTATUS
FatUnlockVolumeInternal (
IN PIRP_CONTEXT IrpContext,
return Status;
}
-\f
+
//
// Local Support Routine
//
//
FatSetVcbCondition( Vcb, VcbBad);
-
+
SetFlag( Vcb->VcbState, VCB_STATE_FLAG_VOLUME_DISMOUNTED );
//
#endif
if (VcbHeld) {
-
+
FatReleaseVolume( IrpContext, Vcb );
}
return Status;
}
-\f
+
//
// Local Support Routine
//
return STATUS_SUCCESS;
}
-\f
+
//
// Local Support Routine
//
return STATUS_SUCCESS;
}
-\f
+
//
// Local Support Routine
//
return Status;
}
-\f
+
//
// Local Support Routine
//
return STATUS_SUCCESS;
}
-\f
+
//
// Local Support Routine
//
return STATUS_SUCCESS;
}
-\f
+
//
// Local Support Routine
//
if (IoIs32bitProcess( Irp )) {
if (IrpSp->Parameters.FileSystemControl.InputBufferLength != sizeof(UINT32)) {
-
+
FatCompleteRequest( FatNull, Irp, STATUS_INVALID_PARAMETER );
DebugTrace(-1, Dbg, "FatInvalidateVolumes -> %08lx\n", STATUS_INVALID_PARAMETER);
if (ExistingVcb->Vpb == DeviceToMarkBad->Vpb) {
KIRQL OldIrql;
-
+
IoAcquireVpbSpinLock( &OldIrql );
if (FlagOn( DeviceToMarkBad->Vpb->Flags, VPB_MOUNTED )) {
NewVpb = ExistingVcb->SwapVpb;
ExistingVcb->SwapVpb = NULL;
SetFlag( ExistingVcb->VcbState, VCB_STATE_FLAG_VPB_MUST_BE_FREED );
-
+
RtlZeroMemory( NewVpb, sizeof( VPB ) );
NewVpb->Type = IO_TYPE_VPB;
NewVpb->Size = sizeof( VPB );
NewVpb->RealDevice = DeviceToMarkBad;
NewVpb->Flags = FlagOn( DeviceToMarkBad->Vpb->Flags, VPB_REMOVE_PENDING );
-
+
DeviceToMarkBad->Vpb = NewVpb;
}
//
if (!VcbDeleted) {
-
+
FatReleaseVcb( &IrpContext, ExistingVcb );
}
}
return STATUS_SUCCESS;
}
-\f
+
//
// Local Support routine
//
return TRUE;
}
-\f
+
//
// Local Support Routine
//
//
// Make this a synchronous IRP because we need access to the input buffer and
// this Irp is marked METHOD_NEITHER.
- //
+ //
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT );
(VOID)FatDecodeFileObject( IrpSp->FileObject, &Vcb, &Fcb, &Ccb );
if (Irp->RequestorMode != KernelMode ||
- Fcb == NULL ||
+ Fcb == NULL ||
!FlagOn(Fcb->FcbState, FCB_STATE_PAGING_FILE) ) {
FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER );
// the case where it isn't.
//
- Result = FatLookupMcbEntry( Fcb->Vcb,
- &Fcb->Mcb,
- RequestedMapSize->LowPart - 1,
- &Lbo,
- NULL,
+ Result = FatLookupMcbEntry( Fcb->Vcb,
+ &Fcb->Mcb,
+ RequestedMapSize->LowPart - 1,
+ &Lbo,
+ NULL,
&Index );
if (!Result) {
NT_ASSERT(FALSE);
try_leave( Status = STATUS_FILE_CORRUPT_ERROR);
}
-
+
*MappingPairs = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
(Index + 2) * (2 * sizeof(LARGE_INTEGER)),
TAG_OUTPUT_MAPPINGPAIRS );
(*MappingPairs)[ i*2 + 0 ].QuadPart = 0;
Status = STATUS_SUCCESS;
- }
- _SEH2_FINALLY {
+ }
+ _SEH2_FINALLY {
DebugUnwind( FatQueryRetrievalPointers );
return Status;
}
-\f
+
//
// Local Support Routine
//
return Status;
}
-\f
+
//
// Local Support Routine
//
//
// Make this a synchronous IRP because we need access to the input buffer and
// this Irp is marked METHOD_NEITHER.
- //
+ //
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT );
return Status;
}
-\f
+
//
// Local Support Routine
//
//
// Make this a synchronous IRP because we need access to the input buffer and
// this Irp is marked METHOD_NEITHER.
- //
+ //
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT );
-
+
//
// Extract and decode the file object and check for type of open.
//
// recursive, as well as recognizing this is safe anyway.
//
if( (TypeOfOpen == UserFileOpen) || (TypeOfOpen == UserDirectoryOpen) ) {
-
+
if (FlagOn( FcbOrDcb->Vcb->VcbState, VCB_STATE_FLAG_WRITE_PROTECTED )) {
(VOID)FatAcquireSharedFcb( IrpContext, FcbOrDcb );
DebugTrace(-1, Dbg, "FatMoveFile -> 0x%x\n", STATUS_ACCESS_DENIED);
return STATUS_ACCESS_DENIED;
}
-
+
(VOID)FatAcquireExclusiveVcb(IrpContext, Vcb);
}
//
if( (TypeOfOpen == UserFileOpen) || (TypeOfOpen == UserDirectoryOpen) ) {
-
+
FatVerifyFcb( IrpContext, FcbOrDcb );
-
+
//
// If we haven't yet set the correct AllocationSize, do so.
//
ClusterShift = Vcb->AllocationSupport.LogOfBytesPerCluster;
#ifdef _MSC_VER
-#pragma prefast( suppress:28931, "calculate it anyway, in case someone adds code that uses this in the future" )
-#endif
+#pragma prefast( suppress:28931, "calculate it anyway, in case someone adds code that uses this in the future" )
+#endif
ClusterSize = 1 << ClusterShift;
-
+
AllocationSize = FcbOrDcb->Header.AllocationSize.LowPart;
McbToUse = &FcbOrDcb->Mcb;
-
+
} else if ((TypeOfOpen == UserVolumeOpen )) {
FatQuickVerifyVcb( IrpContext, Vcb );
FatRaiseStatus(IrpContext, STATUS_FILE_CORRUPT_ERROR );
}
-
- ClusterShift = Vcb->AllocationSupport.LogOfBytesPerCluster;
+
+ ClusterShift = Vcb->AllocationSupport.LogOfBytesPerCluster;
ClusterSize = 1 << ClusterShift;
-
+
if (!FatLookupLastMcbEntry(Vcb, &Vcb->BadBlockMcb, &LastVbo, &LastLbo, &LastIndex)) {
AllocationSize = 0;
} else {
-
+
//
// Round the allocation size to a multiple of of the cluster size.
//
-
+
AllocationSize = (LastVbo + ((LONGLONG)ClusterSize-1)) & ~((LONGLONG)ClusterSize-1);
}
-
+
McbToUse = &Vcb->BadBlockMcb;
-
+
}
//
// Check if a starting cluster was specified.
//
-
+
_SEH2_TRY {
if (Irp->RequestorMode != KernelMode) {
if (!FatGetNextMcbEntry(Vcb, McbToUse, Run, (PVBO)&Vcn, &Lbo, &ByteLength)) {
#ifdef _MSC_VER
-#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
-#endif
+#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
+#endif
FatBugCheck( (ULONG_PTR)FcbOrDcb, (ULONG_PTR)McbToUse, Run );
}
//
// Release resources
//
-
+
if( (TypeOfOpen == UserFileOpen) || (TypeOfOpen == UserDirectoryOpen) ) {
-
+
FatReleaseFcb( IrpContext, FcbOrDcb );
} else if ((TypeOfOpen == UserVolumeOpen )) {
-
+
FatReleaseVcb(IrpContext, Vcb);
}
-
+
//
// If nothing raised then complete the irp.
//
return Status;
}
-\f
+
//
// Local Support Routine
//
)
{
PAGED_CODE();
-
+
if (NodeType(FcbOrDcb) == FAT_NTC_FCB) {
ClearFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WRITE_THROUGH );
- SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_DISABLE_WRITE_THROUGH );
+ SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_DISABLE_WRITE_THROUGH );
- } else {
+ } else {
IrpContext->Flags &= ~(IRP_CONTEXT_FLAG_WRITE_THROUGH|IRP_CONTEXT_FLAG_DISABLE_WRITE_THROUGH);
- IrpContext->Flags |= OldWriteThroughFlags;
+ IrpContext->Flags |= OldWriteThroughFlags;
- }
- }
+ }
+ }
}
_Requires_lock_held_(_Global_critical_region_)
//
// Do a quick check on the input buffer.
//
-
+
#if defined(_WIN64) && defined(BUILD_WOW64_ENABLED)
if (IoIs32bitProcess( Irp )) {
(TargetCluster + InputBuffer->ClusterCount < TargetCluster) ||
(TargetCluster + InputBuffer->ClusterCount > MaxClusters + 2) ||
(InputBuffer->StartingVcn.LowPart >= MaxClusters) ||
- InputBuffer->ClusterCount == 0
+ InputBuffer->ClusterCount == 0
) {
FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER );
//
// If the VDL of the file is zero, it has no valid data in it anyway.
// So it should be safe to avoid flushing the FAT entries and let them be
- // lazily written out.
+ // lazily written out.
//
- // This is done so that bitlocker's cover file doesn't cause
- // unnecessary FAT table I/O when it's moved around.
+ // This is done so that bitlocker's cover file doesn't cause
+ // unnecessary FAT table I/O when it's moved around.
// (See Win8 bug 106505)
//
//
// If this is a file, and the VDL is zero, clear write through.
//
-
+
FatMoveFileNeedsWriteThrough(IrpContext, FcbOrDcb, OldWriteThroughFlags);
(VOID)FatAcquireExclusiveFcb( IrpContext, FcbOrDcb );
FcbAcquired = TRUE;
-
+
FatVerifyFcb( IrpContext, FcbOrDcb );
}
//
// If the VDL of the file is zero, it has no valid data in it anyway.
// So it should be safe to avoid flushing the FAT entries and let them be
- // lazily written out.
+ // lazily written out.
//
- // This is done so that bitlocker's cover file doesn't cause
- // unnecessary FAT table I/O when it's moved around.
+ // This is done so that bitlocker's cover file doesn't cause
+ // unnecessary FAT table I/O when it's moved around.
// (See Win8 bug 106505)
//
if ((FcbOrDcb->Header.ValidDataLength.QuadPart != 0) || (NodeType(FcbOrDcb) != FAT_NTC_FCB)) {
-
+
FatFlushFatEntries( IrpContext,
Vcb,
TargetCluster,
BytesToReallocate >> ClusterShift );
}
-
+
//
// Aqcuire both resources exclusive now, guaranteeing that NOBODY
// is in either the read or write paths.
FatFlushFatEntries( IrpContext, Vcb, SecondSpliceSourceCluster, 1 );
}
-
+
//
// Now do the first splice OR update the dirent in the parent
// and flush the respective object. After this flush the file
// to update our parent directory.
//
- FatGetDirentFromFcbOrDcb( IrpContext,
- FcbOrDcb,
- FALSE,
- &Dirent,
+ FatGetDirentFromFcbOrDcb( IrpContext,
+ FcbOrDcb,
+ FALSE,
+ &Dirent,
&DirentBcb );
-
+
Dirent->FirstClusterOfFile = (USHORT)FirstSpliceTargetCluster;
if (FatIsFat32(Vcb)) {
(FAT_ENTRY)FirstSpliceTargetCluster );
if ((FcbOrDcb->Header.ValidDataLength.QuadPart != 0) || (NodeType(FcbOrDcb) != FAT_NTC_FCB)) {
-
+
FatFlushFatEntries( IrpContext, Vcb, FirstSpliceSourceCluster, 1 );
}
}
//
if (FcbAcquired) {
-
+
FatReleaseFcb( IrpContext, FcbOrDcb );
}
return Status;
}
-\f
+
//
// Local Support Routine
//
//
// If there is more than our max, then reduce the byte count for this
- // pass to our maximum. We must also align the file offset to a
+ // pass to our maximum. We must also align the file offset to a
// buffer size byte boundary.
//
}
}
-\f
+
//
// Local Support Routine
//
//
// Run should always be present, but don't bugcheck in the case where it's not.
//
-
+
if (!Result) {
NT_ASSERT( FALSE);
FatRaiseStatus( IrpContext, STATUS_FILE_CORRUPT_ERROR);
}
-
+
//
// At this point the variables:
//
SourceBytesRemaining -= SourceMcbBytesInRun,
SourceMcbVbo += SourceMcbBytesInRun) {
- if (SourceMcbVbo != 0) {
-#ifdef _MSC_VER
-#pragma prefast( suppress:28931, "needed for debug build" )
-#endif
+ if (SourceMcbVbo != 0) {
+#ifdef _MSC_VER
+#pragma prefast( suppress:28931, "needed for debug build" )
+#endif
Result = FatGetNextMcbEntry( Vcb, &FcbOrDcb->Mcb,
SourceIndex,
&SourceVbo,
}
}
-\f
+
NTSTATUS
FatAllowExtendedDasdIo(
IN PIRP_CONTEXT IrpContext,
}
#if (NTDDI_VERSION >= NTDDI_WIN7)
-\f
-_Requires_lock_held_(_Global_critical_region_)
+
+_Requires_lock_held_(_Global_critical_region_)
NTSTATUS
FatGetRetrievalPointerBase (
_In_ PIRP_CONTEXT IrpContext,
//
// Verify the handle has manage volume access.
- //
-
+ //
+
if ((Ccb == NULL) || !FlagOn( Ccb->Flags, CCB_FLAG_MANAGE_VOLUME_ACCESS )) {
- FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER );
+ FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER );
return STATUS_INVALID_PARAMETER;
}
if (BufferLength < sizeof(RETRIEVAL_POINTER_BASE)) {
- FatCompleteRequest( IrpContext, Irp, STATUS_BUFFER_TOO_SMALL );
+ FatCompleteRequest( IrpContext, Irp, STATUS_BUFFER_TOO_SMALL );
return STATUS_BUFFER_TOO_SMALL;
}
RtlZeroMemory( RetrievalPointerBase, BufferLength );
try {
-
+
FatAcquireSharedVcb(IrpContext, Vcb);
FatQuickVerifyVcb(IrpContext, Vcb);
-
+
RetrievalPointerBase->FileAreaOffset.QuadPart = Vcb->AllocationSupport.FileAreaLbo >> Vcb->AllocationSupport.LogOfBytesPerSector;
Irp->IoStatus.Information = sizeof( RETRIEVAL_POINTER_BASE );
-
+
} finally {
FatReleaseVcb(IrpContext, Vcb);
-
+
}
-
+
FatCompleteRequest( IrpContext, Irp, STATUS_SUCCESS );
-
+
return STATUS_SUCCESS;
-
+
}
-\f
-_Requires_lock_held_(_Global_critical_region_)
+
+_Requires_lock_held_(_Global_critical_region_)
NTSTATUS
FatGetBootAreaInfo (
_In_ PIRP_CONTEXT IrpContext,
//
// Verify the handle has manage volume access.
- //
-
+ //
+
if ((Ccb == NULL) || !FlagOn( Ccb->Flags, CCB_FLAG_MANAGE_VOLUME_ACCESS )) {
- FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER );
+ FatCompleteRequest( IrpContext, Irp, STATUS_INVALID_PARAMETER );
return STATUS_INVALID_PARAMETER;
}
if (BufferLength < sizeof(BOOT_AREA_INFO)) {
- FatCompleteRequest( IrpContext, Irp, STATUS_BUFFER_TOO_SMALL );
+ FatCompleteRequest( IrpContext, Irp, STATUS_BUFFER_TOO_SMALL );
return STATUS_BUFFER_TOO_SMALL;
}
RtlZeroMemory( BootAreaInfo, BufferLength );
try {
-
+
FatAcquireSharedVcb(IrpContext, Vcb);
FatQuickVerifyVcb(IrpContext, Vcb);
if (FatIsFat32( Vcb )) {
-
- BootAreaInfo->BootSectorCount = 2;
+
+ BootAreaInfo->BootSectorCount = 2;
BootAreaInfo->BootSectors[0].Offset.QuadPart = 0;
BootAreaInfo->BootSectors[1].Offset.QuadPart = 6;
} else {
-
+
BootAreaInfo->BootSectorCount = 1;
- BootAreaInfo->BootSectors[0].Offset.QuadPart = 0;
+ BootAreaInfo->BootSectors[0].Offset.QuadPart = 0;
}
-
+
Irp->IoStatus.Information = sizeof( BOOT_AREA_INFO );
-
+
} finally {
FatReleaseVcb(IrpContext, Vcb);
}
-
+
FatCompleteRequest( IrpContext, Irp, STATUS_SUCCESS );
return STATUS_SUCCESS;
}
#endif
-\f
-_Requires_lock_held_(_Global_critical_region_)
+
+_Requires_lock_held_(_Global_critical_region_)
NTSTATUS
FatMarkHandle (
_In_ PIRP_CONTEXT IrpContext,
PCCB DasdCcb = NULL;
TYPE_OF_OPEN TypeOfOpen;
PMARK_HANDLE_INFO HandleInfo = NULL;
- PFILE_OBJECT DasdFileObject = NULL;
+ PFILE_OBJECT DasdFileObject = NULL;
BOOLEAN ReleaseFcb = FALSE;
-
+
#if defined(_WIN64) && defined(BUILD_WOW64_ENABLED)
MARK_HANDLE_INFO LocalMarkHandleInfo = {0};
#endif
//
// Always make this a synchronous IRP.
- //
+ //
SetFlag( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT );
#endif
//
- // Check that only legal bits are being set.
+ // Check that only legal bits are being set.
// We currently only support two bits: protect clusters and unprotect clusters.
//
// Note that we don't actually support the USN journal, but we must ignore the flags in order
// to preserve compatibility.
//
-
+
if (FlagOn( HandleInfo->HandleInfo,
~(MARK_HANDLE_PROTECT_CLUSTERS)) ||
(FlagOn( HandleInfo->HandleInfo,
FatCompleteRequest( IrpContext, Irp, STATUS_ACCESS_DENIED );
return STATUS_ACCESS_DENIED;
}
-
+
}
_SEH2_TRY {
-
+
FatAcquireExclusiveFcb(IrpContext, Fcb);
ReleaseFcb = TRUE;
FatVerifyFcb( IrpContext, Fcb );
if (HandleInfo->HandleInfo & MARK_HANDLE_PROTECT_CLUSTERS) {
-
+
if (Fcb->FcbState & FCB_STATE_DENY_DEFRAG) {
//
// It's already set, bail out.
//
-
+
try_return( Status = STATUS_ACCESS_DENIED );
- }
-
+ }
+
Ccb->Flags |= CCB_FLAG_DENY_DEFRAG;
Fcb->FcbState|= FCB_STATE_DENY_DEFRAG;
-
+
}
try_exit: NOTHING;
-
+
} _SEH2_FINALLY {
-
+
if (ReleaseFcb) {
-
+
FatReleaseFcb(IrpContext, Fcb);
}
} _SEH2_END;
-
+
FatCompleteRequest( IrpContext, Irp, Status );
return Status;
}
-\f
-_Requires_lock_held_(_Global_critical_region_)
+
+_Requires_lock_held_(_Global_critical_region_)
VOID
FatFlushAndCleanVolume(
IN PIRP_CONTEXT IrpContext,
#if (NTDDI_VERSION >= NTDDI_WIN8)
-\f
+
_Requires_lock_held_(_Global_critical_region_)
NTSTATUS
FatSetPurgeFailureMode (
force error propagation, particulary when a filter has mapped a
section for the purposes of scanning the file in the background.
- The purge failure mode is a reference count because it is set
- per mapped section and there may be multiple sections backed by
+ The purge failure mode is a reference count because it is set
+ per mapped section and there may be multiple sections backed by
the file.
Arguments:
BOOLEAN FcbAcquired = FALSE;
PAGED_CODE();
-
+
IrpSp = IoGetCurrentIrpStackLocation( Irp );
//
// Acquire the FCB exclusively to synchronize with coherency flush
// and purge.
//
-
+
FatAcquireExclusiveFcb( IrpContext, Fcb );
FcbAcquired = TRUE;
}
Fcb->PurgeFailureModeEnableCount += 1;
-
+
} else {
ASSERT( FlagOn( SetPurgeInput->Flags, SET_PURGE_FAILURE_MODE_DISABLED ));
FatReleaseFcb( IrpContext, Fcb );
}
}
-
+
//
// Complete the irp if we terminated normally.
//
#endif
-\f
+
NTSTATUS
FatSearchBufferForLabel(
IN PIRP_CONTEXT IrpContext,
return STATUS_SUCCESS;
}
-\f
+
VOID
FatVerifyLookupFatEntry (
IN PIRP_CONTEXT IrpContext,
continue;
}
-
+
#ifdef _MSC_VER
#pragma prefast( pop )
#endif
if ((TypeOfOpen != UserFileOpen) ||
(!IrpSp->FileObject->WriteAccess) ) {
-
+
FatCompleteRequest( IrpContext, Irp, STATUS_ACCESS_DENIED );
return STATUS_ACCESS_DENIED;
}
_SEH2_TRY {
SetFlag( FcbOrDcb->FcbState, FCB_STATE_ZERO_ON_DEALLOCATION );
-
- } _SEH2_FINALLY {
-
+
+ } _SEH2_FINALLY {
+
if (ReleaseFcb) {
FatReleaseFcb(IrpContext, FcbOrDcb);
}
-
+
} _SEH2_END;
-
- FatCompleteRequest( IrpContext, Irp, Status );
- return Status;
+
+ FatCompleteRequest( IrpContext, Irp, Status );
+ return Status;
}
#endif