[ros-diffs] [arty] 44140: Correct 64-bit paths. Files > 4G and large volumes can now have arbitrary sections on them. Theoretically, even >4G as a single section on 64-bit reactos. Unfortunately some code is slightly uglified. Ext2 fixes likely reflect change in build environment, not the original author's bugs.

arty at svn.reactos.org arty at svn.reactos.org
Fri Nov 13 16:35:12 CET 2009


Author: arty
Date: Fri Nov 13 16:35:12 2009
New Revision: 44140

URL: http://svn.reactos.org/svn/reactos?rev=44140&view=rev
Log:
Correct 64-bit paths.  Files > 4G and large volumes can now have arbitrary sections on
them.  Theoretically, even >4G as a single section on 64-bit reactos.
Unfortunately some code is slightly uglified.
Ext2 fixes likely reflect change in build environment, not the original author's bugs.

Modified:
    branches/arty-newcc/drivers/filesystems/ext2/src/DiskIO.c
    branches/arty-newcc/drivers/filesystems/ext2/src/fsctrl.c
    branches/arty-newcc/drivers/filesystems/ext2/src/io.c
    branches/arty-newcc/drivers/filesystems/ext2/src/metadata.c
    branches/arty-newcc/drivers/filesystems/ext2/src/read.c
    branches/arty-newcc/drivers/filesystems/ext2/src/write.c
    branches/arty-newcc/ntoskrnl/cache/copysup.c
    branches/arty-newcc/ntoskrnl/cache/pinsup.c
    branches/arty-newcc/ntoskrnl/include/internal/newcc.h
    branches/arty-newcc/ntoskrnl/include/internal/newmm.h
    branches/arty-newcc/ntoskrnl/mm/rmap.c
    branches/arty-newcc/ntoskrnl/mm/section/data.c
    branches/arty-newcc/ntoskrnl/mm/section/image.c
    branches/arty-newcc/ntoskrnl/mm/section/io.c
    branches/arty-newcc/ntoskrnl/mm/section/pagefile.c
    branches/arty-newcc/ntoskrnl/mm/section/physical.c
    branches/arty-newcc/ntoskrnl/mm/virtual.c

Modified: branches/arty-newcc/drivers/filesystems/ext2/src/DiskIO.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/ext2/src/DiskIO.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/drivers/filesystems/ext2/src/DiskIO.c [iso-8859-1] (original)
+++ branches/arty-newcc/drivers/filesystems/ext2/src/DiskIO.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -18,7 +18,6 @@
 #define			EXT2_BUG_CHECK_ID				EXT2_FILE_DISK_IO
 
 #define			DEBUG_LEVEL						( DEBUG_TRACE_DISKIO )
