[FASTFAT_NEW] Simplify unsupported NT6.2+ workarounds

This commit is contained in:
Serge Gautherie 2020-06-15 06:57:04 +02:00 committed by Victor Perevertkin
parent 1ceed5ad5a
commit ab2b7a6bc6
9 changed files with 9 additions and 105 deletions

View file

@ -2727,11 +2727,7 @@ Return Value:
// Map the MDL. // Map the MDL.
// //
#ifndef __REACTOS__
Buffer = MmGetSystemAddressForMdlSafe(Mdl, HighPagePriority|MdlMappingNoExecute); Buffer = MmGetSystemAddressForMdlSafe(Mdl, HighPagePriority|MdlMappingNoExecute);
#else
Buffer = MmGetSystemAddressForMdlSafe(Mdl, HighPagePriority);
#endif
if (!Buffer) { if (!Buffer) {
NT_ASSERT( FALSE ); NT_ASSERT( FALSE );
ZeroingStatus = STATUS_INSUFFICIENT_RESOURCES; ZeroingStatus = STATUS_INSUFFICIENT_RESOURCES;

View file

@ -1057,11 +1057,7 @@ Return Value:
// that this will be only a single page. // that this will be only a single page.
// //
#ifndef __REACTOS__
if (MmGetSystemAddressForMdlSafe( Mdl, NormalPagePriority | MdlMappingNoExecute ) == NULL) { if (MmGetSystemAddressForMdlSafe( Mdl, NormalPagePriority | MdlMappingNoExecute ) == NULL) {
#else
if (MmGetSystemAddressForMdlSafe( Mdl, NormalPagePriority ) == NULL) {
#endif
FatRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES ); FatRaiseStatus( IrpContext, STATUS_INSUFFICIENT_RESOURCES );
} }
@ -1395,11 +1391,7 @@ Return Value:
// Allocate the local buffer // Allocate the local buffer
// //
#ifndef __REACTOS__
DiskBuffer = FsRtlAllocatePoolWithTag( NonPagedPoolNxCacheAligned, DiskBuffer = FsRtlAllocatePoolWithTag( NonPagedPoolNxCacheAligned,
#else
DiskBuffer = FsRtlAllocatePoolWithTag( NonPagedPoolCacheAligned,
#endif
(ULONG) ROUND_TO_PAGES( SectorSize ), (ULONG) ROUND_TO_PAGES( SectorSize ),
TAG_IO_BUFFER ); TAG_IO_BUFFER );
@ -2775,11 +2767,7 @@ Return Value:
// If we can't get pool, oh well.... // If we can't get pool, oh well....
// //
#ifndef __REACTOS__
Packet = ExAllocatePoolWithTag(NonPagedPoolNx, sizeof(CLEAN_AND_DIRTY_VOLUME_PACKET), ' taF'); Packet = ExAllocatePoolWithTag(NonPagedPoolNx, sizeof(CLEAN_AND_DIRTY_VOLUME_PACKET), ' taF');
#else
Packet = ExAllocatePoolWithTag(NonPagedPool, sizeof(CLEAN_AND_DIRTY_VOLUME_PACKET), ' taF');
#endif
if ( Packet ) { if ( Packet ) {
@ -3407,11 +3395,7 @@ Return Value:
} else { } else {
#ifndef __REACTOS__
PVOID Address = MmGetSystemAddressForMdlSafe( Irp->MdlAddress, NormalPagePriority | MdlMappingNoExecute ); PVOID Address = MmGetSystemAddressForMdlSafe( Irp->MdlAddress, NormalPagePriority | MdlMappingNoExecute );
#else
PVOID Address = MmGetSystemAddressForMdlSafe( Irp->MdlAddress, NormalPagePriority );
#endif
if (Address == NULL) { if (Address == NULL) {
@ -3476,11 +3460,7 @@ Return Value:
UserBuffer = FatMapUserBuffer( IrpContext, Irp ); UserBuffer = FatMapUserBuffer( IrpContext, Irp );
#ifndef __REACTOS__
Irp->AssociatedIrp.SystemBuffer = FsRtlAllocatePoolWithQuotaTag( NonPagedPoolNx, Irp->AssociatedIrp.SystemBuffer = FsRtlAllocatePoolWithQuotaTag( NonPagedPoolNx,
#else
Irp->AssociatedIrp.SystemBuffer = FsRtlAllocatePoolWithQuotaTag( NonPagedPool,
#endif
BufferLength, BufferLength,
TAG_IO_USER_BUFFER ); TAG_IO_USER_BUFFER );

View file

@ -264,11 +264,7 @@ Return Value:
// Allocate the zero page // Allocate the zero page
// //
#ifndef __REACTOS__
FatData.ZeroPage = ExAllocatePoolWithTag( NonPagedPoolNx, PAGE_SIZE, 'ZtaF' ); FatData.ZeroPage = ExAllocatePoolWithTag( NonPagedPoolNx, PAGE_SIZE, 'ZtaF' );
#else
FatData.ZeroPage = ExAllocatePoolWithTag( NonPagedPool, PAGE_SIZE, 'ZtaF' );
#endif
if (FatData.ZeroPage == NULL) { if (FatData.ZeroPage == NULL) {
IoDeleteDevice (FatDiskFileSystemDeviceObject); IoDeleteDevice (FatDiskFileSystemDeviceObject);
IoDeleteDevice (FatCdromFileSystemDeviceObject); IoDeleteDevice (FatCdromFileSystemDeviceObject);
@ -388,11 +384,7 @@ Return Value:
ExInitializeNPagedLookasideList( &FatIrpContextLookasideList, ExInitializeNPagedLookasideList( &FatIrpContextLookasideList,
NULL, NULL,
NULL, NULL,
#ifndef __REACTOS__
POOL_NX_ALLOCATION | POOL_RAISE_IF_ALLOCATION_FAILURE, POOL_NX_ALLOCATION | POOL_RAISE_IF_ALLOCATION_FAILURE,
#else
POOL_RAISE_IF_ALLOCATION_FAILURE,
#endif
sizeof(IRP_CONTEXT), sizeof(IRP_CONTEXT),
TAG_IRP_CONTEXT, TAG_IRP_CONTEXT,
MaxDepth ); MaxDepth );
@ -400,11 +392,7 @@ Return Value:
ExInitializeNPagedLookasideList( &FatNonPagedFcbLookasideList, ExInitializeNPagedLookasideList( &FatNonPagedFcbLookasideList,
NULL, NULL,
NULL, NULL,
#ifndef __REACTOS__
POOL_NX_ALLOCATION | POOL_RAISE_IF_ALLOCATION_FAILURE, POOL_NX_ALLOCATION | POOL_RAISE_IF_ALLOCATION_FAILURE,
#else
POOL_RAISE_IF_ALLOCATION_FAILURE,
#endif
sizeof(NON_PAGED_FCB), sizeof(NON_PAGED_FCB),
TAG_FCB_NONPAGED, TAG_FCB_NONPAGED,
MaxDepth ); MaxDepth );
@ -412,11 +400,7 @@ Return Value:
ExInitializeNPagedLookasideList( &FatEResourceLookasideList, ExInitializeNPagedLookasideList( &FatEResourceLookasideList,
NULL, NULL,
NULL, NULL,
#ifndef __REACTOS__
POOL_NX_ALLOCATION | POOL_RAISE_IF_ALLOCATION_FAILURE, POOL_NX_ALLOCATION | POOL_RAISE_IF_ALLOCATION_FAILURE,
#else
POOL_RAISE_IF_ALLOCATION_FAILURE,
#endif
sizeof(ERESOURCE), sizeof(ERESOURCE),
TAG_ERESOURCE, TAG_ERESOURCE,
MaxDepth ); MaxDepth );

View file

@ -40,6 +40,15 @@ Abstract:
#ifdef __REACTOS__ #ifdef __REACTOS__
// Downgrade unsupported NT6.2+ features.
#undef MdlMappingNoExecute
#define MdlMappingNoExecute 0
#define NonPagedPoolNx NonPagedPool
#define NonPagedPoolNxCacheAligned NonPagedPoolCacheAligned
#undef POOL_NX_ALLOCATION
#define POOL_NX_ALLOCATION 0
// Moved up: needed in 'fatstruc.h'.
typedef enum _TYPE_OF_OPEN { typedef enum _TYPE_OF_OPEN {
UnopenedFileObject = 1, UnopenedFileObject = 1,

View file

@ -2117,11 +2117,7 @@ Return Value:
try_return( Status = STATUS_WRONG_VOLUME ); try_return( Status = STATUS_WRONG_VOLUME );
} }
#ifndef __REACTOS__
BootSector = FsRtlAllocatePoolWithTag(NonPagedPoolNxCacheAligned, BootSector = FsRtlAllocatePoolWithTag(NonPagedPoolNxCacheAligned,
#else
BootSector = FsRtlAllocatePoolWithTag(NonPagedPoolCacheAligned,
#endif
(ULONG) ROUND_TO_PAGES( SectorSize ), (ULONG) ROUND_TO_PAGES( SectorSize ),
TAG_VERIFY_BOOTSECTOR); TAG_VERIFY_BOOTSECTOR);
@ -2212,11 +2208,7 @@ Return Value:
RootDirectorySize = FatBytesPerCluster(&Bpb); RootDirectorySize = FatBytesPerCluster(&Bpb);
} }
#ifndef __REACTOS__
RootDirectory = FsRtlAllocatePoolWithTag( NonPagedPoolNxCacheAligned, RootDirectory = FsRtlAllocatePoolWithTag( NonPagedPoolNxCacheAligned,
#else
RootDirectory = FsRtlAllocatePoolWithTag( NonPagedPoolCacheAligned,
#endif
(ULONG) ROUND_TO_PAGES( RootDirectorySize ), (ULONG) ROUND_TO_PAGES( RootDirectorySize ),
TAG_VERIFY_ROOTDIR); TAG_VERIFY_ROOTDIR);
@ -4009,11 +4001,7 @@ Return Value:
} else if (Irp->MdlAddress != NULL) { } else if (Irp->MdlAddress != NULL) {
#ifndef __REACTOS__
VolumeState = MmGetSystemAddressForMdlSafe( Irp->MdlAddress, LowPagePriority | MdlMappingNoExecute ); VolumeState = MmGetSystemAddressForMdlSafe( Irp->MdlAddress, LowPagePriority | MdlMappingNoExecute );
#else
VolumeState = MmGetSystemAddressForMdlSafe( Irp->MdlAddress, LowPagePriority );
#endif
if (VolumeState == NULL) { if (VolumeState == NULL) {
@ -4829,11 +4817,7 @@ Return Value:
try_leave( Status = STATUS_FILE_CORRUPT_ERROR); try_leave( Status = STATUS_FILE_CORRUPT_ERROR);
} }
#ifndef __REACTOS__
*MappingPairs = FsRtlAllocatePoolWithTag( NonPagedPoolNx, *MappingPairs = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
#else
*MappingPairs = FsRtlAllocatePoolWithTag( NonPagedPool,
#endif
(Index + 2) * (2 * sizeof(LARGE_INTEGER)), (Index + 2) * (2 * sizeof(LARGE_INTEGER)),
TAG_OUTPUT_MAPPINGPAIRS ); TAG_OUTPUT_MAPPINGPAIRS );
@ -6087,11 +6071,7 @@ Return Value:
if (Buffer == NULL) { if (Buffer == NULL) {
#ifndef __REACTOS__
Buffer = FsRtlAllocatePoolWithTag( NonPagedPoolNx, Buffer = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
#else
Buffer = FsRtlAllocatePoolWithTag( NonPagedPool,
#endif
BufferSize, BufferSize,
TAG_DEFRAG_BUFFER ); TAG_DEFRAG_BUFFER );
} }
@ -7979,11 +7959,7 @@ FatVerifyLookupFatEntry (
FatVerifyIndexIsValid( IrpContext, Vcb, FatIndex); FatVerifyIndexIsValid( IrpContext, Vcb, FatIndex);
#ifndef __REACTOS__
Buffer = FsRtlAllocatePoolWithTag( NonPagedPoolNxCacheAligned, Buffer = FsRtlAllocatePoolWithTag( NonPagedPoolNxCacheAligned,
#else
Buffer = FsRtlAllocatePoolWithTag( NonPagedPoolCacheAligned,
#endif
PAGE_SIZE, PAGE_SIZE,
TAG_ENTRY_LOOKUP_BUFFER ); TAG_ENTRY_LOOKUP_BUFFER );

View file

@ -685,11 +685,7 @@ Return Value:
if (!Wait) { if (!Wait) {
IrpContext->FatIoContext = IrpContext->FatIoContext =
#ifndef __REACTOS__
FsRtlAllocatePoolWithTag( NonPagedPoolNx, FsRtlAllocatePoolWithTag( NonPagedPoolNx,
#else
FsRtlAllocatePoolWithTag( NonPagedPool,
#endif
sizeof(FAT_IO_CONTEXT), sizeof(FAT_IO_CONTEXT),
TAG_FAT_IO_CONTEXT ); TAG_FAT_IO_CONTEXT );

View file

@ -556,11 +556,7 @@ Return Value:
// Initialize the performance counters. // Initialize the performance counters.
// //
#ifndef __REACTOS__
Vcb->Statistics = FsRtlAllocatePoolWithTag( NonPagedPoolNx, Vcb->Statistics = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
#else
Vcb->Statistics = FsRtlAllocatePoolWithTag( NonPagedPool,
#endif
sizeof(FILE_SYSTEM_STATISTICS) * FatData.NumberProcessors, sizeof(FILE_SYSTEM_STATISTICS) * FatData.NumberProcessors,
TAG_VCB_STATS ); TAG_VCB_STATS );
UnwindStatistics = Vcb->Statistics; UnwindStatistics = Vcb->Statistics;
@ -579,11 +575,7 @@ Return Value:
// of the storage stack on demand. // of the storage stack on demand.
// //
#ifndef __REACTOS__
Vcb->SwapVpb = FsRtlAllocatePoolWithTag( NonPagedPoolNx, Vcb->SwapVpb = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
#else
Vcb->SwapVpb = FsRtlAllocatePoolWithTag( NonPagedPool,
#endif
sizeof( VPB ), sizeof( VPB ),
TAG_VPB ); TAG_VPB );
@ -1047,11 +1039,7 @@ Return Value:
// have to continually reference through the Vcb // have to continually reference through the Vcb
// //
#ifndef __REACTOS__
UnwindStorage[0] = Dcb = Vcb->RootDcb = FsRtlAllocatePoolWithTag( NonPagedPoolNx, UnwindStorage[0] = Dcb = Vcb->RootDcb = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
#else
UnwindStorage[0] = Dcb = Vcb->RootDcb = FsRtlAllocatePoolWithTag( NonPagedPool,
#endif
sizeof(DCB), sizeof(DCB),
TAG_FCB ); TAG_FCB );
@ -1144,11 +1132,7 @@ Return Value:
// directory is a fixed size so we can set it everything up now. // directory is a fixed size so we can set it everything up now.
// //
#ifndef __REACTOS__
FsRtlInitializeLargeMcb( &Dcb->Mcb, NonPagedPoolNx ); FsRtlInitializeLargeMcb( &Dcb->Mcb, NonPagedPoolNx );
#else
FsRtlInitializeLargeMcb( &Dcb->Mcb, NonPagedPool );
#endif
UnwindMcb = &Dcb->Mcb; UnwindMcb = &Dcb->Mcb;
if (FatIsFat32(Vcb)) { if (FatIsFat32(Vcb)) {
@ -1333,13 +1317,8 @@ Return Value:
if (IsPagingFile) { if (IsPagingFile) {
#ifndef __REACTOS__
PoolType = NonPagedPoolNx; PoolType = NonPagedPoolNx;
Fcb = UnwindStorage[0] = FsRtlAllocatePoolWithTag( NonPagedPoolNx, Fcb = UnwindStorage[0] = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
#else
PoolType = NonPagedPool;
Fcb = UnwindStorage[0] = FsRtlAllocatePoolWithTag( NonPagedPool,
#endif
sizeof(FCB), sizeof(FCB),
TAG_FCB ); TAG_FCB );
} else { } else {

View file

@ -709,11 +709,7 @@ Return Value:
// If we couldn't get pool, oh well.... // If we couldn't get pool, oh well....
// //
#ifndef __REACTOS__
Packet = ExAllocatePoolWithTag(NonPagedPoolNx, sizeof(CLEAN_AND_DIRTY_VOLUME_PACKET), ' taF'); Packet = ExAllocatePoolWithTag(NonPagedPoolNx, sizeof(CLEAN_AND_DIRTY_VOLUME_PACKET), ' taF');
#else
Packet = ExAllocatePoolWithTag(NonPagedPool, sizeof(CLEAN_AND_DIRTY_VOLUME_PACKET), ' taF');
#endif
if ( Packet ) { if ( Packet ) {

View file

@ -447,11 +447,7 @@ Return Value:
if (!Wait) { if (!Wait) {
IrpContext->FatIoContext = IrpContext->FatIoContext =
#ifndef __REACTOS__
FsRtlAllocatePoolWithTag( NonPagedPoolNx, FsRtlAllocatePoolWithTag( NonPagedPoolNx,
#else
FsRtlAllocatePoolWithTag( NonPagedPool,
#endif
sizeof(FAT_IO_CONTEXT), sizeof(FAT_IO_CONTEXT),
TAG_FAT_IO_CONTEXT ); TAG_FAT_IO_CONTEXT );
@ -1662,11 +1658,7 @@ Return Value:
if (!FcbOrDcb->NonPaged->OutstandingAsyncEvent) { if (!FcbOrDcb->NonPaged->OutstandingAsyncEvent) {
FcbOrDcb->NonPaged->OutstandingAsyncEvent = FcbOrDcb->NonPaged->OutstandingAsyncEvent =
#ifndef __REACTOS__
FsRtlAllocatePoolWithTag( NonPagedPoolNx, FsRtlAllocatePoolWithTag( NonPagedPoolNx,
#else
FsRtlAllocatePoolWithTag( NonPagedPool,
#endif
sizeof(KEVENT), sizeof(KEVENT),
TAG_EVENT ); TAG_EVENT );
@ -2420,11 +2412,7 @@ Return Value:
// Get pool and initialize the timer and DPC // Get pool and initialize the timer and DPC
// //
#ifndef __REACTOS__
FlushContext = FsRtlAllocatePoolWithTag( NonPagedPoolNx, FlushContext = FsRtlAllocatePoolWithTag( NonPagedPoolNx,
#else
FlushContext = FsRtlAllocatePoolWithTag( NonPagedPool,
#endif
sizeof(DEFERRED_FLUSH_CONTEXT), sizeof(DEFERRED_FLUSH_CONTEXT),
TAG_DEFERRED_FLUSH_CONTEXT ); TAG_DEFERRED_FLUSH_CONTEXT );