NTFS Driver work (index headers)
authorJohn Hodge <[email protected]>
Fri, 27 Aug 2010 11:00:50 +0000 (19:00 +0800)
committerJohn Hodge <[email protected]>
Fri, 27 Aug 2010 11:00:50 +0000 (19:00 +0800)
Modules/Filesystems/NTFS/attributes.h [new file with mode: 0644]
Modules/Filesystems/NTFS/common.h
Modules/Filesystems/NTFS/dir.c
Modules/Filesystems/NTFS/index.h [new file with mode: 0644]

diff --git a/Modules/Filesystems/NTFS/attributes.h b/Modules/Filesystems/NTFS/attributes.h
new file mode 100644 (file)
index 0000000..671a36e
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Acess2 - NTFS Driver
+ * By John Hodge (thePowersGang)
+ * This file is published under the terms of the Acess licence. See the
+ * file COPYING for details.
+ *
+ * attributes.h - MFT Attribute Types
+ */
+#ifndef _ATTRIBUTES_H_
+#define _ATTRIBUTES_H_
+
+typedef struct
+{
+       Uint64  ParentDirectory;        //!< Parent directory MFT entry
+       Sint64  CreationTime;   //!< Time the file was created
+       Sint64  LastDataModTime;        //!< Last change time for the data
+       Sint64  LastMtfModTime; //!< Last change time for the MFT entry
+       Sint64  LastAccessTime; //!< Last Access Time (unreliable on most systems)
+       
+       Uint64  AllocatedSize;  //!< Allocated data size for $DATA unnamed stream
+       Uint64  DataSize;       //!< Actual size of $DATA unnamed stream
+       Uint32  Flags;  //!< File attribute files
+       
+       union {
+               struct {
+                       Uint16  PackedSize;     //!< Size of buffer needed for extended attributes
+                       Uint16  _reserved;
+               } PACKED        ExtAttrib;
+               struct {
+                       Uint32  Tag;    //!< Type of reparse point
+               } PACKED        ReparsePoint;
+       } PACKED        Type;
+       
+       Uint8   FilenameType;   //!< Filename namespace (DOS, Windows, Unix)
+       WCHAR   Filename[0];
+} PACKED       tNTFS_Attrib_Filename;
+
+#endif
index 6ed0ac6..598120d 100644 (file)
@@ -12,6 +12,8 @@
 #include <acess.h>
 #include <vfs.h>
 
+typedef Uint16 WCHAR;
+
 // === STRUCTURES ===
 /**
  * In-memory representation of an NTFS Disk
index c3a9068..37661e8 100644 (file)
@@ -7,6 +7,7 @@
  * dir.c - Directory Handling
  */
 #include "common.h"
+#include "index.h"
 
 // === PROTOTYPES ===
 char   *NTFS_ReadDir(tVFS_Node *Node, int Pos);
diff --git a/Modules/Filesystems/NTFS/index.h b/Modules/Filesystems/NTFS/index.h
new file mode 100644 (file)
index 0000000..f45d897
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Acess2 - NTFS Driver
+ * By John Hodge (thePowersGang)
+ * This file is published under the terms of the Acess licence. See the
+ * file COPYING for details.
+ *
+ * index.h - Index Types
+ */
+#ifndef _INDEX_H_
+#define _INDEX_H_
+
+#include "attributes.h"
+
+typedef struct
+{
+       Uint32  EntryOffset;
+       Uint32  IndexLength;
+       Uint32  AllocateSize;
+       Uint8   Flags;
+       Uint8   _reserved[3];
+} PACKED       tNTFS_IndexHeader;
+
+typedef struct
+{
+       Uint32  Type;
+       Uint32  CollationRule;
+       Uint32  IndexBlockSize;
+       Uint8   ClustersPerIndexBlock;
+       Uint8   _reserved[3];
+       tNTFS_IndexHeader       Header;
+} PACKED       tNTFS_IndexRoot;
+
+typedef struct
+{
+       union {
+               struct {
+                       Uint64  File;   // MFT Index of file
+               } PACKED        Dir;
+               /**
+                * Views/Indexes
+                */
+               struct {
+                       Uint16  DataOffset;
+                       Uint16  DataLength;
+                       Uint32  _reserved;
+               } PACKED        ViewIndex;
+       } PACKED        Header;
+       
+       Uint16  Length; //!< Size of the index entry (multiple of 8 bytes)
+       Uint16  KeyLength;      //!< Size of key value
+       Uint16  Flags;  //!< Flags Bitfield
+       Uint16  _reserved;
+       
+       /**
+        * \brief Key Data
+        * \note Only valid if \a Flags does not have \a INDEX_ENTRY_END set
+        * \note In NTFS3 only \a Filename is used
+        */
+       union {
+               tNTFS_Attrib_Filename   Filename;
+               //TODO: more key types
+       } PACKED        Key;
+} PACKED       tNTFS_IndexEntry;
+
+#endif

UCC git Repository :: git.ucc.asn.au