/*
+ * 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 <acess.h>
+#include <vfs.h>
+
// === STRUCTURES ===
+/**
+ * In-memory representation of an NTFS Disk
+ */
typedef struct sNTFS_Disk
{
+ int FD;
+
+ int ClusterSize;
+ Uint64 MFTBase;
+ tVFS_Node RootNode;
} tNTFS_Disk;
+typedef struct sNTFS_BootSector
+{
+ // 0
+ Uint8 Jump[3];
+ Uint8 SystemID[8]; // = "NTFS "
+ Uint16 BytesPerSector;
+ Uint8 SectorsPerCluster;
+
+ // 14
+ Uint8 Unused[7];
+ Uint8 MediaDescriptor;
+ Uint16 Unused2;
+ Uint16 SectorsPerTrack;
+
+ Uint64 Unused3;
+ Uint32 Unknown;
+
+ // 38
+ 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
+
+ // 60
+ // If either of these are -ve, the size can be obtained via
+ // SizeInBytes = 2^(-1 * Value)
+ Uint32 ClustersPerMFTRecord;
+ Uint32 ClustersPerIndexRecord;
+
+ Uint64 SerialNumber;
+
+ Uint8 Padding[512-72];
+
+} tNTFS_BootSector;
+
+/**
+ * FILE header, an entry in the MFT
+ */
typedef struct sNTFS_FILE_Header
{
Uint32 Magic; // 'FILE'
} tNTFS_FILE_Header;
+/**
+ * File Attribute, follows the FILE header
+ */
typedef struct sNTFS_FILE_Attrib
{
Uint32 Type; // See eNTFS_FILE_Attribs