Author: pschweitzer Date: Wed Aug 10 11:52:30 2016 New Revision: 72186 URL: http://svn.reactos.org/svn/reactos?rev=72186&view=rev Log: [NTOSKRNL] While attempting to read data from disk in CcReadVirtualAddress(), always align our read size by pages. That means that even on boundaries, we will read a complete page. This fixes FSD relying on Cc to properly align reads and thus poorly failing in disk.sys because of unaligned reads. Notably, it helps MS FastFAT loading a bit farther in ReactOS (but it still fails :-(). This also fixes a few kmtests.
CORE-11003 CORE-11819 Modified: trunk/reactos/ntoskrnl/cc/copy.c Modified: trunk/reactos/ntoskrnl/cc/copy.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/copy.c?rev=72186&r1=72185&r2=72186&view=diff ============================================================================== --- trunk/reactos/ntoskrnl/cc/copy.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/cc/copy.c [iso-8859-1] Wed Aug 10 11:52:30 2016 @@ -65,7 +65,7 @@ CcReadVirtualAddress ( PROS_VACB Vacb) { - ULONG Size; + ULONG Size, Pages; PMDL Mdl; NTSTATUS Status; IO_STATUS_BLOCK IoStatus; @@ -77,7 +77,10 @@ Size = VACB_MAPPING_GRANULARITY; } - Mdl = IoAllocateMdl(Vacb->BaseAddress, Size, FALSE, FALSE, NULL); + Pages = BYTES_TO_PAGES(Size); + ASSERT(Pages * PAGE_SIZE <= VACB_MAPPING_GRANULARITY); + + Mdl = IoAllocateMdl(Vacb->BaseAddress, Pages * PAGE_SIZE, FALSE, FALSE, NULL); if (!Mdl) { return STATUS_INSUFFICIENT_RESOURCES;