mirror of
https://github.com/reactos/reactos.git
synced 2025-06-12 08:08:29 +00:00
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 svn path=/trunk/; revision=31483
This commit is contained in:
parent
3a0687218d
commit
df28dbd1ee
2 changed files with 49 additions and 37 deletions
|
@ -20,7 +20,7 @@
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: services/fs/ntfs/fsctl.c
|
* FILE: drivers/filesystems/ntfs/fsctl.c
|
||||||
* PURPOSE: NTFS filesystem driver
|
* PURPOSE: NTFS filesystem driver
|
||||||
* PROGRAMMER: Eric Kohl
|
* PROGRAMMER: Eric Kohl
|
||||||
* Updated by Valentin Verkhovsky 2003/09/12
|
* Updated by Valentin Verkhovsky 2003/09/12
|
||||||
|
@ -106,8 +106,8 @@ NtfsHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
||||||
TRUE);
|
TRUE);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NTFS-identifier: [%.8s]\n", BootSector->OemName);
|
DPRINT1("NTFS-identifier: [%.8s]\n", BootSector->OEMID);
|
||||||
if (RtlCompareMemory(BootSector->OemName, "NTFS ", 8) != 8)
|
if (RtlCompareMemory(BootSector->OEMID, "NTFS ", 8) != 8)
|
||||||
{
|
{
|
||||||
Status = STATUS_UNRECOGNIZED_VOLUME;
|
Status = STATUS_UNRECOGNIZED_VOLUME;
|
||||||
}
|
}
|
||||||
|
@ -170,33 +170,33 @@ NtfsGetVolumeData(PDEVICE_OBJECT DeviceObject,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read data from the bootsector */
|
/* Read data from the bootsector */
|
||||||
NtfsInfo->BytesPerSector = BootSector->BytesPerSector;
|
NtfsInfo->BytesPerSector = BootSector->BPB.BytesPerSector;
|
||||||
NtfsInfo->SectorsPerCluster = BootSector->SectorsPerCluster;
|
NtfsInfo->SectorsPerCluster = BootSector->BPB.SectorsPerCluster;
|
||||||
NtfsInfo->BytesPerCluster = BootSector->BytesPerSector * BootSector->SectorsPerCluster;
|
NtfsInfo->BytesPerCluster = BootSector->BPB.BytesPerSector * BootSector->BPB.SectorsPerCluster;
|
||||||
NtfsInfo->SectorCount = BootSector->SectorCount;
|
NtfsInfo->SectorCount = BootSector->EBPB.SectorCount;
|
||||||
|
|
||||||
NtfsInfo->MftStart.QuadPart = BootSector->MftLocation;
|
NtfsInfo->MftStart.QuadPart = BootSector->EBPB.MftLocation;
|
||||||
NtfsInfo->MftMirrStart.QuadPart = BootSector->MftMirrLocation;
|
NtfsInfo->MftMirrStart.QuadPart = BootSector->EBPB.MftMirrLocation;
|
||||||
NtfsInfo->SerialNumber = BootSector->SerialNumber;
|
NtfsInfo->SerialNumber = BootSector->EBPB.SerialNumber;
|
||||||
if (BootSector->ClustersPerMftRecord > 0)
|
if (BootSector->EBPB.ClustersPerMftRecord > 0)
|
||||||
NtfsInfo->BytesPerFileRecord = BootSector->ClustersPerMftRecord * NtfsInfo->BytesPerCluster;
|
NtfsInfo->BytesPerFileRecord = BootSector->EBPB.ClustersPerMftRecord * NtfsInfo->BytesPerCluster;
|
||||||
else
|
else
|
||||||
NtfsInfo->BytesPerFileRecord = 1 << (-BootSector->ClustersPerMftRecord);
|
NtfsInfo->BytesPerFileRecord = 1 << (-BootSector->EBPB.ClustersPerMftRecord);
|
||||||
|
|
||||||
//#ifndef NDEBUG
|
//#ifndef NDEBUG
|
||||||
DbgPrint("Boot sector information:\n");
|
DbgPrint("Boot sector information:\n");
|
||||||
DbgPrint(" BytesPerSector: %hu\n", BootSector->BytesPerSector);
|
DbgPrint(" BytesPerSector: %hu\n", BootSector->BPB.BytesPerSector);
|
||||||
DbgPrint(" SectorsPerCluster: %hu\n", BootSector->SectorsPerCluster);
|
DbgPrint(" SectorsPerCluster: %hu\n", BootSector->BPB.SectorsPerCluster);
|
||||||
|
|
||||||
DbgPrint(" SectorCount: %I64u\n", BootSector->SectorCount);
|
DbgPrint(" SectorCount: %I64u\n", BootSector->EBPB.SectorCount);
|
||||||
|
|
||||||
DbgPrint(" MftStart: %I64u\n", BootSector->MftLocation);
|
DbgPrint(" MftStart: %I64u\n", BootSector->EBPB.MftLocation);
|
||||||
DbgPrint(" MftMirrStart: %I64u\n", BootSector->MftMirrLocation);
|
DbgPrint(" MftMirrStart: %I64u\n", BootSector->EBPB.MftMirrLocation);
|
||||||
|
|
||||||
DbgPrint(" ClustersPerMftRecord: %lx\n", BootSector->ClustersPerMftRecord);
|
DbgPrint(" ClustersPerMftRecord: %lx\n", BootSector->EBPB.ClustersPerMftRecord);
|
||||||
DbgPrint(" ClustersPerIndexRecord: %lx\n", BootSector->ClustersPerIndexRecord);
|
DbgPrint(" ClustersPerIndexRecord: %lx\n", BootSector->EBPB.ClustersPerIndexRecord);
|
||||||
|
|
||||||
DbgPrint(" SerialNumber: %I64x\n", BootSector->SerialNumber);
|
DbgPrint(" SerialNumber: %I64x\n", BootSector->EBPB.SerialNumber);
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
ExFreePool(BootSector);
|
ExFreePool(BootSector);
|
||||||
|
|
|
@ -20,28 +20,40 @@
|
||||||
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
|
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S))
|
||||||
|
|
||||||
#include <pshpack1.h>
|
#include <pshpack1.h>
|
||||||
typedef struct _BOOT_SECTOR
|
typedef struct _BIOS_PARAMETERS_BLOCK
|
||||||
{
|
{
|
||||||
UCHAR Magic[3]; // 0x00
|
|
||||||
UCHAR OemName[8]; // 0x03
|
|
||||||
USHORT BytesPerSector; // 0x0B
|
USHORT BytesPerSector; // 0x0B
|
||||||
UCHAR SectorsPerCluster; // 0x0D
|
UCHAR SectorsPerCluster; // 0x0D
|
||||||
UCHAR Unused0[7]; // 0x0E
|
UCHAR Unused0[7]; // 0x0E
|
||||||
UCHAR MediaId; // 0x15
|
UCHAR MediaId; // 0x15
|
||||||
UCHAR Unused1[2]; // 0x16
|
UCHAR Unused1[2]; // 0x16
|
||||||
USHORT SectorsPerTrack;
|
USHORT SectorsPerTrack; // 0x18
|
||||||
USHORT Heads;
|
USHORT Heads; // 0x1A
|
||||||
UCHAR Unused2[8];
|
UCHAR Unused2[8]; // 0x1C
|
||||||
UCHAR Unknown0[4]; /* always 80 00 80 00 */
|
} BIOS_PARAMETERS_BLOCK, *PBIOS_PARAMETERS_BLOCK;
|
||||||
ULONGLONG SectorCount;
|
|
||||||
ULONGLONG MftLocation;
|
typedef struct _EXTENDED_BIOS_PARAMETERS_BLOCK
|
||||||
ULONGLONG MftMirrLocation;
|
{
|
||||||
CHAR ClustersPerMftRecord;
|
UCHAR Unknown[4]; // 0x24, always 80 00 80 00
|
||||||
UCHAR Unused3[3];
|
ULONGLONG SectorCount; // 0x28
|
||||||
CHAR ClustersPerIndexRecord;
|
ULONGLONG MftLocation; // 0x30
|
||||||
UCHAR Unused4[3];
|
ULONGLONG MftMirrLocation; // 0x38
|
||||||
|
CHAR ClustersPerMftRecord; // 0x40
|
||||||
|
UCHAR Unused3[3]; // 0x41
|
||||||
|
CHAR ClustersPerIndexRecord; // 0x44
|
||||||
|
UCHAR Unused4[3]; // 0x45
|
||||||
ULONGLONG SerialNumber; // 0x48
|
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;
|
} BOOT_SECTOR, *PBOOT_SECTOR;
|
||||||
#include <poppack.h>
|
#include <poppack.h>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue