if (!NT_SUCCESS(Status))
{
DPRINT1("ERROR: Couldn't find $BITMAP attribute of Mft!\n");
- ExFreePoolWithTag(BlankFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, BlankFileRecord);
ExReleaseResourceLite(&(Vcb->DirResource));
return Status;
}
if (!BitmapBuffer)
{
DPRINT1("ERROR: Unable to allocate memory for bitmap attribute!\n");
- ExFreePoolWithTag(BlankFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, BlankFileRecord);
ExReleaseResourceLite(&(Vcb->DirResource));
ReleaseAttributeContext(BitmapContext);
return STATUS_INSUFFICIENT_RESOURCES;
if (BytesRead != BitmapSize.LowPart)
{
DPRINT1("ERROR: Bytes read != Bitmap size!\n");
- ExFreePoolWithTag(BlankFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, BlankFileRecord);
ExReleaseResourceLite(&(Vcb->DirResource));
ExFreePoolWithTag(BitmapBuffer, TAG_NTFS);
ReleaseAttributeContext(BitmapContext);
if (!NT_SUCCESS(Status))
{
DPRINT1("ERROR: Failed to set size of $MFT data attribute!\n");
- ExFreePoolWithTag(BlankFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, BlankFileRecord);
ExReleaseResourceLite(&(Vcb->DirResource));
ExFreePoolWithTag(BitmapBuffer, TAG_NTFS);
ReleaseAttributeContext(BitmapContext);
if (!NT_SUCCESS(Status))
{
DPRINT1("ERROR: Couldn't find $BITMAP attribute of Mft!\n");
- ExFreePoolWithTag(BlankFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, BlankFileRecord);
ExReleaseResourceLite(&(Vcb->DirResource));
return Status;
}
if (!NT_SUCCESS(Status))
{
DPRINT1("ERROR: Failed to set size of bitmap attribute!\n");
- ExFreePoolWithTag(BlankFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, BlankFileRecord);
ExReleaseResourceLite(&(Vcb->DirResource));
ExFreePoolWithTag(BitmapBuffer, TAG_NTFS);
ReleaseAttributeContext(BitmapContext);
if (!NT_SUCCESS(Status))
{
DPRINT1("ERROR: Failed to update $MFT file record!\n");
- ExFreePoolWithTag(BlankFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, BlankFileRecord);
ExReleaseResourceLite(&(Vcb->DirResource));
ExFreePoolWithTag(BitmapBuffer, TAG_NTFS);
ReleaseAttributeContext(BitmapContext);
Status = WriteAttribute(Vcb, BitmapContext, 0, BitmapBuffer, NewBitmapSize, &LengthWritten, Vcb->MasterFileTable);
if (!NT_SUCCESS(Status))
{
- ExFreePoolWithTag(BlankFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, BlankFileRecord);
ExReleaseResourceLite(&(Vcb->DirResource));
ExFreePoolWithTag(BitmapBuffer, TAG_NTFS);
ReleaseAttributeContext(BitmapContext);
if (!NT_SUCCESS(Status))
{
DPRINT1("ERROR: Failed to write blank file record!\n");
- ExFreePoolWithTag(BlankFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, BlankFileRecord);
ExReleaseResourceLite(&(Vcb->DirResource));
ExFreePoolWithTag(BitmapBuffer, TAG_NTFS);
ReleaseAttributeContext(BitmapContext);
Status = UpdateMftMirror(Vcb);
// Cleanup
- ExFreePoolWithTag(BlankFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, BlankFileRecord);
ExReleaseResourceLite(&(Vcb->DirResource));
ExFreePoolWithTag(BitmapBuffer, TAG_NTFS);
ReleaseAttributeContext(BitmapContext);
DPRINT1("Unable to create LargeMcb!\n");
if (AttribDataSize.QuadPart > 0)
ExFreePoolWithTag(AttribData, TAG_NTFS);
+ ExFreePoolWithTag(NewRecord, TAG_NTFS);
_SEH2_YIELD(return _SEH2_GetExceptionCode());
} _SEH2_END;
DPRINT1("ERROR: Couldn't update file record to continue migration!\n");
if (AttribDataSize.QuadPart > 0)
ExFreePoolWithTag(AttribData, TAG_NTFS);
+ ExFreePoolWithTag(NewRecord, TAG_NTFS);
return Status;
}
// Do we need to read the file record?
if (FileRecord == NULL)
{
- FileRecord = ExAllocatePoolWithTag(NonPagedPool, Vcb->NtfsInfo.BytesPerFileRecord, TAG_NTFS);
+ FileRecord = ExAllocateFromNPagedLookasideList(&Vcb->FileRecLookasideList);
if (!FileRecord)
{
DPRINT1("Error: Couldn't allocate file record!\n");
{
DPRINT1("ERROR: Couldn't find matching attribute!\n");
if(FileRecordAllocated)
- ExFreePoolWithTag(FileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, FileRecord);
return Status;
}
DPRINT1("DRIVER ERROR: Data being written extends past end of file record!\n");
ReleaseAttributeContext(FoundContext);
if (FileRecordAllocated)
- ExFreePoolWithTag(FileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, FileRecord);
return STATUS_INVALID_PARAMETER;
}
ReleaseAttributeContext(FoundContext);
if (FileRecordAllocated)
- ExFreePoolWithTag(FileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, FileRecord);
if (NT_SUCCESS(Status))
*RealLengthWritten = Length;
NewAllocationSize,
CaseSensitive ? "TRUE" : "FALSE");
- MftRecord = ExAllocatePoolWithTag(NonPagedPool,
- Vcb->NtfsInfo.BytesPerFileRecord,
- TAG_NTFS);
+ MftRecord = ExAllocateFromNPagedLookasideList(&Vcb->FileRecLookasideList);
if (MftRecord == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
Status = ReadFileRecord(Vcb, ParentMFTIndex, MftRecord);
if (!NT_SUCCESS(Status))
{
- ExFreePoolWithTag(MftRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MftRecord);
return Status;
}
Status = FindAttribute(Vcb, MftRecord, AttributeIndexRoot, L"$I30", 4, &IndexRootCtx, NULL);
if (!NT_SUCCESS(Status))
{
- ExFreePoolWithTag(MftRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MftRecord);
return Status;
}
if (IndexRecord == NULL)
{
ReleaseAttributeContext(IndexRootCtx);
- ExFreePoolWithTag(MftRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MftRecord);
return STATUS_INSUFFICIENT_RESOURCES;
}
DPRINT1("ERROR: Failed to read Index Root!\n");
ExFreePoolWithTag(IndexRecord, TAG_NTFS);
ReleaseAttributeContext(IndexRootCtx);
- ExFreePoolWithTag(MftRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MftRecord);
+ return Status;
}
IndexRoot = (PINDEX_ROOT_ATTRIBUTE)IndexRecord;
ReleaseAttributeContext(IndexRootCtx);
ExFreePoolWithTag(IndexRecord, TAG_NTFS);
- ExFreePoolWithTag(MftRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MftRecord);
return Status;
}
ULONG NodeSize;
// Allocate memory for the parent directory
- ParentFileRecord = ExAllocatePoolWithTag(NonPagedPool,
- DeviceExt->NtfsInfo.BytesPerFileRecord,
- TAG_NTFS);
+ ParentFileRecord = ExAllocateFromNPagedLookasideList(&DeviceExt->FileRecLookasideList);
if (!ParentFileRecord)
{
DPRINT1("ERROR: Couldn't allocate memory for file record!\n");
Status = ReadFileRecord(DeviceExt, DirectoryMftIndex, ParentFileRecord);
if (!NT_SUCCESS(Status))
{
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
DPRINT1("ERROR: Couldn't read parent directory with index %I64u\n",
DirectoryMftIndex);
return Status;
{
DPRINT1("ERROR: Couldn't find $I30 $INDEX_ROOT attribute for parent directory with MFT #: %I64u!\n",
DirectoryMftIndex);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
return Status;
}
{
DPRINT1("ERROR: Couldn't allocate memory for index root attribute!\n");
ReleaseAttributeContext(IndexRootContext);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
return STATUS_INSUFFICIENT_RESOURCES;
}
DPRINT1("ERROR: Couln't read index root attribute for Mft index #%I64u\n", DirectoryMftIndex);
ReleaseAttributeContext(IndexRootContext);
ExFreePoolWithTag(I30IndexRoot, TAG_NTFS);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
return Status;
}
DPRINT1("ERROR: Failed to create B-Tree from Index!\n");
ReleaseAttributeContext(IndexRootContext);
ExFreePoolWithTag(I30IndexRoot, TAG_NTFS);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
return Status;
}
DestroyBTree(NewTree);
ReleaseAttributeContext(IndexRootContext);
ExFreePoolWithTag(I30IndexRoot, TAG_NTFS);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
return Status;
}
DestroyBTree(NewTree);
ReleaseAttributeContext(IndexRootContext);
ExFreePoolWithTag(I30IndexRoot, TAG_NTFS);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
return Status;
}
DestroyBTree(NewTree);
ReleaseAttributeContext(IndexRootContext);
ExFreePoolWithTag(I30IndexRoot, TAG_NTFS);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
return Status;
}
DestroyBTree(NewTree);
ReleaseAttributeContext(IndexRootContext);
ExFreePoolWithTag(I30IndexRoot, TAG_NTFS);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
return Status;
}
DestroyBTree(NewTree);
ReleaseAttributeContext(IndexRootContext);
ExFreePoolWithTag(I30IndexRoot, TAG_NTFS);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
return Status;
}
DestroyBTree(NewTree);
ReleaseAttributeContext(IndexRootContext);
ExFreePoolWithTag(I30IndexRoot, TAG_NTFS);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
return Status;
}
ExFreePoolWithTag(NewIndexRoot, TAG_NTFS);
ReleaseAttributeContext(IndexRootContext);
ExFreePoolWithTag(I30IndexRoot, TAG_NTFS);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
DPRINT1("ERROR: Unable to set resident attribute length!\n");
return Status;
}
if (!NT_SUCCESS(Status))
{
DPRINT1("ERROR: Failed to update file record of directory with index: %llx\n", DirectoryMftIndex);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
ExFreePoolWithTag(NewIndexRoot, TAG_NTFS);
ReleaseAttributeContext(IndexRootContext);
ExFreePoolWithTag(I30IndexRoot, TAG_NTFS);
ExFreePoolWithTag(NewIndexRoot, TAG_NTFS);
ReleaseAttributeContext(IndexRootContext);
ExFreePoolWithTag(I30IndexRoot, TAG_NTFS);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
return Status;
}
ExFreePoolWithTag(NewIndexRoot, TAG_NTFS);
ReleaseAttributeContext(IndexRootContext);
ExFreePoolWithTag(I30IndexRoot, TAG_NTFS);
- ExFreePoolWithTag(ParentFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, ParentFileRecord);
return Status;
}
ULONG LengthWritten;
// Allocate memory for the Mft mirror file record
- MirrorFileRecord = ExAllocatePoolWithTag(NonPagedPool, Vcb->NtfsInfo.BytesPerFileRecord, TAG_NTFS);
+ MirrorFileRecord = ExAllocateFromNPagedLookasideList(&Vcb->FileRecLookasideList);
if (!MirrorFileRecord)
{
DPRINT1("Error: Failed to allocate memory for $MFTMirr!\n");
if (!NT_SUCCESS(Status))
{
DPRINT1("ERROR: Failed to read $MFTMirr!\n");
- ExFreePoolWithTag(MirrorFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MirrorFileRecord);
return Status;
}
if (!NT_SUCCESS(Status))
{
DPRINT1("ERROR: Couldn't find $DATA attribute!\n");
- ExFreePoolWithTag(MirrorFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MirrorFileRecord);
return Status;
}
{
DPRINT1("ERROR: Couldn't find $DATA attribute!\n");
ReleaseAttributeContext(MirrDataContext);
- ExFreePoolWithTag(MirrorFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MirrorFileRecord);
return Status;
}
DPRINT1("Error: Couldn't allocate memory for $DATA buffer!\n");
ReleaseAttributeContext(MftDataContext);
ReleaseAttributeContext(MirrDataContext);
- ExFreePoolWithTag(MirrorFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MirrorFileRecord);
return STATUS_INSUFFICIENT_RESOURCES;
}
ReleaseAttributeContext(MftDataContext);
ReleaseAttributeContext(MirrDataContext);
ExFreePoolWithTag(DataBuffer, TAG_NTFS);
- ExFreePoolWithTag(MirrorFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MirrorFileRecord);
return STATUS_UNSUCCESSFUL;
}
ReleaseAttributeContext(MftDataContext);
ReleaseAttributeContext(MirrDataContext);
ExFreePoolWithTag(DataBuffer, TAG_NTFS);
- ExFreePoolWithTag(MirrorFileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MirrorFileRecord);
return Status;
}
CaseSensitive ? "TRUE" : "FALSE",
OutMFTIndex);
- MftRecord = ExAllocatePoolWithTag(NonPagedPool,
- Vcb->NtfsInfo.BytesPerFileRecord,
- TAG_NTFS);
+ MftRecord = ExAllocateFromNPagedLookasideList(&Vcb->FileRecLookasideList);
if (MftRecord == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
Status = ReadFileRecord(Vcb, MFTIndex, MftRecord);
if (!NT_SUCCESS(Status))
{
- ExFreePoolWithTag(MftRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MftRecord);
return Status;
}
Status = FindAttribute(Vcb, MftRecord, AttributeIndexRoot, L"$I30", 4, &IndexRootCtx, NULL);
if (!NT_SUCCESS(Status))
{
- ExFreePoolWithTag(MftRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MftRecord);
return Status;
}
if (IndexRecord == NULL)
{
ReleaseAttributeContext(IndexRootCtx);
- ExFreePoolWithTag(MftRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MftRecord);
return STATUS_INSUFFICIENT_RESOURCES;
}
OutMFTIndex);
ExFreePoolWithTag(IndexRecord, TAG_NTFS);
- ExFreePoolWithTag(MftRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, MftRecord);
return Status;
}
FsRtlDissectName(Current, &Current, &Remaining);
}
- *FileRecord = ExAllocatePoolWithTag(NonPagedPool, Vcb->NtfsInfo.BytesPerFileRecord, TAG_NTFS);
+ *FileRecord = ExAllocateFromNPagedLookasideList(&Vcb->FileRecLookasideList);
if (*FileRecord == NULL)
{
DPRINT("NtfsLookupFileAt: Can't allocate MFT record\n");
if (!NT_SUCCESS(Status))
{
DPRINT("NtfsLookupFileAt: Can't read MFT record\n");
- ExFreePoolWithTag(*FileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, *FileRecord);
return Status;
}
return Status;
}
- *FileRecord = ExAllocatePoolWithTag(NonPagedPool, Vcb->NtfsInfo.BytesPerFileRecord, TAG_NTFS);
+ *FileRecord = ExAllocateFromNPagedLookasideList(&Vcb->FileRecLookasideList);
if (*FileRecord == NULL)
{
DPRINT("NtfsFindFileAt: Can't allocate MFT record\n");
if (!NT_SUCCESS(Status))
{
DPRINT("NtfsFindFileAt: Can't read MFT record\n");
- ExFreePoolWithTag(*FileRecord, TAG_NTFS);
+ ExFreeToNPagedLookasideList(&Vcb->FileRecLookasideList, *FileRecord);
return Status;
}