[NTOS:CC] Fix some tests, complain where the current implementation won't let us do the right thing

This commit is contained in:
Jérôme Gardou 2020-12-18 15:24:09 +01:00
parent 674ab3dce3
commit 6d97d8d2e1
2 changed files with 8 additions and 7 deletions

View file

@ -225,9 +225,13 @@ CcpPinData(
BOOLEAN Result;
VacbOffset = (ULONG)(FileOffset->QuadPart % VACB_MAPPING_GRANULARITY);
/* This seems to be valid, according to KMTests */
if ((VacbOffset + Length) > VACB_MAPPING_GRANULARITY)
{
/* Complain loudly, we shoud pin the whole range */
DPRINT1("TRUNCATING DATA PIN FROM %lu to %lu!\n", Length, VACB_MAPPING_GRANULARITY - VacbOffset);
Length = VACB_MAPPING_GRANULARITY - VacbOffset;
}
KeAcquireSpinLock(&SharedCacheMap->BcbSpinLock, &OldIrql);
NewBcb = CcpFindBcb(SharedCacheMap, FileOffset, Length, TRUE);
@ -353,7 +357,10 @@ CcMapData (
VacbOffset = (ULONG)(FileOffset->QuadPart % VACB_MAPPING_GRANULARITY);
/* KMTests seem to show that it is allowed to call accross mapping granularity */
if ((VacbOffset + Length) > VACB_MAPPING_GRANULARITY)
{
DPRINT1("TRUNCATING DATA MAP FROM %lu to %lu!\n", Length, VACB_MAPPING_GRANULARITY - VacbOffset);
Length = VACB_MAPPING_GRANULARITY - VacbOffset;
}
KeAcquireSpinLock(&SharedCacheMap->BcbSpinLock, &OldIrql);
iBcb = CcpFindBcb(SharedCacheMap, FileOffset, Length, FALSE);

View file

@ -572,12 +572,6 @@ CcRosCreateVacb (
DPRINT("CcRosCreateVacb()\n");
if (FileOffset >= SharedCacheMap->SectionSize.QuadPart)
{
*Vacb = NULL;
return STATUS_INVALID_PARAMETER;
}
current = ExAllocateFromNPagedLookasideList(&VacbLookasideList);
current->BaseAddress = NULL;
current->Valid = FALSE;