Author: pschweitzer
Date: Sat Dec 29 00:56:19 2007
New Revision: 31483
URL:
http://svn.reactos.org/svn/reactos?rev=31483&view=rev
Log:
Reorganized NTFS driver header :
- Renamed Magic (bad !) to jump, and OemName to OEMID
- Created structures for BPB and EBPB and used them in BOOT_SECTOR one
- Added a field to BOOY_SECTOR structure
This is based on Technet doc and Alex Ionescu doc
Modified:
trunk/reactos/drivers/filesystems/ntfs/fsctl.c
trunk/reactos/drivers/filesystems/ntfs/ntfs.h
Modified: trunk/reactos/drivers/filesystems/ntfs/fsctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/f…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/fsctl.c (original)
+++ trunk/reactos/drivers/filesystems/ntfs/fsctl.c Sat Dec 29 00:56:19 2007
@@ -20,7 +20,7 @@
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
- * FILE: services/fs/ntfs/fsctl.c
+ * FILE: drivers/filesystems/ntfs/fsctl.c
* PURPOSE: NTFS filesystem driver
* PROGRAMMER: Eric Kohl
* Updated by Valentin Verkhovsky 2003/09/12
@@ -106,8 +106,8 @@
TRUE);
if (NT_SUCCESS(Status))
{
- DPRINT1("NTFS-identifier: [%.8s]\n", BootSector->OemName);
- if (RtlCompareMemory(BootSector->OemName, "NTFS ", 8) != 8)
+ DPRINT1("NTFS-identifier: [%.8s]\n", BootSector->OEMID);
+ if (RtlCompareMemory(BootSector->OEMID, "NTFS ", 8) != 8)
{
Status = STATUS_UNRECOGNIZED_VOLUME;
}
@@ -170,33 +170,33 @@
}
/* Read data from the bootsector */
- NtfsInfo->BytesPerSector = BootSector->BytesPerSector;
- NtfsInfo->SectorsPerCluster = BootSector->SectorsPerCluster;
- NtfsInfo->BytesPerCluster = BootSector->BytesPerSector *
BootSector->SectorsPerCluster;
- NtfsInfo->SectorCount = BootSector->SectorCount;
-
- NtfsInfo->MftStart.QuadPart = BootSector->MftLocation;
- NtfsInfo->MftMirrStart.QuadPart = BootSector->MftMirrLocation;
- NtfsInfo->SerialNumber = BootSector->SerialNumber;
- if (BootSector->ClustersPerMftRecord > 0)
- NtfsInfo->BytesPerFileRecord = BootSector->ClustersPerMftRecord *
NtfsInfo->BytesPerCluster;
+ NtfsInfo->BytesPerSector = BootSector->BPB.BytesPerSector;
+ NtfsInfo->SectorsPerCluster = BootSector->BPB.SectorsPerCluster;
+ NtfsInfo->BytesPerCluster = BootSector->BPB.BytesPerSector *
BootSector->BPB.SectorsPerCluster;
+ NtfsInfo->SectorCount = BootSector->EBPB.SectorCount;
+
+ NtfsInfo->MftStart.QuadPart = BootSector->EBPB.MftLocation;
+ NtfsInfo->MftMirrStart.QuadPart = BootSector->EBPB.MftMirrLocation;
+ NtfsInfo->SerialNumber = BootSector->EBPB.SerialNumber;
+ if (BootSector->EBPB.ClustersPerMftRecord > 0)
+ NtfsInfo->BytesPerFileRecord = BootSector->EBPB.ClustersPerMftRecord *
NtfsInfo->BytesPerCluster;
else
- NtfsInfo->BytesPerFileRecord = 1 << (-BootSector->ClustersPerMftRecord);
+ NtfsInfo->BytesPerFileRecord = 1 <<
(-BootSector->EBPB.ClustersPerMftRecord);
//#ifndef NDEBUG
DbgPrint("Boot sector information:\n");
- DbgPrint(" BytesPerSector: %hu\n", BootSector->BytesPerSector);
- DbgPrint(" SectorsPerCluster: %hu\n",
BootSector->SectorsPerCluster);
-
- DbgPrint(" SectorCount: %I64u\n", BootSector->SectorCount);
-
- DbgPrint(" MftStart: %I64u\n", BootSector->MftLocation);
- DbgPrint(" MftMirrStart: %I64u\n",
BootSector->MftMirrLocation);
-
- DbgPrint(" ClustersPerMftRecord: %lx\n",
BootSector->ClustersPerMftRecord);
- DbgPrint(" ClustersPerIndexRecord: %lx\n",
BootSector->ClustersPerIndexRecord);
-
- DbgPrint(" SerialNumber: %I64x\n", BootSector->SerialNumber);
+ DbgPrint(" BytesPerSector: %hu\n",
BootSector->BPB.BytesPerSector);
+ DbgPrint(" SectorsPerCluster: %hu\n",
BootSector->BPB.SectorsPerCluster);
+
+ DbgPrint(" SectorCount: %I64u\n",
BootSector->EBPB.SectorCount);
+
+ DbgPrint(" MftStart: %I64u\n",
BootSector->EBPB.MftLocation);
+ DbgPrint(" MftMirrStart: %I64u\n",
BootSector->EBPB.MftMirrLocation);
+
+ DbgPrint(" ClustersPerMftRecord: %lx\n",
BootSector->EBPB.ClustersPerMftRecord);
+ DbgPrint(" ClustersPerIndexRecord: %lx\n",
BootSector->EBPB.ClustersPerIndexRecord);
+
+ DbgPrint(" SerialNumber: %I64x\n",
BootSector->EBPB.SerialNumber);
//#endif
ExFreePool(BootSector);
Modified: trunk/reactos/drivers/filesystems/ntfs/ntfs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/n…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/ntfs.h (original)
+++ trunk/reactos/drivers/filesystems/ntfs/ntfs.h Sat Dec 29 00:56:19 2007
@@ -20,28 +20,40 @@
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
#include <pshpack1.h>
-typedef struct _BOOT_SECTOR
-{
- UCHAR Magic[3]; // 0x00
- UCHAR OemName[8]; // 0x03
+typedef struct _BIOS_PARAMETERS_BLOCK
+{
USHORT BytesPerSector; // 0x0B
- UCHAR SectorsPerCluster; // 0x0D
+ UCHAR SectorsPerCluster; // 0x0D
UCHAR Unused0[7]; // 0x0E
UCHAR MediaId; // 0x15
UCHAR Unused1[2]; // 0x16
- USHORT SectorsPerTrack;
- USHORT Heads;
- UCHAR Unused2[8];
- UCHAR Unknown0[4]; /* always 80 00 80 00 */
- ULONGLONG SectorCount;
- ULONGLONG MftLocation;
- ULONGLONG MftMirrLocation;
- CHAR ClustersPerMftRecord;
- UCHAR Unused3[3];
- CHAR ClustersPerIndexRecord;
- UCHAR Unused4[3];
+ USHORT SectorsPerTrack; // 0x18
+ USHORT Heads; // 0x1A
+ UCHAR Unused2[8]; // 0x1C
+} BIOS_PARAMETERS_BLOCK, *PBIOS_PARAMETERS_BLOCK;
+
+typedef struct _EXTENDED_BIOS_PARAMETERS_BLOCK
+{
+ UCHAR Unknown[4]; // 0x24, always 80 00 80 00
+ ULONGLONG SectorCount; // 0x28
+ ULONGLONG MftLocation; // 0x30
+ ULONGLONG MftMirrLocation; // 0x38
+ CHAR ClustersPerMftRecord; // 0x40
+ UCHAR Unused3[3]; // 0x41
+ CHAR ClustersPerIndexRecord; // 0x44
+ UCHAR Unused4[3]; // 0x45
ULONGLONG SerialNumber; // 0x48
- UCHAR BootCode[432]; // 0x50
+ UCHAR Checksum[4]; // 0x50
+} EXTENDED_BIOS_PARAMETERS_BLOCK, *PEXTENDED_BIOS_PARAMETERS_BLOCK;
+
+typedef struct _BOOT_SECTOR
+{
+ UCHAR Jump[3]; // 0x00
+ UCHAR OEMID[8]; // 0x03
+ BIOS_PARAMETERS_BLOCK BPB;
+ EXTENDED_BIOS_PARAMETERS_BLOCK EBPB;
+ UCHAR BootStrap[426]; // 0x54
+ USHORT EndSector; // 0x1FE
} BOOT_SECTOR, *PBOOT_SECTOR;
#include <poppack.h>