mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
- Fixed calculation of MFT record size.
- Fixed attribute finding/dumping bounds checking. - Fixed reading of volume information MFT record. - Disabled debug messages. svn path=/trunk/; revision=9615
This commit is contained in:
parent
70dfb7876f
commit
39ff6d3136
12 changed files with 60 additions and 74 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: attrib.c,v 1.9 2004/01/28 20:53:06 ekohl Exp $
|
/* $Id: attrib.c,v 1.10 2004/06/05 08:28:37 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -279,7 +279,8 @@ NtfsDumpFileAttributes (PFILE_RECORD_HEADER FileRecord)
|
||||||
PATTRIBUTE Attribute;
|
PATTRIBUTE Attribute;
|
||||||
|
|
||||||
Attribute = (PATTRIBUTE)((ULONG_PTR)FileRecord + FileRecord->AttributeOffset);
|
Attribute = (PATTRIBUTE)((ULONG_PTR)FileRecord + FileRecord->AttributeOffset);
|
||||||
while (Attribute->AttributeType !=-1)
|
while (Attribute < (PATTRIBUTE)((ULONG_PTR)FileRecord + FileRecord->BytesInUse) &&
|
||||||
|
Attribute->AttributeType != -1)
|
||||||
{
|
{
|
||||||
NtfsDumpAttribute (Attribute);
|
NtfsDumpAttribute (Attribute);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: close.c,v 1.1 2003/07/17 13:31:39 chorns Exp $
|
/* $Id: close.c,v 1.2 2004/06/05 08:28:37 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "ntfs.h"
|
#include "ntfs.h"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: create.c,v 1.3 2003/11/13 15:26:34 ekohl Exp $
|
/* $Id: create.c,v 1.4 2004/06/05 08:28:37 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "ntfs.h"
|
#include "ntfs.h"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: dirctl.c,v 1.7 2003/11/13 15:26:34 ekohl Exp $
|
/* $Id: dirctl.c,v 1.8 2004/06/05 08:28:37 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "ntfs.h"
|
#include "ntfs.h"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: fcb.c,v 1.10 2004/01/28 20:53:06 ekohl Exp $
|
/* $Id: fcb.c,v 1.11 2004/06/05 08:28:37 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include "ntfs.h"
|
#include "ntfs.h"
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: finfo.c,v 1.2 2003/07/17 13:31:39 chorns Exp $
|
/* $Id: finfo.c,v 1.3 2004/06/05 08:28:37 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "ntfs.h"
|
#include "ntfs.h"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: fsctl.c,v 1.9 2003/11/12 15:30:21 ekohl Exp $
|
/* $Id: fsctl.c,v 1.10 2004/06/05 08:28:37 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <ntos/minmax.h>
|
#include <ntos/minmax.h>
|
||||||
|
|
||||||
#define NDEBUG
|
//#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "ntfs.h"
|
#include "ntfs.h"
|
||||||
|
@ -122,7 +122,7 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
PNTFS_INFO NtfsInfo)
|
PDEVICE_EXTENSION DeviceExt)
|
||||||
{
|
{
|
||||||
DISK_GEOMETRY DiskGeometry;
|
DISK_GEOMETRY DiskGeometry;
|
||||||
PFILE_RECORD_HEADER MftRecord;
|
PFILE_RECORD_HEADER MftRecord;
|
||||||
|
@ -130,9 +130,9 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
PVOLINFO_ATTRIBUTE VolumeInfo;
|
PVOLINFO_ATTRIBUTE VolumeInfo;
|
||||||
PBOOT_SECTOR BootSector;
|
PBOOT_SECTOR BootSector;
|
||||||
PATTRIBUTE Attribute;
|
PATTRIBUTE Attribute;
|
||||||
ULONG FileRecordSize;
|
|
||||||
ULONG Size;
|
ULONG Size;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
PNTFS_INFO NtfsInfo = &DeviceExt->NtfsInfo;
|
||||||
|
|
||||||
DPRINT("NtfsGetVolumeData() called\n");
|
DPRINT("NtfsGetVolumeData() called\n");
|
||||||
|
|
||||||
|
@ -179,7 +179,10 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
NtfsInfo->MftStart.QuadPart = BootSector->MftLocation;
|
NtfsInfo->MftStart.QuadPart = BootSector->MftLocation;
|
||||||
NtfsInfo->MftMirrStart.QuadPart = BootSector->MftMirrLocation;
|
NtfsInfo->MftMirrStart.QuadPart = BootSector->MftMirrLocation;
|
||||||
NtfsInfo->SerialNumber = BootSector->SerialNumber;
|
NtfsInfo->SerialNumber = BootSector->SerialNumber;
|
||||||
NtfsInfo->ClustersPerFileRecord = BootSector->ClustersPerMftRecord;
|
if (BootSector->ClustersPerMftRecord > 0)
|
||||||
|
NtfsInfo->BytesPerFileRecord = BootSector->ClustersPerMftRecord * NtfsInfo->BytesPerCluster;
|
||||||
|
else
|
||||||
|
NtfsInfo->BytesPerFileRecord = 1 << (-BootSector->ClustersPerMftRecord);
|
||||||
|
|
||||||
//#ifndef NDEBUG
|
//#ifndef NDEBUG
|
||||||
DbgPrint("Boot sector information:\n");
|
DbgPrint("Boot sector information:\n");
|
||||||
|
@ -199,13 +202,8 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
ExFreePool(BootSector);
|
ExFreePool(BootSector);
|
||||||
|
|
||||||
if (NtfsInfo->ClustersPerFileRecord == 0xF6)
|
|
||||||
FileRecordSize = NtfsInfo->ClustersPerFileRecord * NtfsInfo->BytesPerCluster;
|
|
||||||
else
|
|
||||||
FileRecordSize = NtfsInfo->BytesPerCluster;
|
|
||||||
|
|
||||||
MftRecord = ExAllocatePool(NonPagedPool,
|
MftRecord = ExAllocatePool(NonPagedPool,
|
||||||
FileRecordSize);
|
NtfsInfo->BytesPerFileRecord);
|
||||||
if (MftRecord == NULL)
|
if (MftRecord == NULL)
|
||||||
{
|
{
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
@ -213,7 +211,7 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
Status = NtfsReadSectors(DeviceObject,
|
Status = NtfsReadSectors(DeviceObject,
|
||||||
NtfsInfo->MftStart.u.LowPart * NtfsInfo->SectorsPerCluster,
|
NtfsInfo->MftStart.u.LowPart * NtfsInfo->SectorsPerCluster,
|
||||||
FileRecordSize / NtfsInfo->BytesPerSector,
|
NtfsInfo->BytesPerFileRecord / NtfsInfo->BytesPerSector,
|
||||||
NtfsInfo->BytesPerSector,
|
NtfsInfo->BytesPerSector,
|
||||||
(PVOID)MftRecord,
|
(PVOID)MftRecord,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
@ -223,32 +221,20 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NtfsInfo->ClustersPerFileRecord == 0xF6)
|
VolumeRecord = ExAllocatePool(NonPagedPool, NtfsInfo->BytesPerFileRecord);
|
||||||
|
if (VolumeRecord == NULL)
|
||||||
{
|
{
|
||||||
VolumeRecord = (PVOID)((ULONG_PTR)MftRecord + 3 * (NtfsInfo->BytesPerCluster / 4));
|
ExFreePool (MftRecord);
|
||||||
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
VolumeRecord = ExAllocatePool(NonPagedPool,
|
|
||||||
FileRecordSize);
|
|
||||||
if (VolumeRecord == NULL)
|
|
||||||
{
|
|
||||||
ExFreePool (MftRecord);
|
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read cluster MftStart + 3 (Volume File) */
|
/* Read Volume File (MFT index 3) */
|
||||||
Status = NtfsReadSectors(DeviceObject,
|
DeviceExt->StorageDevice = DeviceObject;
|
||||||
(NtfsInfo->MftStart.u.LowPart + 3) * NtfsInfo->SectorsPerCluster,
|
Status = ReadFileRecord(DeviceExt, 3, VolumeRecord, MftRecord);
|
||||||
FileRecordSize / NtfsInfo->BytesPerSector,
|
if (!NT_SUCCESS(Status))
|
||||||
NtfsInfo->BytesPerSector,
|
{
|
||||||
(PVOID)VolumeRecord,
|
ExFreePool (MftRecord);
|
||||||
TRUE);
|
return Status;
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
ExFreePool (MftRecord);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -266,10 +252,10 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
/* Get volume name */
|
/* Get volume name */
|
||||||
Attribute = FindAttribute (VolumeRecord, AttributeVolumeName, NULL);
|
Attribute = FindAttribute (VolumeRecord, AttributeVolumeName, NULL);
|
||||||
DPRINT("Attribute %p\n", Attribute);
|
DPRINT("Attribute %p\n", Attribute);
|
||||||
DPRINT("Data length %lu\n", AttributeDataLength (Attribute));
|
|
||||||
|
|
||||||
if (Attribute != NULL && ((PRESIDENT_ATTRIBUTE)Attribute)->ValueLength != 0)
|
if (Attribute != NULL && ((PRESIDENT_ATTRIBUTE)Attribute)->ValueLength != 0)
|
||||||
{
|
{
|
||||||
|
DPRINT("Data length %lu\n", AttributeDataLength (Attribute));
|
||||||
NtfsInfo->VolumeLabelLength =
|
NtfsInfo->VolumeLabelLength =
|
||||||
min (((PRESIDENT_ATTRIBUTE)Attribute)->ValueLength, MAXIMUM_VOLUME_LABEL_LENGTH);
|
min (((PRESIDENT_ATTRIBUTE)Attribute)->ValueLength, MAXIMUM_VOLUME_LABEL_LENGTH);
|
||||||
RtlCopyMemory (NtfsInfo->VolumeLabel,
|
RtlCopyMemory (NtfsInfo->VolumeLabel,
|
||||||
|
@ -284,10 +270,10 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
/* Get volume information */
|
/* Get volume information */
|
||||||
Attribute = FindAttribute (VolumeRecord, AttributeVolumeInformation, NULL);
|
Attribute = FindAttribute (VolumeRecord, AttributeVolumeInformation, NULL);
|
||||||
DPRINT("Attribute %p\n", Attribute);
|
DPRINT("Attribute %p\n", Attribute);
|
||||||
DPRINT("Data length %lu\n", AttributeDataLength (Attribute));
|
|
||||||
|
|
||||||
if (Attribute != NULL && ((PRESIDENT_ATTRIBUTE)Attribute)->ValueLength != 0)
|
if (Attribute != NULL && ((PRESIDENT_ATTRIBUTE)Attribute)->ValueLength != 0)
|
||||||
{
|
{
|
||||||
|
DPRINT("Data length %lu\n", AttributeDataLength (Attribute));
|
||||||
VolumeInfo = (PVOID)((ULONG_PTR)Attribute + ((PRESIDENT_ATTRIBUTE)Attribute)->ValueOffset);
|
VolumeInfo = (PVOID)((ULONG_PTR)Attribute + ((PRESIDENT_ATTRIBUTE)Attribute)->ValueOffset);
|
||||||
|
|
||||||
NtfsInfo->MajorVersion = VolumeInfo->MajorVersion;
|
NtfsInfo->MajorVersion = VolumeInfo->MajorVersion;
|
||||||
|
@ -295,10 +281,6 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
NtfsInfo->Flags = VolumeInfo->Flags;
|
NtfsInfo->Flags = VolumeInfo->Flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NtfsInfo->ClustersPerFileRecord != 0xF6)
|
|
||||||
{
|
|
||||||
ExFreePool (VolumeRecord);
|
|
||||||
}
|
|
||||||
ExFreePool (MftRecord);
|
ExFreePool (MftRecord);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -353,7 +335,7 @@ NtfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
sizeof(DEVICE_EXTENSION));
|
sizeof(DEVICE_EXTENSION));
|
||||||
|
|
||||||
Status = NtfsGetVolumeData(DeviceToMount,
|
Status = NtfsGetVolumeData(DeviceToMount,
|
||||||
&DeviceExt->NtfsInfo);
|
DeviceExt);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: mft.c,v 1.4 2003/11/13 15:26:34 ekohl Exp $
|
/* $Id: mft.c,v 1.5 2004/06/05 08:28:37 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <ntos/minmax.h>
|
#include <ntos/minmax.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "ntfs.h"
|
#include "ntfs.h"
|
||||||
|
@ -60,8 +60,7 @@ NtfsOpenMft (PDEVICE_EXTENSION Vcb)
|
||||||
|
|
||||||
DPRINT1("NtfsOpenMft() called\n");
|
DPRINT1("NtfsOpenMft() called\n");
|
||||||
|
|
||||||
BytesPerFileRecord =
|
BytesPerFileRecord = Vcb->NtfsInfo.BytesPerFileRecord;
|
||||||
Vcb->NtfsInfo.ClustersPerFileRecord * Vcb->NtfsInfo.BytesPerCluster;
|
|
||||||
|
|
||||||
MftRecord = ExAllocatePool(NonPagedPool,
|
MftRecord = ExAllocatePool(NonPagedPool,
|
||||||
BytesPerFileRecord);
|
BytesPerFileRecord);
|
||||||
|
@ -129,7 +128,8 @@ FindAttribute (PFILE_RECORD_HEADER FileRecord,
|
||||||
PATTRIBUTE Attribute;
|
PATTRIBUTE Attribute;
|
||||||
|
|
||||||
Attribute = (PATTRIBUTE)((ULONG_PTR)FileRecord + FileRecord->AttributeOffset);
|
Attribute = (PATTRIBUTE)((ULONG_PTR)FileRecord + FileRecord->AttributeOffset);
|
||||||
while (Attribute->AttributeType != -1)
|
while (Attribute < (PATTRIBUTE)((ULONG_PTR)FileRecord + FileRecord->BytesInUse) &&
|
||||||
|
Attribute->AttributeType != -1)
|
||||||
{
|
{
|
||||||
if (Attribute->AttributeType == Type)
|
if (Attribute->AttributeType == Type)
|
||||||
{
|
{
|
||||||
|
@ -189,18 +189,17 @@ ReadAttribute (PATTRIBUTE attr,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
VOID
|
NTSTATUS
|
||||||
ReadFileRecord (PDEVICE_EXTENSION Vcb,
|
ReadFileRecord (PDEVICE_EXTENSION Vcb,
|
||||||
ULONG index,
|
ULONG index,
|
||||||
PFILE_RECORD_HEADER file,
|
PFILE_RECORD_HEADER file,
|
||||||
PFILE_RECORD_HEADER Mft)
|
PFILE_RECORD_HEADER Mft)
|
||||||
{
|
{
|
||||||
PVOID p;
|
PVOID p;
|
||||||
ULONG clusters = Vcb->NtfsInfo.ClustersPerFileRecord;
|
ULONG BytesPerFileRecord = Vcb->NtfsInfo.BytesPerFileRecord;
|
||||||
ULONG BytesPerFileRecord = clusters * Vcb->NtfsInfo.BytesPerCluster;
|
ULONG clusters = max(BytesPerFileRecord / Vcb->NtfsInfo.BytesPerCluster, 1);
|
||||||
|
|
||||||
|
p = ExAllocatePool(NonPagedPool, clusters * Vcb->NtfsInfo.BytesPerCluster);
|
||||||
p = ExAllocatePool(NonPagedPool, BytesPerFileRecord);
|
|
||||||
|
|
||||||
ULONGLONG vcn = index * BytesPerFileRecord / Vcb->NtfsInfo.BytesPerCluster;
|
ULONGLONG vcn = index * BytesPerFileRecord / Vcb->NtfsInfo.BytesPerCluster;
|
||||||
|
|
||||||
|
@ -215,6 +214,8 @@ ReadFileRecord (PDEVICE_EXTENSION Vcb,
|
||||||
ExFreePool(p);
|
ExFreePool(p);
|
||||||
|
|
||||||
FixupUpdateSequenceArray(file);
|
FixupUpdateSequenceArray(file);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: ntfs.c,v 1.5 2004/02/10 16:22:56 navaraf Exp $
|
/* $Id: ntfs.c,v 1.6 2004/06/05 08:28:37 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <rosrtl/string.h>
|
#include <rosrtl/string.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "ntfs.h"
|
#include "ntfs.h"
|
||||||
|
|
|
@ -29,8 +29,10 @@ typedef struct _BOOT_SECTOR
|
||||||
ULONGLONG SectorCount;
|
ULONGLONG SectorCount;
|
||||||
ULONGLONG MftLocation;
|
ULONGLONG MftLocation;
|
||||||
ULONGLONG MftMirrLocation;
|
ULONGLONG MftMirrLocation;
|
||||||
ULONG ClustersPerMftRecord;
|
CHAR ClustersPerMftRecord;
|
||||||
ULONG ClustersPerIndexRecord;
|
BYTE Unused3[3];
|
||||||
|
CHAR ClustersPerIndexRecord;
|
||||||
|
BYTE Unused4[3];
|
||||||
ULONGLONG SerialNumber; // 0x48
|
ULONGLONG SerialNumber; // 0x48
|
||||||
UCHAR BootCode[432]; // 0x50
|
UCHAR BootCode[432]; // 0x50
|
||||||
} __attribute__((packed)) BOOT_SECTOR, *PBOOT_SECTOR;
|
} __attribute__((packed)) BOOT_SECTOR, *PBOOT_SECTOR;
|
||||||
|
@ -49,7 +51,7 @@ typedef struct _NTFS_INFO
|
||||||
ULONGLONG SectorCount;
|
ULONGLONG SectorCount;
|
||||||
ULARGE_INTEGER MftStart;
|
ULARGE_INTEGER MftStart;
|
||||||
ULARGE_INTEGER MftMirrStart;
|
ULARGE_INTEGER MftMirrStart;
|
||||||
ULONG ClustersPerFileRecord;
|
ULONG BytesPerFileRecord;
|
||||||
|
|
||||||
ULONGLONG SerialNumber;
|
ULONGLONG SerialNumber;
|
||||||
USHORT VolumeLabelLength;
|
USHORT VolumeLabelLength;
|
||||||
|
@ -423,7 +425,7 @@ ReadAttribute(PATTRIBUTE attr, PVOID buffer, PDEVICE_EXTENSION Vcb,
|
||||||
ULONG
|
ULONG
|
||||||
AttributeDataLength(PATTRIBUTE attr);
|
AttributeDataLength(PATTRIBUTE attr);
|
||||||
|
|
||||||
VOID
|
NTSTATUS
|
||||||
ReadFileRecord (PDEVICE_EXTENSION Vcb,
|
ReadFileRecord (PDEVICE_EXTENSION Vcb,
|
||||||
ULONG index,
|
ULONG index,
|
||||||
PFILE_RECORD_HEADER file,
|
PFILE_RECORD_HEADER file,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: rw.c,v 1.2 2003/11/13 15:26:34 ekohl Exp $
|
/* $Id: rw.c,v 1.3 2004/06/05 08:28:37 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <ntos/minmax.h>
|
#include <ntos/minmax.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "ntfs.h"
|
#include "ntfs.h"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: volinfo.c,v 1.3 2003/11/12 15:30:21 ekohl Exp $
|
/* $Id: volinfo.c,v 1.4 2004/06/05 08:28:37 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
//#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "ntfs.h"
|
#include "ntfs.h"
|
||||||
|
|
Loading…
Reference in a new issue