#define NDEBUG
#include <debug.h>
-UNICODE_STRING EmptyName = RTL_CONSTANT_STRING(L"");
-
/* FUNCTIONS ****************************************************************/
/*
return Status;
}
- Status = FindAttribute(DeviceExt, DeviceExt->MasterFileTable, AttributeData, &EmptyName, &DeviceExt->MFTContext);
+ Status = FindAttribute(DeviceExt, DeviceExt->MasterFileTable, AttributeData, L"", 0, &DeviceExt->MFTContext);
if (!NT_SUCCESS(Status))
{
DPRINT1("Can't find data attribute for Master File Table.\n");
NtfsDumpFileAttributes(VolumeRecord);
/* Get volume name */
- Status = FindAttribute(DeviceExt, VolumeRecord, AttributeVolumeName, &EmptyName, &AttrCtxt);
+ Status = FindAttribute(DeviceExt, VolumeRecord, AttributeVolumeName, L"", 0, &AttrCtxt);
if (NT_SUCCESS(Status) && AttrCtxt->Record.Resident.ValueLength != 0)
{
DeviceExt->VolumeFcb = VolumeFcb;
/* Get volume information */
- Status = FindAttribute(DeviceExt, VolumeRecord, AttributeVolumeInformation, &EmptyName, &AttrCtxt);
+ Status = FindAttribute(DeviceExt, VolumeRecord, AttributeVolumeInformation, L"", 0, &AttrCtxt);
if (NT_SUCCESS(Status) && AttrCtxt->Record.Resident.ValueLength != 0)
{
#define NDEBUG
#include <debug.h>
-UNICODE_STRING IndexOfFileNames = RTL_CONSTANT_STRING(L"$I30");
-
/* FUNCTIONS ****************************************************************/
PNTFS_ATTR_CONTEXT
PNTFS_ATTR_RECORD AttrRecord,
PNTFS_ATTR_RECORD AttrRecordEnd,
ULONG Type,
- const WCHAR *Name,
+ PCWSTR Name,
ULONG NameLength)
{
- DPRINT("FindAttributeHelper(%p, %p, %p, 0x%x, %s, %u)\n", Vcb, AttrRecord, AttrRecordEnd, Type, Name, NameLength);
+ DPRINT1("FindAttributeHelper(%p, %p, %p, 0x%x, %S, %u)\n", Vcb, AttrRecord, AttrRecordEnd, Type, Name, NameLength);
while (AttrRecord < AttrRecordEnd)
{
if (AttrRecord->Type == Type)
{
- DPRINT("%d, %d\n", AttrRecord->NameLength, NameLength);
if (AttrRecord->NameLength == NameLength)
{
PWCHAR AttrName;
FindAttribute(PDEVICE_EXTENSION Vcb,
PFILE_RECORD_HEADER MftRecord,
ULONG Type,
- PUNICODE_STRING Name,
+ PCWSTR Name,
+ ULONG NameLength,
PNTFS_ATTR_CONTEXT * AttrCtx)
{
PNTFS_ATTR_RECORD AttrRecord;
PNTFS_ATTR_RECORD AttrRecordEnd;
- DPRINT("NtfsFindAttribute(%p, %p, %u, %s)\n", Vcb, MftRecord, Type, Name);
+ DPRINT1("NtfsFindAttribute(%p, %p, %u, %S, %u, %p)\n", Vcb, MftRecord, Type, Name, NameLength, AttrCtx);
AttrRecord = (PNTFS_ATTR_RECORD)((PCHAR)MftRecord + MftRecord->AttributeOffset);
AttrRecordEnd = (PNTFS_ATTR_RECORD)((PCHAR)MftRecord + Vcb->NtfsInfo.BytesPerFileRecord);
- *AttrCtx = FindAttributeHelper(Vcb, AttrRecord, AttrRecordEnd, Type, Name->Buffer, Name->Length);
+ *AttrCtx = FindAttributeHelper(Vcb, AttrRecord, AttrRecordEnd, Type, Name, NameLength);
if (*AttrCtx == NULL)
{
return STATUS_OBJECT_NAME_NOT_FOUND;
NTSTATUS Status;
ULONG CurrentEntry = 0;
+ DPRINT1("NtfsFindMftRecord(%p, %I64d, %wZ, %p, %u, %p, %p)\n", Vcb, MFTIndex, FileName, FirstEntry, DirSearch, OutMFTIndex, OutName);
+
MftRecord = ExAllocatePoolWithTag(NonPagedPool,
Vcb->NtfsInfo.BytesPerFileRecord,
TAG_NTFS);
{
//Magic = MftRecord->Magic;
- Status = FindAttribute(Vcb, MftRecord, AttributeIndexRoot, &IndexOfFileNames, &IndexRootCtx);
+ Status = FindAttribute(Vcb, MftRecord, AttributeIndexRoot, L"$I30", 4, &IndexRootCtx);
if (!NT_SUCCESS(Status))
{
ExFreePoolWithTag(MftRecord, TAG_NTFS);
IndexBlockSize = IndexRoot->SizeOfEntry;
- Status = FindAttribute(Vcb, MftRecord, AttributeBitmap, &IndexOfFileNames, &IndexBitmapCtx);
+ Status = FindAttribute(Vcb, MftRecord, AttributeBitmap, L"$I30", 4, &IndexBitmapCtx);
if (!NT_SUCCESS(Status))
{
- DPRINT("Corrupted filesystem!\n");
+ DPRINT1("Corrupted filesystem!\n");
ExFreePoolWithTag(MftRecord, TAG_NTFS);
return Status;
}
ReadAttribute(Vcb, IndexBitmapCtx, 0, BitmapData, (ULONG)BitmapDataSize);
ReleaseAttributeContext(IndexBitmapCtx);
- Status = FindAttribute(Vcb, MftRecord, AttributeIndexAllocation, &IndexOfFileNames, &IndexAllocationCtx);
+ Status = FindAttribute(Vcb, MftRecord, AttributeIndexAllocation, L"$I30", 4, &IndexAllocationCtx);
if (!NT_SUCCESS(Status))
{
DPRINT("Corrupted filesystem!\n");
ReadAttribute(Vcb, IndexAllocationCtx, RecordOffset, IndexRecord, IndexBlockSize);
- if (!FixupUpdateSequenceArray(Vcb, &((PFILE_RECORD_HEADER)IndexRecord)->Ntfs))
+ if (!NT_SUCCESS(FixupUpdateSequenceArray(Vcb, &((PFILE_RECORD_HEADER)IndexRecord)->Ntfs)))
{
break;
}
PULONGLONG MFTIndex,
ULONGLONG CurrentMFTIndex)
{
- UNICODE_STRING Current, Remaining, Found;
+ UNICODE_STRING Current, Remaining;
NTSTATUS Status;
WCHAR FoundName[MAX_PATH + 1];
- ULONG FirstEntry = 0;
+ ULONG FirstEntry = 0, Length;
DPRINT1("NtfsLookupFileAt(%p, %wZ, %p, %p, %I64x)\n", Vcb, PathName, FileRecord, DataContext, CurrentMFTIndex);
return Status;
}
- RtlInitUnicodeString(&Found, FoundName);
+ Length = wcslen(FoundName) * sizeof(WCHAR);
- Status = FindAttribute(Vcb, *FileRecord, AttributeData, &Found, DataContext);
+ Status = FindAttribute(Vcb, *FileRecord, AttributeData, FoundName, Length, DataContext);
if (!NT_SUCCESS(Status))
{
DPRINT("NtfsLookupFileAt: Can't find data attribute\n");
PULONGLONG MFTIndex,
ULONGLONG CurrentMFTIndex)
{
- UNICODE_STRING Found;
NTSTATUS Status;
WCHAR FoundName[MAX_PATH + 1];
+ ULONG Length;
DPRINT1("NtfsFindFileAt(%p, %wZ, %p, %p, %p, %p, %I64x)\n", Vcb, SearchPattern, FirstEntry, FileRecord, DataContext, MFTIndex, CurrentMFTIndex);
return Status;
}
- RtlInitUnicodeString(&Found, FoundName);
+ Length = wcslen(FoundName) * sizeof(WCHAR);
- Status = FindAttribute(Vcb, *FileRecord, AttributeData, &Found, DataContext);
+ Status = FindAttribute(Vcb, *FileRecord, AttributeData, FoundName, Length, DataContext);
if (!NT_SUCCESS(Status))
{
DPRINT("NtfsFindFileAt: Can't find data attribute\n");