TNTFSDiskAttribute

From Ultibo.org
Revision as of 06:03, 24 May 2018 by Ultibo (Talk | contribs) (Created page with "Return to Unit NTFSClass __TOC__ === Description === ---- ''To be documented'' === Class definitions === ---- <div class="toccolours mw-collapsible m...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Return to Unit NTFSClass


Description


To be documented

Class definitions



TNTFSDiskAttribute = class(TListObject)

constructor Create(ALocalLock:TMutexHandle; AParent:TNTFSDiskRecord);  
destructor Destroy; override;  
private
FLocalLock:TMutexHandle;  
protected
FStatus:LongWord;  
FData:Pointer; Only applicable if attribute is resident
 
FAttributeType:LongWord; Attribute Type (e.g. 0x80, 0xA0)
FAttributeSize:LongWord; Length of the Attribute (including header)
FAttributeFlags:Word; Attribute Flags
FAttributeId:Word; Attribute Id
FAttributeName:String; Attribute Name
FNonResident:Byte; Non-resident flag
 
FIndexed:Byte; Indexed flag
FDataSize:LongWord; Length of the Attribute Data
 
FStartVCN:Int64; Starting VCN
FLastVCN:Int64; Last VCN
FStreamSize:Int64; Real size of the attribute
FStreamUsed:Int64; The actual Allocated size of the attribute (Only present when compressed and only in the first instance)
FStreamAllocated:Int64; Allocated size of the attribute
FInitializedSize:Int64; Initialized data size of the stream (Portion which has been Written)
FCompressionUnit:Word; Compression Unit Size
 
FRuns:TNTFSDiskRuns; List of runs of this attribute
FItems:TNTFSDiskItems; List of items of this attribute
FIndex:TNTFSDiskIndex; Index of this attribute if applicable
FParent:TNTFSDiskRecord; Record owning this attribute
 
FAttributeHash:LongWord;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function GetRunsLock:TSynchronizerHandle;  
function GetItemsLock:TSynchronizerHandle;  
function GetIndexLock:TSynchronizerHandle;  
function GetExtendedsLock:TSynchronizerHandle;  
 
function GetRunLocal:TMutexHandle;  
function GetItemLocal:TMutexHandle;  
function GetKeyLocal:TMutexHandle;  
function GetExtendedLocal:TMutexHandle;  
 
function GetUpdating:Boolean;  
procedure SetUpdating(AValue:Boolean);  
 
function GetIsFixed:Boolean;  
function GetIsSingle:Boolean;  
function GetIsUnlisted:Boolean;  
function GetIsUnmovable:Boolean;  
function GetIsManaged:Boolean;  
 
function GetIsSparse:Boolean;  
procedure SetIsSparse(AValue:Boolean);  
function GetIsEncrypted:Boolean;  
procedure SetIsEncrypted(AValue:Boolean);  
function GetIsCompressed:Boolean;  
procedure SetIsCompressed(AValue:Boolean);  
 
function GetAttributeName:String;  
procedure SetAttributeName(const AAttributeName:String);  
 
function GetDataSize:LongWord; virtual;  
procedure SetDataSize(AValue:LongWord); virtual;  
 
function Compare(AAttribute:TNTFSDiskAttribute):Integer; virtual;  
 
function CreateRuns(ANew:Boolean):TNTFSDiskRuns;  
function CreateItems(ANew:Boolean):TNTFSDiskItems;  
 
function GetRecord(AInstance:Integer):TNTFSDiskRecord;  
function GetAttribute(AType:LongWord; const AName:String; AInstance:Integer):TNTFSDiskAttribute;  
public
property Updating:Boolean read GetUpdating write SetUpdating;  
 
property IsFixed:Boolean read GetIsFixed;  
property IsSingle:Boolean read GetIsSingle;  
property IsUnlisted:Boolean read GetIsUnlisted;  
property IsUnmovable:Boolean read GetIsUnmovable;  
property IsManaged:Boolean read GetIsManaged;  
 
property IsSparse:Boolean read GetIsSparse write SetIsSparse;  
property IsEncrypted:Boolean read GetIsEncrypted write SetIsEncrypted;  
property IsCompressed:Boolean read GetIsCompressed write SetIsCompressed;  
 
property Data:Pointer read FData;  
 
property AttributeType:LongWord read FAttributeType;  
property AttributeSize:LongWord read FAttributeSize write FAttributeSize;  
property AttributeFlags:Word read FAttributeFlags write FAttributeFlags;  
property AttributeId:Word read FAttributeId write FAttributeId;  
property AttributeName:String read GetAttributeName write SetAttributeName;  
property NonResident:Byte read FNonResident write FNonResident;  
 
property Indexed:Byte read FIndexed write FIndexed;  
property DataSize:LongWord read GetDataSize write SetDataSize;  
 
property StartVCN:Int64 read FStartVCN write FStartVCN;  
property LastVCN:Int64 read FLastVCN write FLastVCN;  
property StreamSize:Int64 read FStreamSize write FStreamSize;  
property StreamUsed:Int64 read FStreamUsed write FStreamUsed;  
property StreamAllocated:Int64 read FStreamAllocated write FStreamAllocated;  
property InitializedSize:Int64 read FInitializedSize write FInitializedSize;  
property CompressionUnit:Word read FCompressionUnit write FCompressionUnit;  
 
property Runs:TNTFSDiskRuns read FRuns;  
property Items:TNTFSDiskItems read FItems;  
property Index:TNTFSDiskIndex read FIndex;  
property Parent:TNTFSDiskRecord read FParent write FParent;  
 
property AttributeHash:LongWord read FAttributeHash;  
 
function GetRunCount(const AVCN:Int64; var AStartVCN,ACount:Int64):Boolean;  
function GetRunLength(const AVCN:Int64; var AStartVCN,ALength:Int64):Boolean;  
function GetRunByUnit(const AUnit:Int64; var AStartVCN:Int64):TNTFSDiskRun;  
function GetRunByCluster(const ACluster:Int64; var AStartVCN:Int64):TNTFSDiskRun;  
 
function CreateRun(ANew:Boolean):TNTFSDiskRun;  
function DestroyRun(ARun:TNTFSDiskRun):Boolean;  
function NewRun(const AStart,ALength:Int64):TNTFSDiskRun;  
function InsertRun(APrev:TNTFSDiskRun; const AStart,ALength:Int64):TNTFSDiskRun;  
function GetRun(const AVCN:Int64; var AStartVCN:Int64):TNTFSDiskRun;  
function GetRunOld(const AVCN:Int64; var AStartVCN:Int64):TNTFSDiskRun;  
function MergeRun(ARun:TNTFSDiskRun):Boolean;  
function SplitRun(ARun:TNTFSDiskRun; const ALength:Int64):Boolean;  
function RemoveRun(ARun:TNTFSDiskRun):Boolean;  
function MoveRun(ADest:TNTFSDiskAttribute; ARun:TNTFSDiskRun):Boolean;  
 
function GetItemByAttribute(AAttribute:TNTFSDiskAttribute):TNTFSDiskItem;  
 
function CreateItem(ANew:Boolean):TNTFSDiskItem;  
function DestroyItem(AItem:TNTFSDiskItem):Boolean;  
function NewItem(AAttribute:TNTFSDiskAttribute):TNTFSDiskItem;  
function GetItem(AType:LongWord; const AName:String; AInstance:Integer):TNTFSDiskItem;  
function RemoveItem(AItem:TNTFSDiskItem):Boolean;  
function MoveItem(AItem:TNTFSDiskItem; AAttribute:TNTFSDiskAttribute):Boolean;  
function RenameItem(AItem:TNTFSDiskItem; AAttribute:TNTFSDiskAttribute):Boolean;  
 
function CreateIndex(AVersion,ASector:Word):Boolean; virtual;  
function NewIndex(AVersion,ASector:Word; AType,ARule,ASize,AOffset:LongWord):Boolean; virtual;  
 
function RecordNumber:Int64;  
function FileReference:Int64;  
function BaseReference:Int64;  
 
function RunOffset:Word; Offset to the Data Run
function DataOffset:Word; Offset to the Attribute Data
function AttributeNameSize:Word;  
function AttributeNameLength:Byte; Name length
function AttributeNameOffset:Word; Offset to the Name
 
function RunCount:LongWord;  
function ItemCount:LongWord;  
 
function CalculatedSize(AVersion:Word):LongWord; virtual;  
function CalculatedDataSize(AVersion:Word):LongWord; virtual;  
function CalculatedStreamSize(AVersion:Word):Int64; virtual;  
function CalculatedStreamUsed(AVersion:Word):Int64; virtual;  
 
function CoalesceRun(ARun:TNTFSDiskRun):Boolean;  
 
function UpdateRun(ARun:TNTFSDiskRun):Boolean;  
function UpdateKey(AKey:TNTFSDiskKey):Boolean; virtual;  
function UpdateItem(AItem:TNTFSDiskItem):Boolean; virtual;  
function UpdateEntry(AEntry:TNTFSDiskEntry):Boolean; virtual;  
function UpdateAttribute(AEntry:TNTFSDiskEntry):Boolean; virtual;  
 
function ReadRuns(ABuffer:Pointer; var AOffset:LongWord; AVersion:Word):Boolean;  
function WriteRuns(ABuffer:Pointer; var AOffset:LongWord; AVersion:Word):Boolean;  
 
function ReadItems(ABuffer:Pointer; var AOffset,ASize:LongWord; AVersion:Word):Boolean;  
function WriteItems(ABuffer:Pointer; var AOffset,ASize:LongWord; AVersion:Word):Boolean;  
 
function ReadData(ABuffer:Pointer; var AOffset:LongWord; AVersion:Word):Boolean; virtual;  
function WriteData(ABuffer:Pointer; var AOffset:LongWord; AVersion:Word):Boolean; virtual;  
 
function ReadAttribute(ABuffer:Pointer; var AOffset,ASize:LongWord; AVersion:Word):Boolean; virtual;  
function WriteAttribute(ABuffer:Pointer; var AOffset,ASize:LongWord; AVersion:Word):Boolean; virtual;  


Function declarations



constructor TNTFSDiskAttribute.Create(ALocalLock:TMutexHandle; AParent:TNTFSDiskRecord);
Description: To be documented
Note None documented


destructor TNTFSDiskAttribute.Destroy;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.AcquireLock:Boolean;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.ReleaseLock:Boolean;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetRunsLock:TSynchronizerHandle;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetItemsLock:TSynchronizerHandle;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetIndexLock:TSynchronizerHandle;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetExtendedsLock:TSynchronizerHandle;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetRunLocal:TMutexHandle;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetItemLocal:TMutexHandle;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetKeyLocal:TMutexHandle;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetExtendedLocal:TMutexHandle;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetUpdating:Boolean;
Description: To be documented
Note None documented


procedure TNTFSDiskAttribute.SetUpdating(AValue:Boolean);
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetIsFixed:Boolean;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetIsSingle:Boolean;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetIsUnlisted:Boolean;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetIsUnmovable:Boolean;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetIsManaged:Boolean;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetIsSparse:Boolean;
Description: To be documented
Note None documented


procedure TNTFSDiskAttribute.SetIsSparse(AValue:Boolean);
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetIsEncrypted:Boolean;
Description: To be documented
Note None documented


procedure TNTFSDiskAttribute.SetIsEncrypted(AValue:Boolean);
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetIsCompressed:Boolean;
Description: To be documented
Note None documented


procedure TNTFSDiskAttribute.SetIsCompressed(AValue:Boolean);
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetAttributeName:String;
Description: To be documented
Note None documented


procedure TNTFSDiskAttribute.SetAttributeName(const AAttributeName:String);
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetDataSize:LongWord;
Description: To be documented
Note None documented


procedure TNTFSDiskAttribute.SetDataSize(AValue:LongWord);
Description: To be documented
Note None documented


function TNTFSDiskAttribute.Compare(AAttribute:TNTFSDiskAttribute):Integer;
Description: Compare attribute by type, name and vcn for sort order
Note The passed attribute is the first value in a standard compare

Id is not used for sort order as it is unique per file record
Name is compared using a case insensitive compare method


function TNTFSDiskAttribute.CreateRuns(ANew:Boolean):TNTFSDiskRuns;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.CreateItems(ANew:Boolean):TNTFSDiskItems;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.GetRecord(AInstance:Integer):TNTFSDiskRecord;
Description: Used by TNTFSDiskRecord.GetRecord methods to enumerate records within a list
Note None documented


function TNTFSDiskAttribute.GetAttribute(AType:LongWord; const AName:String; AInstance:Integer):TNTFSDiskAttribute;
Description: Used by TNTFSDiskRecord.GetAttribute methods to enumerate attributes within a list
Note None documented


function TNTFSDiskAttribute.GetRunCount(const AVCN:Int64; var AStartVCN,ACount:Int64):Boolean;
Description: Get the count of clusters from the supplied VCN to the end of the attributes runs
Note StartVCN will be the start of the run containing the VCN


function TNTFSDiskAttribute.GetRunLength(const AVCN:Int64; var AStartVCN,ALength:Int64):Boolean;
Description: Get the count of clusters from the supplied VCN to the end of run containing the VCN
Note StartVCN will be the start of the run containing the VCN


function TNTFSDiskAttribute.GetRunByUnit(const AUnit:Int64; var AStartVCN:Int64):TNTFSDiskRun;
Description: Get the run containing the supplied compression unit
Note StartVCN will be the start of the run, not neccessarily the start of the unit.

This will only work on the first instance


function TNTFSDiskAttribute.GetRunByCluster(const ACluster:Int64; var AStartVCN:Int64):TNTFSDiskRun;
Description: Get the run containing the supplied cluster
Note Not Required for FileSystem, may be used by Defragger


function TNTFSDiskAttribute.CreateRun(ANew:Boolean):TNTFSDiskRun;
Description: Create a run, add to list do not update attribute
Note None documented


function TNTFSDiskAttribute.DestroyRun(ARun:TNTFSDiskRun):Boolean;
Description: Remove the run from the list and free, do not update attribute
Note None documented


function TNTFSDiskAttribute.NewRun(const AStart,ALength:Int64):TNTFSDiskRun;
Description: Create a run, insert in list and update attribute
Note None documented


function TNTFSDiskAttribute.InsertRun(APrev:TNTFSDiskRun; const AStart,ALength:Int64):TNTFSDiskRun;
Description: Create a run, insert in list and update attribute
Note None documented


function TNTFSDiskAttribute.GetRun(const AVCN:Int64; var AStartVCN:Int64):TNTFSDiskRun;
Description: Get the run containing the supplied VCN
Note None documented


function TNTFSDiskAttribute.GetRunOld(const AVCN:Int64; var AStartVCN:Int64):TNTFSDiskRun;
Description: Get the run containing the supplied VCN
Note None documented


function TNTFSDiskAttribute.MergeRun(ARun:TNTFSDiskRun):Boolean;
Description: Merge the run with the next run in the list and delete the merged run
Note If supplied run is normal then next run must be contiguous or merge will fail

If supplied run is sparse then next run must also be sparse or merge will fail


function TNTFSDiskAttribute.SplitRun(ARun:TNTFSDiskRun; const ALength:Int64):Boolean;
Description: Split the run at the supplied length and insert a new run in the list
Note New run will be inserted as the next run following the supplied run

Supplied run can be either normal or sparse


function TNTFSDiskAttribute.RemoveRun(ARun:TNTFSDiskRun):Boolean;
Description: Remove the run from the list, free and update attribute
Note Run must be the last actual run (not Last)


function TNTFSDiskAttribute.MoveRun(ADest:TNTFSDiskAttribute; ARun:TNTFSDiskRun):Boolean;
Description: Remove the run from the list and insert in the list of passed attribute
Note Run must be the last actual run (not Last)

Run will be inserted first in the destination


function TNTFSDiskAttribute.GetItemByAttribute(AAttribute:TNTFSDiskAttribute):TNTFSDiskItem;
Description: Get the item which references the supplied attribute
Note None documented


function TNTFSDiskAttribute.CreateItem(ANew:Boolean):TNTFSDiskItem;
Description: Create an item, add to end of list do not update attribute
Note None documented


function TNTFSDiskAttribute.DestroyItem(AItem:TNTFSDiskItem):Boolean;
Description: Remove the item from the list and free, do not update attribute
Note None documented


function TNTFSDiskAttribute.NewItem(AAttribute:TNTFSDiskAttribute):TNTFSDiskItem;
Description: Create an item, insert in sorted list and update attribute
Note None documented


function TNTFSDiskAttribute.GetItem(AType:LongWord; const AName:String; AInstance:Integer):TNTFSDiskItem;
Description: Get an item by type, name and instance
Note None documented


function TNTFSDiskAttribute.RemoveItem(AItem:TNTFSDiskItem):Boolean;
Description: Remove the item from the list, free and update attribute
Note None documented


function TNTFSDiskAttribute.MoveItem(AItem:TNTFSDiskItem; AAttribute:TNTFSDiskAttribute):Boolean;
Description: Remove the item from the list and reinsert with the new parent reference
Note None documented


function TNTFSDiskAttribute.RenameItem(AItem:TNTFSDiskItem; AAttribute:TNTFSDiskAttribute):Boolean;
Description: Remove the item from the list and reinsert with the new name
Note None documented


function TNTFSDiskAttribute.CreateIndex(AVersion,ASector:Word):Boolean;
Description: Create an index, setup properties do not update attribute
Note None documented


function TNTFSDiskAttribute.NewIndex(AVersion,ASector:Word; AType,ARule,ASize,AOffset:LongWord):Boolean;
Description: Create an index, setup properties and update attribute
Note None documented


function TNTFSDiskAttribute.RecordNumber:Int64;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.FileReference:Int64;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.BaseReference:Int64;
Description: Returns parent reference when no base record is assigned (ie parent record is the base)
Note None documented


function TNTFSDiskAttribute.RunOffset:Word;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.DataOffset:Word;
Description: Data Offset is supplied even if no data exists
Note None documented


function TNTFSDiskAttribute.AttributeNameSize:Word;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.AttributeNameLength:Byte;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.AttributeNameOffset:Word;
Description: Name Offset is supplied even if no name exists
Note None documented


function TNTFSDiskAttribute.RunCount:LongWord;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.ItemCount:LongWord;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.CalculatedSize(AVersion:Word):LongWord;
Description: To be documented
Note Calculated Size includes any rounding required for alignment


function TNTFSDiskAttribute.CalculatedDataSize(AVersion:Word):LongWord;
Description: Calculated Data Size is the actual size of the data following the attribute header
Note This will be the Data Size for Resident and the Run Size for Non Resident but may be overridden by descendants

Size Attribute will use this value to update the Attribute and Record Sizes


function TNTFSDiskAttribute.CalculatedStreamSize(AVersion:Word):Int64;
Description: Calculated Stream Size is the actual size of the data stream of the attribute
Note This will be the Data Size value for Resident, and the Stream Size value for Non Resident but may be overridden by descendants.

This is the value that should be passed to Size Attribute


function TNTFSDiskAttribute.CalculatedStreamUsed(AVersion:Word):Int64;
Description: Calculated Stream Used is the actual allocated size of the data stream in a compressed attribute
Note This will be the same as the Data Size value for Resident but will be the total allocated runs (Non Sparse) for Non Resident

Size Attribute will use this value to update Stream Used


function TNTFSDiskAttribute.CoalesceRun(ARun:TNTFSDiskRun):Boolean;
Description: Coalesce all runs in the list starting at the supplied run or first if not supplied
Note None documented


function TNTFSDiskAttribute.UpdateRun(ARun:TNTFSDiskRun):Boolean;
Description: Update all runs in the list starting at the supplied run or first if not supplied
Note None documented


function TNTFSDiskAttribute.UpdateKey(AKey:TNTFSDiskKey):Boolean;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.UpdateItem(AItem:TNTFSDiskItem):Boolean;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.UpdateEntry(AEntry:TNTFSDiskEntry):Boolean;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.UpdateAttribute(AEntry:TNTFSDiskEntry):Boolean;
Description: To be documented
Note None documented


function TNTFSDiskAttribute.ReadRuns(ABuffer:Pointer; var AOffset:LongWord; AVersion:Word):Boolean;
Description: Read the attribute data runs from the supplied buffer at the supplied offset
Note None documented


function TNTFSDiskAttribute.WriteRuns(ABuffer:Pointer; var AOffset:LongWord; AVersion:Word):Boolean;
Description: Write the attribute data runs to the supplied buffer at the supplied offset
Note None documented


function TNTFSDiskAttribute.ReadItems(ABuffer:Pointer; var AOffset,ASize:LongWord; AVersion:Word):Boolean;
Description: Read the attribute data items from the supplied buffer at the supplied offset
Note None documented


function TNTFSDiskAttribute.WriteItems(ABuffer:Pointer; var AOffset,ASize:LongWord; AVersion:Word):Boolean;
Description: Write the attribute data items to the supplied buffer at the supplied offset
Note None documented


function TNTFSDiskAttribute.ReadData(ABuffer:Pointer; var AOffset:LongWord; AVersion:Word):Boolean;
Description: Read the resident attribute data from the supplied buffer at the supplied offset
Note None documented


function TNTFSDiskAttribute.WriteData(ABuffer:Pointer; var AOffset:LongWord; AVersion:Word):Boolean;
Description: Write the resident attribute data to the supplied buffer at the supplied offset
Note None documented


function TNTFSDiskAttribute.ReadAttribute(ABuffer:Pointer; var AOffset,ASize:LongWord; AVersion:Word):Boolean;
Description: Read the attribute header and resident attribute data or data runs from the supplied buffer at the supplied offset
Note None documented


function TNTFSDiskAttribute.WriteAttribute(ABuffer:Pointer; var AOffset,ASize:LongWord; AVersion:Word):Boolean;
Description: Write the attribute header and resident attribute data or data runs to the supplied buffer at the supplied offset
Note None documented


Return to Unit Reference