-
 
 /*************************************************************************
 *
@@ -80,9 +79,9 @@
 	LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVCB->LogBlockSize;
 	PhysicalBlockSize = PtrTargetDeviceObject->SectorSize;
 	
-	NoOfPhysicalBlocks = NoOfLogicalBlocks * LogicalBlockSize / PhysicalBlockSize;
-
-	StartPhysicalBlock.QuadPart = ( StartLogicalBlock.QuadPart ) * 
+	NoOfPhysicalBlocks = (ULONGLONG)NoOfLogicalBlocks * LogicalBlockSize / PhysicalBlockSize;
+
+	StartPhysicalBlock.QuadPart = (ULONGLONG)( StartLogicalBlock.QuadPart ) * 
 									( LogicalBlockSize / PhysicalBlockSize );
 
 	Status = Ext2ReadPhysicalBlocks( PtrTargetDeviceObject,
@@ -144,7 +143,7 @@
 	
 	NumberOfBytesToRead = PhysicalBlockSize * NoOfBlocks;
 
-	ByteOffset.QuadPart = StartPhysicalBlock.QuadPart * PhysicalBlockSize;
+	ByteOffset.QuadPart = (ULONGLONG)StartPhysicalBlock.QuadPart * PhysicalBlockSize;
 
 	try
 	{

Modified: branches/arty-newcc/drivers/filesystems/ext2/src/fsctrl.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/ext2/src/fsctrl.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/drivers/filesystems/ext2/src/fsctrl.c [iso-8859-1] (original)
+++ branches/arty-newcc/drivers/filesystems/ext2/src/fsctrl.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -393,12 +393,12 @@
 			if( PtrVCB->LogBlockSize )
 			{
 				//	First block contains the descriptors...
-				VolumeByteOffset.QuadPart = LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)LogicalBlockSize;
 			}
 			else
 			{
 				//	Second block contains the descriptors...
-				VolumeByteOffset.QuadPart = LogicalBlockSize * 2;
+				VolumeByteOffset.QuadPart = (ULONGLONG)LogicalBlockSize * 2;
 			}
 
 			NumberOfBytesToRead = PtrVCB->NoOfGroups * sizeof( struct ext2_group_desc );

Modified: branches/arty-newcc/drivers/filesystems/ext2/src/io.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/ext2/src/io.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/drivers/filesystems/ext2/src/io.c [iso-8859-1] (original)
+++ branches/arty-newcc/drivers/filesystems/ext2/src/io.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -140,13 +140,13 @@
 			{
 				PtrIrpSp->Parameters.Read.Length = ReadWriteLength;
 				PtrIrpSp->Parameters.Read.ByteOffset.QuadPart = 
-					PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
+					(ULONGLONG)PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
 			}
 			else if( PtrIrpContext->MajorFunction == IRP_MJ_WRITE )
 			{
 				PtrIrpSp->Parameters.Write.Length = ReadWriteLength;
 				PtrIrpSp->Parameters.Write.ByteOffset.QuadPart = 
-					PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
+					(ULONGLONG)PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
 			}
 
 			//	PtrIrpSp->Parameters.Read.Length = ReadWriteLength;
@@ -170,12 +170,12 @@
 			if( PtrIrpContext->MajorFunction == IRP_MJ_READ )
 			{
 				PtrIrpSp->Parameters.Read.Length = ReadWriteLength;
-				PtrIrpSp->Parameters.Read.ByteOffset.QuadPart = PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
+				PtrIrpSp->Parameters.Read.ByteOffset.QuadPart = (ULONGLONG)PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
 			}
 			else if( PtrIrpContext->MajorFunction == IRP_MJ_WRITE )
 			{
 				PtrIrpSp->Parameters.Write.Length = ReadWriteLength;
-				PtrIrpSp->Parameters.Write.ByteOffset.QuadPart = PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
+				PtrIrpSp->Parameters.Write.ByteOffset.QuadPart = (ULONGLONG)PtrIoRuns[i].LogicalBlock * ( LogicalBlockSize );
 			}
 
 			//	PtrIrpSp->Parameters.Read.Length = ReadWriteLength;

Modified: branches/arty-newcc/drivers/filesystems/ext2/src/metadata.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/ext2/src/metadata.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/drivers/filesystems/ext2/src/metadata.c [iso-8859-1] (original)
+++ branches/arty-newcc/drivers/filesystems/ext2/src/metadata.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -101,8 +101,10 @@
 		LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVcb->LogBlockSize;
 		NumberOfBytesToRead = sizeof(EXT2_INODE);	//	LogicalBlockSize;
 
-		VolumeByteOffset.QuadPart = PtrVcb->PtrGroupDescriptors[ GroupNo ].InodeTablesBlock
+		VolumeByteOffset.QuadPart = (ULONGLONG)PtrVcb->PtrGroupDescriptors[ GroupNo ].InodeTablesBlock
 				* LogicalBlockSize + Index * PtrVcb->InodeSize;
+		DebugTrace(DEBUG_TRACE_MISC, "VolumeByteOffset.HighPart %08x", VolumeByteOffset.HighPart);
+		DebugTrace(DEBUG_TRACE_MISC, "VolumeByteOffset.LowPart  %08x", VolumeByteOffset.LowPart);
 		//VolumeByteOffset.QuadPart = PtrVcb->InodeTableBlock[ GroupNo ] * LogicalBlockSize +
 		//	Index * PtrVcb->InodeSize;
 		
@@ -298,7 +300,7 @@
 		}
 
 		VolumeByteOffset.QuadPart = 
-			PtrVCB->PtrGroupDescriptors[ GroupNo ].InodeBitmapBlock * LogicalBlockSize;
+			(ULONGLONG)PtrVCB->PtrGroupDescriptors[ GroupNo ].InodeBitmapBlock * LogicalBlockSize;
 		
 		NumberOfBytesToRead = PtrVCB->InodesCount / PtrVCB->NoOfGroups;
 
@@ -534,7 +536,7 @@
 		BitmapIndex = BitmapIndex - ( BlockIndex * LogicalBlockSize );
 
 		VolumeByteOffset.QuadPart = 
-			( PtrVCB->PtrGroupDescriptors[ GroupNo ].InodeBitmapBlock + BlockIndex ) 
+			(ULONGLONG)( PtrVCB->PtrGroupDescriptors[ GroupNo ].InodeBitmapBlock + BlockIndex ) 
 			* LogicalBlockSize;
 
 		//
@@ -752,7 +754,7 @@
 		LogicalBlockSize = EXT2_MIN_BLOCK_SIZE << PtrVcb->LogBlockSize;
 		NumberOfBytesToRead = sizeof(EXT2_INODE);
 
-		VolumeByteOffset.QuadPart = PtrVcb->PtrGroupDescriptors[ GroupNo ].InodeTablesBlock
+		VolumeByteOffset.QuadPart = (ULONGLONG)PtrVcb->PtrGroupDescriptors[ GroupNo ].InodeTablesBlock
 				* LogicalBlockSize + Index * PtrVcb->InodeSize;
 		
 		TempOffset.QuadPart = Ext2Align64( VolumeByteOffset.QuadPart, LogicalBlockSize );
@@ -936,7 +938,7 @@
 			}
 		}
 
-		VolumeByteOffset.QuadPart = BlockNo * LogicalBlockSize;
+		VolumeByteOffset.QuadPart = (ULONGLONG)BlockNo * LogicalBlockSize;
 		CcMapData(	PtrFileObject,
 					&VolumeByteOffset,
 					LogicalBlockSize,
@@ -1243,7 +1245,7 @@
 		}
 
 		//	No of blocks CURRENTLY allocated...
-		NoOfBlocks = (ULONG) PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize.QuadPart / LogicalBlockSize;
+		NoOfBlocks = (ULONG) (PtrFCB->NTRequiredFCB.CommonFCBHeader.AllocationSize.QuadPart / LogicalBlockSize);
 		
 		
 		if( NoOfBlocks < EXT2_NDIR_BLOCKS )
@@ -1311,7 +1313,7 @@
 
 				//	Bring in the new block to the cache
 				//	Zero it out
-				VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
 
 				if( !CcPreparePinWrite( 
 					PtrVCB->PtrStreamFileObject,
@@ -1329,7 +1331,7 @@
 			{
 				//	 Just bring in the SIB to the cache
 				
-				VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
 
 				if( !CcPreparePinWrite( PtrVCB->PtrStreamFileObject,
 							&VolumeByteOffset,
@@ -1402,7 +1404,7 @@
 
 				//	Bring in the new block to the cache
 				//	Zero it out
-				VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
 
 				if( !CcPreparePinWrite( 
 					PtrVCB->PtrStreamFileObject,
@@ -1446,7 +1448,7 @@
 				DebugTrace(DEBUG_TRACE_SPECIAL, "Ext2AllocBlock", 0);
 				PtrDIBBuffer[SBlockNo] = Ext2AllocBlock( PtrIrpContext, PtrVCB, 1 );
 				CcSetDirtyPinnedData( PtrDIBBCB, NULL );
-				VolumeByteOffset.QuadPart = PtrDIBBuffer[SBlockNo] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrDIBBuffer[SBlockNo] * LogicalBlockSize;
 
 				Inode.i_blocks += ( LogicalBlockSize / 512 );
 
@@ -1538,7 +1540,7 @@
 
 				//	Bring in the new block to the cache
 				//	Zero it out
-				VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
 
 				if( !CcPreparePinWrite( 
 					PtrVCB->PtrStreamFileObject,
@@ -1580,7 +1582,7 @@
 				DebugTrace(DEBUG_TRACE_SPECIAL, "Ext2AllocBlock", 0);
 				PtrDIBBuffer[SBlockNo] = Ext2AllocBlock( PtrIrpContext, PtrVCB, 1 );
 				CcSetDirtyPinnedData( PtrDIBBCB, NULL );
-				VolumeByteOffset.QuadPart = PtrDIBBuffer[SBlockNo] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrDIBBuffer[SBlockNo] * LogicalBlockSize;
 
 				Inode.i_blocks += ( LogicalBlockSize / 512 );
 
@@ -1715,7 +1717,7 @@
 		}
 
 		VolumeByteOffset.QuadPart = 
-			PtrVCB->PtrGroupDescriptors[ GroupNo ].BlockBitmapBlock * LogicalBlockSize;
+			(ULONGLONG)PtrVCB->PtrGroupDescriptors[ GroupNo ].BlockBitmapBlock * LogicalBlockSize;
 		
 		NumberOfBytesToRead = PtrVCB->BlocksCount / PtrVCB->NoOfGroups;
 
@@ -1947,7 +1949,7 @@
 		BitmapIndex = BitmapIndex - ( BlockIndex * LogicalBlockSize );
 
 		VolumeByteOffset.QuadPart = 
-			( PtrVCB->PtrGroupDescriptors[ GroupNo ].BlockBitmapBlock + BlockIndex ) 
+			(ULONGLONG)( PtrVCB->PtrGroupDescriptors[ GroupNo ].BlockBitmapBlock + BlockIndex ) 
 			* LogicalBlockSize;
 		
 		//
@@ -2259,7 +2261,7 @@
 		ULONG			TIndex, DIndex, SIndex;
 
 		//	Pin the Double Indirect Pointer Block...
-		VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_TIND_BLOCK ] * LogicalBlockSize;
+		VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_TIND_BLOCK ] * LogicalBlockSize;
 		if (!CcMapData( PtrVCB->PtrStreamFileObject,
 		   &VolumeByteOffset,
 		   LogicalBlockSize,
@@ -2275,7 +2277,7 @@
 		{
 			if( PtrPinnedTIndirectBlock[ TIndex ] )
 			{
-				VolumeByteOffset.QuadPart = PtrPinnedTIndirectBlock[TIndex] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrPinnedTIndirectBlock[TIndex] * LogicalBlockSize;
 				if (!CcMapData( PtrVCB->PtrStreamFileObject,
 				   &VolumeByteOffset,
 				   LogicalBlockSize,
@@ -2291,7 +2293,7 @@
 				{
 					if( PtrPinnedDIndirectBlock[DIndex] )
 					{
-						VolumeByteOffset.QuadPart = PtrPinnedDIndirectBlock[DIndex] * LogicalBlockSize;
+						VolumeByteOffset.QuadPart = (ULONGLONG)PtrPinnedDIndirectBlock[DIndex] * LogicalBlockSize;
 						if (!CcMapData( PtrVCB->PtrStreamFileObject,
 						   &VolumeByteOffset,
 						   LogicalBlockSize,
@@ -2350,7 +2352,7 @@
 		ULONG			DIndex, SIndex;
 
 		//	Pin the Double Indirect Pointer Block...
-		VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
+		VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
 		if (!CcMapData( PtrVCB->PtrStreamFileObject,
 		   &VolumeByteOffset,
 		   LogicalBlockSize,
@@ -2366,7 +2368,7 @@
 		{
 			if( PtrPinnedDIndirectBlock[DIndex] )
 			{
-				VolumeByteOffset.QuadPart = PtrPinnedDIndirectBlock[DIndex] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrPinnedDIndirectBlock[DIndex] * LogicalBlockSize;
 				if (!CcMapData( PtrVCB->PtrStreamFileObject,
 				   &VolumeByteOffset,
 				   LogicalBlockSize,
@@ -2416,7 +2418,7 @@
 		ULONG			Index;
 
 		//	Pin the Single Indirect Pointer Block...
-		VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
+		VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
 		if (!CcMapData( PtrVCB->PtrStreamFileObject,
 		   &VolumeByteOffset,
 		   LogicalBlockSize,
@@ -2513,7 +2515,7 @@
 		ULONG			Index;
 
 		//	Pin the Single Indirect Pointer Block...
-		VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
+		VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
 		if (!CcMapData( PtrVCB->PtrStreamFileObject,
 		   &VolumeByteOffset,
 		   LogicalBlockSize,

Modified: branches/arty-newcc/drivers/filesystems/ext2/src/read.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/ext2/src/read.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/drivers/filesystems/ext2/src/read.c [iso-8859-1] (original)
+++ branches/arty-newcc/drivers/filesystems/ext2/src/read.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -212,6 +212,7 @@
 		}
 		
 		DebugTrace(DEBUG_TRACE_READ_DETAILS,   "  ->ByteCount           = 0x%8lx", PtrIoStackLocation->Parameters.Read.Length);
+		DebugTrace(DEBUG_TRACE_READ_DETAILS,   "  ->ByteOffset.HighPart = 0x%8lx", PtrIoStackLocation->Parameters.Read.ByteOffset.HighPart);
 		DebugTrace(DEBUG_TRACE_READ_DETAILS,   "  ->ByteOffset.LowPart  = 0x%8lx", PtrIoStackLocation->Parameters.Read.ByteOffset.LowPart);
 		
 		if( CanWait )
@@ -674,7 +675,7 @@
 				LARGE_INTEGER VolumeByteOffset;
 
 				DebugTrace(DEBUG_TRACE_MISC,   "Reading in some Single Indirect Blocks from IND block at %x", PtrFCB->IBlock[EXT2_IND_BLOCK]);
-				VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_IND_BLOCK ] * LogicalBlockSize;
 
 				//
 				//	Asking the cache manager to oblige by pinning the single indirect block...
@@ -713,7 +714,9 @@
 
 				DebugTrace(DEBUG_TRACE_MISC,   "Reading in some Double Indirect Blocks", 0);
 
-				VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
+				DebugTrace(DEBUG_TRACE_MISC, "VolumeByteOffset.HighPart %08x", VolumeByteOffset.HighPart);
+				DebugTrace(DEBUG_TRACE_MISC, "VolumeByteOffset.LowPart  %08x", VolumeByteOffset.LowPart);
 
 				//
 				//	Asking the cache manager to oblige by pinning the double indirect block...
@@ -772,7 +775,7 @@
 
 					for( i = 0; i < DIArrayCount; i++ )
 					{
-						VolumeByteOffset.QuadPart =  PtrPinnedDIndirectBlock[StartIndirectBlock+i] * LogicalBlockSize;
+						VolumeByteOffset.QuadPart =  (ULONGLONG)PtrPinnedDIndirectBlock[StartIndirectBlock+i] * LogicalBlockSize;
 						if (!CcMapData( PtrVCB->PtrStreamFileObject,
 						   &VolumeByteOffset,
 						   LogicalBlockSize,
@@ -817,7 +820,7 @@
 
 				DebugTrace(DEBUG_TRACE_MISC,   "Reading in some Triple Indirect Blocks", 0);
 
-				VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_TIND_BLOCK ] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_TIND_BLOCK ] * LogicalBlockSize;
 
 				DebugTrace(DEBUG_TRACE_TRIPLE,   "ByteOffset = 0x%I64X", ByteOffset );
 				DebugTrace(DEBUG_TRACE_TRIPLE,   "ReadLength = 0x%lX", ReadLength );
@@ -890,7 +893,7 @@
 
 					for( i = 0; i < Count; i++, ByteOffsetTillHere += DoubleIndirectBlockSize)
 					{
-						VolumeByteOffset.QuadPart =  PtrPinnedTIndirectBlock[StartDIndirectBlock+i] * LogicalBlockSize;
+						VolumeByteOffset.QuadPart = (ULONGLONG)PtrPinnedTIndirectBlock[StartDIndirectBlock+i] * LogicalBlockSize;
 						
 						DebugTrace(DEBUG_TRACE_TRIPLE,   "Double VolOffset = 0x%I64X", VolumeByteOffset );
 
@@ -940,7 +943,7 @@
 								
 							for( i = 0; i < (EndIndirectBlock - StartIndirectBlock); i++ )
 							{
-								VolumeByteOffset.QuadPart =  TempDIBuffer[StartIndirectBlock+i] * LogicalBlockSize;
+								VolumeByteOffset.QuadPart = (ULONGLONG)TempDIBuffer[StartIndirectBlock+i] * LogicalBlockSize;
 								DebugTrace(DEBUG_TRACE_TRIPLE,   "Single VolOffset = 0x%I64X", VolumeByteOffset );
 
 								if (!CcMapData( PtrVCB->PtrStreamFileObject,

Modified: branches/arty-newcc/drivers/filesystems/ext2/src/write.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/ext2/src/write.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/drivers/filesystems/ext2/src/write.c [iso-8859-1] (original)
+++ branches/arty-newcc/drivers/filesystems/ext2/src/write.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -627,6 +627,16 @@
 					PtrReqdFCB->CommonFCBHeader.FileSize.QuadPart = 
 						ByteOffset.QuadPart + WriteLength;				
 					
+					if ( PtrReqdFCB->CommonFCBHeader.FileSize.QuadPart > PtrReqdFCB->CommonFCBHeader.AllocationSize.QuadPart )
+					{
+						DbgPrint
+							("File size greater than allocation size: %08x%08x vs %08x%08x %wZ\n",
+							 PtrReqdFCB->CommonFCBHeader.FileSize.HighPart,
+							 PtrReqdFCB->CommonFCBHeader.FileSize.LowPart,
+							 PtrReqdFCB->CommonFCBHeader.AllocationSize.HighPart,
+							 PtrReqdFCB->CommonFCBHeader.AllocationSize.LowPart,
+							 &PtrFileObject->FileName);
+					}
 					ASSERT( PtrReqdFCB->CommonFCBHeader.FileSize.QuadPart <= PtrReqdFCB->CommonFCBHeader.AllocationSize.QuadPart );
 
 					Ext2UpdateFileSize( PtrIrpContext, PtrFileObject, PtrFCB );
@@ -796,7 +806,7 @@
 				DebugTrace(DEBUG_TRACE_WRITE_DETAILS,   "Reading in some Indirect Blocks", 0);
 
 				DebugTrace(DEBUG_TRACE_WRITE_DETAILS,   "Indirect block at %x", PtrFCB->IBlock[EXT2_NDIR_BLOCKS]);
-				VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_NDIR_BLOCKS ] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_NDIR_BLOCKS ] * LogicalBlockSize;
 
 				//
 				//	Asking the cache manager to oblige by pinning the single indirect block...
@@ -836,7 +846,7 @@
 
 				DebugTrace(DEBUG_TRACE_MISC,   "Reading in some Double Indirect Blocks", 0);
 
-				VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
 
 				//
 				//	Asking the cache manager to oblige by pinning the double indirect block...
@@ -895,7 +905,7 @@
 
 					for( i = 0; i < DIArrayCount; i++ )
 					{
-						VolumeByteOffset.QuadPart =  PtrPinnedDIndirectBlock[StartIndirectBlock+i] * LogicalBlockSize;
+						VolumeByteOffset.QuadPart = (ULONGLONG)PtrPinnedDIndirectBlock[StartIndirectBlock+i] * LogicalBlockSize;
 						if (!CcMapData( PtrVCB->PtrStreamFileObject,
 						   &VolumeByteOffset,
 						   LogicalBlockSize,
@@ -928,7 +938,7 @@
 
 				DebugTrace(DEBUG_TRACE_MISC,   "Reading in some Double Indirect Blocks", 0);
 
-				VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_DIND_BLOCK ] * LogicalBlockSize;
 
 				//
 				//	Asking the cache manager to oblige by pinning the double indirect block...
@@ -991,7 +1001,7 @@
 
 					for( i = 0; i < DIArrayCount; i++ )
 					{
-						VolumeByteOffset.QuadPart =  PtrPinnedDIndirectBlock[StartIndirectBlock+i] * LogicalBlockSize;
+						VolumeByteOffset.QuadPart = (ULONGLONG)PtrPinnedDIndirectBlock[StartIndirectBlock+i] * LogicalBlockSize;
 						if (!CcMapData( PtrVCB->PtrStreamFileObject,
 						   &VolumeByteOffset,
 						   LogicalBlockSize,
@@ -1036,7 +1046,7 @@
 
 				DebugTrace(DEBUG_TRACE_MISC,   "Reading in some Triple Indirect Blocks", 0);
 
-				VolumeByteOffset.QuadPart = PtrFCB->IBlock[ EXT2_TIND_BLOCK ] * LogicalBlockSize;
+				VolumeByteOffset.QuadPart = (ULONGLONG)PtrFCB->IBlock[ EXT2_TIND_BLOCK ] * LogicalBlockSize;
 
 				DebugTrace(DEBUG_TRACE_TRIPLE,   "ByteOffset = 0x%I64X", ByteOffset );
 				DebugTrace(DEBUG_TRACE_TRIPLE,   "WriteLength = 0x%lX", WriteLength );
@@ -1109,7 +1119,7 @@
 
 					for( i = 0; i < Count; i++, ByteOffsetTillHere += DoubleIndirectBlockSize)
 					{
-						VolumeByteOffset.QuadPart =  PtrPinnedTIndirectBlock[StartDIndirectBlock+i] * LogicalBlockSize;
+						VolumeByteOffset.QuadPart = (ULONGLONG)PtrPinnedTIndirectBlock[StartDIndirectBlock+i] * LogicalBlockSize;
 						
 						DebugTrace(DEBUG_TRACE_TRIPLE,   "Double VolOffset = 0x%I64X", VolumeByteOffset );
 
@@ -1159,7 +1169,7 @@
 								
 							for( i = 0; i < (EndIndirectBlock - StartIndirectBlock); i++ )
 							{
-								VolumeByteOffset.QuadPart =  TempDIBuffer[StartIndirectBlock+i] * LogicalBlockSize;
+								VolumeByteOffset.QuadPart = (ULONGLONG)TempDIBuffer[StartIndirectBlock+i] * LogicalBlockSize;
 								DebugTrace(DEBUG_TRACE_TRIPLE,   "Single VolOffset = 0x%I64X", VolumeByteOffset );
 
 								if (!CcMapData( PtrVCB->PtrStreamFileObject,

Modified: branches/arty-newcc/ntoskrnl/cache/copysup.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/copysup.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/cache/copysup.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/cache/copysup.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -54,41 +54,42 @@
 
     while (CacheOffset.QuadPart < EndOfExtent.QuadPart)
     {
-	NextOffset.QuadPart = (CacheOffset.QuadPart + CACHE_STRIPE) & ~(CACHE_STRIPE-1);
-	ReadLen = EndOfExtent.QuadPart - CacheOffset.QuadPart;
-	if (CacheOffset.QuadPart + ReadLen > NextOffset.QuadPart)
-	{
-	    ReadLen = NextOffset.QuadPart - CacheOffset.QuadPart;
-	}
-
-	DPRINT("Reading %d bytes in this go (at %08x%08x)\n", ReadLen, CacheOffset.HighPart, CacheOffset.LowPart);
-
-	if (!CcPinRead
-	    (FileObject,
-	     &CacheOffset,
-	     ReadLen,
-	     Wait ? PIN_WAIT : PIN_IF_BCB,
-	     &Bcb,
-	     (PVOID*)&ReadBuffer))
-	{
-	    IoStatus->Status = STATUS_UNSUCCESSFUL;
-	    IoStatus->Information = 0;
-	    DPRINT("Failed CcCopyRead\n");
-	    return FALSE;
-	}
-
-	DPRINT("Copying %d bytes at %08x%08x\n", ReadLen, CacheOffset.HighPart, CacheOffset.LowPart);
-	RtlCopyMemory
-	    (BufferTarget,
-	     ReadBuffer,
-	     ReadLen);
-
-	BufferTarget += ReadLen;
+		NextOffset.QuadPart = CacheOffset.QuadPart;
+		NextOffset.LowPart = (NextOffset.LowPart + CACHE_STRIPE) & ~(CACHE_STRIPE-1);
+		ReadLen = EndOfExtent.QuadPart - CacheOffset.QuadPart;
+		if (CacheOffset.QuadPart + ReadLen > NextOffset.QuadPart)
+		{
+			ReadLen = NextOffset.QuadPart - CacheOffset.QuadPart;
+		}
+		
+		DPRINT("Reading %d bytes in this go (at %08x%08x)\n", ReadLen, CacheOffset.HighPart, CacheOffset.LowPart);
+		
+		if (!CcPinRead
+			(FileObject,
+			 &CacheOffset,
+			 ReadLen,
+			 Wait ? PIN_WAIT : PIN_IF_BCB,
+			 &Bcb,
+			 (PVOID*)&ReadBuffer))
+		{
+			IoStatus->Status = STATUS_UNSUCCESSFUL;
+			IoStatus->Information = 0;
+			DPRINT("Failed CcCopyRead\n");
+			return FALSE;
+		}
+		
+		DPRINT("Copying %d bytes at %08x%08x\n", ReadLen, CacheOffset.HighPart, CacheOffset.LowPart);
+		RtlCopyMemory
+			(BufferTarget,
+			 ReadBuffer,
+			 ReadLen);
+		
+		BufferTarget += ReadLen;
+		
+		CacheOffset = NextOffset;
+		CcUnpinData(Bcb);
+    }
 	
-	CacheOffset = NextOffset;
-	CcUnpinData(Bcb);
-    }
-
     IoStatus->Status = STATUS_SUCCESS;
     IoStatus->Information = Length;
     
@@ -139,7 +140,8 @@
 
 	while (CurrentOffset.QuadPart < EndOffset.QuadPart)
 	{
-		NextOffset.QuadPart = (CurrentOffset.QuadPart + CACHE_STRIPE) & ~(CACHE_STRIPE - 1);
+		NextOffset.HighPart = CurrentOffset.HighPart;
+		NextOffset.LowPart = (CurrentOffset.LowPart + CACHE_STRIPE) & ~(CACHE_STRIPE - 1);
 		DPRINT("NextOffset %08x%08x\n", NextOffset.u.HighPart, NextOffset.u.LowPart);
 		WriteLen = MIN(NextOffset.QuadPart - CurrentOffset.QuadPart, Length);
 		DPRINT("Copying %x bytes from %08x%08x\n", 

Modified: branches/arty-newcc/ntoskrnl/cache/pinsup.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/pinsup.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/cache/pinsup.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/cache/pinsup.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -39,14 +39,14 @@
 PETHREAD LastThread;
 VOID _CcpLock(const char *file, int line)
 {
-    DPRINT("<<<---<<< CC In Mutex(%s:%d %x)!\n", file, line, PsGetCurrentThread());
+    //DPRINT("<<<---<<< CC In Mutex(%s:%d %x)!\n", file, line, PsGetCurrentThread());
     ExAcquireFastMutex(&CcMutex);
 }
 
 VOID _CcpUnlock(const char *file, int line)
 {
     ExReleaseFastMutex(&CcMutex);
-    DPRINT(">>>--->>> CC Exit Mutex!\n", file, line);
+    //DPRINT(">>>--->>> CC Exit Mutex!\n", file, line);
 }
 
 PDEVICE_OBJECT
@@ -301,11 +301,12 @@
 		return FALSE;
 	}
 
-    DPRINT("CcMapData(F->%x,%x:%d)\n", FileObject, FileOffset->LowPart, Length);
+    DPRINT("CcMapData(F->%x,%08x%08x:%d)\n", FileObject, FileOffset->HighPart, FileOffset->LowPart, Length);
 
     ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL);
 
-    Target.QuadPart = CACHE_ROUND_DOWN(FileOffset->QuadPart);
+    Target.HighPart = FileOffset->HighPart;
+	Target.LowPart = CACHE_ROUND_DOWN(FileOffset->LowPart);
 
     CcpLock();
 
@@ -320,8 +321,9 @@
 		*BcbResult = Bcb;
 		*Buffer = ((PCHAR)Bcb->BaseAddress) + (int)(FileOffset->QuadPart - Bcb->FileOffset.QuadPart);
 		DPRINT
-			("Bcb #%x Buffer maps (%x) At %x Length %x (Getting %x:%x) %wZ\n", 
+			("Bcb #%x Buffer maps (%08x%08x) At %x Length %x (Getting %x:%x) %wZ\n", 
 			 Bcb - CcCacheSections,
+			 Bcb->FileOffset.HighPart,
 			 Bcb->FileOffset.LowPart, 
 			 Bcb->BaseAddress,
 			 Bcb->Length,
@@ -430,8 +432,9 @@
 	*Buffer = ((PCHAR)Bcb->BaseAddress) + (int)(FileOffset->QuadPart - Bcb->FileOffset.QuadPart);
 
 	DPRINT
-		("Bcb #%x Buffer maps (%x) At %x Length %x (Getting %x:%x) %wZ\n", 
+		("Bcb #%x Buffer maps (%08x%08x) At %x Length %x (Getting %x:%x) %wZ\n", 
 		 Bcb - CcCacheSections,
+			 Bcb->FileOffset.HighPart,
 		 Bcb->FileOffset.LowPart, 
 		 Bcb->BaseAddress,
 		 Bcb->Length,

Modified: branches/arty-newcc/ntoskrnl/include/internal/newcc.h
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/include/internal/newcc.h?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/include/internal/newcc.h [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/include/internal/newcc.h [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -225,9 +225,6 @@
 #define CACHE_NUM_SECTIONS (CACHE_OVERALL_SIZE / CACHE_STRIPE)
 #define CACHE_ROUND_UP(x) (((x) + (CACHE_STRIPE-1)) & ~(CACHE_STRIPE-1))
 #define CACHE_ROUND_DOWN(x) ((x) & ~(CACHE_STRIPE-1))
-#define CACHE_NEED_SECTIONS(OFFSET,LENGTH) \
-	((CACHE_ROUND_UP((OFFSET)->QuadPart + (LENGTH)) -		\
-	  CACHE_ROUND_DOWN((OFFSET)->QuadPart)) >> CACHE_SHIFT)
 #define INVALID_CACHE ((ULONG)~0)
 
 extern NOCC_BCB CcCacheSections[CACHE_NUM_SECTIONS];

Modified: branches/arty-newcc/ntoskrnl/include/internal/newmm.h
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/include/internal/newmm.h?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/include/internal/newmm.h [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/include/internal/newmm.h [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -326,8 +326,8 @@
         struct
         {
             ROS_SECTION_OBJECT* Section;
-            ULONG ViewOffset;
             PMM_SECTION_SEGMENT Segment;
+            LARGE_INTEGER ViewOffset;
             BOOLEAN WriteCopyView;
             LIST_ENTRY RegionListHead;
         } SectionData;
@@ -1859,7 +1859,7 @@
                    PVOID* BaseAddress,
                    SIZE_T ViewSize,
                    ULONG Protect,
-                   ULONG ViewOffset,
+                   PLARGE_INTEGER ViewOffset,
                    ULONG AllocationType);
 
 /* section/image.c ***********************************************************/

