X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FFilesystems%2FNTFS%2Fcommon.h;h=598120d27c9023e7260448f114ce9ccd58355afa;hb=3681dbf27244ee07ae618a9d33a608ae6089d3c5;hp=ba25c18af93482fb65ea8304ab8a279bfaa447da;hpb=377247d261f82cc9c26ccd06cc075594b12bd760;p=tpg%2Facess2.git diff --git a/Modules/Filesystems/NTFS/common.h b/Modules/Filesystems/NTFS/common.h index ba25c18a..598120d2 100644 --- a/Modules/Filesystems/NTFS/common.h +++ b/Modules/Filesystems/NTFS/common.h @@ -1,14 +1,76 @@ /* + * Acess2 - NTFS Driver + * By John Hodge (thePowersGang) + * This file is published under the terms of the Acess licence. See the + * file COPYING for details. + * + * common.h - Common Types and Definitions */ #ifndef _COMMON_H_ #define _COMMON_H_ +#include +#include + +typedef Uint16 WCHAR; + // === STRUCTURES === +/** + * In-memory representation of an NTFS Disk + */ typedef struct sNTFS_Disk { + int FD; + int CacheHandle; + + int ClusterSize; + Uint64 MFTBase; + Uint32 MFTRecSize; + tVFS_Node RootNode; } tNTFS_Disk; +typedef struct sNTFS_BootSector +{ + // 0 + Uint8 Jump[3]; + Uint8 SystemID[8]; // = "NTFS " + Uint16 BytesPerSector; + Uint8 SectorsPerCluster; + + // 0xE + Uint8 Unused[7]; + Uint8 MediaDescriptor; + Uint16 Unused2; + Uint16 SectorsPerTrack; + Uint16 Heads; + + // 0x1C + Uint64 Unused3; + Uint32 Unkown; // Usually 0x00800080 (according to Linux docs) + + // 0x28 + Uint64 TotalSectorCount; // Size of volume in sectors + Uint64 MFTStart; // Logical Cluster Number of Cluster 0 of MFT + Uint64 MFTMirrorStart; // Logical Cluster Number of Cluster 0 of MFT Backup + + // 0x40 + // If either of these are -ve, the size can be obtained via + // SizeInBytes = 2^(-1 * Value) + Sint8 ClustersPerMFTRecord; + Uint8 Unused4[3]; + Sint8 ClustersPerIndexRecord; + Uint8 Unused5[3]; + + Uint64 SerialNumber; + + Uint8 Padding[512-0x50]; + +} PACKED tNTFS_BootSector; + +/** + * FILE header, an entry in the MFT + */ typedef struct sNTFS_FILE_Header { Uint32 Magic; // 'FILE' @@ -46,8 +108,11 @@ typedef struct sNTFS_FILE_Header } All; } OSDep; -} tNTFS_FILE_Header; +} PACKED tNTFS_FILE_Header; +/** + * File Attribute, follows the FILE header + */ typedef struct sNTFS_FILE_Attrib { Uint32 Type; // See eNTFS_FILE_Attribs @@ -83,6 +148,6 @@ typedef struct sNTFS_FILE_Attrib // Data Runs } NonResident; }; -} tNTFS_FILE_Attrib; +} PACKED tNTFS_FILE_Attrib; #endif