Modified: branches/arty-newcc/ntoskrnl/mm/rmap.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/rmap.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/rmap.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/rmap.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -119,8 +119,8 @@
    Type = MemoryArea->Type;
    if (Type == MEMORY_AREA_SECTION_VIEW)
    {
-      Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
-               + MemoryArea->Data.SectionData.ViewOffset;
+	  Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress;
+
       /*
        * Get or create a pageop
        */
@@ -253,8 +253,7 @@
    Type = MemoryArea->Type;
    if (Type == MEMORY_AREA_SECTION_VIEW)
    {
-      Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
-             + MemoryArea->Data.SectionData.ViewOffset;
+	  Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress;
 
       /*
        * Get or create a pageop
@@ -286,8 +285,7 @@
 #ifdef _NEWCC_
    else if (Type == MEMORY_AREA_PAGE_FILE_SECTION)
    {
-      Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
-             + MemoryArea->Data.SectionData.ViewOffset;
+	  Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress;
 
       /*
        * Get or create a pageop
@@ -318,8 +316,7 @@
    }
    else if (Type == MEMORY_AREA_IMAGE_SECTION)
    {
-      Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
-             + MemoryArea->Data.SectionData.ViewOffset;
+	  Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress;
 
       /*
        * Get or create a pageop

Modified: branches/arty-newcc/ntoskrnl/mm/section/data.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section/data.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/section/data.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/section/data.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -206,6 +206,7 @@
 
 	  if (MmIsDirtyPageRmap(Page))
 	  {
+		  DPRINT("MiWriteBackPage(%wZ,%08x%08x)\n", &FileObject->FileName, Offset->u.HighPart, Offset->u.LowPart);
 		  Status = MiWriteBackPage(FileObject, Offset, PAGE_SIZE, Page);
 		  if (!NT_SUCCESS(Status))
 		  {
@@ -358,7 +359,7 @@
 	Region = MmFindRegion(MemoryArea->StartingAddress,
 						  &MemoryArea->Data.SectionData.RegionListHead,
 						  Address, NULL);
-	TotalOffset.QuadPart = Offset + MemoryArea->Data.SectionData.ViewOffset;
+	TotalOffset.QuadPart = MemoryArea->Data.SectionData.ViewOffset.QuadPart + Offset;
 
 	/*
 	 * Lock the segment
@@ -367,13 +368,13 @@
 
 	Entry = MiGetPageEntrySectionSegment(Segment, &TotalOffset);
 	HasSwapEntry = MmIsPageSwapEntry(Process, (PVOID)PAddress);
-	DPRINT("Entry %x HasSwapEntry %x Offset %x\n", Entry, HasSwapEntry, TotalOffset.QuadPart);
+	DPRINT("Entry %x HasSwapEntry %x Offset %08x%08x\n", Entry, HasSwapEntry, TotalOffset.u.HighPart, TotalOffset.u.LowPart);
 
 	if (Entry == 0 && !HasSwapEntry)
 	{
 		DPRINT("Segment->RawLength %08x%08x\n", Segment->RawLength.u.HighPart, Segment->RawLength.u.LowPart);
 		DPRINT("Segment->Length    %08x%08x\n", Segment->Length.u.HighPart, Segment->Length.u.LowPart);
-		DPRINT("Reading at offset %x (relative %x)\n", TotalOffset.LowPart, Offset);
+		DPRINT("Reading at offset %08x%08x (relative %x)\n", TotalOffset.HighPart, TotalOffset.LowPart, Offset);
 	
 		MmUnlockSectionSegment(Segment);
 		MmUnlockAddressSpace(AddressSpace);
@@ -616,8 +617,8 @@
     * Find the offset of the page
     */
    PAddress = MM_ROUND_DOWN(Address, PAGE_SIZE);
-   Offset.QuadPart = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress
-	   + MemoryArea->Data.SectionData.ViewOffset;
+   Offset.QuadPart = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress +
+	   MemoryArea->Data.SectionData.ViewOffset.QuadPart;
 
    Segment = MemoryArea->Data.SectionData.Segment;
    Section = MemoryArea->Data.SectionData.Section;
@@ -728,7 +729,8 @@
 	PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
 	
 	Address = MM_ROUND_DOWN(Address, PAGE_SIZE);
-	Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress;
+	Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress +
+		MemoryArea->Data.SectionData.ViewOffset.QuadPart;
 	Region = MmFindRegion(MemoryArea->StartingAddress,
 						  &MemoryArea->Data.SectionData.RegionListHead,
 						  Address, NULL);
@@ -819,9 +821,10 @@
 	}
 
 	Segment = MemoryArea->Data.SectionData.Segment;
-	End.QuadPart = PAGE_ROUND_DOWN(FileOffset.QuadPart + Length);
-	FileOffset.QuadPart = PAGE_ROUND_UP(FileOffset.QuadPart);
-	FirstMapped.QuadPart = MemoryArea->Data.SectionData.ViewOffset;
+	End.QuadPart = FileOffset.QuadPart + Length;
+	End.LowPart = PAGE_ROUND_DOWN(End.LowPart);
+	FileOffset.LowPart = PAGE_ROUND_UP(FileOffset.LowPart);
+	FirstMapped.QuadPart = MemoryArea->Data.SectionData.ViewOffset.QuadPart;
 	DPRINT1
 		("Pulling zero pages for %08x%08x-%08x%08x\n",
 		 FileOffset.u.HighPart, FileOffset.u.LowPart,
@@ -917,7 +920,6 @@
    MM_SECTION_PAGEOUT_CONTEXT Context;
    SWAPENTRY SwapEntry;
    ULONG Entry;
-   LARGE_INTEGER FileOffset;
    NTSTATUS Status;
    PFILE_OBJECT FileObject;
    PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
@@ -929,9 +931,8 @@
     */
    Context.Segment = MemoryArea->Data.SectionData.Segment;
    Context.Section = MemoryArea->Data.SectionData.Section;
-
-   Context.Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress;
-   FileOffset = Context.Offset;
+   Context.Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress +
+	   MemoryArea->Data.SectionData.ViewOffset.QuadPart;
 
    FileObject = Context.Section->FileObject;
 
@@ -984,7 +985,8 @@
 
 	  if (Context.WasDirty)
 	  {
-		  Status = MiWriteBackPage(FileObject, &FileOffset, PAGE_SIZE, Page);
+		  DPRINT("MiWriteBackPage(%wZ,%08x%08x)\n", &FileObject->FileName, Context.Offset.u.HighPart, Context.Offset.u.LowPart);
+		  Status = MiWriteBackPage(FileObject, &Context.Offset, PAGE_SIZE, Page);
 		  if (!NT_SUCCESS(Status))
 		  {
 			  DPRINT1("CCRosUnmapCacheSegment failed, status = %x\n", Status);
@@ -1161,7 +1163,8 @@
 
    Address = (PVOID)PAGE_ROUND_DOWN(Address);
 
-   Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress;
+   Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress +
+	   MemoryArea->Data.SectionData.ViewOffset.QuadPart;
 
    /*
     * Get the segment and section.
@@ -1209,6 +1212,7 @@
    if (!Private)
    {
       ASSERT(SwapEntry == 0);
+	  DPRINT("MiWriteBackPage(%wZ,%08x%08x)\n", &FileObject->FileName, Offset.u.HighPart, Offset.u.LowPart);
       Status = PageOp->Status = MiWriteBackPage(FileObject, &Offset, PAGE_SIZE, Page);
       MmspCompleteAndReleasePageOp(PageOp);
       return(Status);
@@ -1280,7 +1284,7 @@
 	BeginningAddress = PAGE_ROUND_DOWN((ULONG_PTR)MemoryArea->StartingAddress);
 	EndingAddress = PAGE_ROUND_UP((ULONG_PTR)MemoryArea->EndingAddress);
 	Segment = MemoryArea->Data.SectionData.Segment;
-	ViewOffset.QuadPart = MemoryArea->Data.SectionData.ViewOffset;
+	ViewOffset.QuadPart = MemoryArea->Data.SectionData.ViewOffset.QuadPart;
 
 	MmLockSectionSegment(Segment);
 
@@ -1325,6 +1329,7 @@
 		Page = Pages[(PageAddress - BeginningAddress) >> PAGE_SHIFT];
 		if (Page)
 		{
+			DPRINT("MiWriteBackPage(%wZ,%08x%08x)\n", &Segment->FileObject->FileName, FileOffset.u.HighPart, FileOffset.u.LowPart);
 			Status = MiWriteBackPage(Segment->FileObject, &FileOffset, PAGE_SIZE, Page);
 			MmUnlockPage(Page);
 			MmSetCleanAllRmaps(Page);
@@ -1394,7 +1399,7 @@
             PFN_TYPE Page;
 
             Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
-                     + MemoryArea->Data.SectionData.ViewOffset;
+                     + MemoryArea->Data.SectionData.ViewOffset.QuadPart;
             Entry = MiGetPageEntrySectionSegment(Segment, &Offset);
             Page = MmGetPfnForProcess(Process, Address);
 
@@ -1919,7 +1924,7 @@
                    PVOID* BaseAddress,
                    SIZE_T ViewSize,
                    ULONG Protect,
-                   ULONG ViewOffset,
+                   PLARGE_INTEGER ViewOffset,
                    ULONG AllocationType)
 {
    PMEMORY_AREA MArea;
@@ -1954,7 +1959,10 @@
 
    MArea->Data.SectionData.Segment = Segment;
    MArea->Data.SectionData.Section = Section;
-   MArea->Data.SectionData.ViewOffset = ViewOffset;
+   if (ViewOffset)
+	   MArea->Data.SectionData.ViewOffset = *ViewOffset;
+   else
+	   MArea->Data.SectionData.ViewOffset.QuadPart = 0;
    MArea->Data.SectionData.WriteCopyView = FALSE;
    MmInitializeRegion(&MArea->Data.SectionData.RegionListHead,
                       ViewSize, 0, Protect);
@@ -2219,7 +2227,7 @@
    Address = (PVOID)PAGE_ROUND_DOWN(Address);
 
    Offset.QuadPart = ((ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress) +
-            MemoryArea->Data.SectionData.ViewOffset;
+            MemoryArea->Data.SectionData.ViewOffset.QuadPart;
 
    Section = MemoryArea->Data.SectionData.Section;
    Segment = MemoryArea->Data.SectionData.Segment;
@@ -2352,7 +2360,7 @@
 			Offset -= PAGE_SIZE;
 			PageOp = MmCheckForPageOp(MemoryArea, NULL, NULL,
 									  MemoryArea->Data.SectionData.Segment,
-									  Offset + MemoryArea->Data.SectionData.ViewOffset);
+									  Offset);
 			if (PageOp)
 			{
 				MmUnlockAddressSpace(AddressSpace);
@@ -2648,7 +2656,7 @@
 
 	MmLockSectionSegment(Segment);
 	Segment->RawLength.QuadPart = NewSize->QuadPart;
-	Segment->Length.QuadPart = MAX(Segment->Length.QuadPart, PAGE_ROUND_UP(Segment->RawLength.QuadPart));
+	Segment->Length.QuadPart = MAX(Segment->Length.QuadPart, PAGE_ROUND_UP(Segment->RawLength.LowPart));
 	MmUnlockSectionSegment(Segment);
 	Section->MaximumSize = *NewSize;
 	return STATUS_SUCCESS;
@@ -2842,7 +2850,7 @@
 {
    PROS_SECTION_OBJECT Section;
    PMMSUPPORT AddressSpace;
-   ULONG ViewOffset;
+   LARGE_INTEGER ViewOffset;
    NTSTATUS Status = STATUS_SUCCESS;
 
    ASSERT(Process);
@@ -2900,14 +2908,14 @@
 
       if (SectionOffset == NULL)
       {
-         ViewOffset = 0;
+         ViewOffset.QuadPart = 0;
       }
       else
       {
-         ViewOffset = SectionOffset->u.LowPart;
+         ViewOffset = *SectionOffset;
       }
 
-      if ((ViewOffset % PAGE_SIZE) != 0)
+      if ((ViewOffset.QuadPart % PAGE_SIZE) != 0)
       {
          MmUnlockAddressSpace(AddressSpace);
          return(STATUS_MAPPED_ALIGNMENT);
@@ -2915,11 +2923,11 @@
 
       if ((*ViewSize) == 0)
       {
-         (*ViewSize) = Section->MaximumSize.u.LowPart - ViewOffset;
+         (*ViewSize) = Section->MaximumSize.QuadPart - ViewOffset.QuadPart;
       }
-      else if (((*ViewSize)+ViewOffset) > Section->MaximumSize.u.LowPart)
+      else if (((*ViewSize)+ViewOffset.QuadPart) > Section->MaximumSize.QuadPart)
       {
-         (*ViewSize) = Section->MaximumSize.u.LowPart - ViewOffset;
+         (*ViewSize) = Section->MaximumSize.QuadPart - ViewOffset.QuadPart;
       }
 
       MmLockSectionSegment(Section->Segment);
@@ -2929,7 +2937,7 @@
                                   BaseAddress,
                                   *ViewSize,
                                   Protect,
-                                  ViewOffset,
+                                  &ViewOffset,
                                   AllocationType & (MEM_TOP_DOWN|SEC_NO_CHANGE));
       MmUnlockSectionSegment(Section->Segment);
       if (!NT_SUCCESS(Status))
@@ -3085,7 +3093,7 @@
     PMMSUPPORT AddressSpace;
     NTSTATUS Status;
     
-    DPRINT("MmMapViewInSystemSpaceAtOffset() called offset %x\n", FileOffset->LowPart);
+    DPRINT("MmMapViewInSystemSpaceAtOffset() called offset %08x%08x\n", FileOffset->HighPart, FileOffset->LowPart);
     
     Section = (PROS_SECTION_OBJECT)SectionObject;
     AddressSpace = MmGetKernelAddressSpace();
@@ -3100,7 +3108,7 @@
 				MappedBase,
 				*ViewSize,
 				Section->SectionPageProtection,
-				FileOffset->LowPart,
+				FileOffset,
 				0);
     
     MmUnlockSectionSegment(Section->Segment);

Modified: branches/arty-newcc/ntoskrnl/mm/section/image.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section/image.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/section/image.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/section/image.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -1797,7 +1797,7 @@
    Address = (PVOID)PAGE_ROUND_DOWN(Address);
 
    Offset.QuadPart = ((ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress) +
-            MemoryArea->Data.SectionData.ViewOffset;
+            MemoryArea->Data.SectionData.ViewOffset.QuadPart;
 
    Section = MemoryArea->Data.SectionData.Section;
    Segment = MemoryArea->Data.SectionData.Segment;

Modified: branches/arty-newcc/ntoskrnl/mm/section/io.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section/io.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/section/io.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/section/io.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -239,9 +239,10 @@
     ASSERT(DeviceObject);
 
     DPRINT
-		("PAGING READ: FileObject %x <%wZ> Offset %x Length %d\n", 
+		("PAGING READ: FileObject %x <%wZ> Offset %08x%08x Length %d\n", 
 		 &FileObject, 
 		 &FileObject->FileName,
+		 FileOffset->HighPart,
 		 FileOffset->LowPart,
 		 Length);
 

Modified: branches/arty-newcc/ntoskrnl/mm/section/pagefile.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section/pagefile.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/section/pagefile.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/section/pagefile.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -712,7 +712,7 @@
    Address = (PVOID)PAGE_ROUND_DOWN(Address);
 
    Offset.QuadPart = ((ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress) +
-            MemoryArea->Data.SectionData.ViewOffset;
+            MemoryArea->Data.SectionData.ViewOffset.QuadPart;
 
    Section = MemoryArea->Data.SectionData.Section;
    Segment = MemoryArea->Data.SectionData.Segment;

Modified: branches/arty-newcc/ntoskrnl/mm/section/physical.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section/physical.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/section/physical.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/section/physical.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -75,11 +75,11 @@
 	 * Just map the desired physical page
 	 */
 	PAddress = MM_ROUND_DOWN(Address, PAGE_SIZE);
-	Offset = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress + MemoryArea->Data.SectionData.ViewOffset;
+	Offset = (ULONG_PTR)PAddress - (ULONG_PTR)MemoryArea->StartingAddress;
 	Region = MmFindRegion(MemoryArea->StartingAddress,
 						  &MemoryArea->Data.SectionData.RegionListHead,
 						  Address, NULL);
-	Page = Offset >> PAGE_SHIFT;
+	Page = (Offset + MemoryArea->Data.SectionData.ViewOffset.QuadPart) >> PAGE_SHIFT;
 	Status = MmCreateVirtualMappingUnsafe(Process,
 										  Address,
 										  Region->Protect,

Modified: branches/arty-newcc/ntoskrnl/mm/virtual.c
URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/virtual.c?rev=44140&r1=44139&r2=44140&view=diff
==============================================================================
--- branches/arty-newcc/ntoskrnl/mm/virtual.c [iso-8859-1] (original)
+++ branches/arty-newcc/ntoskrnl/mm/virtual.c [iso-8859-1] Fri Nov 13 16:35:12 2009
@@ -81,6 +81,11 @@
                         break;
 
                     case MEMORY_AREA_SECTION_VIEW:
+#ifdef _NEWCC_
+				    case MEMORY_AREA_PHYSICAL_MEMORY_SECTION:
+				    case MEMORY_AREA_PAGE_FILE_SECTION:
+				    case MEMORY_AREA_IMAGE_SECTION:
+#endif
                         Status = MmQuerySectionView(MemoryArea, Address, Info,
                                                     ResultLength);
                         break;




More information about the Ros-diffs mailing list