TAcceleratorsResource

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Accelerator table resource type

Declaration

Source position: acceleratorsresource.pp line 45

type TAcceleratorsResource = class(TAbstractResource)
protected
function GetType; override;
function GetName; override;
function ChangeDescTypeAllowed(); override;
function ChangeDescValueAllowed(); override;
procedure NotifyResourcesLoaded; override;
public
constructor Create(); | Creates a new accelerator table resource
destructor Destroy; override;
procedure UpdateRawData; override;
procedure Add(); | Adds a new accelerator to the table
procedure Clear; | Empties the accelerator table
procedure Delete(); | Deletes an accelerator from the table
property Count: Integer; [r] | The number of accelerators in the table
property Items []: TAccelerator; default; [rw] | Indexed array of accelerators in the table
end;

Inheritance

TAcceleratorsResource | Accelerator table resource type
|
TAbstractResource | Base abstract resource class
|
TObject

Description

This class represents a resource of type RT_ACCELERATOR.

An accelerator table resource is a collection of accelerators (represented by TAccelerator records).

An accelerator represents a keystroke that can be associated with some action.

This resource type is very Microsoft Windows-specific, so it might not be of interest for many users.

Methods are provided to add, delete and modify single accelerators.

Remark: This class doesn't allow its type to be changed to anything else than RT_ACCELERATOR. Attempts to do so result in a EResourceDescChangeNotAllowedException.
Documentation generated on: Jun 27 2020


TAcceleratorsResource
 | ro | Count
 |  | Items
TAbstractResource
 | ro | _Type
 | ro | Name
 |  | LangID
 | ro | DataSize
 | ro | HeaderSize
 |  | DataVersion
 |  | MemoryFlags
 |  | Version
 |  | Characteristics
 | ro | DataOffset
 |  | CodePage
 | ro | RawData
 |  | CacheData
 | ro | OwnerList
 | ro | Owner


ro | Count (TAcceleratorsResource)
ro | DataOffset (TAbstractResource)
ro | DataSize (TAbstractResource)
 | DataVersion (TAbstractResource)
ro | HeaderSize (TAbstractResource)
 | Items (TAcceleratorsResource)
 | LangID (TAbstractResource)
 | MemoryFlags (TAbstractResource)
ro | Name (TAbstractResource)
ro | Owner (TAbstractResource)
ro | OwnerList (TAbstractResource)
ro | RawData (TAbstractResource)
 | Version (TAbstractResource)
ro |


TAcceleratorsResource
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
 | Create
 | Destroy
 | UpdateRawData
 | Add
 | Clear
 | Delete
TAbstractResource
pt | SetDescOwner
pt | SetOwnerList
pt | SetChildOwner
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
pt | Create
 | Destroy
 | CompareContents
 | UpdateRawData
 | SetCustomRawDataStream


pt | ChangeDescTypeAllowed (TAbstractResource)
pt | ChangeDescTypeAllowed (TAcceleratorsResource)
pt | ChangeDescValueAllowed (TAbstractResource)
pt | ChangeDescValueAllowed (TAcceleratorsResource)
 | Clear (TAcceleratorsResource)
 | CompareContents (TAbstractResource)
pt | Create (TAbstractResource)
 | Create (TAcceleratorsResource)
 | Delete (TAcceleratorsResource)
 | Destroy (TAbstractResource)
 | Destroy (TAcceleratorsResource)
pt | GetName (TAbstractResource)
pt | GetName (TAcceleratorsResource)
pt | GetType (TAbstractResource)
pt | GetType (TAcceleratorsResource)
pt | NotifyResourcesLoaded (TAbstractResource)
pt | NotifyResourcesLoaded (TAcceleratorsResource)
pt | SetChildOwner (TAbstractResource)
 | SetCustomRawDataStream (TAbstractResource)
pt | SetDescOwner (TAbstractResource)
pt |


TAcceleratorsResource

TAbstractResource


TAcceleratorsResource.Add

Adds a new accelerator to the table

Declaration

Source position: acceleratorsresource.pp line 65

public procedure TAcceleratorsResource.Add(

  aItem: TAccelerator

);

Arguments

aItem

The accelerator to add

See also

TAcceleratorsResource.Items

Indexed array of accelerators in the table


TAcceleratorsResource.Clear

Empties the accelerator table

Declaration

Source position: acceleratorsresource.pp line 66

public procedure TAcceleratorsResource.Clear;

See also

TAcceleratorsResource.Items | Indexed array of accelerators in the table
TAcceleratorsResource.Delete | Deletes an accelerator from the table


TAcceleratorsResource.Count

The number of accelerators in the table

Declaration

Source position: acceleratorsresource.pp line 68

public property TAcceleratorsResource.Count : Integer
  read GetCount;

See also

TAcceleratorsResource.Items

Indexed array of accelerators in the table


TAcceleratorsResource.Create

Creates a new accelerator table resource

Declaration

Source position: acceleratorsresource.pp line 61

public constructor TAcceleratorsResource.Create; override;

constructor TAcceleratorsResource.Create(

  aType: TResourceDesc;

  aName: TResourceDesc

); override;

Arguments

aType | Ignored. Can be nil.
aName | The name of the resource

Description

Please note that aType parameter is not used, since this class always uses RT_ACCELERATOR as type.


TAcceleratorsResource.Delete

Deletes an accelerator from the table

Declaration

Source position: acceleratorsresource.pp line 67

public procedure TAcceleratorsResource.Delete(

  aIndex: Integer

);

Arguments

aIndex

The index of the accelerator to delete

See also

TAcceleratorsResource.Items | Indexed array of accelerators in the table
TAcceleratorsResource.Clear | Empties the accelerator table


TAcceleratorsResource.Items

Indexed array of accelerators in the table

Declaration

Source position: acceleratorsresource.pp line 69

public property TAcceleratorsResource.Items[index: Integer] : TAccelerator
  read GetItem
  write SetItem;
  default;

Description

This property can be used to access all accelerators in the object.

Remark: This array is 0-based: valid elements range from 0 to Count-1.
Remark: If you need to access RawData after you added, deleted or modified accelerators, be sure to call UpdateRawData first. This isn't needed however when resource is written to a stream, since TResources takes care of it.

See also

TAcceleratorsResource.Count | The number of accelerators in the table
TAccelerator | A single accelerator entry


TBitmapResource

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Bitmap resource type

Declaration

Source position: bitmapresource.pp line 29

type TBitmapResource = class(TAbstractResource)
protected
function GetType; override;
function GetName; override;
function ChangeDescTypeAllowed(); override;
function ChangeDescValueAllowed(); override;
procedure NotifyResourcesLoaded; override;
public
constructor Create(); | Creates a new bitmap resource
destructor Destroy; override;
procedure UpdateRawData; override;
procedure SetCustomBitmapDataStream(); | Sets a custom stream as the underlying stream for BitmapData
property BitmapData: TStream; [r] | Resource data as a BMP stream
end;

Inheritance

TBitmapResource | Bitmap resource type
|
TAbstractResource | Base abstract resource class
|
TObject

Description

This class represents a resource of type RT_BITMAP.

A bitmap resource contents is very similar to a BMP file. However some differences exists, so RawData is not appropriate if you need to read and write BMP data. Instead, BitmapData property gives access to a BMP file-like stream.

Remark: This class doesn't allow its type to be changed to anything else than RT_BITMAP. Attempts to do so result in a EResourceDescChangeNotAllowedException.

See also

BitmapData | Resource data as a BMP stream
TAbstractResource.RawData | The raw resource data stream


TBitmapResource
 | ro | BitmapData
TAbstractResource
 | ro | _Type
 | ro | Name
 |  | LangID
 | ro | DataSize
 | ro | HeaderSize
 |  | DataVersion
 |  | MemoryFlags
 |  | Version
 |  | Characteristics
 | ro | DataOffset
 |  | CodePage
 | ro | RawData
 |  | CacheData
 | ro | OwnerList
 | ro | Owner


ro | BitmapData (TBitmapResource)
 | CacheData (TAbstractResource)
 | Characteristics (TAbstractResource)
 | CodePage (TAbstractResource)
ro | DataOffset (TAbstractResource)
ro | DataSize (TAbstractResource)
 | DataVersion (TAbstractResource)
ro | HeaderSize (TAbstractResource)
 | LangID (TAbstractResource)
 | MemoryFlags (TAbstractResource)
ro | Name (TAbstractResource)
ro | Owner (TAbstractResource)
ro | OwnerList (TAbstractResource)
ro | RawData (TAbstractResource)
 | Version (TAbstractResource)
ro |


TBitmapResource
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
 | Create
 | Destroy
 | UpdateRawData
 | SetCustomBitmapDataStream
TAbstractResource
pt | SetDescOwner
pt | SetOwnerList
pt | SetChildOwner
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
pt | Create
 | Destroy
 | CompareContents
 | UpdateRawData
 | SetCustomRawDataStream


pt | ChangeDescTypeAllowed (TAbstractResource)
pt | ChangeDescTypeAllowed (TBitmapResource)
pt | ChangeDescValueAllowed (TAbstractResource)
pt | ChangeDescValueAllowed (TBitmapResource)
 | CompareContents (TAbstractResource)
pt | Create (TAbstractResource)
 | Create (TBitmapResource)
 | Destroy (TAbstractResource)
 | Destroy (TBitmapResource)
pt | GetName (TAbstractResource)
pt | GetName (TBitmapResource)
pt | GetType (TAbstractResource)
pt | GetType (TBitmapResource)
pt | NotifyResourcesLoaded (TAbstractResource)
pt | NotifyResourcesLoaded (TBitmapResource)
pt | SetChildOwner (TAbstractResource)
 | SetCustomBitmapDataStream (TBitmapResource)
 | SetCustomRawDataStream (TAbstractResource)
pt | SetDescOwner (TAbstractResource)
pt |


TBitmapResource

TAbstractResource


TBitmapResource.BitmapData

Resource data as a BMP stream

Declaration

Source position: bitmapresource.pp line 47

public property TBitmapResource.BitmapData : TStream
  read GetBitmapData;

Description

BitmapData property gives access to resource data in a BMP file-like stream, unlike RawData.

BitmapData does not create a copy of RawData so memory usage is generally kept limited.

You can also set a custom stream as the underlying stream for BitmapData via SetCustomBitmapDataStream, much like SetCustomRawDataStream does for RawData. This is useful when you want a TBitmapResource to be created from a bmp file for which you have a stream.

Remark: If you need to access RawData after you modified BitmapData, be sure to call UpdateRawData first. This isn't needed however when resource is written to a stream, since TResources takes care of it.

See also

TBitmapResource.SetCustomBitmapDataStream | Sets a custom stream as the underlying stream for BitmapData
TAbstractResource.RawData | The raw resource data stream
TAbstractResource.UpdateRawData | Updates RawData stream.


TBitmapResource.Create

Creates a new bitmap resource

Declaration

Source position: bitmapresource.pp line 42

public constructor TBitmapResource.Create; override;

constructor TBitmapResource.Create(

  aType: TResourceDesc;

  aName: TResourceDesc

); override;

Arguments

aType | Ignored. Can be nil.
aName | The name of the resource

Description

Please note that aType parameter is not used, since this class always uses RT_BITMAP as type.


TBitmapResource.SetCustomBitmapDataStream

Sets a custom stream as the underlying stream for BitmapData

Declaration

Source position: bitmapresource.pp line 46

public procedure TBitmapResource.SetCustomBitmapDataStream(

  aStream: TStream

);

Arguments

aStream

The custom stream to use as the underlying BitmapData stream

Description

This method allows the user to use a custom stream as the underlying stream for BitmapData. This is useful when you want a TBitmapResource to be created from a bmp file for which you have a stream.

Sample code

This code creates a resource containing a bitmap

var
  aName : TResourceDesc;
  aRes : TBitmapResource;
  aFile : TFileStream;
  Resources : TResources;
begin
  Resources:=TResources.Create;
  aName:=TResourceDesc.Create('MYBITMAP');
  aRes:=TBitmapResource.Create(nil,aName); //type is always RT_BITMAP
  aName.Free; //not needed anymore
  aFile:=TFileStream.Create('mybitmap.bmp',fmOpenRead or fmShareDenyNone);
  aRes.SetCustomBitmapDataStream(aFile);
  Resources.Add(aRes);
  Resources.WriteToFile('myresource.res');

  Resources.Free; //it destroys aRes as well.
  aFile.Free;
end;

See also

TBitmapResource.BitmapData | Resource data as a BMP stream
TAbstractResource.UpdateRawData | Updates RawData stream.


TCoffResourceReader

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

COFF resource reader

Declaration

Source position: coffreader.pp line 29

type TCoffResourceReader = class(TAbstractResourceReader)

protected

  function GetExtensions; override;

  function GetDescription; override;

  procedure Load(); override;

  function CheckMagic(); override;

public

  constructor Create; override;

  destructor Destroy; override;

  property MachineType: TCoffMachineType; [r]

The machine type of the object file

end;

Inheritance

TCoffResourceReader | COFF resource reader
|
TAbstractResourceReader | Base abstract resource reader class
|
TObject

Description

This class provides a reader for COFF object files containing resources.

COFF is the file format used by Microsoft Windows object files. Usually resources get stored in a object file that can be given to a linker to produce an executable.

After an object file has been read, MachineType property holds the machine type the object file was built for.

Remark: This reader is not able to read full PE images. Use TWinPEImageResourceReader instead.

See also

TCoffResourceReader.MachineType | The machine type of the object file
TAbstractResourceReader | Base abstract resource reader class
TWinPEImageResourceReader | PE image file resource reader
TCoffResourceWriter | COFF resource writer


TCoffResourceReader
 | ro | MachineType
TAbstractResourceReader
 | ro | Extensions
 | ro | Description


ro | Description (TAbstractResourceReader)
ro | Extensions (TAbstractResourceReader)
ro |


TCoffResourceReader
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create
 | Destroy
TAbstractResourceReader
pt | SetDataSize
pt | SetHeaderSize
pt | SetDataOffset
pt | SetRawData
pt | CallSubReaderLoad
pt | AddNoTree
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create


pt | AddNoTree (TAbstractResourceReader)
pt | CallSubReaderLoad (TAbstractResourceReader)
pt | CheckMagic (TAbstractResourceReader)
pt | CheckMagic (TCoffResourceReader)
 | Create (TAbstractResourceReader)
 | Create (TCoffResourceReader)
 | Destroy (TCoffResourceReader)
pt | GetDescription (TAbstractResourceReader)
pt | GetDescription (TCoffResourceReader)
pt | GetExtensions (TAbstractResourceReader)
pt | GetExtensions (TCoffResourceReader)
pt | GetTree (TAbstractResourceReader)
pt | Load (TAbstractResourceReader)
pt | Load (TCoffResourceReader)
pt | SetDataOffset (TAbstractResourceReader)
pt | SetDataSize (TAbstractResourceReader)
pt | SetHeaderSize (TAbstractResourceReader)
pt |


TCoffResourceReader

TAbstractResourceReader


TCoffResourceReader.Destroy

Declaration

Source position: coffreader.pp line 54

public destructor TCoffResourceReader.Destroy; override;


TCoffResourceReader.MachineType

The machine type of the object file

Declaration

Source position: coffreader.pp line 55

public property TCoffResourceReader.MachineType : TCoffMachineType
  read fMachineType;

Description

This property holds the machine type of the object file that has been read.

Remark: Obviously, this property is meaningful only after an object file has been read.

See also

TCoffMachineType

Enumeration for COFF machine type


TCoffRelocations

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

COFF relocation table

Declaration

Source position: coffwriter.pp line 71

type TCoffRelocations = class

protected

  function GetCount;

  function GetRelocation();

public

  constructor Create();

  destructor Destroy; override;

  procedure Add();

  procedure AddRelativeToSection();

  procedure Clear;

  property Count: Integer; [r]

  property Items []: PCoffRelocation; default; [r]

  property StartAddress: LongWord; [rw]

  property MachineType: TCoffMachineType; [rw]

end;

Inheritance

TCoffRelocations

COFF relocation table
|

TObject

Description

This class is used internally by TCoffResourceWriter.


TCoffRelocations
 | ro | Count
 | ro | Items
 |  | StartAddress
 |  | MachineType


ro | Count (TCoffRelocations)
ro |


TCoffRelocations
pt | GetCount
pt | GetRelocation
 | Create
 | Destroy
 | Add
 | AddRelativeToSection
 | Clear


 | Add (TCoffRelocations)
 | AddRelativeToSection (TCoffRelocations)
 | Clear (TCoffRelocations)
 | Create (TCoffRelocations)
 | Destroy (TCoffRelocations)
pt | GetCount (TCoffRelocations)
pt |


TCoffRelocations


TCoffRelocations.Add

Declaration

Source position: coffwriter.pp line 82

public procedure TCoffRelocations.Add(

  aAddress: LongWord;

  aType: Word;

  aSymTableIndex: LongWord

);


TCoffRelocations.AddRelativeToSection

Declaration

Source position: coffwriter.pp line 83

public procedure TCoffRelocations.AddRelativeToSection(

  aAddress: LongWord;

  aSectSymTableIndex: LongWord

);


TCoffRelocations.Clear

Declaration

Source position: coffwriter.pp line 84

public procedure TCoffRelocations.Clear;


TCoffRelocations.Count

Declaration

Source position: coffwriter.pp line 85

public property TCoffRelocations.Count : Integer
  read GetCount;


TCoffRelocations.Create

Declaration

Source position: coffwriter.pp line 80

public constructor TCoffRelocations.Create(

  aMachineType: TCoffMachineType

);


TCoffRelocations.Destroy

Declaration

Source position: coffwriter.pp line 81

public destructor TCoffRelocations.Destroy; override;


TCoffRelocations.GetCount

Declaration

Source position: coffwriter.pp line 77

protected function TCoffRelocations.GetCount: Integer;


TCoffRelocations.GetRelocation

Declaration

Source position: coffwriter.pp line 78

protected function TCoffRelocations.GetRelocation(

  index: Integer

):PCoffRelocation;


TCoffRelocations.Items

Declaration

Source position: coffwriter.pp line 86

public property TCoffRelocations.Items[index: Integer] : PCoffRelocation
  read GetRelocation;
  default;


TCoffRelocations.MachineType

Declaration

Source position: coffwriter.pp line 88

public property TCoffRelocations.MachineType : TCoffMachineType
  read fMachineType
  write fMachineType;


TCoffRelocations.StartAddress

Declaration

Source position: coffwriter.pp line 87

public property TCoffRelocations.StartAddress : LongWord
  read fStartAddress
  write fStartAddress;


TCoffResourceWriter

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

COFF resource writer

Declaration

Source position: coffwriter.pp line 93

type TCoffResourceWriter = class(TAbstractResourceWriter)

protected

  fRoot: TRootResTreeNode;

  fRelocations: TCoffRelocations;

  fResDataSectionSymIdx: Word;

  fResHandlesSectionSymIdx: Word;

  fResDataEntryCurrentRVA: LongWord;

  fSymTablePtr: LongWord;

  fStringTable: TCoffStringTable;

  fNumSymtableEntries: LongWord;

  fSymStorageClass: Byte;

  fOppositeEndianess: Boolean;

  procedure WriteEmptyCoffHeader();

  procedure WriteEmptySectionHeader(); virtual;

  procedure WriteResStringTable(); virtual;

  procedure WriteRawData();

  procedure WriteRelocations();

  procedure WriteCoffStringTable();

  function GetFixedCoffHeader; virtual;

  procedure FixCoffHeader();

  procedure FixSectionHeader(); virtual;

  function GetExtensions; override;

  function GetDescription; override;

  function PrescanNode(); virtual;

  procedure PrescanResourceTree; virtual;

  procedure Write(); override;

  procedure WriteSymbolTable(); virtual;

public

  constructor Create; override;

  destructor Destroy; override;

  property MachineType: TCoffMachineType; [rw]

The machine type of the object file

  property OppositeEndianess: Boolean; [rw]

end;

Inheritance

TCoffResourceWriter | COFF resource writer
|
TAbstractResourceWriter | Base abstract resource writer class
|
TObject

Description

This class provides a writer for COFF object files containing resources.

COFF is the file format used by Microsoft Windows object files. Usually resources get stored in a object file that can be given to a linker to produce an executable.

MachineType property can be used to set the machine type of the object file to generate.

See also

TCoffResourceWriter.MachineType | The machine type of the object file
TAbstractResourceWriter | Base abstract resource writer class
TCoffResourceWriter | COFF resource reader


TCoffResourceWriter
 |  | MachineType
 |  | OppositeEndianess
TAbstractResourceWriter
 | ro | Extensions
 | ro | Description


ro | Description (TAbstractResourceWriter)
ro |


TCoffResourceWriter
pt | WriteEmptyCoffHeader
pt | WriteEmptySectionHeader
pt | WriteResStringTable
pt | WriteRawData
pt | WriteRelocations
pt | WriteCoffStringTable
pt | GetFixedCoffHeader
pt | FixCoffHeader
pt | FixSectionHeader
pt | GetExtensions
pt | GetDescription
pt | PrescanNode
pt | PrescanResourceTree
pt | Write
pt | WriteSymbolTable
 | Create
 | Destroy
TAbstractResourceWriter
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Write
 | Create


pt | FixCoffHeader (TCoffResourceWriter)
pt | FixSectionHeader (TCoffResourceWriter)
pt | GetDescription (TAbstractResourceWriter)
pt | GetDescription (TCoffResourceWriter)
pt | GetExtensions (TAbstractResourceWriter)
pt | GetExtensions (TCoffResourceWriter)
pt | GetFixedCoffHeader (TCoffResourceWriter)
pt | GetTree (TAbstractResourceWriter)
pt | PrescanNode (TCoffResourceWriter)
pt | PrescanResourceTree (TCoffResourceWriter)
pt | Write (TAbstractResourceWriter)
pt | Write (TCoffResourceWriter)
pt | WriteCoffStringTable (TCoffResourceWriter)
pt | WriteEmptyCoffHeader (TCoffResourceWriter)
pt | WriteEmptySectionHeader (TCoffResourceWriter)
pt | WriteRawData (TCoffResourceWriter)
pt | WriteRelocations (TCoffResourceWriter)
pt | WriteResStringTable (TCoffResourceWriter)
pt |


TCoffResourceWriter

TAbstractResourceWriter


TCoffResourceWriter.Destroy

Declaration

Source position: coffwriter.pp line 140

public destructor TCoffResourceWriter.Destroy; override;


TCoffResourceWriter.FixCoffHeader

Declaration

Source position: coffwriter.pp line 130

protected procedure TCoffResourceWriter.FixCoffHeader(

  aStream: TStream

);


TCoffResourceWriter.FixSectionHeader

Declaration

Source position: coffwriter.pp line 131

protected procedure TCoffResourceWriter.FixSectionHeader(

  aStream: TStream;

  aResources: TResources

); virtual;


TCoffResourceWriter.fNumSymtableEntries

Declaration

Source position: coffwriter.pp line 120

protected TCoffResourceWriter.fNumSymtableEntries : LongWord;


TCoffResourceWriter.fOppositeEndianess

Declaration

Source position: coffwriter.pp line 122

protected TCoffResourceWriter.fOppositeEndianess : Boolean;


TCoffResourceWriter.fRelocations

Declaration

Source position: coffwriter.pp line 114

protected TCoffResourceWriter.fRelocations : TCoffRelocations;


TCoffResourceWriter.fResDataEntryCurrentRVA

Declaration

Source position: coffwriter.pp line 117

protected TCoffResourceWriter.fResDataEntryCurrentRVA : LongWord;


TCoffResourceWriter.fResDataSectionSymIdx

Declaration

Source position: coffwriter.pp line 115

protected TCoffResourceWriter.fResDataSectionSymIdx : Word;


TCoffResourceWriter.fResHandlesSectionSymIdx

Declaration

Source position: coffwriter.pp line 116

protected TCoffResourceWriter.fResHandlesSectionSymIdx : Word;


TCoffResourceWriter.fRoot

Declaration

Source position: coffwriter.pp line 113

protected TCoffResourceWriter.fRoot : TRootResTreeNode;


TCoffResourceWriter.fStringTable

Declaration

Source position: coffwriter.pp line 119

protected TCoffResourceWriter.fStringTable : TCoffStringTable;


TCoffResourceWriter.fSymStorageClass

Declaration

Source position: coffwriter.pp line 121

protected TCoffResourceWriter.fSymStorageClass : Byte;


TCoffResourceWriter.fSymTablePtr

Declaration

Source position: coffwriter.pp line 118

protected TCoffResourceWriter.fSymTablePtr : LongWord;


TCoffResourceWriter.GetFixedCoffHeader

Declaration

Source position: coffwriter.pp line 129

protected function TCoffResourceWriter.GetFixedCoffHeader: TCoffHeader; virtual;


TCoffResourceWriter.MachineType

The machine type of the object file

Declaration

Source position: coffwriter.pp line 141

public property TCoffResourceWriter.MachineType : TCoffMachineType
  read fMachineType
  write SetMachineType;

Description

This property can be used to set the machine type of the object file to write.

See also

TCoffMachineType

Enumeration for COFF machine type


TCoffResourceWriter.OppositeEndianess

Declaration

Source position: coffwriter.pp line 142

public property TCoffResourceWriter.OppositeEndianess : Boolean
  read fOppositeEndianess
  write fOppositeEndianess;


TCoffResourceWriter.PrescanNode

Declaration

Source position: coffwriter.pp line 134

protected function TCoffResourceWriter.PrescanNode(

  aNode: TResourceTreeNode;

  aNodeSize: LongWord

):LongWord; virtual;


TCoffResourceWriter.PrescanResourceTree

Declaration

Source position: coffwriter.pp line 135

protected procedure TCoffResourceWriter.PrescanResourceTree; virtual;


TCoffResourceWriter.WriteCoffStringTable

Declaration

Source position: coffwriter.pp line 128

protected procedure TCoffResourceWriter.WriteCoffStringTable(

  aStream: TStream

);


TCoffResourceWriter.WriteEmptyCoffHeader

Declaration

Source position: coffwriter.pp line 123

protected procedure TCoffResourceWriter.WriteEmptyCoffHeader(

  aStream: TStream

);


TCoffResourceWriter.WriteEmptySectionHeader

Declaration

Source position: coffwriter.pp line 124

protected procedure TCoffResourceWriter.WriteEmptySectionHeader(

  aStream: TStream

); virtual;


TCoffResourceWriter.WriteRawData

Declaration

Source position: coffwriter.pp line 126

protected procedure TCoffResourceWriter.WriteRawData(

  aStream: TStream

);


TCoffResourceWriter.WriteRelocations

Declaration

Source position: coffwriter.pp line 127

protected procedure TCoffResourceWriter.WriteRelocations(

  aStream: TStream

);


TCoffResourceWriter.WriteResStringTable

Declaration

Source position: coffwriter.pp line 125

protected procedure TCoffResourceWriter.WriteResStringTable(

  aStream: TStream

); virtual;


TCoffResourceWriter.WriteSymbolTable

Declaration

Source position: coffwriter.pp line 137

protected procedure TCoffResourceWriter.WriteSymbolTable(

  aStream: TStream;

  aResources: TResources

); virtual;


TCoffStringTable

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Declaration

Source position: coffwriter.pp line 29

type TCoffStringTable = class(TStringList)

public

  constructor Create;

  function Add(); override;

  procedure Delete(); override;

  property Size: ptruint; [r]

end;

Inheritance

TCoffStringTable
|

TStringList
|

TStrings
|

TPersistent,IFPObserved
|

TObject


TCoffStringTable
 | ro | Size
TStringList
 |  | Duplicates
 |  | Sorted
 |  | CaseSensitive
 |  | OwnsObjects
 |  | SortStyle
TStrings
 | ro | UpdateCount
 |  | AlwaysQuote
 |  | Capacity
 |  | CommaText
 | ro | Count
 |  | DefaultEncoding
 |  | DelimitedText
 |  | Delimiter
 | ro | Encoding
 |  | LineBreak
 |  | MissingNameValueSeparatorAction
 | ro | Names
 |  | NameValueSeparator
 |  | Objects
 |  | Options
 |  | QuoteChar
 |  | SkipLastLineBreak
 |  | TrailingLineBreak
 |  | StrictDelimiter
 |  | Strings
 |  | StringsAdapter
 |  | Text
 |  | TextLineBreakStyle
 |  | UseLocale
 |  | ValueFromIndex
 |  | Values
 |  | WriteBOM
TPersistent


 | AlwaysQuote (TStrings)
 | Capacity (TStrings)
 | CaseSensitive (TStringList)
 | CommaText (TStrings)
ro | Count (TStrings)
 | DefaultEncoding (TStrings)
 | DelimitedText (TStrings)
 | Delimiter (TStrings)
 | Duplicates (TStringList)
ro | Encoding (TStrings)
 | LineBreak (TStrings)
 | MissingNameValueSeparatorAction (TStrings)
ro | Names (TStrings)
 | NameValueSeparator (TStrings)
 | Objects (TStrings)
 | Options (TStrings)
 | OwnsObjects (TStringList)
 | QuoteChar (TStrings)
ro | Size (TCoffStringTable)
 | SkipLastLineBreak (TStrings)
 | Sorted (TStringList)
 | SortStyle (TStringList)
 | StrictDelimiter (TStrings)
 | Strings (TStrings)
 | StringsAdapter (TStrings)
 | Text (TStrings)
 | TextLineBreakStyle (TStrings)
 | TrailingLineBreak (TStrings)
ro | UpdateCount (TStrings)
 | UseLocale (TStrings)
 | ValueFromIndex (TStrings)
 | Values (TStrings)
 | WriteBOM (TStrings)


TCoffStringTable
 | Create
 | Add
 | Delete
TStringList
 | ExchangeItemsInt
 | GetSorted
 | Grow
 | InternalClear
 | QuickSort
 | SetSorted
 | SetCaseSensitive
 | SetSortStyle
 | CheckIndex
 | ExchangeItems
 | Changed
 | Changing
 | Get
 | GetCapacity
 | GetCount
 | GetObject
 | Put
 | PutObject
 | SetCapacity
 | SetUpdateState
 | InsertItem
 | DoCompareText
 | Destroy
 | Add
 | Clear
 | Delete
 | Exchange
 | Find
 | IndexOf
 | Insert
 | Sort
 | CustomSort
TStrings
 | GetCommaText
 | GetLineBreakCharLBS
 | GetMissingNameValueSeparatorAction
 | GetName
 | GetStrictDelimiter
 | GetTrailingLineBreak
 | GetUseLocale
 | GetValue
 | GetWriteBOM
 | GetLBS
 | SetDefaultEncoding
 | SetEncoding
 | SetLBS
 | ReadData
 | SetCommaText
 | SetMissingNameValueSeparatorAction
 | SetStringsAdapter
 | SetStrictDelimiter
 | SetTrailingLineBreak
 | SetUseLocale
 | SetWriteBOM
 | SetValue
 | SetDelimiter
 | SetQuoteChar
 | SetNameValueSeparator
 | WriteData
 | DoSetTextStr
 | GetDelimiter
 | GetNameValueSeparator
 | GetQuoteChar
 | GetLineBreak
 | SetLineBreak
 | GetSkipLastLineBreak
 | SetSkipLastLineBreak
 | DoSetDelimitedText
 | CompareStrings
 | DefineProperties
 | Error
 | Get
 | GetCapacity
 | GetCount
 | GetObject
 | GetTextStr
 | Put
 | PutObject
 | SetCapacity
 | SetTextStr
 | SetUpdateState
 | DoCompareText
 | GetDelimitedText
 | SetDelimitedText
 | GetValueFromIndex
 | SetValueFromIndex
 | CheckSpecialChars
 | GetNextLine
 | GetNextLinebreak
 | Create
 | Destroy
 | ToObjectArray
 | ToStringArray
 | Add
 | AddObject
 | AddPair
 | AddStrings
 | SetStrings
 | AddText
 | AddCommaText
 | AddDelimitedtext
 | Append
 | Assign
 | BeginUpdate
 | Clear
 | Delete
 | EndUpdate
 | Equals
 | Exchange
 | ExtractName
 | Filter
 | Fill
 | ForEach
 | GetEnumerator
 | GetNameValue
 | GetText
 | IndexOf
 | IndexOfName
 | IndexOfObject
 | Insert
 | InsertObject
 | LastIndexOf
 | LoadFromFile
 | LoadFromStream
 | Map
 | Move
 | Pop
 | Reduce
 | Reverse
 | SaveToFile
 | SaveToStream
 | Shift
 | Slice
 | SetText
TPersistent
 | AssignError
 | AssignTo
 | DefineProperties
 | GetOwner
 | Destroy
 | Assign
 | FPOAttachObserver
 | FPODetachObserver
 | FPONotifyObservers
 | GetNamePath


Add (TStrings)

Add (TStringList)

Add (TCoffStringTable)

AddCommaText (TStrings)

AddDelimitedtext (TStrings)

AddObject (TStrings)

AddPair (TStrings)

AddStrings (TStrings)

AddText (TStrings)

Append (TStrings)

Assign (TPersistent)

Assign (TStrings)

AssignError (TPersistent)

AssignTo (TPersistent)

BeginUpdate (TStrings)

Changed (TStringList)

Changing (TStringList)

CheckIndex (TStringList)

CheckSpecialChars (TStrings)

Clear (TStrings)

Clear (TStringList)

CompareStrings (TStrings)

Create (TStrings)

Create (TCoffStringTable)

CustomSort (TStringList)

DefineProperties (TPersistent)

DefineProperties (TStrings)

Delete (TStrings)

Delete (TStringList)

Delete (TCoffStringTable)

Destroy (TPersistent)

Destroy (TStrings)

Destroy (TStringList)

DoCompareText (TStrings)

DoCompareText (TStringList)

DoSetDelimitedText (TStrings)

DoSetTextStr (TStrings)

EndUpdate (TStrings)

Equals (TStrings)

Error (TStrings)

Exchange (TStrings)

Exchange (TStringList)

ExchangeItems (TStringList)

ExchangeItemsInt (TStringList)

ExtractName (TStrings)

Fill (TStrings)

Filter (TStrings)

Find (TStringList)

ForEach (TStrings)

FPOAttachObserver (TPersistent)

FPODetachObserver (TPersistent)

FPONotifyObservers (TPersistent)

Get (TStrings)

Get (TStringList)

GetCapacity (TStrings)

GetCapacity (TStringList)

GetCommaText (TStrings)

GetCount (TStrings)

GetCount (TStringList)

GetDelimitedText (TStrings)

GetDelimiter (TStrings)

GetEnumerator (TStrings)

GetLBS (TStrings)

GetLineBreak (TStrings)

GetLineBreakCharLBS (TStrings)

GetMissingNameValueSeparatorAction (TStrings)

GetName (TStrings)

GetNamePath (TPersistent)

GetNameValue (TStrings)

GetNameValueSeparator (TStrings)

GetNextLine (TStrings)

GetNextLinebreak (TStrings)

GetObject (TStrings)

GetObject (TStringList)

GetOwner (TPersistent)

GetQuoteChar (TStrings)

GetSkipLastLineBreak (TStrings)

GetSorted (TStringList)

GetStrictDelimiter (TStrings)

GetText (TStrings)

GetTextStr (TStrings)

GetTrailingLineBreak (TStrings)

GetUseLocale (TStrings)

GetValue (TStrings)

GetValueFromIndex (TStrings)

GetWriteBOM (TStrings)

Grow (TStringList)

IndexOf (TStrings)

IndexOf (TStringList)

IndexOfName (TStrings)

IndexOfObject (TStrings)

Insert (TStrings)

Insert (TStringList)

InsertItem (TStringList)

InsertObject (TStrings)

InternalClear (TStringList)

LastIndexOf (TStrings)

LoadFromFile (TStrings)

LoadFromStream (TStrings)

Map (TStrings)

Move (TStrings)

Pop (TStrings)

Put (TStrings)

Put (TStringList)

PutObject (TStrings)

PutObject (TStringList)

QuickSort (TStringList)

ReadData (TStrings)

Reduce (TStrings)

Reverse (TStrings)

SaveToFile (TStrings)

SaveToStream (TStrings)

SetCapacity (TStrings)

SetCapacity (TStringList)

SetCaseSensitive (TStringList)

SetCommaText (TStrings)

SetDefaultEncoding (TStrings)

SetDelimitedText (TStrings)

SetDelimiter (TStrings)

SetEncoding (TStrings)

SetLBS (TStrings)

SetLineBreak (TStrings)

SetMissingNameValueSeparatorAction (TStrings)

SetNameValueSeparator (TStrings)

SetQuoteChar (TStrings)

SetSkipLastLineBreak (TStrings)

SetSorted (TStringList)

SetSortStyle (TStringList)

SetStrictDelimiter (TStrings)

SetStrings (TStrings)

SetStringsAdapter (TStrings)

SetText (TStrings)

SetTextStr (TStrings)

SetTrailingLineBreak (TStrings)

SetUpdateState (TStrings)

SetUpdateState (TStringList)

SetUseLocale (TStrings)

SetValue (TStrings)

SetValueFromIndex (TStrings)

SetWriteBOM (TStrings)

Shift (TStrings)

Slice (TStrings)

Sort (TStringList)

ToObjectArray (TStrings)

ToStringArray (TStrings)

WriteData (TStrings)


TCoffStringTable
TStringList
 | OnChange
 | OnChanging
TStrings
TPersistent


OnChange (TStringList)

OnChanging (TStringList)


TCoffStringTable.Add

Declaration

Source position: coffwriter.pp line 34

public function TCoffStringTable.Add(

  const S: string

):Integer; override;


TCoffStringTable.Create

Declaration

Source position: coffwriter.pp line 33

public constructor TCoffStringTable.Create;


TCoffStringTable.Delete

Declaration

Source position: coffwriter.pp line 35

public procedure TCoffStringTable.Delete(

  Index: Integer

); override;


TCoffStringTable.Size

Declaration

Source position: coffwriter.pp line 36

public property TCoffStringTable.Size : ptruint
  read fSize;


TResourceStringTable

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

COFF resource string table

Declaration

Source position: coffwriter.pp line 41

type TResourceStringTable = class

public

  constructor Create;

  destructor Destroy; override;

  procedure Add();

  procedure Clear;

  property Count: Integer; [r]

  property Items []: string; default; [r]

  property StartRVA: LongWord; [rw]

  property CurrRVA: LongWord; [r]

  property EndRVA: LongWord; [r]

end;

Inheritance

TResourceStringTable

COFF resource string table
|

TObject

Description

This class is used internally by TCoffResourceWriter.


TResourceStringTable
 | ro | Count
 | ro | Items
 |  | StartRVA
 | ro | CurrRVA
 | ro | EndRVA


ro | Count (TResourceStringTable)
ro | CurrRVA (TResourceStringTable)
ro | EndRVA (TResourceStringTable)
ro |


TResourceStringTable
 | Create
 | Destroy
 | Add
 | Clear


Add (TResourceStringTable)

Clear (TResourceStringTable)

Create (TResourceStringTable)

Destroy (TResourceStringTable)


TResourceStringTable


TResourceStringTable.Add

Declaration

Source position: coffwriter.pp line 53

public procedure TResourceStringTable.Add(

  s: string

);


TResourceStringTable.Clear

Declaration

Source position: coffwriter.pp line 54

public procedure TResourceStringTable.Clear;


TResourceStringTable.Count

Declaration

Source position: coffwriter.pp line 55

public property TResourceStringTable.Count : Integer
  read GetCount;


TResourceStringTable.Create

Declaration

Source position: coffwriter.pp line 51

public constructor TResourceStringTable.Create;


TResourceStringTable.CurrRVA

Declaration

Source position: coffwriter.pp line 58

public property TResourceStringTable.CurrRVA : LongWord
  read fCurrRVA;


TResourceStringTable.Destroy

Declaration

Source position: coffwriter.pp line 52

public destructor TResourceStringTable.Destroy; override;


TResourceStringTable.EndRVA

Declaration

Source position: coffwriter.pp line 59

public property TResourceStringTable.EndRVA : LongWord
  read fEndRVA;


TResourceStringTable.Items

Declaration

Source position: coffwriter.pp line 56

public property TResourceStringTable.Items[index: Integer] : string
  read GetString;
  default;


TResourceStringTable.StartRVA

Declaration

Source position: coffwriter.pp line 57

public property TResourceStringTable.StartRVA : LongWord
  read fStartRVA
  write SetStartRVA;


TDfmResourceReader

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

DFM resource reader

Declaration

Source position: dfmreader.pp line 29

type TDfmResourceReader = class(TAbstractResourceReader)

protected

  function GetExtensions; override;

  function GetDescription; override;

  procedure Load(); override;

  function CheckMagic(); override;

public

  constructor Create; override;

  destructor Destroy; override;

end;

Inheritance

TDfmResourceReader | DFM resource reader
|
TAbstractResourceReader | Base abstract resource reader class
|
TObject

Description

This class isn't a proper resource reader. It provides a quick way to create a resource file from a DFM/XFM/LFM file, similar to what Delphi does with constructs like {$R *.dfm}.

This class reads a DFM, XFM or LFM file, compiles it to binary format if it isn't, and stores it in a resource of type RT_RCDATA with the name of the form specified in the DFM file.


TDfmResourceReader
TAbstractResourceReader
 | ro | Extensions
 | ro | Description


ro | Description (TAbstractResourceReader)
ro |


TDfmResourceReader
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create
 | Destroy
TAbstractResourceReader
pt | SetDataSize
pt | SetHeaderSize
pt | SetDataOffset
pt | SetRawData
pt | CallSubReaderLoad
pt | AddNoTree
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create


pt | AddNoTree (TAbstractResourceReader)
pt | CallSubReaderLoad (TAbstractResourceReader)
pt | CheckMagic (TAbstractResourceReader)
pt | CheckMagic (TDfmResourceReader)
 | Create (TAbstractResourceReader)
 | Create (TDfmResourceReader)
 | Destroy (TDfmResourceReader)
pt | GetDescription (TAbstractResourceReader)
pt | GetDescription (TDfmResourceReader)
pt | GetExtensions (TAbstractResourceReader)
pt | GetExtensions (TDfmResourceReader)
pt | GetTree (TAbstractResourceReader)
pt | Load (TAbstractResourceReader)
pt | Load (TDfmResourceReader)
pt | SetDataOffset (TAbstractResourceReader)
pt | SetDataSize (TAbstractResourceReader)
pt | SetHeaderSize (TAbstractResourceReader)
pt |


TDfmResourceReader

TAbstractResourceReader


TDfmResourceReader.Destroy

Declaration

Source position: dfmreader.pp line 56

public destructor TDfmResourceReader.Destroy; override;


EElfResourceReaderException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for elf resource reader-related exceptions

Declaration

Source position: elfreader.pp line 26

type EElfResourceReaderException = class(EResourceReaderException)

Inheritance

EElfResourceReaderException | Base class for elf resource reader-related exceptions
|
EResourceReaderException | Base class for resource reader-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject


EElfResourceReaderException
EResourceReaderException
EResourceException
Exception
 | HelpContext
 | Message


HelpContext (Exception)

Message (Exception)


EElfResourceReaderException
EResourceReaderException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


Create (Exception)

CreateFmt (Exception)

CreateFmtHelp (Exception)

CreateHelp (Exception)

CreateRes (Exception)

CreateResFmt (Exception)

CreateResFmtHelp (Exception)

CreateResHelp (Exception)

ToString (Exception)


EElfResourceReaderException

EResourceReaderException

EResourceException

Exception


EElfResourceReaderNoSectionsException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

No section headers error

Declaration

Source position: elfreader.pp line 29

type EElfResourceReaderNoSectionsException = class(EElfResourceReaderException)

Inheritance

EElfResourceReaderNoSectionsException | No section headers error
|
EElfResourceReaderException | Base class for elf resource reader-related exceptions
|
EResourceReaderException | Base class for resource reader-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised by Load method of TElfResourceReader when no section headers are found.


EElfResourceReaderNoSectionsException
EElfResourceReaderException
EResourceReaderException
EResourceException
Exception
 | HelpContext
 | Message


EElfResourceReaderNoSectionsException
EElfResourceReaderException
EResourceReaderException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EElfResourceReaderNoSectionsException

EElfResourceReaderException

EResourceReaderException

EResourceException

Exception


EElfResourceReaderNoStringTableException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

No string table error

Declaration

Source position: elfreader.pp line 30

type EElfResourceReaderNoStringTableException = class(EElfResourceReaderException)

Inheritance

EElfResourceReaderNoStringTableException | No string table error
|
EElfResourceReaderException | Base class for elf resource reader-related exceptions
|
EResourceReaderException | Base class for resource reader-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised by Load method of TElfResourceReader when no ELF string table is found.


EElfResourceReaderNoStringTableException
EElfResourceReaderException
EResourceReaderException
EResourceException
Exception
 | HelpContext
 | Message


EElfResourceReaderNoStringTableException
EElfResourceReaderException
EResourceReaderException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EElfResourceReaderNoStringTableException

EElfResourceReaderException

EResourceReaderException

EResourceException

Exception


EElfResourceReaderUnknownClassException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Unknown ELF class error

Declaration

Source position: elfreader.pp line 27

type EElfResourceReaderUnknownClassException = class(EElfResourceReaderException)

Inheritance

EElfResourceReaderUnknownClassException | Unknown ELF class error
|
EElfResourceReaderException | Base class for elf resource reader-related exceptions
|
EResourceReaderException | Base class for resource reader-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised by Load method of TElfResourceReader when class field of ELF header is neither ELFCLASS32 nor ELFCLASS64.


EElfResourceReaderUnknownClassException
EElfResourceReaderException
EResourceReaderException
EResourceException
Exception
 | HelpContext
 | Message


EElfResourceReaderUnknownClassException
EElfResourceReaderException
EResourceReaderException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EElfResourceReaderUnknownClassException

EElfResourceReaderException

EResourceReaderException

EResourceException

Exception


EElfResourceReaderUnknownVersionException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Unknown ELF version error

Declaration

Source position: elfreader.pp line 28

type EElfResourceReaderUnknownVersionException = class(EElfResourceReaderException)

Inheritance

EElfResourceReaderUnknownVersionException | Unknown ELF version error
|
EElfResourceReaderException | Base class for elf resource reader-related exceptions
|
EResourceReaderException | Base class for resource reader-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised by Load method of TElfResourceReader when version field of ELF header is not 1.


EElfResourceReaderUnknownVersionException
EElfResourceReaderException
EResourceReaderException
EResourceException
Exception
 | HelpContext
 | Message


EElfResourceReaderUnknownVersionException
EElfResourceReaderException
EResourceReaderException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EElfResourceReaderUnknownVersionException

EElfResourceReaderException

EResourceReaderException

EResourceException

Exception


TElfResourceReader

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

ELF resource reader

Declaration

Source position: elfreader.pp line 36

type TElfResourceReader = class(TAbstractResourceReader)

protected

  function GetExtensions; override;

  function GetDescription; override;

  procedure Load(); override;

  function CheckMagic(); override;

public

  constructor Create; override;

  destructor Destroy; override;

  property MachineType: TElfMachineType; [r]

The machine type of the object file

end;

Inheritance

TElfResourceReader | ELF resource reader
|
TAbstractResourceReader | Base abstract resource reader class
|
TObject

Description

This class provides a reader for ELF object files and images containing resources.

ELF is the file format used by unices and other operating systems for object files and image files (executables, dynamic libraries and so on). Free Pascal can store resources in ELF files in its own format.

After an object file has been read, MachineType property holds the machine type the object file was built for.

Remark: This reader can't read ELF files without section headers. These are however very rare.

See also

TElfResourceReader.MachineType | The machine type of the object file
TAbstractResourceReader | Base abstract resource reader class
TElfResourceWriter | ELF resource writer
Format of resources in object files | Format of resources in object files


TElfResourceReader
 | ro | MachineType
TAbstractResourceReader
 | ro | Extensions
 | ro | Description


TElfResourceReader
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create
 | Destroy
TAbstractResourceReader
pt | SetDataSize
pt | SetHeaderSize
pt | SetDataOffset
pt | SetRawData
pt | CallSubReaderLoad
pt | AddNoTree
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create


pt | AddNoTree (TAbstractResourceReader)
pt | CallSubReaderLoad (TAbstractResourceReader)
pt | CheckMagic (TAbstractResourceReader)
pt | CheckMagic (TElfResourceReader)
 | Create (TAbstractResourceReader)
 | Create (TElfResourceReader)
 | Destroy (TElfResourceReader)
pt | GetDescription (TAbstractResourceReader)
pt | GetDescription (TElfResourceReader)
pt | GetExtensions (TAbstractResourceReader)
pt | GetExtensions (TElfResourceReader)
pt | GetTree (TAbstractResourceReader)
pt | Load (TAbstractResourceReader)
pt | Load (TElfResourceReader)
pt | SetDataOffset (TAbstractResourceReader)
pt | SetDataSize (TAbstractResourceReader)
pt | SetHeaderSize (TAbstractResourceReader)
pt |


TElfResourceReader

TAbstractResourceReader


TElfResourceReader.Destroy

Declaration

Source position: elfreader.pp line 54

public destructor TElfResourceReader.Destroy; override;


TElfResourceReader.MachineType

The machine type of the object file

Declaration

Source position: elfreader.pp line 55

public property TElfResourceReader.MachineType : TElfMachineType
  read fMachineType;

Description

This property holds the machine type of the object file that has been read.

Remark: Obviously, this property is meaningful only after an object file has been read.

See also

TElfMachineType

Enumeration for ELF machine type


EElfResourceWriterException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for elf resource writer-related exceptions

Declaration

Source position: elfwriter.pp line 26

type EElfResourceWriterException = class(EResourceWriterException)

Inheritance

EElfResourceWriterException | Base class for elf resource writer-related exceptions
|
EResourceWriterException | Base class for resource writer-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject


EElfResourceWriterException
EResourceWriterException
EResourceException
Exception
 | HelpContext
 | Message


EElfResourceWriterException
EResourceWriterException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EElfResourceWriterException

EResourceWriterException

EResourceException

Exception


EElfResourceWriterUnknownClassException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Internal error

Declaration

Source position: elfwriter.pp line 28

type EElfResourceWriterUnknownClassException = class(EElfResourceWriterException)

Inheritance

EElfResourceWriterUnknownClassException | Internal error
|
EElfResourceWriterException | Base class for elf resource writer-related exceptions
|
EResourceWriterException | Base class for resource writer-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

If this exception is raised, an internal error occurred.


EElfResourceWriterUnknownClassException
EElfResourceWriterException
EResourceWriterException
EResourceException
Exception
 | HelpContext
 | Message


EElfResourceWriterUnknownClassException
EElfResourceWriterException
EResourceWriterException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EElfResourceWriterUnknownClassException

EElfResourceWriterException

EResourceWriterException

EResourceException

Exception


EElfResourceWriterUnknownMachineException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Unknown machine type error

Declaration

Source position: elfwriter.pp line 27

type EElfResourceWriterUnknownMachineException = class(EElfResourceWriterException)

Inheritance

EElfResourceWriterUnknownMachineException | Unknown machine type error
|
EElfResourceWriterException | Base class for elf resource writer-related exceptions
|
EResourceWriterException | Base class for resource writer-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised when an attempt is made to set TElfResourceWriter.MachineType to an unknown machine type.

See also

TElfResourceWriter.MachineType

The machine type of the object file


EElfResourceWriterUnknownMachineException
EElfResourceWriterException
EResourceWriterException
EResourceException
Exception
 | HelpContext
 | Message


EElfResourceWriterUnknownMachineException
EElfResourceWriterException
EResourceWriterException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EElfResourceWriterUnknownMachineException

EElfResourceWriterException

EResourceWriterException

EResourceException

Exception


EElfResourceWriterUnknownSectionException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Internal error

Declaration

Source position: elfwriter.pp line 29

type EElfResourceWriterUnknownSectionException = class(EElfResourceWriterException)

Inheritance

EElfResourceWriterUnknownSectionException | Internal error
|
EElfResourceWriterException | Base class for elf resource writer-related exceptions
|
EResourceWriterException | Base class for resource writer-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

If this exception is raised, an internal error occurred.


EElfResourceWriterUnknownSectionException
EElfResourceWriterException
EResourceWriterException
EResourceException
Exception
 | HelpContext
 | Message


EElfResourceWriterUnknownSectionException
EElfResourceWriterException
EResourceWriterException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EElfResourceWriterUnknownSectionException

EElfResourceWriterException

EResourceWriterException

EResourceException

Exception


TElfResourceWriter

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

ELF resource writer

Declaration

Source position: elfwriter.pp line 34

type TElfResourceWriter = class(TAbstractResourceWriter)

protected

  function GetExtensions; override;

  function GetDescription; override;

  procedure Write(); override;

public

  constructor Create; override;

  destructor Destroy; override;

  property MachineType: TElfMachineType; [rw]

The machine type of the object file

end;

Inheritance

TElfResourceWriter | ELF resource writer
|
TAbstractResourceWriter | Base abstract resource writer class
|
TObject

Description

This class provides a writer for ELF object files and images containing resources.

ELF is the file format used by unices and other operating systems for object files and image files (executables, dynamic libraries and so on). Free Pascal can store resources in ELF files in its own format.

MachineType property can be used to set the machine type of the object file to generate.

See also

TElfResourceWriter.MachineType | The machine type of the object file
TAbstractResourceWriter | Base abstract resource writer class
TElfResourceReader | ELF resource reader
Format of resources in object files | Format of resources in object files


TElfResourceWriter
 |  | MachineType
TAbstractResourceWriter
 | ro | Extensions
 | ro | Description


TElfResourceWriter
pt | GetExtensions
pt | GetDescription
pt | Write
 | Create
 | Destroy
TAbstractResourceWriter
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Write
 | Create


pt | GetDescription (TAbstractResourceWriter)
pt | GetDescription (TElfResourceWriter)
pt | GetExtensions (TAbstractResourceWriter)
pt | GetExtensions (TElfResourceWriter)
pt | GetTree (TAbstractResourceWriter)
pt | Write (TAbstractResourceWriter)
pt |


TElfResourceWriter

TAbstractResourceWriter


TElfResourceWriter.Destroy

Declaration

Source position: elfwriter.pp line 54

public destructor TElfResourceWriter.Destroy; override;


TElfResourceWriter.MachineType

The machine type of the object file

Declaration

Source position: elfwriter.pp line 55

public property TElfResourceWriter.MachineType : TElfMachineType
  read fMachineType
  write SetMachineType;

Description

This property can be used to set the machine type of the object file to write.

If an attempt is made to set MachineType to an unsupported value, an EElfResourceWriterUnknownMachineException exception is raised.

See also

TElfMachineType | Enumeration for ELF machine type
EElfResourceWriterUnknownMachineException | Unknown machine type error


TExternalResourceReader

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

External file resource reader

Declaration

Source position: externalreader.pp line 29

type TExternalResourceReader = class(TAbstractResourceReader)

protected

  function GetExtensions; override;

  function GetDescription; override;

  procedure Load(); override;

  function CheckMagic(); override;

public

  constructor Create; override;

  destructor Destroy; override;

  property Endianess: Byte; [r]

The byte order used in the file

end;

Inheritance

TExternalResourceReader | External file resource reader
|
TAbstractResourceReader | Base abstract resource reader class
|
TObject

Description

This class provides a reader for .fpcres files: they are standalone files containing resources.

Standalone files are files that don't get linked with the final executable. They are used as a fallback solution on all those platforms for which an internal resource format is not available.

At runtime the resource file is read by Free Pascal RTL to provide resource support to the application.

After an external file has been read, Endianess property holds the byte order used in the file.

See also

TExternalResourceReader.Endianess | The byte order used in the file
TAbstractResourceReader | Base abstract resource reader class
TExternalResourceWriter | External file resource writer


TExternalResourceReader
 | ro | Endianess
TAbstractResourceReader
 | ro | Extensions
 | ro | Description


ro | Description (TAbstractResourceReader)
ro | Endianess (TExternalResourceReader)
ro |


TExternalResourceReader
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create
 | Destroy
TAbstractResourceReader
pt | SetDataSize
pt | SetHeaderSize
pt | SetDataOffset
pt | SetRawData
pt | CallSubReaderLoad
pt | AddNoTree
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create


pt | AddNoTree (TAbstractResourceReader)
pt | CallSubReaderLoad (TAbstractResourceReader)
pt | CheckMagic (TAbstractResourceReader)
pt | CheckMagic (TExternalResourceReader)
 | Create (TAbstractResourceReader)
 | Create (TExternalResourceReader)
 | Destroy (TExternalResourceReader)
pt | GetDescription (TAbstractResourceReader)
pt | GetDescription (TExternalResourceReader)
pt | GetExtensions (TAbstractResourceReader)
pt | GetExtensions (TExternalResourceReader)
pt | GetTree (TAbstractResourceReader)
pt | Load (TAbstractResourceReader)
pt | Load (TExternalResourceReader)
pt | SetDataOffset (TAbstractResourceReader)
pt | SetDataSize (TAbstractResourceReader)
pt | SetHeaderSize (TAbstractResourceReader)
pt |


TExternalResourceReader

TAbstractResourceReader


TExternalResourceReader.Destroy

Declaration

Source position: externalreader.pp line 53

public destructor TExternalResourceReader.Destroy; override;


TExternalResourceReader.Endianess

The byte order used in the file

Declaration

Source position: externalreader.pp line 54

public property TExternalResourceReader.Endianess : Byte
  read fEndianess;

Description

This property holds the byte order (endianess) of the file that has been read.

Remark: Obviously, this property is meaningful only after a file has been read.

See also

EXT_ENDIAN_BIG | The file uses big endian byte order
EXT_ENDIAN_LITTLE | The file uses little endian byte order


EExternalResInvalidEndianessException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Invalid endianess error

Declaration

Source position: externalwriter.pp line 27

type EExternalResInvalidEndianessException = class(EExternalResourceWriterException)

Inheritance

EExternalResInvalidEndianessException | Invalid endianess error
|
EExternalResourceWriterException | Base class for external resource writer-related exceptions
|
EResourceWriterException | Base class for resource writer-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised when an attempt is made to set Endianess property of a TExternalResourceWriter object to a value other than EXT_ENDIAN_BIG or EXT_ENDIAN_LITTLE.

See also

TExternalResourceWriter.Endianess

The byte order to use in the file


EExternalResInvalidEndianessException
EExternalResourceWriterException
EResourceWriterException
EResourceException
Exception
 | HelpContext
 | Message


EExternalResInvalidEndianessException
EExternalResourceWriterException
EResourceWriterException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EExternalResInvalidEndianessException

EExternalResourceWriterException

EResourceWriterException

EResourceException

Exception


EExternalResourceWriterException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for external resource writer-related exceptions

Declaration

Source position: externalwriter.pp line 26

type EExternalResourceWriterException = class(EResourceWriterException)

Inheritance

EExternalResourceWriterException | Base class for external resource writer-related exceptions
|
EResourceWriterException | Base class for resource writer-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject


EExternalResourceWriterException
EResourceWriterException
EResourceException
Exception
 | HelpContext
 | Message


EExternalResourceWriterException
EResourceWriterException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EExternalResourceWriterException

EResourceWriterException

EResourceException

Exception


TExternalResourceWriter

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

External file resource writer

Declaration

Source position: externalwriter.pp line 33

type TExternalResourceWriter = class(TAbstractResourceWriter)

protected

  function GetExtensions; override;

  function GetDescription; override;

  procedure Write(); override;

public

  constructor Create; override;

  destructor Destroy; override;

  property Endianess: Byte; [rw]

The byte order to use in the file

end;

Inheritance

TExternalResourceWriter | External file resource writer
|
TAbstractResourceWriter | Base abstract resource writer class
|
TObject

Description

This class provides a writer for .fpcres files: they are standalone files containing resources.

Standalone files are files that don't get linked with the final executable. They are used as a fallback solution on all those platforms for which an internal resource format is not available.

At runtime the resource file is read by Free Pascal RTL to provide resource support to the application.

Endianess property can be used to set the byte order to use in the file to generate.

See also

TExternalResourceWriter.Endianess | The byte order to use in the file
TAbstractResourceWriter | Base abstract resource writer class
TExternalResourceReader | External file resource reader


TExternalResourceWriter
 |  | Endianess
TAbstractResourceWriter
 | ro | Extensions
 | ro | Description


ro | Description (TAbstractResourceWriter)
 | Endianess (TExternalResourceWriter)
ro |


TExternalResourceWriter
pt | GetExtensions
pt | GetDescription
pt | Write
 | Create
 | Destroy
TAbstractResourceWriter
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Write
 | Create


pt | GetDescription (TAbstractResourceWriter)
pt | GetDescription (TExternalResourceWriter)
pt | GetExtensions (TAbstractResourceWriter)
pt | GetExtensions (TExternalResourceWriter)
pt | GetTree (TAbstractResourceWriter)
pt | Write (TAbstractResourceWriter)
pt |


TExternalResourceWriter

TAbstractResourceWriter


TExternalResourceWriter.Destroy

Declaration

Source position: externalwriter.pp line 64

public destructor TExternalResourceWriter.Destroy; override;


TExternalResourceWriter.Endianess

The byte order to use in the file

Declaration

Source position: externalwriter.pp line 65

public property TExternalResourceWriter.Endianess : Byte
  read fEndianess
  write SetEndianess;

Description

This property can be used to set the byte order (endianess) of the file to write.

Remark: If a value other than EXT_ENDIAN_BIG or EXT_ENDIAN_LITTLE is used, an EExternalResInvalidEndianessException exception is raised.

See also

EXT_ENDIAN_BIG | The file uses big endian byte order
EXT_ENDIAN_LITTLE | The file uses little endian byte order


TGroupCursorResource

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Group cursor resource type

Declaration

Source position: groupcursorresource.pp line 29

type TGroupCursorResource = class(TGroupResource)

protected

  procedure ReadResourceItemHeader; override;

  procedure WriteHeader(); override;

  procedure CreateSubItem; override;

  procedure UpdateItemOwner(); override;

  procedure ClearItemList; override;

  procedure DeleteSubItems; override;

  function GetSubStream(); override;

  function GetType; override;

  function GetName; override;

  function ChangeDescTypeAllowed(); override;

  function ChangeDescValueAllowed(); override;

public

  constructor Create();

Creates a new group cursor resource

end;

Inheritance

TGroupCursorResource | Group cursor resource type
|
TGroupResource | Abstract common class for group icon and group cursor classes
|
TAbstractResource | Base abstract resource class
|
TObject

Description

This class represents a resource of type RT_GROUP_CURSOR.

Resources of this type are strictly related to .cur files: typically a resource compiler creates resources of this type when it is instructed to insert a cursor from a .cur file.

There is although a big difference between .cur files and cursor resources: a .cur file contains a cursor, which is made of several different images (for different sizes and color depth), but while a file of this type is self-contained, when it comes to resources data is scattered over several different resources: an RT_GROUP_CURSOR resource only contains information about the single images, which are contained each in a different resource of type RT_CURSOR. The single resources are pretty unuseful alone, since they only consist of raw image data: they must be accessed in the contest of the RT_GROUP_CURSOR resource, which provides information about them.

TGroupCursorResource provides a way to handle a cursor as if it was a .cur file, via ItemData property. Single cursor resources are automatically created or destroyed as needed.

Remark: This class doesn't allow its type to be changed to anything else than RT_GROUP_CURSOR. Attempts to do so result in a EResourceDescChangeNotAllowedException.

See also

TGroupResource.ItemData | Resource data as an ICO/CUR stream
TGroupIconResource | Group icon resource type


TGroupCursorResource
TGroupResource
 | ro | ItemData
TAbstractResource
 | ro | _Type
 | ro | Name
 |  | LangID
 | ro | DataSize
 | ro | HeaderSize
 |  | DataVersion
 |  | MemoryFlags
 |  | Version
 |  | Characteristics
 | ro | DataOffset
 |  | CodePage
 | ro | RawData
 |  | CacheData
 | ro | OwnerList
 | ro | Owner


ro | DataOffset (TAbstractResource)
ro | DataSize (TAbstractResource)
 | DataVersion (TAbstractResource)
ro | HeaderSize (TAbstractResource)
ro | ItemData (TGroupResource)
 | LangID (TAbstractResource)
 | MemoryFlags (TAbstractResource)
ro | Name (TAbstractResource)
ro | Owner (TAbstractResource)
ro | OwnerList (TAbstractResource)
ro | RawData (TAbstractResource)
 | Version (TAbstractResource)
ro |


TGroupCursorResource
pt | ReadResourceItemHeader
pt | WriteHeader
pt | CreateSubItem
pt | UpdateItemOwner
pt | ClearItemList
pt | DeleteSubItems
pt | GetSubStream
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
 | Create
TGroupResource
pt | FindSubResources
pt | ReadResourceItemHeader
pt | CheckBuildItemStream
pt | GetItemData
pt | WriteHeader
pt | WriteResHeader
pt | CreateSubItems
pt | CreateSubItem
pt | UpdateItemOwner
pt | ClearItemList
pt | DeleteSubItems
pt | GetSubStreamCount
pt | GetSubStream
pt | SetOwnerList
pt | NotifyResourcesLoaded
 | Destroy
 | CompareContents
 | SetCustomItemDataStream
 | UpdateRawData
TAbstractResource
pt | SetDescOwner
pt | SetOwnerList
pt | SetChildOwner
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
pt | Create
 | Destroy
 | CompareContents
 | UpdateRawData
 | SetCustomRawDataStream


pt | ChangeDescTypeAllowed (TAbstractResource)
pt | ChangeDescTypeAllowed (TGroupCursorResource)
pt | ChangeDescValueAllowed (TAbstractResource)
pt | ChangeDescValueAllowed (TGroupCursorResource)
pt | CheckBuildItemStream (TGroupResource)
pt | ClearItemList (TGroupResource)
pt | ClearItemList (TGroupCursorResource)
 | CompareContents (TAbstractResource)
 | CompareContents (TGroupResource)
pt | Create (TAbstractResource)
 | Create (TGroupCursorResource)
pt | CreateSubItem (TGroupResource)
pt | CreateSubItem (TGroupCursorResource)
pt | CreateSubItems (TGroupResource)
pt | DeleteSubItems (TGroupResource)
pt | DeleteSubItems (TGroupCursorResource)
 | Destroy (TAbstractResource)
 | Destroy (TGroupResource)
pt | FindSubResources (TGroupResource)
pt | GetItemData (TGroupResource)
pt | GetName (TAbstractResource)
pt | GetName (TGroupCursorResource)
pt | GetSubStream (TGroupResource)
pt | GetSubStream (TGroupCursorResource)
pt | GetSubStreamCount (TGroupResource)
pt | GetType (TAbstractResource)
pt | GetType (TGroupCursorResource)
pt | NotifyResourcesLoaded (TAbstractResource)
pt | NotifyResourcesLoaded (TGroupResource)
pt | ReadResourceItemHeader (TGroupResource)
pt | ReadResourceItemHeader (TGroupCursorResource)
pt | SetChildOwner (TAbstractResource)
 | SetCustomItemDataStream (TGroupResource)
 | SetCustomRawDataStream (TAbstractResource)
pt | SetDescOwner (TAbstractResource)
pt | SetOwnerList (TAbstractResource)
pt | SetOwnerList (TGroupResource)
pt | UpdateItemOwner (TGroupResource)
pt | UpdateItemOwner (TGroupCursorResource)
 | UpdateRawData (TAbstractResource)
 | UpdateRawData (TGroupResource)
pt | WriteHeader (TGroupResource)
pt | WriteHeader (TGroupCursorResource)
pt |


TGroupCursorResource

TGroupResource

TAbstractResource


TGroupCursorResource.ChangeDescTypeAllowed

Declaration

Source position: groupcursorresource.pp line 42

protected function TGroupCursorResource.ChangeDescTypeAllowed(

  aDesc: TResourceDesc

):Boolean; override;


TGroupCursorResource.ChangeDescValueAllowed

Declaration

Source position: groupcursorresource.pp line 43

protected function TGroupCursorResource.ChangeDescValueAllowed(

  aDesc: TResourceDesc

):Boolean; override;


TGroupCursorResource.ClearItemList

Declaration

Source position: groupcursorresource.pp line 37

protected procedure TGroupCursorResource.ClearItemList; override;


TGroupCursorResource.Create

Creates a new group cursor resource

Declaration

Source position: groupcursorresource.pp line 45

public constructor TGroupCursorResource.Create; override;

constructor TGroupCursorResource.Create(

  aType: TResourceDesc;

  aName: TResourceDesc

); override;

Arguments

aType | Ignored. Can be nil.
aName | The name of the resource

Description

Please note that aType parameter is not used, since this class always uses RT_GROUP_CURSOR as type.


TGroupCursorResource.CreateSubItem

Declaration

Source position: groupcursorresource.pp line 35

protected procedure TGroupCursorResource.CreateSubItem; override;


TGroupCursorResource.DeleteSubItems

Declaration

Source position: groupcursorresource.pp line 38

protected procedure TGroupCursorResource.DeleteSubItems; override;


TGroupCursorResource.GetName

Declaration

Source position: groupcursorresource.pp line 41

protected function TGroupCursorResource.GetName: TResourceDesc; override;


TGroupCursorResource.GetSubStream

Declaration

Source position: groupcursorresource.pp line 39

protected function TGroupCursorResource.GetSubStream(

  const index: Integer;

  out aSize: Int64

):TStream; override;


TGroupCursorResource.GetType

Declaration

Source position: groupcursorresource.pp line 40

protected function TGroupCursorResource.GetType: TResourceDesc; override;


TGroupCursorResource.ReadResourceItemHeader

Declaration

Source position: groupcursorresource.pp line 33

protected procedure TGroupCursorResource.ReadResourceItemHeader; override;


TGroupCursorResource.UpdateItemOwner

Declaration

Source position: groupcursorresource.pp line 36

protected procedure TGroupCursorResource.UpdateItemOwner(

  index: Integer

); override;


TGroupCursorResource.WriteHeader

Declaration

Source position: groupcursorresource.pp line 34

protected procedure TGroupCursorResource.WriteHeader(

  aStream: TStream

); override;


TGroupIconResource

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Group icon resource type

Declaration

Source position: groupiconresource.pp line 29

type TGroupIconResource = class(TGroupResource)

protected

  procedure ReadResourceItemHeader; override;

  procedure WriteHeader(); override;

  procedure CreateSubItem; override;

  procedure UpdateItemOwner(); override;

  procedure ClearItemList; override;

  procedure DeleteSubItems; override;

  function GetSubStream(); override;

  function GetType; override;

  function GetName; override;

  function ChangeDescTypeAllowed(); override;

  function ChangeDescValueAllowed(); override;

public

  constructor Create();

Creates a new group icon resource

end;

Inheritance

TGroupIconResource | Group icon resource type
|
TGroupResource | Abstract common class for group icon and group cursor classes
|
TAbstractResource | Base abstract resource class
|
TObject

Description

This class represents a resource of type RT_GROUP_ICON.

Resources of this type are strictly related to .ico files: typically a resource compiler creates resources of this type when it is instructed to insert an icon from an .ico file.

There is although a big difference between .ico files and icon resources: an .ico file contains an icon, which is made of several different images (for different sizes and color depth), but while a file of this type is self-contained, when it comes to resources data is scattered over several different resources: an RT_GROUP_ICON resource only contains information about the single images, which are contained each in a different resource of type RT_ICON. The single resources are pretty unuseful alone, since they only consist of raw image data: they must be accessed in the contest of the RT_GROUP_ICON resource, which provides information about them.

TGroupIconResource provides a way to handle an icon as if it was a .ico file, via ItemData property. Single icon resources are automatically created or destroyed as needed.

Remark: This class doesn't allow its type to be changed to anything else than RT_GROUP_ICON. Attempts to do so result in a EResourceDescChangeNotAllowedException.

See also

TGroupResource.ItemData | Resource data as an ICO/CUR stream
TGroupCursorResource | Group cursor resource type


TGroupIconResource
TGroupResource
 | ro | ItemData
TAbstractResource
 | ro | _Type
 | ro | Name
 |  | LangID
 | ro | DataSize
 | ro | HeaderSize
 |  | DataVersion
 |  | MemoryFlags
 |  | Version
 |  | Characteristics
 | ro | DataOffset
 |  | CodePage
 | ro | RawData
 |  | CacheData
 | ro | OwnerList
 | ro | Owner


TGroupIconResource
pt | ReadResourceItemHeader
pt | WriteHeader
pt | CreateSubItem
pt | UpdateItemOwner
pt | ClearItemList
pt | DeleteSubItems
pt | GetSubStream
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
 | Create
TGroupResource
pt | FindSubResources
pt | ReadResourceItemHeader
pt | CheckBuildItemStream
pt | GetItemData
pt | WriteHeader
pt | WriteResHeader
pt | CreateSubItems
pt | CreateSubItem
pt | UpdateItemOwner
pt | ClearItemList
pt | DeleteSubItems
pt | GetSubStreamCount
pt | GetSubStream
pt | SetOwnerList
pt | NotifyResourcesLoaded
 | Destroy
 | CompareContents
 | SetCustomItemDataStream
 | UpdateRawData
TAbstractResource
pt | SetDescOwner
pt | SetOwnerList
pt | SetChildOwner
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
pt | Create
 | Destroy
 | CompareContents
 | UpdateRawData
 | SetCustomRawDataStream


pt | ChangeDescTypeAllowed (TAbstractResource)
pt | ChangeDescTypeAllowed (TGroupIconResource)
pt | ChangeDescValueAllowed (TAbstractResource)
pt | ChangeDescValueAllowed (TGroupIconResource)
pt | CheckBuildItemStream (TGroupResource)
pt | ClearItemList (TGroupResource)
pt | ClearItemList (TGroupIconResource)
 | CompareContents (TAbstractResource)
 | CompareContents (TGroupResource)
pt | Create (TAbstractResource)
 | Create (TGroupIconResource)
pt | CreateSubItem (TGroupResource)
pt | CreateSubItem (TGroupIconResource)
pt | CreateSubItems (TGroupResource)
pt | DeleteSubItems (TGroupResource)
pt | DeleteSubItems (TGroupIconResource)
 | Destroy (TAbstractResource)
 | Destroy (TGroupResource)
pt | FindSubResources (TGroupResource)
pt | GetItemData (TGroupResource)
pt | GetName (TAbstractResource)
pt | GetName (TGroupIconResource)
pt | GetSubStream (TGroupResource)
pt | GetSubStream (TGroupIconResource)
pt | GetSubStreamCount (TGroupResource)
pt | GetType (TAbstractResource)
pt | GetType (TGroupIconResource)
pt | NotifyResourcesLoaded (TAbstractResource)
pt | NotifyResourcesLoaded (TGroupResource)
pt | ReadResourceItemHeader (TGroupResource)
pt | ReadResourceItemHeader (TGroupIconResource)
pt | SetChildOwner (TAbstractResource)
 | SetCustomItemDataStream (TGroupResource)
 | SetCustomRawDataStream (TAbstractResource)
pt | SetDescOwner (TAbstractResource)
pt | SetOwnerList (TAbstractResource)
pt | SetOwnerList (TGroupResource)
pt | UpdateItemOwner (TGroupResource)
pt | UpdateItemOwner (TGroupIconResource)
 | UpdateRawData (TAbstractResource)
 | UpdateRawData (TGroupResource)
pt | WriteHeader (TGroupResource)
pt | WriteHeader (TGroupIconResource)
pt |


TGroupIconResource

TGroupResource

TAbstractResource


TGroupIconResource.ChangeDescTypeAllowed

Declaration

Source position: groupiconresource.pp line 42

protected function TGroupIconResource.ChangeDescTypeAllowed(

  aDesc: TResourceDesc

):Boolean; override;


TGroupIconResource.ChangeDescValueAllowed

Declaration

Source position: groupiconresource.pp line 43

protected function TGroupIconResource.ChangeDescValueAllowed(

  aDesc: TResourceDesc

):Boolean; override;


TGroupIconResource.ClearItemList

Declaration

Source position: groupiconresource.pp line 37

protected procedure TGroupIconResource.ClearItemList; override;


TGroupIconResource.Create

Creates a new group icon resource

Declaration

Source position: groupiconresource.pp line 45

public constructor TGroupIconResource.Create; override;

constructor TGroupIconResource.Create(

  aType: TResourceDesc;

  aName: TResourceDesc

); override;

Arguments

aType | Ignored. Can be nil.
aName | The name of the resource

Description

Please note that aType parameter is not used, since this class always uses RT_GROUP_ICON as type.


TGroupIconResource.CreateSubItem

Declaration

Source position: groupiconresource.pp line 35

protected procedure TGroupIconResource.CreateSubItem; override;


TGroupIconResource.DeleteSubItems

Declaration

Source position: groupiconresource.pp line 38

protected procedure TGroupIconResource.DeleteSubItems; override;


TGroupIconResource.GetName

Declaration

Source position: groupiconresource.pp line 41

protected function TGroupIconResource.GetName: TResourceDesc; override;


TGroupIconResource.GetSubStream

Declaration

Source position: groupiconresource.pp line 39

protected function TGroupIconResource.GetSubStream(

  const index: Integer;

  out aSize: Int64

):TStream; override;


TGroupIconResource.GetType

Declaration

Source position: groupiconresource.pp line 40

protected function TGroupIconResource.GetType: TResourceDesc; override;


TGroupIconResource.ReadResourceItemHeader

Declaration

Source position: groupiconresource.pp line 33

protected procedure TGroupIconResource.ReadResourceItemHeader; override;


TGroupIconResource.UpdateItemOwner

Declaration

Source position: groupiconresource.pp line 36

protected procedure TGroupIconResource.UpdateItemOwner(

  index: Integer

); override;


TGroupIconResource.WriteHeader

Declaration

Source position: groupiconresource.pp line 34

protected procedure TGroupIconResource.WriteHeader(

  aStream: TStream

); override;


TGroupCachedDataStream

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Cached stream for group classes

Declaration

Source position: groupresource.pp line 62

type TGroupCachedDataStream = class(TCachedDataStream)

public

  constructor Create(); override;

  destructor Destroy; override;

  function Read(); override;

end;

Inheritance

TGroupCachedDataStream | Cached stream for group classes
|
TCachedDataStream | Base cached stream class
|
TStream
|
TObject

Description

This class is used by TGroupResource descendants to provide an .ico/.cur like stream.

Unlike TCachedResourceDataStream, which provides a stream-like interface over a portion of another stream, this class lets multiple stream to be seen as one: this way, several RT_ICON or RT_CURSOR resources can appear like a single .ico or .cur file.

See also

TGroupResource | Abstract common class for group icon and group cursor classes
TGroupIconResource | Group icon resource type
TGroupCursorResource | Group cursor resource type
TCachedDataStream | Base cached stream class
TCachedResourceDataStream | An implementation of a cached stream


TGroupCachedDataStream
TCachedDataStream
TStream
 | Position
 | Size


Position (TStream)

Size (TStream)


TGroupCachedDataStream
 | Create
 | Destroy
 | Read
TCachedDataStream
pt | GetPosition
pt | SetPosition
pt | GetSize
pt | SetSize64
 | Create
 | Write
 | Seek
TStream
 | InvalidSeek
 | Discard
 | DiscardLarge
 | FakeSeekForward
 | GetPosition
 | SetPosition
 | GetSize
 | SetSize64
 | SetSize
 | ReadNotImplemented
 | WriteNotImplemented
 | Read
 | Write
 | Seek
 | ReadBuffer
 | WriteBuffer
 | CopyFrom
 | ReadComponent
 | ReadComponentRes
 | WriteComponent
 | WriteComponentRes
 | WriteDescendent
 | WriteDescendentRes
 | WriteResourceHeader
 | FixupResourceHeader
 | ReadResHeader
 | ReadByte
 | ReadWord
 | ReadDWord
 | ReadQWord
 | ReadAnsiString
 | WriteByte
 | WriteWord
 | WriteDWord
 | WriteQWord
 | WriteAnsiString


 | CopyFrom (TStream)
 | Create (TCachedDataStream)
 | Create (TGroupCachedDataStream)
 | Destroy (TGroupCachedDataStream)
 | Discard (TStream)
 | DiscardLarge (TStream)
 | FakeSeekForward (TStream)
 | FixupResourceHeader (TStream)
 | GetPosition (TStream)
pt | GetPosition (TCachedDataStream)
 | GetSize (TStream)
pt | GetSize (TCachedDataStream)
 | InvalidSeek (TStream)
 | Read (TStream)
 | Read (TGroupCachedDataStream)
 | ReadAnsiString (TStream)
 | ReadBuffer (TStream)
 | ReadByte (TStream)
 | ReadComponent (TStream)
 | ReadComponentRes (TStream)
 | ReadDWord (TStream)
 | ReadNotImplemented (TStream)
 | ReadQWord (TStream)
 | ReadResHeader (TStream)
 | ReadWord (TStream)
 | Seek (TStream)
 | Seek (TCachedDataStream)
 | SetPosition (TStream)
pt | SetPosition (TCachedDataStream)
 | SetSize (TStream)
 | SetSize64 (TStream)
pt | SetSize64 (TCachedDataStream)
 | Write (TStream)
 | Write (TCachedDataStream)
 | WriteAnsiString (TStream)
 | WriteBuffer (TStream)
 | WriteByte (TStream)
 | WriteComponent (TStream)
 | WriteComponentRes (TStream)
 | WriteDescendent (TStream)
 | WriteDescendentRes (TStream)
 | WriteDWord (TStream)
 | WriteNotImplemented (TStream)


TGroupCachedDataStream

TCachedDataStream

TStream


TGroupCachedDataStream.Destroy

Declaration

Source position: groupresource.pp line 70

public destructor TGroupCachedDataStream.Destroy; override;


TGroupCachedDataStream.Read

Declaration

Source position: groupresource.pp line 71

public function TGroupCachedDataStream.Read(

  var Buffer;

  Count: LongInt

):LongInt; override;


TGroupResource

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Abstract common class for group icon and group cursor classes

Declaration

Source position: groupresource.pp line 29

type TGroupResource = class(TAbstractResource)
protected
fType: TResourceDesc;
fName: TResourceDesc;
fItemData: TStream;
fItemList: TFPList;
dummyType: TResourceDesc;
dummyName: TResourceDesc;
procedure FindSubResources;
procedure ReadResourceItemHeader; virtual; abstract;
procedure CheckBuildItemStream;
function GetItemData;
procedure WriteHeader(); virtual; abstract;
function WriteResHeader;
procedure CreateSubItems;
procedure CreateSubItem; virtual; abstract;
procedure UpdateItemOwner(); virtual; abstract;
procedure ClearItemList; virtual; abstract;
procedure DeleteSubItems; virtual; abstract;
function GetSubStreamCount;
function GetSubStream(); virtual; abstract;
procedure SetOwnerList(); override;
procedure NotifyResourcesLoaded; override;
public
destructor Destroy; override; |
function CompareContents(); override;
procedure SetCustomItemDataStream(); | Sets a custom stream as the underlying stream for ItemData
procedure UpdateRawData; override;
property ItemData: TStream; [r] | Resource data as an ICO/CUR stream
end;

Inheritance

TGroupResource | Abstract common class for group icon and group cursor classes
|
TAbstractResource | Base abstract resource class
|
TObject

Description

This class provides common functionalities that are extended by TGroupIconResource and TGroupCursorResource.

Resources of type RT_GROUP_ICON and RT_GROUP_CURSOR represent a .ico or .cur file, respectively. However, data isn't contained in a single resource, but it's scattered over several different resources. That is, a .ico file contains an icon, which is made of several different images (for different sizes and color depth); when it is represented as a resource, however, the RT_GROUP_ICON resource only contains information about the single images, which are contained each in a different resource of type RT_ICON. The single resources are pretty unuseful alone, since they only consist of raw image data: they must be accessed in the contest of the RT_GROUP_ICON resource, which provides information about them.

TGroupIconResource and TGroupCursorResource provide a way to handle resources of these types as if they were .ico or .cur files. This class implements common functionalities, since icons and cursors are very similar.

Remark: An object of this class should never be directly instantiated: use a descendant class instead.

See also

TGroupIconResource | Group icon resource type
TGroupCursorResource | Group cursor resource type


TGroupResource
 | ro | ItemData
TAbstractResource
 | ro | _Type
 | ro | Name
 |  | LangID
 | ro | DataSize
 | ro | HeaderSize
 |  | DataVersion
 |  | MemoryFlags
 |  | Version
 |  | Characteristics
 | ro | DataOffset
 |  | CodePage
 | ro | RawData
 |  | CacheData
 | ro | OwnerList
 | ro | Owner


TGroupResource
pt | FindSubResources
pt | ReadResourceItemHeader
pt | CheckBuildItemStream
pt | GetItemData
pt | WriteHeader
pt | WriteResHeader
pt | CreateSubItems
pt | CreateSubItem
pt | UpdateItemOwner
pt | ClearItemList
pt | DeleteSubItems
pt | GetSubStreamCount
pt | GetSubStream
pt | SetOwnerList
pt | NotifyResourcesLoaded
 | Destroy
 | CompareContents
 | SetCustomItemDataStream
 | UpdateRawData
TAbstractResource
pt | SetDescOwner
pt | SetOwnerList
pt | SetChildOwner
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
pt | Create
 | Destroy
 | CompareContents
 | UpdateRawData
 | SetCustomRawDataStream


pt | ChangeDescTypeAllowed (TAbstractResource)
pt | ChangeDescValueAllowed (TAbstractResource)
pt | CheckBuildItemStream (TGroupResource)
pt | ClearItemList (TGroupResource)
 | CompareContents (TAbstractResource)
 | CompareContents (TGroupResource)
pt | Create (TAbstractResource)
pt | CreateSubItem (TGroupResource)
pt | CreateSubItems (TGroupResource)
pt | DeleteSubItems (TGroupResource)
 | Destroy (TAbstractResource)
 | Destroy (TGroupResource)
pt | FindSubResources (TGroupResource)
pt | GetItemData (TGroupResource)
pt | GetName (TAbstractResource)
pt | GetSubStream (TGroupResource)
pt | GetSubStreamCount (TGroupResource)
pt | GetType (TAbstractResource)
pt | NotifyResourcesLoaded (TAbstractResource)
pt | NotifyResourcesLoaded (TGroupResource)
pt | ReadResourceItemHeader (TGroupResource)
pt | SetChildOwner (TAbstractResource)
 | SetCustomItemDataStream (TGroupResource)
 | SetCustomRawDataStream (TAbstractResource)
pt | SetDescOwner (TAbstractResource)
pt | SetOwnerList (TAbstractResource)
pt | SetOwnerList (TGroupResource)
pt | UpdateItemOwner (TGroupResource)
 | UpdateRawData (TAbstractResource)
 | UpdateRawData (TGroupResource)
pt | WriteHeader (TGroupResource)
pt |


TGroupResource

TAbstractResource


TGroupResource.CheckBuildItemStream

Declaration

Source position: groupresource.pp line 39

protected procedure TGroupResource.CheckBuildItemStream;


TGroupResource.ClearItemList

Declaration

Source position: groupresource.pp line 46

protected procedure TGroupResource.ClearItemList; virtual; abstract;


TGroupResource.CreateSubItem

Declaration

Source position: groupresource.pp line 44

protected procedure TGroupResource.CreateSubItem; virtual; abstract;


TGroupResource.CreateSubItems

Declaration

Source position: groupresource.pp line 43

protected procedure TGroupResource.CreateSubItems;


TGroupResource.DeleteSubItems

Declaration

Source position: groupresource.pp line 47

protected procedure TGroupResource.DeleteSubItems; virtual; abstract;


TGroupResource.Destroy

Declaration

Source position: groupresource.pp line 53

public destructor TGroupResource.Destroy; override;


TGroupResource.dummyName

Declaration

Source position: groupresource.pp line 36

protected TGroupResource.dummyName : TResourceDesc;


TGroupResource.dummyType

Declaration

Source position: groupresource.pp line 35

protected TGroupResource.dummyType : TResourceDesc;


TGroupResource.FindSubResources

Declaration

Source position: groupresource.pp line 37

protected procedure TGroupResource.FindSubResources;


TGroupResource.fItemData

Declaration

Source position: groupresource.pp line 33

protected TGroupResource.fItemData : TStream;


TGroupResource.fItemList

Declaration

Source position: groupresource.pp line 34

protected TGroupResource.fItemList : TFPList;


TGroupResource.fName

Declaration

Source position: groupresource.pp line 32

protected TGroupResource.fName : TResourceDesc;


TGroupResource.fType

Declaration

Source position: groupresource.pp line 31

protected TGroupResource.fType : TResourceDesc;


TGroupResource.GetItemData

Declaration

Source position: groupresource.pp line 40

protected function TGroupResource.GetItemData: TStream;


TGroupResource.GetSubStream

Declaration

Source position: groupresource.pp line 49

protected function TGroupResource.GetSubStream(

  const index: Integer;

  out aSize: Int64

):TStream; virtual; abstract;


TGroupResource.GetSubStreamCount

Declaration

Source position: groupresource.pp line 48

protected function TGroupResource.GetSubStreamCount: Integer;


TGroupResource.ItemData

Resource data as an ICO/CUR stream

Declaration

Source position: groupresource.pp line 57

public property TGroupResource.ItemData : TStream
  read GetItemData;

Description

This property gives access to resource data in a (ICO or CUR) file-like stream, unlike RawData.

The exact format of the stream (ico or cur) is determined by the descendant class of TGroupResource that is used.

ItemData does not create a copy of RawData so memory usage is generally kept limited.

You can also set a custom stream as the underlying stream for ItemData via SetCustomItemDataStream, much like SetCustomRawDataStream does for RawData. This is useful when you want a TGroupIconResource or TGroupCursorResource to be created from a ico or cur file for which you have a stream.

Remark: If you need to access RawData after you modified ItemData, be sure to call UpdateRawData first. This isn't needed however when resource is written to a stream, since TResources takes care of it.

See also

TGroupResource.SetCustomItemDataStream | Sets a custom stream as the underlying stream for ItemData
TGroupIconResource | Group icon resource type
TGroupCursorResource | Group cursor resource type
TAbstractResource.RawData | The raw resource data stream
TAbstractResource.UpdateRawData | Updates RawData stream.


TGroupResource.ReadResourceItemHeader

Declaration

Source position: groupresource.pp line 38

protected procedure TGroupResource.ReadResourceItemHeader; virtual; abstract;


TGroupResource.SetCustomItemDataStream

Sets a custom stream as the underlying stream for ItemData

Declaration

Source position: groupresource.pp line 55

public procedure TGroupResource.SetCustomItemDataStream(

  aStream: TStream

);

Arguments

aStream

The custom stream to use as the underlying ItemData stream

Description

This method allows the user to use a custom stream as the underlying stream for ItemData. This is useful when you want a TGroupIconResource or TGroupCursorResource to be created from a ico or cur file for which you have a stream.

Sample code

This code creates a resource containing an icon

var
  aName : TResourceDesc;
  aRes : TGroupIconResource;
  aFile : TFileStream;
  Resources : TResources;
begin
  Resources:=TResources.Create;
  aName:=TResourceDesc.Create('MAINICON');
  aRes:=TGroupIconResource.Create(nil,aName); //type is always RT_GROUP_ICON
  aName.Free; //not needed anymore
  aFile:=TFileStream.Create('mainicon.ico',fmOpenRead or fmShareDenyNone);
  aRes.SetCustomItemDataStream(aFile);
  Resources.Add(aRes);
  Resources.WriteToFile('myresource.res');

  Resources.Free; //it destroys aRes as well.
  aFile.Free;
end;

See also

TGroupResource.ItemData | Resource data as an ICO/CUR stream
TGroupIconResource | Group icon resource type
TGroupCursorResource | Group cursor resource type
TAbstractResource.UpdateRawData | Updates RawData stream.


TGroupResource.UpdateItemOwner

Declaration

Source position: groupresource.pp line 45

protected procedure TGroupResource.UpdateItemOwner(

  index: Integer

); virtual; abstract;


TGroupResource.WriteHeader

Declaration

Source position: groupresource.pp line 41

protected procedure TGroupResource.WriteHeader(

  aStream: TStream

); virtual; abstract;


TGroupResource.WriteResHeader

Declaration

Source position: groupresource.pp line 42

protected function TGroupResource.WriteResHeader: Word;


TMachOResourceReader

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Mach-O resource reader

Declaration

Source position: machoreader.pp line 29

type TMachOResourceReader = class(TAbstractResourceReader)

protected

  function GetExtensions; override;

  function GetDescription; override;

  procedure Load(); override;

  function CheckMagic(); override;

public

  constructor Create; override;

  destructor Destroy; override;

  property MachineType: TMachOMachineType; [r]

The machine type of the object file

end;

Inheritance

TMachOResourceReader | Mach-O resource reader
|
TAbstractResourceReader | Base abstract resource reader class
|
TObject

Description

This class provides a reader for Mach-O object files and images containing resources.

Mach-O is the file format used by Darwin and Mac OS X for object files and image files (executables, dynamic libraries and so on). Free Pascal can store resources in Mach-O files in its own format.

After an object file has been read, MachineType property holds the machine type the object file was built for.

Remark: This reader can't read multiple-architecture Mach-O files (like universal binary). To read a particular Mach-O file in a multiple-architecture file, extract it with lipo command.

See also

TMachOResourceReader.MachineType | The machine type of the object file
TAbstractResourceReader | Base abstract resource reader class
TMachOResourceWriter | Mach-O resource writer
Format of resources in object files | Format of resources in object files


TMachOResourceReader
 | ro | MachineType
TAbstractResourceReader
 | ro | Extensions
 | ro | Description


TMachOResourceReader
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create
 | Destroy
TAbstractResourceReader
pt | SetDataSize
pt | SetHeaderSize
pt | SetDataOffset
pt | SetRawData
pt | CallSubReaderLoad
pt | AddNoTree
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create


pt | AddNoTree (TAbstractResourceReader)
pt | CallSubReaderLoad (TAbstractResourceReader)
pt | CheckMagic (TAbstractResourceReader)
pt | CheckMagic (TMachOResourceReader)
 | Create (TAbstractResourceReader)
 | Create (TMachOResourceReader)
 | Destroy (TMachOResourceReader)
pt | GetDescription (TAbstractResourceReader)
pt | GetDescription (TMachOResourceReader)
pt | GetExtensions (TAbstractResourceReader)
pt | GetExtensions (TMachOResourceReader)
pt | GetTree (TAbstractResourceReader)
pt | Load (TAbstractResourceReader)
pt | Load (TMachOResourceReader)
pt | SetDataOffset (TAbstractResourceReader)
pt | SetDataSize (TAbstractResourceReader)
pt | SetHeaderSize (TAbstractResourceReader)
pt |


TMachOResourceReader

TAbstractResourceReader


TMachOResourceReader.Destroy

Declaration

Source position: machoreader.pp line 48

public destructor TMachOResourceReader.Destroy; override;


TMachOResourceReader.MachineType

The machine type of the object file

Declaration

Source position: machoreader.pp line 49

public property TMachOResourceReader.MachineType : TMachOMachineType
  read fMachineType;

Description

This property holds the machine type of the object file that has been read.

Remark: Obviously, this property is meaningful only after an object file has been read.

See also

TMachOMachineType

Enumeration for Mach-O machine type


EMachOResourceWriterException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for Mach-O resource writer-related exceptions

Declaration

Source position: machowriter.pp line 26

type EMachOResourceWriterException = class(EResourceWriterException)

Inheritance

EMachOResourceWriterException | Base class for Mach-O resource writer-related exceptions
|
EResourceWriterException | Base class for resource writer-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject


EMachOResourceWriterException
EResourceWriterException
EResourceException
Exception
 | HelpContext
 | Message


EMachOResourceWriterException
EResourceWriterException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EMachOResourceWriterException

EResourceWriterException

EResourceException

Exception


EMachOResourceWriterSymbolTableWrongOrderException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Declaration

Source position: machowriter.pp line 28

type EMachOResourceWriterSymbolTableWrongOrderException = class(EMachOResourceWriterException)

Inheritance

EMachOResourceWriterSymbolTableWrongOrderException
|
EMachOResourceWriterException | Base class for Mach-O resource writer-related exceptions
|
EResourceWriterException | Base class for resource writer-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject


EMachOResourceWriterSymbolTableWrongOrderException
EMachOResourceWriterException
EResourceWriterException
EResourceException
Exception
 | HelpContext
 | Message


EMachOResourceWriterSymbolTableWrongOrderException
EMachOResourceWriterException
EResourceWriterException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EMachOResourceWriterSymbolTableWrongOrderException

EMachOResourceWriterException

EResourceWriterException

EResourceException

Exception


EMachOResourceWriterUnknownBitSizeException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Internal error

Declaration

Source position: machowriter.pp line 27

type EMachOResourceWriterUnknownBitSizeException = class(EMachOResourceWriterException)

Inheritance

EMachOResourceWriterUnknownBitSizeException | Internal error
|
EMachOResourceWriterException | Base class for Mach-O resource writer-related exceptions
|
EResourceWriterException | Base class for resource writer-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

If this exception is raised, an internal error occurred.


EMachOResourceWriterUnknownBitSizeException
EMachOResourceWriterException
EResourceWriterException
EResourceException
Exception
 | HelpContext
 | Message


EMachOResourceWriterUnknownBitSizeException
EMachOResourceWriterException
EResourceWriterException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EMachOResourceWriterUnknownBitSizeException

EMachOResourceWriterException

EResourceWriterException

EResourceException

Exception


TMachOResourceWriter

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Mach-O resource writer

Declaration

Source position: machowriter.pp line 44

type TMachOResourceWriter = class(TAbstractResourceWriter)

protected

  function GetExtensions; override;

  function GetDescription; override;

  procedure Write(); override;

public

  constructor Create; override;

  destructor Destroy; override;

  property MachineType: TMachOMachineType; [rw]

The machine type of the object file

  property SubMachineType: TMachoSubMachineType; [rw]

end;

Inheritance

TMachOResourceWriter | Mach-O resource writer
|
TAbstractResourceWriter | Base abstract resource writer class
|
TObject

Description

This class provides a writer for Mach-O object files and images containing resources.

Mach-O is the file format used by Darwin and Mac OS X for object files and image files (executables, dynamic libraries and so on). Free Pascal can store resources in Mach-O files in its own format.

MachineType property can be used to set the machine type of the object file to generate.

See also

TMachOResourceWriter.MachineType | The machine type of the object file
TAbstractResourceWriter | Base abstract resource writer class
TMachOResourceReader | Mach-O resource reader
Format of resources in object files | Format of resources in object files


TMachOResourceWriter
 |  | MachineType
 |  | SubMachineType
TAbstractResourceWriter
 | ro | Extensions
 | ro | Description


TMachOResourceWriter
pt | GetExtensions
pt | GetDescription
pt | Write
 | Create
 | Destroy
TAbstractResourceWriter
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Write
 | Create


pt | GetDescription (TAbstractResourceWriter)
pt | GetDescription (TMachOResourceWriter)
pt | GetExtensions (TAbstractResourceWriter)
pt | GetExtensions (TMachOResourceWriter)
pt | GetTree (TAbstractResourceWriter)
pt | Write (TAbstractResourceWriter)
pt |


TMachOResourceWriter

TAbstractResourceWriter


TMachOResourceWriter.Destroy

Declaration

Source position: machowriter.pp line 64

public destructor TMachOResourceWriter.Destroy; override;


TMachOResourceWriter.MachineType

The machine type of the object file

Declaration

Source position: machowriter.pp line 65

public property TMachOResourceWriter.MachineType : TMachOMachineType
  read fMachineType
  write SetMachineType;

Description

This property can be used to set the machine type of the object file to write.

See also

TMachOMachineType

Enumeration for Mach-O machine type


TMachOResourceWriter.SubMachineType

Declaration

Source position: machowriter.pp line 66

public property TMachOResourceWriter.SubMachineType : TMachoSubMachineType
  read fSubMachineType
  write SetSubMachineType;


TCachedDataStream

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base cached stream class

Declaration

Source position: resdatastream.pp line 26

type TCachedDataStream = class(TStream)
protected
fStream: TStream; | The original stream
fSize: Int64; | The size of the cached stream
fPosition: Int64; | The position from the cached stream perspective
function GetPosition; override;
procedure SetPosition(); override;
function GetSize; override;
procedure SetSize64(); override;
public
constructor Create(); virtual; | Creates a new object
function Write(); override;
function Seek(); override;
end;

Inheritance

TCachedDataStream

Base cached stream class
|

TStream
|

TObject

Description

This abstract class provides basic cached stream functionalities.

A cached stream is a read-only stream that operates on a portion of another stream. That is, it creates a "window" on the original stream from which to read data. Since it is a read-only stream, trying to write to the stream or to set its size cause an EInvalidOperation exception to be raised.

This class is used by TResourceDataStream to access the raw data of a resource. When an attempt to write to the stream is detected, TResourceDataStream replaces it with a memory stream and copies the contents of the cached stream to the memory one, thus providing a copy-on-write mechanism.

Remark: An object of this class should never be directly instantiated: use a descendant class instead.

See also

TResourceDataStream | Stream class that provides copy-on-write functionality
TCachedResourceDataStream | An implementation of a cached stream


TCachedDataStream
TStream
 | Position
 | Size


TCachedDataStream
pt | GetPosition
pt | SetPosition
pt | GetSize
pt | SetSize64
 | Create
 | Write
 | Seek
TStream
 | InvalidSeek
 | Discard
 | DiscardLarge
 | FakeSeekForward
 | GetPosition
 | SetPosition
 | GetSize
 | SetSize64
 | SetSize
 | ReadNotImplemented
 | WriteNotImplemented
 | Read
 | Write
 | Seek
 | ReadBuffer
 | WriteBuffer
 | CopyFrom
 | ReadComponent
 | ReadComponentRes
 | WriteComponent
 | WriteComponentRes
 | WriteDescendent
 | WriteDescendentRes
 | WriteResourceHeader
 | FixupResourceHeader
 | ReadResHeader
 | ReadByte
 | ReadWord
 | ReadDWord
 | ReadQWord
 | ReadAnsiString
 | WriteByte
 | WriteWord
 | WriteDWord
 | WriteQWord
 | WriteAnsiString


 | Discard (TStream)
 | DiscardLarge (TStream)
 | FakeSeekForward (TStream)
 | FixupResourceHeader (TStream)
 | GetPosition (TStream)
pt | GetPosition (TCachedDataStream)
 | GetSize (TStream)
pt | GetSize (TCachedDataStream)
 | InvalidSeek (TStream)
 | Read (TStream)
 | ReadAnsiString (TStream)
 | ReadBuffer (TStream)
 | ReadByte (TStream)
 | ReadComponent (TStream)
 | ReadComponentRes (TStream)
 | ReadDWord (TStream)
 | ReadNotImplemented (TStream)
 | ReadQWord (TStream)
 | ReadResHeader (TStream)
 | ReadWord (TStream)
 | Seek (TStream)
 | Seek (TCachedDataStream)
 | SetPosition (TStream)
pt | SetPosition (TCachedDataStream)
 | SetSize (TStream)
 | SetSize64 (TStream)
pt | SetSize64 (TCachedDataStream)
 | Write (TStream)
 | Write (TCachedDataStream)
 | WriteAnsiString (TStream)
 | WriteBuffer (TStream)
 | WriteByte (TStream)
 | WriteComponent (TStream)
 | WriteComponentRes (TStream)
 | WriteDescendent (TStream)
 | WriteDescendentRes (TStream)
 | WriteDWord (TStream)
 | WriteNotImplemented (TStream)


TCachedDataStream

TStream


TCachedDataStream.Create

Creates a new object

Declaration

Source position: resdatastream.pp line 37

public constructor TCachedDataStream.Create(

  aStream: TStream;

  aResource: TAbstractResource;

  aSize: Int64

); virtual;

Arguments

aStream | The stream from which to read data
aResource | The resource whose data must be read
aSize | The size of the resource data

Description

A new cached stream is created on top of the aStream stream.

See also

TCachedDataStream | Base cached stream class
TResourceDataStream | Stream class that provides copy-on-write functionality
TResourceDataStream.Create | Creates a new object


TCachedDataStream.fPosition

The position from the cached stream perspective

Declaration

Source position: resdatastream.pp line 31

protected TCachedDataStream.fPosition : Int64;

Description

This protected member is provided to let descendant classes access the position of the cached stream.


TCachedDataStream.fSize

The size of the cached stream

Declaration

Source position: resdatastream.pp line 30

protected TCachedDataStream.fSize : Int64;

Description

This protected member is provided to let descendant classes access the size of the cached stream.


TCachedDataStream.fStream

The original stream

Declaration

Source position: resdatastream.pp line 29

protected TCachedDataStream.fStream : TStream;

Description

This protected member is provided to let descendant classes access the original stream.


TCachedDataStream.GetPosition

Declaration

Source position: resdatastream.pp line 32

protected function TCachedDataStream.GetPosition: Int64; override;


TCachedDataStream.GetSize

Declaration

Source position: resdatastream.pp line 34

protected function TCachedDataStream.GetSize: Int64; override;


TCachedDataStream.Seek

Declaration

Source position: resdatastream.pp line 39

public function TCachedDataStream.Seek(

  const Offset: Int64;

  Origin: TSeekOrigin

):Int64; override;


TCachedDataStream.SetPosition

Declaration

Source position: resdatastream.pp line 33

protected procedure TCachedDataStream.SetPosition(

  const Pos: Int64

); override;


TCachedDataStream.SetSize64

Declaration

Source position: resdatastream.pp line 35

protected procedure TCachedDataStream.SetSize64(

  const NewSize: Int64

); override;


TCachedDataStream.Write

Declaration

Source position: resdatastream.pp line 38

public function TCachedDataStream.Write(

  const Buffer;

  Count: LongInt

):LongInt; override;


TCachedResourceDataStream

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

An implementation of a cached stream

Declaration

Source position: resdatastream.pp line 45

type TCachedResourceDataStream = class(TCachedDataStream)

public

  constructor Create(); override;

  function Read(); override;

end;

Inheritance

TCachedResourceDataStream | An implementation of a cached stream
|
TCachedDataStream | Base cached stream class
|
TStream
|
TObject

Description

This class provides an implementation of TCachedDataStream.

Usually resource readers create a TResourceDataStream with a TCachedResourceDataStream as the underlying stream.

See also

TCachedDataStream | Base cached stream class
TResourceDataStream | Stream class that provides copy-on-write functionality


TCachedResourceDataStream
TCachedDataStream
TStream
 | Position
 | Size


TCachedResourceDataStream
 | Create
 | Read
TCachedDataStream
pt | GetPosition
pt | SetPosition
pt | GetSize
pt | SetSize64
 | Create
 | Write
 | Seek
TStream
 | InvalidSeek
 | Discard
 | DiscardLarge
 | FakeSeekForward
 | GetPosition
 | SetPosition
 | GetSize
 | SetSize64
 | SetSize
 | ReadNotImplemented
 | WriteNotImplemented
 | Read
 | Write
 | Seek
 | ReadBuffer
 | WriteBuffer
 | CopyFrom
 | ReadComponent
 | ReadComponentRes
 | WriteComponent
 | WriteComponentRes
 | WriteDescendent
 | WriteDescendentRes
 | WriteResourceHeader
 | FixupResourceHeader
 | ReadResHeader
 | ReadByte
 | ReadWord
 | ReadDWord
 | ReadQWord
 | ReadAnsiString
 | WriteByte
 | WriteWord
 | WriteDWord
 | WriteQWord
 | WriteAnsiString


 | Discard (TStream)
 | DiscardLarge (TStream)
 | FakeSeekForward (TStream)
 | FixupResourceHeader (TStream)
 | GetPosition (TStream)
pt | GetPosition (TCachedDataStream)
 | GetSize (TStream)
pt | GetSize (TCachedDataStream)
 | InvalidSeek (TStream)
 | Read (TStream)
 | Read (TCachedResourceDataStream)
 | ReadAnsiString (TStream)
 | ReadBuffer (TStream)
 | ReadByte (TStream)
 | ReadComponent (TStream)
 | ReadComponentRes (TStream)
 | ReadDWord (TStream)
 | ReadNotImplemented (TStream)
 | ReadQWord (TStream)
 | ReadResHeader (TStream)
 | ReadWord (TStream)
 | Seek (TStream)
 | Seek (TCachedDataStream)
 | SetPosition (TStream)
pt | SetPosition (TCachedDataStream)
 | SetSize (TStream)
 | SetSize64 (TStream)
pt | SetSize64 (TCachedDataStream)
 | Write (TStream)
 | Write (TCachedDataStream)
 | WriteAnsiString (TStream)
 | WriteBuffer (TStream)
 | WriteByte (TStream)
 | WriteComponent (TStream)
 | WriteComponentRes (TStream)
 | WriteDescendent (TStream)
 | WriteDescendentRes (TStream)
 | WriteDWord (TStream)
 | WriteNotImplemented (TStream)


TCachedResourceDataStream

TCachedDataStream

TStream


TCachedResourceDataStream.Read

Declaration

Source position: resdatastream.pp line 51

public function TCachedResourceDataStream.Read(

  var Buffer;

  Count: LongInt

):LongInt; override;


TResourceDataStream

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Stream class that provides copy-on-write functionality

Declaration

Source position: resdatastream.pp line 61

type TResourceDataStream = class(TStream)
protected
function GetPosition; override;
procedure SetPosition(); override;
function GetSize; override;
procedure SetSize64(); override;
public
constructor Create(); | Creates a new object
destructor Destroy; override;
function Compare(); | Compares the stream to another one
procedure SetCustomStream(); | Sets a custom stream as the underlying stream
function Read(); override;
function Write(); override;
function Seek(); override;
property Cached: Boolean; [rw] | Controls the copy-on-write behaviour of the stream
end;

Inheritance

TResourceDataStream

Stream class that provides copy-on-write functionality
|

TStream
|

TObject

Description

This class provides the copy-on-write mechanism of TAbstractResource.RawData, via more levels of indirection.

It uses an underlying stream, to which it redirects operations.

The underlying stream can be a TCachedDataStream descendant, a memory stream or a custom stream. Usually when a resource is loaded from a stream, the underlying stream is a TCachedDataStream descendant, which provides a read-only stream-like interface over a portion of the original stream (that is, the part of the original stream where resource data resides). When TResourceDataStream is requested to write data, it replaces the underlying stream with a memory stream, whose contents are copied from the previous underlying stream: this way, copy-on-write functionality can be achieved.

As said before, third possibility is to have a custom stream as the underlying stream: a user can set this stream via TAbstractResource.SetCustomRawDataStream method, which in turn calls TResourceDataStream.SetCustomStream

Figure: Levels of indirection

.
                     TResourceDataStream
                              |
       _______________________|_______________________________
      |                       |                               |
TMemoryStream     TCachedDataStream descendant          custom stream
                         /           \
 _______________________|_____________|______________________________
|                o r i g|i n a l   s t|r e a m                       |
|_______________________|_____________|______________________________|

See also

TCachedDataStream | Base cached stream class
TResourceDataStream.Create | Creates a new object
TResourceDataStream.SetCustomStream | Sets a custom stream as the underlying stream


TResourceDataStream
 | Cached
TStream
 | Position
 | Size


Cached (TResourceDataStream)

Position (TStream)

Size (TStream)


TResourceDataStream
pt | GetPosition
pt | SetPosition
pt | GetSize
pt | SetSize64
 | Create
 | Destroy
 | Compare
 | SetCustomStream
 | Read
 | Write
 | Seek
TStream
 | InvalidSeek
 | Discard
 | DiscardLarge
 | FakeSeekForward
 | GetPosition
 | SetPosition
 | GetSize
 | SetSize64
 | SetSize
 | ReadNotImplemented
 | WriteNotImplemented
 | Read
 | Write
 | Seek
 | ReadBuffer
 | WriteBuffer
 | CopyFrom
 | ReadComponent
 | ReadComponentRes
 | WriteComponent
 | WriteComponentRes
 | WriteDescendent
 | WriteDescendentRes
 | WriteResourceHeader
 | FixupResourceHeader
 | ReadResHeader
 | ReadByte
 | ReadWord
 | ReadDWord
 | ReadQWord
 | ReadAnsiString
 | WriteByte
 | WriteWord
 | WriteDWord
 | WriteQWord
 | WriteAnsiString


 | Compare (TResourceDataStream)
 | CopyFrom (TStream)
 | Create (TResourceDataStream)
 | Destroy (TResourceDataStream)
 | Discard (TStream)
 | DiscardLarge (TStream)
 | FakeSeekForward (TStream)
 | FixupResourceHeader (TStream)
 | GetPosition (TStream)
pt | GetPosition (TResourceDataStream)
 | GetSize (TStream)
pt | GetSize (TResourceDataStream)
 | InvalidSeek (TStream)
 | Read (TStream)
 | Read (TResourceDataStream)
 | ReadAnsiString (TStream)
 | ReadBuffer (TStream)
 | ReadByte (TStream)
 | ReadComponent (TStream)
 | ReadComponentRes (TStream)
 | ReadDWord (TStream)
 | ReadNotImplemented (TStream)
 | ReadQWord (TStream)
 | ReadResHeader (TStream)
 | ReadWord (TStream)
 | Seek (TStream)
 | Seek (TResourceDataStream)
 | SetCustomStream (TResourceDataStream)
 | SetPosition (TStream)
pt | SetPosition (TResourceDataStream)
 | SetSize (TStream)
 | SetSize64 (TStream)
pt | SetSize64 (TResourceDataStream)
 | Write (TStream)
 | Write (TResourceDataStream)
 | WriteAnsiString (TStream)
 | WriteBuffer (TStream)
 | WriteByte (TStream)
 | WriteComponent (TStream)
 | WriteComponentRes (TStream)
 | WriteDescendent (TStream)
 | WriteDescendentRes (TStream)
 | WriteDWord (TStream)
 | WriteNotImplemented (TStream)


TResourceDataStream

TStream


TResourceDataStream.Cached

Controls the copy-on-write behaviour of the stream

Declaration

Source position: resdatastream.pp line 82

public property TResourceDataStream.Cached : Boolean
  read GetCached
  write SetCached;

Description

When this property is set to true, a cached stream is used as the underlying stream for read operations. If it is set to false, no caching is performed and data is always copied to a memory stream.

Note that this property does nothing if the underlying stream is a custom stream.

By default this property is true.

See also

TResourceDataStream | Stream class that provides copy-on-write functionality
TAbstractResource.CacheData | Controls the copy-on-write behaviour of the resource


TResourceDataStream.Compare

Compares the stream to another one

Declaration

Source position: resdatastream.pp line 77

public function TResourceDataStream.Compare(

  aStream: TStream

):Boolean;

Arguments

aStream

The stream to compare to this one. It can be nil

Function result

True if the contents of the two streams are the same

Description

This methods compares the stream with aStream. If they are of the same length and their contents are the same, true is returned, false otherwise.

See also

TAbstractResource.CompareContents

Compares the contents of the resource to the contents of another one


TResourceDataStream.Create

Creates a new object

Declaration

Source position: resdatastream.pp line 75

public constructor TResourceDataStream.Create(

  aStream: TStream;

  aResource: TAbstractResource;

  aSize: Int64;

  aClass: TCachedStreamClass

);

Arguments

aStream | The stream which resource data must be read from. It can be nil
aResource | The resource whose data must be read
aSize | The size of the resource data
aClass | The class to use to create the underlying cached stream

Description

A new TResourceDataStream object is created.

If aStream is nil, the underlying stream is a memory stream. Otherwise, a cached stream of the class specified in aClass is created and set as the underlying stream.

See also

TResourceDataStream | Stream class that provides copy-on-write functionality
TCachedDataStream | Base cached stream class
TResourceDataStream.SetCustomStream | Sets a custom stream as the underlying stream


TResourceDataStream.Destroy

Declaration

Source position: resdatastream.pp line 76

public destructor TResourceDataStream.Destroy; override;


TResourceDataStream.GetPosition

Declaration

Source position: resdatastream.pp line 70

protected function TResourceDataStream.GetPosition: Int64; override;


TResourceDataStream.GetSize

Declaration

Source position: resdatastream.pp line 72

protected function TResourceDataStream.GetSize: Int64; override;


TResourceDataStream.Read

Declaration

Source position: resdatastream.pp line 79

public function TResourceDataStream.Read(

  var Buffer;

  Count: LongInt

):LongInt; override;


TResourceDataStream.Seek

Declaration

Source position: resdatastream.pp line 81

public function TResourceDataStream.Seek(

  const Offset: Int64;

  Origin: TSeekOrigin

):Int64; override;


TResourceDataStream.SetCustomStream

Sets a custom stream as the underlying stream

Declaration

Source position: resdatastream.pp line 78

public procedure TResourceDataStream.SetCustomStream(

  aStream: TStream

);

Arguments

aStream

The stream to use as the underlying stream. It can be nil

Description

This method sets a custom stream as the underlying stream.

If aStream is nil, a new memory stream is used as the underlying stream. This can be used to remove a previously set custom stream as the underlying stream.

Usually it is called by TAbstractResource.SetCustomRawDataStream.

See also

TResourceDataStream | Stream class that provides copy-on-write functionality
TAbstractResource.SetCustomRawDataStream | Sets a custom stream as the underlying stream for RawData


TResourceDataStream.SetPosition

Declaration

Source position: resdatastream.pp line 71

protected procedure TResourceDataStream.SetPosition(

  const Pos: Int64

); override;


TResourceDataStream.SetSize64

Declaration

Source position: resdatastream.pp line 73

protected procedure TResourceDataStream.SetSize64(

  const NewSize: Int64

); override;


TResourceDataStream.Write

Declaration

Source position: resdatastream.pp line 80

public function TResourceDataStream.Write(

  const Buffer;

  Count: LongInt

):LongInt; override;


EResourceClassAlreadyRegisteredException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

A resource class for a given type has already been registered

Declaration

Source position: resfactory.pp line 27

type EResourceClassAlreadyRegisteredException = class(EResourceFactoryException)

Inheritance

EResourceClassAlreadyRegisteredException | A resource class for a given type has already been registered
|
EResourceFactoryException | Base class for resource factory-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised by class method RegisterResourceClass of TResourceFactory when an attempt is made to register a class for an already registered type.

See also

TResourceFactory.RegisterResourceClass

Registers a resource class


EResourceClassAlreadyRegisteredException
EResourceFactoryException
EResourceException
Exception
 | HelpContext
 | Message


EResourceClassAlreadyRegisteredException
EResourceFactoryException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceClassAlreadyRegisteredException

EResourceFactoryException

EResourceException

Exception


EResourceFactoryException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for resource factory-related exceptions

Declaration

Source position: resfactory.pp line 26

type EResourceFactoryException = class(EResourceException)

Inheritance

EResourceFactoryException | Base class for resource factory-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject


EResourceFactoryException
EResourceException
Exception
 | HelpContext
 | Message


EResourceFactoryException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceFactoryException

EResourceException

Exception


TResourceFactory

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Factory class for resources

Declaration

Source position: resfactory.pp line 36

type TResourceFactory = class
public
class procedure RegisterResourceClass(); | Registers a resource class
class function CreateResource(); | Creates a new resource
end;

Inheritance

TResourceFactory

Factory class for resources
|

TObject

Description

Resources are represented by descendants of TAbstractResource. Some applications don't need specialized resource classes, and a TGenericResource can be enough. On the other hand, sometimes it is required that a resource of a specific type is created with a more specialized class. This class provides a centralized point for the creation of resources.

TResourceFactory holds a list of registered classes with an associated resource type. When it is requested to create a resource for a given type, it creates a resource of the class associated with that type. If no class matching that type is found, TGenericResource is used.

Usually each resource class registers itself in the initialization section of the unit in which it is implemented.

See also

TResourceFactory.RegisterResourceClass | Registers a resource class
TResourceFactory.CreateResource | Creates a new resource
TAbstractResource | Base abstract resource class
TGenericResource | Generic resource class


TResourceFactory


TResourceFactory
 | RegisterResourceClass
 | CreateResource


CreateResource (TResourceFactory)

RegisterResourceClass (TResourceFactory)


TResourceFactory.CreateResource

Creates a new resource

Declaration

Source position: resfactory.pp line 46

public class function TResourceFactory.CreateResource(

  aType: TResourceDesc;

  aName: TResourceDesc

):TAbstractResource;

Arguments

aType | The type of the resource to create
aName | The name of the resource to create

Function result

A new resource

Description

This class method creates a new resource of the class associated with the given type, and sets its name and type based on the values passed as parameters.

If no class matching the given type is found, the resource is created with TGenericResource class.

See also

TResourceFactory | Factory class for resources
TResourceFactory.RegisterResourceClass | Registers a resource class
TGenericResource | Generic resource class


TResourceFactory.RegisterResourceClass

Registers a resource class

Declaration

Source position: resfactory.pp line 43

public class procedure TResourceFactory.RegisterResourceClass(

  aType: TResID;

  aClass: TResourceClass

); overload;

class procedure TResourceFactory.RegisterResourceClass(

  aType: TResName;

  aClass: TResourceClass

); overload;

class procedure TResourceFactory.RegisterResourceClass(

  aType: TResourceDesc;

  aClass: TResourceClass

); overload;

Arguments

aType | The type associated to the resource class
aClass | The resource class to register

Arguments

aType | The type associated to the resource class
aClass | The resource class to register

Arguments

aType | The type associated to the resource class
aClass | The resource class to register

Description

This class method registers a resource class for the given resource type.

Errors

If a class has already been registered for the given resource type, an EResourceClassAlreadyRegisteredException exception is raised.

See also

TResourceFactory

Factory class for resources


ENoMoreFreeIDsException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

There are no more free IDs to use as name for a resource

Declaration

Source position: resource.pp line 83

type ENoMoreFreeIDsException = class(EResourceException)

Inheritance

ENoMoreFreeIDsException | There are no more free IDs to use as name for a resource
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised by TResources.AddAutoID method when it is not possible to generate an ID to use as a name for the given resource, because all possible 65536 IDs are already assigned to resources of the same type as the given one.

See also

TResources.AddAutoID

Adds a resource and gives it a new autogenerated name


ENoMoreFreeIDsException
EResourceException
Exception
 | HelpContext
 | Message


ENoMoreFreeIDsException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


ENoMoreFreeIDsException

EResourceException

Exception


EResourceDescChangeNotAllowedException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Description is not allowed to change

Declaration

Source position: resource.pp line 79

type EResourceDescChangeNotAllowedException = class(EResourceException)

Inheritance

EResourceDescChangeNotAllowedException | Description is not allowed to change
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised when a resource description (either type or name) is tried to be changed, but the resource class doesn't allow it.

See also

TAbstractResource._Type | The type of the resource
TAbstractResource.Name | The name of the resource


EResourceDescChangeNotAllowedException
EResourceException
Exception
 | HelpContext
 | Message


EResourceDescChangeNotAllowedException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceDescChangeNotAllowedException

EResourceException

Exception


EResourceDescTypeException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Wrong description type error

Declaration

Source position: resource.pp line 78

type EResourceDescTypeException = class(EResourceException)

Inheritance

EResourceDescTypeException | Wrong description type error
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised when a resource description is of type dtName and TResourceDesc.ID property is read.

See also

TResourceDesc.ID

The value of the resource description as an ID


EResourceDescTypeException
EResourceException
Exception
 | HelpContext
 | Message


EResourceDescTypeException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceDescTypeException

EResourceException

Exception


EResourceDuplicateException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

There is already a resource with same type, name and language ID

Declaration

Source position: resource.pp line 81

type EResourceDuplicateException = class(EResourceException)

Inheritance

EResourceDuplicateException | There is already a resource with same type, name and language ID
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised when a resource is being added to a TResources object, but another resource with the same type, name and language ID already exists.

See also

TResources.Add | Adds a resource
TResources.MoveFrom | Moves all resources of another TResources object to itself


EResourceDuplicateException
EResourceException
Exception
 | HelpContext
 | Message


EResourceDuplicateException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceDuplicateException

EResourceException

Exception


EResourceException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for resource-related exceptions

Declaration

Source position: resource.pp line 77

type EResourceException = class(Exception)

Inheritance

EResourceException

Base class for resource-related exceptions
|

Exception
|

TObject


EResourceException
Exception
 | HelpContext
 | Message


EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceException

Exception


EResourceLangIDChangeNotAllowedException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Language ID is not allowed to change

Declaration

Source position: resource.pp line 80

type EResourceLangIDChangeNotAllowedException = class(EResourceException)

Inheritance

EResourceLangIDChangeNotAllowedException | Language ID is not allowed to change
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised when the resource language ID is tried to be changed, but the resource is contained in a TResources object.

See also

TAbstractResource.LangID

The language ID of the resource


EResourceLangIDChangeNotAllowedException
EResourceException
Exception
 | HelpContext
 | Message


EResourceLangIDChangeNotAllowedException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceLangIDChangeNotAllowedException

EResourceException

Exception


EResourceNotFoundException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

No resource matching the search criteria is found

Declaration

Source position: resource.pp line 82

type EResourceNotFoundException = class(EResourceException)

Inheritance

EResourceNotFoundException | No resource matching the search criteria is found
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised when searching for a resource in a TResources object fails.

See also

TResources.Find | Searches for a resource
TResources.Remove | Removes a resource


EResourceNotFoundException
EResourceException
Exception
 | HelpContext
 | Message


EResourceNotFoundException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceNotFoundException

EResourceException

Exception


EResourceReaderException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for resource reader-related exceptions

Declaration

Source position: resource.pp line 85

type EResourceReaderException = class(EResourceException)

Inheritance

EResourceReaderException | Base class for resource reader-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject


EResourceReaderException
EResourceException
Exception
 | HelpContext
 | Message


EResourceReaderException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceReaderException

EResourceException

Exception


EResourceReaderNotFoundException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

No suitable resource reader was found

Declaration

Source position: resource.pp line 86

type EResourceReaderNotFoundException = class(EResourceReaderException)

Inheritance

EResourceReaderNotFoundException | No suitable resource reader was found
|
EResourceReaderException | Base class for resource reader-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised when no TAbstractResourceReader descendant able to read a stream was found.

See also

TResources.FindReader | Searches for a suitable resource reader
TResources.LoadFromStream | Loads the contents of the object from a stream
TResources.LoadFromFile | Loads the contents of the object from a file


EResourceReaderNotFoundException
EResourceReaderException
EResourceException
Exception
 | HelpContext
 | Message


EResourceReaderNotFoundException
EResourceReaderException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceReaderNotFoundException

EResourceReaderException

EResourceException

Exception


EResourceReaderUnexpectedEndOfStreamException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

The stream ended prematurely

Declaration

Source position: resource.pp line 88

type EResourceReaderUnexpectedEndOfStreamException = class(EResourceReaderException)

Inheritance

EResourceReaderUnexpectedEndOfStreamException | The stream ended prematurely
|
EResourceReaderException | Base class for resource reader-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised by Load method of a TAbstractResourceReader descendant when the stream it was asked to read resources from ended prematurely.

See also

TAbstractResourceReader.Load

Loads resources from a stream


EResourceReaderUnexpectedEndOfStreamException
EResourceReaderException
EResourceException
Exception
 | HelpContext
 | Message


EResourceReaderUnexpectedEndOfStreamException
EResourceReaderException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceReaderUnexpectedEndOfStreamException

EResourceReaderException

EResourceException

Exception


EResourceReaderWrongFormatException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

The stream is not in the format the reader supports

Declaration

Source position: resource.pp line 87

type EResourceReaderWrongFormatException = class(EResourceReaderException)

Inheritance

EResourceReaderWrongFormatException | The stream is not in the format the reader supports
|
EResourceReaderException | Base class for resource reader-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised by Load method of a TAbstractResourceReader descendant when the stream it was asked to read resources from is not in the format it supports.

See also

TAbstractResourceReader.Load

Loads resources from a stream


EResourceReaderWrongFormatException
EResourceReaderException
EResourceException
Exception
 | HelpContext
 | Message


EResourceReaderWrongFormatException
EResourceReaderException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceReaderWrongFormatException

EResourceReaderException

EResourceException

Exception


EResourceWriterException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for resource writer-related exceptions

Declaration

Source position: resource.pp line 90

type EResourceWriterException = class(EResourceException)

Inheritance

EResourceWriterException | Base class for resource writer-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject


EResourceWriterException
EResourceException
Exception
 | HelpContext
 | Message


EResourceWriterException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceWriterException

EResourceException

Exception


EResourceWriterNotFoundException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

No suitable resource writer was found

Declaration

Source position: resource.pp line 91

type EResourceWriterNotFoundException = class(EResourceWriterException)

Inheritance

EResourceWriterNotFoundException | No suitable resource writer was found
|
EResourceWriterException | Base class for resource writer-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised by WriteToFile method of TResources when no TAbstractResourceWriter descendant matching filename extension was found.

See also

TResources.WriteToFile

Writes the contents of the object to a file


EResourceWriterNotFoundException
EResourceWriterException
EResourceException
Exception
 | HelpContext
 | Message


EResourceWriterNotFoundException
EResourceWriterException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EResourceWriterNotFoundException

EResourceWriterException

EResourceException

Exception


TAbstractResource

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base abstract resource class

Declaration

Source position: resource.pp line 129

type TAbstractResource = class
protected
procedure SetDescOwner(); | Sets this resource as the owner of the given TResourceDesc
procedure SetOwnerList(); virtual; | Protected method to let a resource list set itself as the owner of the resource
procedure SetChildOwner(); | Protected method to let a resource set itself as the owner of a sub-resource
function GetType; virtual; abstract; | Returns the type of the resource
function GetName; virtual; abstract; | Returns the name of the resource
function ChangeDescTypeAllowed(); virtual; abstract; | Reports whether changing the type of resource type or name is allowed
function ChangeDescValueAllowed(); virtual; abstract; | Reports whether changing the value of resource type or name is allowed
procedure NotifyResourcesLoaded; virtual; abstract; | Tells the resource that all resources have been loaded
constructor Create(); | Creates a new resource
public
destructor Destroy; override; | Destroys the object
function CompareContents(); virtual; | Compares the contents of the resource to the contents of another one
procedure UpdateRawData; virtual; abstract; | Updates RawData stream.
procedure SetCustomRawDataStream(); | Sets a custom stream as the underlying stream for RawData
property _Type: TResourceDesc; [r] | The type of the resource
property Name: TResourceDesc; [r] | The name of the resource
property LangID: TLangID; [rw] | The language ID of the resource
property DataSize: LongWord; [r] | The size of resource raw data
property HeaderSize: LongWord; [r] | The size of resource header
property DataVersion: LongWord; [rw] | The version of the resource data
property MemoryFlags: Word; [rw] | The memory flags of the resource
property Version: LongWord; [rw] | A user defined version number
property Characteristics: LongWord; [rw] | A user defined piece of data
property DataOffset: LongWord; [r] | The offset of resource data from the beginning of the stream
property CodePage: LongWord; [rw] | The code page of the resource
property RawData: TStream; [r] | The raw resource data stream
property CacheData: Boolean; [rw] | Controls the copy-on-write behaviour of the resource
property OwnerList: TResources; [r] | The resource list that owns this resource
property Owner: TAbstractResource; [r] | The owner of this resource
end;

Inheritance

TAbstractResource

Base abstract resource class
|

TObject

Description

This is the base class that represents a resource.

A resource is identified by its type, name and language ID even if some file formats or operating systems don't consider the latter.

There are also additional properties that aren't always present in all file formats, so their values aren't always meaningful: however, they can be used to display detailed information when possible.

Every resource has a RawData stream that holds resource data. This stream uses a copy-on-write mechanism: if the resource has been read from a stream or file, RawData redirects read operations to the original stream. This is particularly useful when a resource file must be converted from a format to another, or when more resource files must be merged, since (potentially large) resource data is directly copied from the original to the destination stream without the need of allocating a lot of memory.

When resource data is encoded in a resource-specific format, RawData can be uncomfortable: it's often better to use a more specialized descendant class that provides additional properties and methods.

Resources cannot be read or written alone from/to a stream: they need to be contained in a TResources object, which represents an abstract view of a resource file.

Usually each descendant registers itself with TResourceFactory class in the initialization section of the unit in which it is implemented: this way TResourceFactory class can know which class to use to instantiate a resource of a given type.

Remark: An object of this class should never be directly instantiated: use a descendant class instead.

See also

TGenericResource | Generic resource class
TAcceleratorsResource | Accelerator table resource type
TBitmapResource | Bitmap resource type
TGroupCursorResource | Group cursor resource type
TGroupIconResource | Group icon resource type
TStringTableResource | String table resource type
TVersionResource | Version information resource type
TResources | A collection of resources
TResourceFactory | Factory class for resources


TAbstractResource
 | ro | _Type
 | ro | Name
 |  | LangID
 | ro | DataSize
 | ro | HeaderSize
 |  | DataVersion
 |  | MemoryFlags
 |  | Version
 |  | Characteristics
 | ro | DataOffset
 |  | CodePage
 | ro | RawData
 |  | CacheData
 | ro | OwnerList
 | ro | Owner


ro | DataOffset (TAbstractResource)
ro | DataSize (TAbstractResource)
 | DataVersion (TAbstractResource)
ro | HeaderSize (TAbstractResource)
 | LangID (TAbstractResource)
 | MemoryFlags (TAbstractResource)
ro | Name (TAbstractResource)
ro | Owner (TAbstractResource)
ro | OwnerList (TAbstractResource)
ro | RawData (TAbstractResource)
 | Version (TAbstractResource)
ro |


TAbstractResource
pt | SetDescOwner
pt | SetOwnerList
pt | SetChildOwner
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
pt | Create
 | Destroy
 | CompareContents
 | UpdateRawData
 | SetCustomRawDataStream


pt | ChangeDescTypeAllowed (TAbstractResource)
pt | ChangeDescValueAllowed (TAbstractResource)
 | CompareContents (TAbstractResource)
pt | Create (TAbstractResource)
 | Destroy (TAbstractResource)
pt | GetName (TAbstractResource)
pt | GetType (TAbstractResource)
pt | NotifyResourcesLoaded (TAbstractResource)
pt | SetChildOwner (TAbstractResource)
 | SetCustomRawDataStream (TAbstractResource)
pt | SetDescOwner (TAbstractResource)
pt |


TAbstractResource


TAbstractResource._Type

The type of the resource

Declaration

Source position: resource.pp line 164

public property TAbstractResource._Type : TResourceDesc
  read GetType;

Description

Remark:

Please note that some TAbstractResource descendants don't allow resource type to be changed (e.g: it's not possible for a TBitmapResource to have a type other than RT_BITMAP). If it is the case, an EResourceDescChangeNotAllowedException exception is raised.

Moreover, if the resource is contained in a TResources object, type change is not allowed.

See also

TAbstractResource.ChangeDescTypeAllowed | Reports whether changing the type of resource type or name is allowed
TAbstractResource.ChangeDescValueAllowed | Reports whether changing the value of resource type or name is allowed


TAbstractResource.CacheData

Controls the copy-on-write behaviour of the resource

Declaration

Source position: resource.pp line 176

public property TAbstractResource.CacheData : Boolean
  read GetCacheData
  write SetCacheData;

Description

When CacheData is true, copy-on-write mechanism of RawData is enabled.

Setting CacheData to false forces the raw resource data to be loaded in memory without performing any caching.

By default, CacheData is true.

See also

TAbstractResource.RawData | The raw resource data stream
TResources.CacheData | Controls the copy-on-write behaviour of all resources


TAbstractResource.ChangeDescTypeAllowed

Reports whether changing the type of resource type or name is allowed

Declaration

Source position: resource.pp line 154

protected function TAbstractResource.ChangeDescTypeAllowed(

  aDesc: TResourceDesc

):Boolean; virtual; abstract;

Arguments

aDesc

The TResourceDesc whose type should be changed

Function result

True if the resource allows the given TResourceDesc to change type

Description

Descendant classes must implement this method to declare if the resource allows changing the type of one of its resource description (type or name): that is, if it allows one of its descriptions type to change from dtName to dtID or vice versa.

Example:

A certain resource class allows its name only to be changed: e.g. a TBitmapResource doesn't want its type to be anything else than RT_BITMAP. It then allows changing the type of the description only if the description is the resource name:

Result:=aDesc=fName;

See also

TAbstractResource.ChangDescValueAllowed


TAbstractResource.ChangeDescValueAllowed

Reports whether changing the value of resource type or name is allowed

Declaration

Source position: resource.pp line 155

protected function TAbstractResource.ChangeDescValueAllowed(

  aDesc: TResourceDesc

):Boolean; virtual; abstract;

Arguments

aDesc

The TResourceDesc whose value should be changed

Function result

True if the resource allows the given TResourceDesc to change value

Description

Descendant classes must implement this method to declare if the resource allows changing the value of one of its resource description (type or name).

Example:

A certain resource class allows its name only to be changed: e.g. a TBitmapResource doesn't want its type to be anything else than RT_BITMAP. It then allows changing the value of the description only if the description is the resource name:

Result:=aDesc=fName;

See also

TAbstractResource.ChangDescTypeAllowed


TAbstractResource.Characteristics

A user defined piece of data

Declaration

Source position: resource.pp line 172

public property TAbstractResource.Characteristics : LongWord
  read fCharacteristics
  write fCharacteristics;

Description

A tool that writes resource files can write arbitrary data in this field.

This property is not always meaningful, since not all file formats support it.

Its value, when nonzero, can be used for information purposes.

See also

TAbstractResource.Version

A user defined version number


TAbstractResource.CodePage

The code page of the resource

Declaration

Source position: resource.pp line 174

public property TAbstractResource.CodePage : LongWord
  read fCodePage
  write fCodePage;

Description

This property is not always meaningful, since not all file formats support it.

Its value, when nonzero, can be used for information purposes.


TAbstractResource.CompareContents

Compares the contents of the resource to the contents of another one

Declaration

Source position: resource.pp line 161

public function TAbstractResource.CompareContents(

  aResource: TAbstractResource

):Boolean; virtual;

Arguments

aResource

The resource to compare to this one

Function result

True if the contents of the two resources are the same

Description

This methods compares the contents of the resource with the ones of aResource. If they are of the same length and their contents are the same, true is returned, false otherwise.

Usually this methods compares the contents of the two RawData streams, calling TResourceDataStream.Compare, but descendent classes can implement a different algorithm.

See also

TResourceDataStream.Compare

Compares the stream to another one


TAbstractResource.Create

Creates a new resource

Declaration

Source position: resource.pp line 157

protected constructor TAbstractResource.Create; virtual; overload;

constructor TAbstractResource.Create(

  aType: TResourceDesc;

  aName: TResourceDesc

); virtual; abstract; overload;

Arguments

aType | The type of the resource to be created
aName | The name of the resource to be created

Description

A new resource is created with the given type and name.

Remark: Please note that the resource doesn't take ownership of the TResourceDesc objects passed as parameters, it simply copies them: it's user responsibility to free them when no longer needed.


TAbstractResource.DataOffset

The offset of resource data from the beginning of the stream

Declaration

Source position: resource.pp line 173

public property TAbstractResource.DataOffset : LongWord
  read fDataOffset;

Description

A reader sets this property to let the resource know where its raw data begins in the resource stream.

See also

TAbstractResource.RawData | The raw resource data stream
TAbstractResource.DataSize | The size of resource raw data


TAbstractResource.DataSize

The size of resource raw data

Declaration

Source position: resource.pp line 167

public property TAbstractResource.DataSize : LongWord
  read GetDataSize;

Description

DataSize is the length, in bytes, of the resource data, accessible via RawData property.

See also

TAbstractResource.RawData | The raw resource data stream
TAbstractResource.DataOffset | The offset of resource data from the beginning of the stream


TAbstractResource.DataVersion

The version of the resource data

Declaration

Source position: resource.pp line 169

public property TAbstractResource.DataVersion : LongWord
  read fDataVersion
  write fDataVersion;

Description

This property is not always meaningful, since not all file formats support it.

Its value, when nonzero, can be used for information purposes.


TAbstractResource.Destroy

Destroys the object

Declaration

Source position: resource.pp line 160

public destructor TAbstractResource.Destroy; override;


TAbstractResource.GetName

Returns the name of the resource

Declaration

Source position: resource.pp line 153

protected function TAbstractResource.GetName: TResourceDesc; virtual; abstract;

Function result

The TResourceDesc object representing the name of the resource

Description

Descendant classes must implement this method to provide access to the resource name.


TAbstractResource.GetType

Returns the type of the resource

Declaration

Source position: resource.pp line 152

protected function TAbstractResource.GetType: TResourceDesc; virtual; abstract;

Function result

The TResourceDesc object representing the type of the resource

Description

Descendant classes must implement this method to provide access to the resource type.


TAbstractResource.HeaderSize

The size of resource header

Declaration

Source position: resource.pp line 168

public property TAbstractResource.HeaderSize : LongWord
  read fHeaderSize;

Description

This property is not always meaningful, since not all file formats support it.

Its value, when nonzero, can be used for information purposes.


TAbstractResource.LangID

The language ID of the resource

Declaration

Source position: resource.pp line 166

public property TAbstractResource.LangID : TLangID
  read fLangID
  write SetLangID;

Description

Remark: Please note that if the resource is contained in a TResources object, language ID change is not allowed: trying to do so results in an EResourceLangIDChangeNotAllowedException exception being raised.


TAbstractResource.MemoryFlags

The memory flags of the resource

Declaration

Source position: resource.pp line 170

public property TAbstractResource.MemoryFlags : Word
  read fMemoryFlags
  write fMemoryFlags;

Description

This field is a combination of the following flags

  • MF_MOVEABLE
  • MF_PURE
  • MF_PRELOAD
  • MF_DISCARDABLE

By default, a newly created resource has MF_MOVEABLE and MF_DISCARDABLE flags set.

Remark: Please note that memory flags are ignored by Windows and Free Pascal RTL. They are provided only for compatibility with 16-bit Windows.

This property is not always meaningful, since not all file formats support it.

Its value, when nonzero, can be used for information purposes.


TAbstractResource.Name

The name of the resource

Declaration

Source position: resource.pp line 165

public property TAbstractResource.Name : TResourceDesc
  read GetName;

Description

Remark:

Please note that some TAbstractResource descendants don't allow resource name to be changed (e.g: a TStringTableResource name is determined by the range of strings' ID it contains). If it is the case, an EResourceDescChangeNotAllowedException exception is raised.

Moreover, if the resource is contained in a TResources object, name change is not allowed.

See also

TAbstractResource.ChangeDescTypeAllowed | Reports whether changing the type of resource type or name is allowed
TAbstractResource.ChangeDescValueAllowed | Reports whether changing the value of resource type or name is allowed


TAbstractResource.NotifyResourcesLoaded

Tells the resource that all resources have been loaded

Declaration

Source position: resource.pp line 156

protected procedure TAbstractResource.NotifyResourcesLoaded; virtual; abstract;

Description

This method is called by a TResources object when the loading of all resources from a stream has completed.

Example:

A Group resource (e.g. TGroupIconResource) can use this method to find all its sub-resources, since all resources have been loaded from a stream.


TAbstractResource.Owner

The owner of this resource

Declaration

Source position: resource.pp line 178

public property TAbstractResource.Owner : TAbstractResource
  read fOwner;

Description

This property is meaningful only for those sub-resources that are part of a larger group resource.

Example: an icon is made by a RT_GROUP_ICON resource and many RT_ICON resources that hold single-image data. Each RT_ICON resource has a pointer to the RT_GROUP_ICON resource in its Owner property.


TAbstractResource.OwnerList

The resource list that owns this resource

Declaration

Source position: resource.pp line 177

public property TAbstractResource.OwnerList : TResources
  read fOwnerList;

Description

This property identifies the TResources object to which this resource belongs to.

This property can be nil if the resource isn't part of a resource list.


TAbstractResource.RawData

The raw resource data stream

Declaration

Source position: resource.pp line 175

public property TAbstractResource.RawData : TStream
  read GetRawData;

Description

This property provides access to the resource raw data in a stream-like way.

When a resource has been read from a stream, RawData redirects read operations to the original stream. When RawData is written to, a copy-on-write mechanism copies data from the original stream to a memory stream.

The copy-on-write behaviour can be controlled via CacheData property.

Note that for some predefined resource types there are better ways to read and write resource data: some resource types use specific formats, so RawData might not always be what one expected. E.g. in a resource of type RT_BITMAP, RawData doesn't contain a valid BMP file: in this case it's better to use BitmapData stream of TBitmapResource class to work with a BMP-like stream.

Remark: When writing to a "specialized" stream in a descendant class (like the TBitmapResource.BitmapData stream mentioned earlier), RawData contents might not be valid anymore. If you need to access RawData again, be sure to call UpdateRawData method first.

Usually there isn't much penalty in using specialized streams in descendant classes, since data isn't duplicated in two or more streams, whenever possible. So, having a very large bitmap resource and reading/writing it via TBitmapResource.BitmapData doesn't mean the bitmap is allocated two times.

See also

TAbstractResource.CacheData | Controls the copy-on-write behaviour of the resource
TAbstractResource.UpdateRawData | Updates RawData stream.
TAbstractResource.SetCustomRawDataStream | Sets a custom stream as the underlying stream for RawData


TAbstractResource.SetChildOwner

Protected method to let a resource set itself as the owner of a sub-resource

Declaration

Source position: resource.pp line 151

protected procedure TAbstractResource.SetChildOwner(

  aChild: TAbstractResource

);

Arguments

aChild

The sub-resource that the resource must own


TAbstractResource.SetCustomRawDataStream

Sets a custom stream as the underlying stream for RawData

Declaration

Source position: resource.pp line 163

public procedure TAbstractResource.SetCustomRawDataStream(

  aStream: TStream

);

Arguments

aStream

The custom stream to use as the underlying RawData stream. It can be nil

Description

Normally, RawData uses a memory stream or the original resource stream (e.g. the original file containing the resource) as its underlying stream. This method allows the user to use a custom stream as the underlying stream. This can be useful when a resource must be created from the contents of an original file as-is.

If aStream is nil, a new memory stream is used as the underlying stream. This can be used to remove a previously set custom stream as the underlying stream.

Sample code

This code creates a resource containing an html file

var
  aType, aName : TResourceDesc;
  aRes : TGenericResource;
  aFile : TFileStream;
begin
  aType:=TResourceDesc.Create(RT_HTML);
  aName:=TResourceDesc.Create('index');
  aRes:=TGenericResource.Create(aType,aName);
  aFile:=TFileStream.Create('index.html',fmOpenRead or fmShareDenyNone);
  aRes.SetCustomRawDataStream(aFile);

  //do something...

  aRes.Free;
  aFile.Free;
  aType.Free;
  aName.Free;
end;

See also

TAbstractResource.RawData

The raw resource data stream


TAbstractResource.SetDescOwner

Sets this resource as the owner of the given TResourceDesc

Declaration

Source position: resource.pp line 149

protected procedure TAbstractResource.SetDescOwner(

  aDesc: TResourceDesc

);

Arguments

aDesc

The TResourceDesc that the resource must own

Description

This method is provided so that descendants of TAbstractResource can set themselves as the owners of the given TResourceDesc


TAbstractResource.SetOwnerList

Protected method to let a resource list set itself as the owner of the resource

Declaration

Source position: resource.pp line 150

protected procedure TAbstractResource.SetOwnerList(

  aResources: TResources

); virtual;

Arguments

aResources

The resource list that is to become the owner of the resource


TAbstractResource.UpdateRawData

Updates RawData stream.

Declaration

Source position: resource.pp line 162

public procedure TAbstractResource.UpdateRawData; virtual; abstract;

Description

When operating on resource data with more high-level streams than RawData (e.g: TBitmapResource.BitmapData) RawData contents are no longer valid. This method ensures that RawData stream is properly synchronized with the contents of the higher-level stream.

Remark: Normally a resource writer doesn't need to call this method when it is about to write the resource data to a stream, since TResources class takes care of this before telling the resource writer to write resources to a stream.

See also

TAbstractResource.RawData

The raw resource data stream


TAbstractResource.Version

A user defined version number

Declaration

Source position: resource.pp line 171

public property TAbstractResource.Version : LongWord
  read fVersion
  write fVersion;

Description

A tool that writes resource files can write version information in this field.

This property is not always meaningful, since not all file formats support it.

Its value, when nonzero, can be used for information purposes.

See also

TAbstractResource.Characteristics

A user defined piece of data


TAbstractResourceReader

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base abstract resource reader class

Declaration

Source position: resource.pp line 283

type TAbstractResourceReader = class
protected
procedure SetDataSize(); | Protected method to let a reader set a resource DataSize property
procedure SetHeaderSize(); | Protected method to let a reader set a resource HeaderSize property
procedure SetDataOffset(); | Protected method to let a reader set a resource DataOffset property
procedure SetRawData(); | Protected method to let a reader set a resource RawData property
procedure CallSubReaderLoad(); | Calls another reader's Load method
procedure AddNoTree(); | Adds a resource without updating the internal tree
function GetTree(); | Gets the internal resource tree of a TResources object
function GetExtensions; virtual; abstract; | Returns the extensions the reader is registered for
function GetDescription; virtual; abstract; | Returns the description of the reader
procedure Load(); virtual; abstract; | Loads resources from a stream
function CheckMagic(); virtual; abstract; | Checks whether a stream is in a format the reader recognizes
public
constructor Create; virtual; abstract; | Creates a new reader object
property Extensions: string; [r] | The extensions of file types the reader is able to read
property Description: string; [r] | The reader description
end;

Inheritance

TAbstractResourceReader

Base abstract resource reader class
|

TObject

Description

This is the base class that represents a resource reader.

A resource reader is an object whose job is to populate a TResources object with resources read from a stream in a specific format.

Typically, a TResources object invokes CheckMagic method of the resource reader when it's searching for a reader able to read a certain stream, and Load method when it wants the reader to read data from the stream.

Usually each resource reader registers itself with TResources class in the initialization section of the unit in which it is implemented: this way a TResources object can find it when probing a stream that is to be read.

Remark: An object of this class should never be directly instantiated: use a descendant class instead.

See also

TResources | A collection of resources
TAbstractResource | Base abstract resource class
TAbstractResourceWriter | Base abstract resource writer class
TResResourceReader | .res resource reader
TCoffResourceReader | COFF resource reader
TWinPEResourceReader | PE image file resource reader
TElfResourceReader | ELF resource reader
TExternalResourceReader | External file resource reader
TDfmResourceReader | DFM resource reader


TAbstractResourceReader
 | ro | Extensions
 | ro | Description


TAbstractResourceReader
pt | SetDataSize
pt | SetHeaderSize
pt | SetDataOffset
pt | SetRawData
pt | CallSubReaderLoad
pt | AddNoTree
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create


pt | AddNoTree (TAbstractResourceReader)
pt | CallSubReaderLoad (TAbstractResourceReader)
pt | CheckMagic (TAbstractResourceReader)
 | Create (TAbstractResourceReader)
pt | GetDescription (TAbstractResourceReader)
pt | GetExtensions (TAbstractResourceReader)
pt | GetTree (TAbstractResourceReader)
pt | Load (TAbstractResourceReader)
pt | SetDataOffset (TAbstractResourceReader)
pt | SetDataSize (TAbstractResourceReader)
pt | SetHeaderSize (TAbstractResourceReader)
pt |


TAbstractResourceReader


TAbstractResourceReader.AddNoTree

Adds a resource without updating the internal tree

Declaration

Source position: resource.pp line 291

protected procedure TAbstractResourceReader.AddNoTree(

  aResources: TResources;

  aResource: TAbstractResource

);

Arguments

aResources | The TResources object to be notified
aResource | The resource that has been added to the tree

Description

This protected method is used by descendents of TAbstractResourceReader after they add new resources to the internal resource tree used by a TResources object. Calling this method notifies the TResources object about the newly-added resource.

See also

TAbstractResourceReader.GetTree | Gets the internal resource tree of a TResources object
TRootResTreeNode | The root node in a resource tree


TAbstractResourceReader.CallSubReaderLoad

Calls another reader's Load method

Declaration

Source position: resource.pp line 290

protected procedure TAbstractResourceReader.CallSubReaderLoad(

  aReader: TAbstractResourceReader;

  aResources: TResources;

  aStream: TStream

);

Arguments

aReader | The reader whose Load method must be called
aResources | The aResources parameter of Load method
aStream | The aStream parameter of Load method

Description

This method allows a descendant class to call another reader's Load method. This can be useful when a reader needs to use another one.


TAbstractResourceReader.CheckMagic

Checks whether a stream is in a format the reader recognizes

Declaration

Source position: resource.pp line 296

protected function TAbstractResourceReader.CheckMagic(

  aStream: TStream

):Boolean; virtual; abstract;

Arguments

aStream

The stream to check

Function result

true if the format of the stream is recognized

Description

A TResources object invokes this method when it is searching for a reader able to read a stream, passing that stream as the aStream parameter.

aStream position is already correctly set: the reader must start to read from there.

This method should read the minimum amount of information needed to recognize the contents of a stream as a valid format: it usually means reading a magic number or a file header.

See also

TAbstractResourceReader.Load | Loads resources from a stream
TResources.FindReader | Searches for a suitable resource reader
TResources.LoadFromStream | Loads the contents of the object from a stream
TResources.LoadFromFile | Loads the contents of the object from a file


TAbstractResourceReader.Create

Creates a new reader object

Declaration

Source position: resource.pp line 298

public constructor TAbstractResourceReader.Create; virtual; abstract;


TAbstractResourceReader.Description

The reader description

Declaration

Source position: resource.pp line 300

public property TAbstractResourceReader.Description : string
  read GetDescription;

Description

This property provides a textual description of the reader, e.g. "FOO resource reader"


TAbstractResourceReader.Extensions

The extensions of file types the reader is able to read

Declaration

Source position: resource.pp line 299

public property TAbstractResourceReader.Extensions : string
  read GetExtensions;

Description

This property is a string made of space-separated file extensions (each including the leading dot), all lowercase.

This property signals which file types the reader is able to read.


TAbstractResourceReader.GetDescription

Returns the description of the reader

Declaration

Source position: resource.pp line 294

protected function TAbstractResourceReader.GetDescription: string; virtual; abstract;

Function result

The description of the reader

Description

Descendant classes must implement this method to provide access to Description property.

See also

TAbstractResourceReader.Description

The reader description


TAbstractResourceReader.GetExtensions

Returns the extensions the reader is registered for

Declaration

Source position: resource.pp line 293

protected function TAbstractResourceReader.GetExtensions: string; virtual; abstract;

Function result

The extensions the reader is registered for

Description

Descendant classes must implement this method to provide access to Extensions property.

See also

TAbstractResourceReader.Extensions

The extensions of file types the reader is able to read


TAbstractResourceReader.GetTree

Gets the internal resource tree of a TResources object

Declaration

Source position: resource.pp line 292

protected function TAbstractResourceReader.GetTree(

  aResources: TResources

):TObject;

Arguments

aResources

The TResources object whose tree must be returned

Function result

The resource tree. It is an instance of TRootResTreeNode.

Description

This protected method can be used by descendents of TAbstractResourceReader to obtain the internal resource tree used by a TResources object. The internal resource tree is an instance of TRootResTreeNode.

Some resource readers can improve their performance if, instead of calling TResources.Add, add themselves resources to the internal tree used by a TResources object.

Remark: After adding a resource to a resource tree, a reader must always call AddNoTree method to let the TResources object know about the newly-added resource.

See also

TAbstractResourceReader.AddNoTree | Adds a resource without updating the internal tree
TRootResTreeNode | The root node in a resource tree


TAbstractResourceReader.Load

Loads resources from a stream

Declaration

Source position: resource.pp line 295

protected procedure TAbstractResourceReader.Load(

  aResources: TResources;

  aStream: TStream

); virtual; abstract;

Arguments

aResources | The TResources object to be loaded from the stream
aStream | The stream which resources must be loaded from

Description

A TResources object invokes this method when it needs to be loaded from a stream, passing itself as the aResources parameter and the stream as the aStream parameter.

aStream position is already correctly set: the reader must start to read from there.

Descendant classes must ensure that the the stream is in a format they recognize, otherwise an EResourceReaderWrongFormatException exception must be raised.

Each resource is then created, read from the stream and added to the TResources object.

When reading a resource, a reader must:

  • Create the resource via TResourceFactory.CreateResource class method with the correct type and name.

  • Set at least the following resource properties:

    • DataSize, via SetDataSize method.
    • DataOffset, via SetDataSize method. This is the offset of the resource data from the beginning of the stream.
    • RawData. The reader must create a TResourceDataStream object and assign it to the resource via SetRawData method.

Errors

If the stream is in a format not recognized by the reader, a EResourceReaderWrongFormatException exception must be raised.

If the stream ends prematurely, a EResourceReaderUnexpectedEndOfStreamException exception must be raised.

See also

TResources | A collection of resources
TResources.LoadFromStream | Loads the contents of the object from a stream
TResources.LoadFromFile | Loads the contents of the object from a file
TAbstractResource | Base abstract resource class
TAbstractResource.DataSize | The size of resource raw data
TAbstractResource.DataOffset | The offset of resource data from the beginning of the stream
TAbstractResource.RawData | The raw resource data stream
TAbstractResourceReader.SetDataSize | Protected method to let a reader set a resource DataSize property
TAbstractResourceReader.SetDataOffset | Protected method to let a reader set a resource DataOffset property
TAbstractResourceReader.SetRawData | Protected method to let a reader set a resource RawData property
TAbstractResourceReader.CheckMagic | Checks whether a stream is in a format the reader recognizes
TResourceDataStream | Stream class that provides copy-on-write functionality


TAbstractResourceReader.SetDataOffset

Protected method to let a reader set a resource DataOffset property

Declaration

Source position: resource.pp line 288

protected procedure TAbstractResourceReader.SetDataOffset(

  aResource: TAbstractResource;

  aValue: LongWord

);

Arguments

aResource | The resource whose DataOffset property must be set
aValue | The value to set the property to

Description

This method allows a descendant class to set DataOffset property of a resource that is being loaded.

See also

TAbstractResourceReader.SetDataSize | Protected method to let a reader set a resource DataSize property
TAbstractResourceReader.SetHeaderSize | Protected method to let a reader set a resource HeaderSize property
TAbstractResourceReader.SetRawData | Protected method to let a reader set a resource RawData property


TAbstractResourceReader.SetDataSize

Protected method to let a reader set a resource DataSize property

Declaration

Source position: resource.pp line 286

protected procedure TAbstractResourceReader.SetDataSize(

  aResource: TAbstractResource;

  aValue: LongWord

);

Arguments

aResource | The resource whose DataSize property must be set
aValue | The value to set the property to

Description

This method allows a descendant class to set DataSize property of a resource that is being loaded.

See also

TAbstractResourceReader.SetHeaderSize | Protected method to let a reader set a resource HeaderSize property
TAbstractResourceReader.SetDataOffset | Protected method to let a reader set a resource DataOffset property
TAbstractResourceReader.SetRawData | Protected method to let a reader set a resource RawData property


TAbstractResourceReader.SetHeaderSize

Protected method to let a reader set a resource HeaderSize property

Declaration

Source position: resource.pp line 287

protected procedure TAbstractResourceReader.SetHeaderSize(

  aResource: TAbstractResource;

  aValue: LongWord

);

Arguments

aResource | The resource whose HeaderSize property must be set
aValue | The value to set the property to

Description

This method allows a descendant class to set HeaderSize property of a resource that is being loaded.

See also

TAbstractResourceReader.SetDataSize | Protected method to let a reader set a resource DataSize property
TAbstractResourceReader.SetDataOffset | Protected method to let a reader set a resource DataOffset property
TAbstractResourceReader.SetRawData | Protected method to let a reader set a resource RawData property


TAbstractResourceReader.SetRawData

Protected method to let a reader set a resource RawData property

Declaration

Source position: resource.pp line 289

protected procedure TAbstractResourceReader.SetRawData(

  aResource: TAbstractResource;

  aStream: TStream

);

Arguments

aResource | The resource whose RawData property must be set
aStream | The value to set the property to

Description

This method allows a descendant class to set RawData property of a resource that is being loaded.

See also

TAbstractResourceReader.SetDataSize | Protected method to let a reader set a resource DataSize property
TAbstractResourceReader.SetHeaderSize | Protected method to let a reader set a resource HeaderSize property
TAbstractResourceReader.SetDataOffset | Protected method to let a reader set a resource DataOffset property


TAbstractResourceWriter

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base abstract resource writer class

Declaration

Source position: resource.pp line 305

type TAbstractResourceWriter = class
protected
function GetTree(); | Gets the internal resource tree of a TResources object
function GetExtensions; virtual; abstract; | Returns the extensions the writer is registered for
function GetDescription; virtual; abstract; | Returns the description of the writer
procedure Write(); virtual; abstract; | Writes resources to a stream
public
constructor Create; virtual; abstract; | Creates a new writer object
property Extensions: string; [r] | The extensions of file types the writer is able to write
property Description: string; [r] | The writer description
end;

Inheritance

TAbstractResourceWriter

Base abstract resource writer class
|

TObject

Description

This is the base class that represents a resource writer.

A resource writer is an object whose job is to write all resources contained in a TResources object to a stream in a specific format.

Typically, a TResources object invokes Write method of the resource writer when it wants the writer to write data to a stream.

Usually each resource writer registers itself with TResources class in the initialization section of the unit in which it is implemented: this way a TResources object can find it when it is asked to write itself to a file, and no writer was specified (the writer is found based on the extension of the file to write to).

Remark: An object of this class should never be directly instantiated: use a descendant class instead.

See also

TResources | A collection of resources
TAbstractResource | Base abstract resource class
TAbstractResourceReader | Base abstract resource reader class
TResResourceWriter | .res resource writer
TCoffResourceWriter | COFF resource writer
TElfResourceWriter | ELF resource writer
TExternalResourceWriter | External file resource writer


TAbstractResourceWriter
 | ro | Extensions
 | ro | Description


TAbstractResourceWriter
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Write
 | Create


pt | GetDescription (TAbstractResourceWriter)
pt | GetExtensions (TAbstractResourceWriter)
pt | GetTree (TAbstractResourceWriter)
pt |


TAbstractResourceWriter


TAbstractResourceWriter.Create

Creates a new writer object

Declaration

Source position: resource.pp line 313

public constructor TAbstractResourceWriter.Create; virtual; abstract;


TAbstractResourceWriter.Description

The writer description

Declaration

Source position: resource.pp line 315

public property TAbstractResourceWriter.Description : string
  read GetDescription;

Description

This property provides a textual description of the writer, e.g. "FOO resource writer"


TAbstractResourceWriter.Extensions

The extensions of file types the writer is able to write

Declaration

Source position: resource.pp line 314

public property TAbstractResourceWriter.Extensions : string
  read GetExtensions;

Description

This property is a string made of space-separated file extensions (each including the leading dot), all lowercase.

This property signals which file types the writer is able to write.


TAbstractResourceWriter.GetDescription

Returns the description of the writer

Declaration

Source position: resource.pp line 310

protected function TAbstractResourceWriter.GetDescription: string; virtual; abstract;

Function result

The description of the writer

Description

Descendant classes must implement this method to provide access to Description property.

See also

TAbstractResourceWriter.Description

The writer description


TAbstractResourceWriter.GetExtensions

Returns the extensions the writer is registered for

Declaration

Source position: resource.pp line 309

protected function TAbstractResourceWriter.GetExtensions: string; virtual; abstract;

Function result

The extensions the writer is registered for

Description

Descendant classes must implement this method to provide access to Extensions property.

See also

TAbstractResourceWriter.Extensions

The extensions of file types the writer is able to write


TAbstractResourceWriter.GetTree

Gets the internal resource tree of a TResources object

Declaration

Source position: resource.pp line 308

protected function TAbstractResourceWriter.GetTree(

  aResources: TResources

):TObject;

Arguments

aResources

The TResources object whose tree must be returned

Function result

The resource tree. It is an instance of TRootResTreeNode.

Description

This protected method can be used by descendents of TAbstractResourceWriter to obtain the internal resource tree used by a TResources object. The internal resource tree is an instance of TRootResTreeNode.

Some resource writers need to order resources with a tree structure before writing them to a file. Instead of doing this work themselves, they can use the already-ordered internal resource tree of the TResources object they must write.

See also

TRootResTreeNode

The root node in a resource tree


TAbstractResourceWriter.Write

Writes resources to a stream

Declaration

Source position: resource.pp line 311

protected procedure TAbstractResourceWriter.Write(

  aResources: TResources;

  aStream: TStream

); virtual; abstract;

Arguments

aResources | The TResources object to be written to the stream
aStream | The stream which resources must be written to

Description

A TResources object invokes this method when it needs to be written to a stream, passing itself as the aResources parameter and the stream as the aStream parameter.

aStream position is already correctly set: the writer must start to write from there.

A writer must write data in the way specified by the format it supports: usually this means writing a header and all resources contained in the TResources object.

For each resource, a writer should write some information about the resource (like type and name) in a way defined by the format it implements, and the resource data, which is accessible by RawData property of the resource.

See also

TResources | A collection of resources
TResources.WriteToStream | Writes the contents of the object to a stream
TResources.WriteToFile | Writes the contents of the object to a file
TAbstractResource | Base abstract resource class
TAbstractResource.DataSize | The size of resource raw data
TAbstractResource.RawData | The raw resource data stream


TGenericResource

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Generic resource class

Declaration

Source position: resource.pp line 185

type TGenericResource = class(TAbstractResource)

protected

  function GetType; override;

  function GetName; override;

  function ChangeDescTypeAllowed(); override;

  function ChangeDescValueAllowed(); override;

  procedure NotifyResourcesLoaded; override;

public

  constructor Create(); override;

  destructor Destroy; override;

  procedure UpdateRawData; override;

end;

Inheritance

TGenericResource | Generic resource class
|
TAbstractResource | Base abstract resource class
|
TObject

Description

This class represents a generic resource.

It is suitable to use in all situations where a higher level class is not needed (e.g. the resource raw data is made of arbitrary data) or when total low-level control is desirable.

This class is also the default one that is used by TResourceFactory when it finds no class matching the given type.

See also

TResourceFactory.CreateResource

Creates a new resource


TGenericResource
TAbstractResource
 | ro | _Type
 | ro | Name
 |  | LangID
 | ro | DataSize
 | ro | HeaderSize
 |  | DataVersion
 |  | MemoryFlags
 |  | Version
 |  | Characteristics
 | ro | DataOffset
 |  | CodePage
 | ro | RawData
 |  | CacheData
 | ro | OwnerList
 | ro | Owner


TGenericResource
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
 | Create
 | Destroy
 | UpdateRawData
TAbstractResource
pt | SetDescOwner
pt | SetOwnerList
pt | SetChildOwner
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
pt | Create
 | Destroy
 | CompareContents
 | UpdateRawData
 | SetCustomRawDataStream


pt | ChangeDescTypeAllowed (TAbstractResource)
pt | ChangeDescTypeAllowed (TGenericResource)
pt | ChangeDescValueAllowed (TAbstractResource)
pt | ChangeDescValueAllowed (TGenericResource)
 | CompareContents (TAbstractResource)
pt | Create (TAbstractResource)
 | Create (TGenericResource)
 | Destroy (TAbstractResource)
 | Destroy (TGenericResource)
pt | GetName (TAbstractResource)
pt | GetName (TGenericResource)
pt | GetType (TAbstractResource)
pt | GetType (TGenericResource)
pt | NotifyResourcesLoaded (TAbstractResource)
pt | NotifyResourcesLoaded (TGenericResource)
pt | SetChildOwner (TAbstractResource)
 | SetCustomRawDataStream (TAbstractResource)
pt | SetDescOwner (TAbstractResource)
pt |


TGenericResource

TAbstractResource


TResourceDesc

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

A resource description (type or name)

Declaration

Source position: resource.pp line 99

type TResourceDesc = class
protected
procedure SetOwner(); | Protected method to let a resource set itself as owner of the TResourceDesc
public
constructor Create(); | Creates a new TResourceDesc object
procedure Assign(); | Assigns the contents of another TResourceDesc object to this one
function Equals(); | Compares the contents of another TResourceDesc object to this one
property Name: TResName; [rw] | The value of the resource description as a name
property ID: TResID; [rw] | The value of the resource description as an ID
property DescType: TDescType; [r] | The type of the resource description
end;

Inheritance

TResourceDesc

A resource description (type or name)
|

TObject

Description

This class represent a resource description (type or name).

Resources are identified by a type, name and (optionally) a language ID.

Type and name can be either a name (a string identifier) or an ID (an integer identifier in the range 0..65535).

Remark: Unfortunately, name is used both to refer to a the name of the resource and both to the format of a resource description

Example:

Typically, a Windows executable has a main icon, which is a resource of type RT_GROUP_ICON (type is an ID) and name MAINICON (name is a name).

See also

TAbstractResource

Base abstract resource class


TResourceDesc
 |  | Name
 |  | ID
 | ro | DescType


ro


TResourceDesc
pt | SetOwner
 | Create
 | Assign
 | Equals


pt


TResourceDesc


TResourceDesc.Assign

Assigns the contents of another TResourceDesc object to this one

Declaration

Source position: resource.pp line 118

public procedure TResourceDesc.Assign(

  aResourceDesc: TResourceDesc

);

Arguments

aResourceDesc

The object from which data must be copied

Errors

If changing values is not permitted because owner resource doesn't allow it (e.g. because owner resource is a TBitmapResource and values other than RT_BITMAP are not permitted for the resource type) an EResourceDescChangeNotAllowedException exception is raised.


TResourceDesc.Create

Creates a new TResourceDesc object

Declaration

Source position: resource.pp line 115

public constructor TResourceDesc.Create; overload;

constructor TResourceDesc.Create(

  const aID: TResID

); overload;

constructor TResourceDesc.Create(

  const aName: TResName

); overload;

Arguments

aID

The ID to use as the resource description ID

Arguments

aName

The name to use as the resource description name

Description

Creates a new TResourceDesc object.

Without arguments, resource description is of type dtName and its name is empty.

If an argument is specified, resource description and name/id are set accordingly to the value passed as parameter.


TResourceDesc.DescType

The type of the resource description

Declaration

Source position: resource.pp line 122

public property TResourceDesc.DescType : TDescType
  read fDescType;

Description

When DescType is dtName, resource description value is a name and can be accessed via Name property

When DescType is dtID, resource description value is an ID and can be accessed via ID property

See also

TResourceDesc.Name | The value of the resource description as a name
TResourceDesc.ID | The value of the resource description as an ID
TDescType | The type of a resource type or name


TResourceDesc.Equals

Compares the contents of another TResourceDesc object to this one

Declaration

Source position: resource.pp line 119

public function TResourceDesc.Equals(

  aResDesc: TResourceDesc

):Boolean;

Arguments

aResDesc

The object to compare with this one

Function result

True if the contents of the two objects are the same


TResourceDesc.ID

The value of the resource description as an ID

Declaration

Source position: resource.pp line 121

public property TResourceDesc.ID : TResID
  read GetID
  write SetID;

Description

Setting this property causes DescType to be dtID

Remark: When reading, if DescType is dtName, an EResourceDescTypeException exception is raised.

See also

TResourceDesc.Name | The value of the resource description as a name
TResourceDesc.DescType | The type of the resource description


TResourceDesc.Name

The value of the resource description as a name

Declaration

Source position: resource.pp line 120

public property TResourceDesc.Name : TResName
  read GetName
  write SetName;

Description

Setting this property causes DescType to be dtName

When reading, if DescType is dtID, the ID is returned as a string value.

See also

TResourceDesc.ID | The value of the resource description as an ID
TResourceDesc.DescType | The type of the resource description


TResourceDesc.SetOwner

Protected method to let a resource set itself as owner of the TResourceDesc

Declaration

Source position: resource.pp line 113

protected procedure TResourceDesc.SetOwner(

  aOwner: TAbstractResource

);

Arguments

aOwner

The resource that is to become the owner of the TResourceDesc


TResources

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

A collection of resources

Declaration

Source position: resource.pp line 209

type TResources = class
public
constructor Create; | Creates a new TResources object
destructor Destroy; override; | Destroys the object
procedure Add(); | Adds a resource
function AddAutoID(); | Adds a resource and gives it a new autogenerated name
procedure Clear; | Deletes all resources
function Find(); | Searches for a resource
class function FindReader(); | Searches for a suitable resource reader
procedure MoveFrom(); | Moves all resources of another TResources object to itself
function Remove(); | Removes a resource
procedure LoadFromStream(); | Loads the contents of the object from a stream
procedure LoadFromFile(); | Loads the contents of the object from a file
class procedure RegisterReader(); | Registers a resource reader class
class procedure RegisterWriter(); | Registers a resource writer class
procedure WriteToStream(); | Writes the contents of the object to a stream
procedure WriteToFile(); | Writes the contents of the object to a file
property Count: LongWord; [r] | The number of resources in the object
property Items []: TAbstractResource; default; [r] | Indexed array of resources in the object
property CacheData: Boolean; [rw] | Controls the copy-on-write behaviour of all resources
end;

Inheritance

TResources

A collection of resources
|

TObject

Description

This class represents a format-independent view of a resource file. It holds a collection of resources (TAbstractResource descendants).

Typically, a TResource object is loaded from and written to a stream via format-dependent readers and writers, which are descendants of TAbstractResourceReader and TAbstractResourceWriter, respectively.

Single resources can be added, removed, searched and modified: a resource compiler or editor probably will create resources, set their data, and add them to a TResources object which can then be written to file in the desired format.

This class also provides some class methods to register and find resource readers and writers: these classes, once registered, will be used by a TResources object when it is asked to load or save itself to a stream and the user didn't specify a reader or writer.

Remark: Because of the copy-on-write mechanism of TAbstractResource, care should be taken when loading resources, since by default resource data isn't immediately read from the stream: resources hold a reference to the original stream because they need it when their data is requested. For further information, see TResources.LoadFromStream and TResources.LoadFromFile.

See also

TAbstractResource | Base abstract resource class
TAbstractResourceReader | Base abstract resource reader class
TAbstractResourceWriter | Base abstract resource writer class


TResources
 | ro | Count
 | ro | Items
 |  | CacheData


ro | Count (TResources)
ro |


TResources
 | Create
 | Destroy
 | Add
 | AddAutoID
 | Clear
 | Find
 | FindReader
 | MoveFrom
 | Remove
 | LoadFromStream
 | LoadFromFile
 | RegisterReader
 | RegisterWriter
 | WriteToStream
 | WriteToFile


Add (TResources)

AddAutoID (TResources)

Clear (TResources)

Create (TResources)

Destroy (TResources)

Find (TResources)

FindReader (TResources)

LoadFromFile (TResources)

LoadFromStream (TResources)

MoveFrom (TResources)

RegisterReader (TResources)

RegisterWriter (TResources)

Remove (TResources)

WriteToFile (TResources)

WriteToStream (TResources)


TResources


TResources.Add

Adds a resource

Declaration

Source position: resource.pp line 247

public procedure TResources.Add(

  aResource: TAbstractResource

);

Arguments

aResource

The resource to add

Description

This method adds aResource to the object, and sets itself as the owner list of the resource.

Errors

If a resource with the same type, name and language ID already exists, an EResourceDuplicateException exception is raised.

See also

TResources.AddAutoID

Adds a resource and gives it a new autogenerated name


TResources.AddAutoID

Adds a resource and gives it a new autogenerated name

Declaration

Source position: resource.pp line 248

public function TResources.AddAutoID(

  aResource: TAbstractResource

):TResID;

Arguments

aResource

The resource to add

Function result

The autogenerated ID of the added resource

Description

This method tries to find a spare ID to use as a name for the given resource, assigns it to the resource, and adds it.

This method is useful when the name of the resource is not important. E.g. a group resource doesn't care about the names of its sub-resources, so it could use this method to ensure that its sub-resources don't clash with names of other sub-resources of the same type.

Errors

If there are no more free IDs for the resource type of the given resource (that is, when the number of resources of the same type of aResource with an ID name is equal to 65536) an ENoMoreFreeIDsException exception is raised.

See also

TResources.Add

Adds a resource


TResources.CacheData

Controls the copy-on-write behaviour of all resources

Declaration

Source position: resource.pp line 278

public property TResources.CacheData : Boolean
  read fCacheData
  write SetCacheData;

Description

Changing this property changes CacheData property of all resources contained in the object.

This property affects existing resources and resources that are added or loaded.

By default, CacheData is true.

See also

TAbstractResource.CacheData | Controls the copy-on-write behaviour of the resource
TAbstractResource.RawData | The raw resource data stream


TResources.Clear

Deletes all resources

Declaration

Source position: resource.pp line 249

public procedure TResources.Clear;

Description

This method empties the TResources object destroying all resources.


TResources.Count

The number of resources in the object

Declaration

Source position: resource.pp line 276

public property TResources.Count : LongWord
  read GetCount;

See also

TResources.Items

Indexed array of resources in the object


TResources.Create

Creates a new TResources object

Declaration

Source position: resource.pp line 245

public constructor TResources.Create;


TResources.Destroy

Destroys the object

Declaration

Source position: resource.pp line 246

public destructor TResources.Destroy; override;

Description

Remark: All resources are destroyed as well.


TResources.Find

Searches for a resource

Declaration

Source position: resource.pp line 250

public function TResources.Find(

  aType: TResourceDesc;

  aName: TResourceDesc;

  const aLangID: TLangID

):TAbstractResource; overload;

function TResources.Find(

  aType: TResourceDesc;

  aName: TResourceDesc

):TAbstractResource; overload;

function TResources.Find(

  const aType: TResName;

  const aName: TResName;

  const aLangID: TLangID

):TAbstractResource; overload;

function TResources.Find(

  const aType: TResName;

  const aName: TResID;

  const aLangID: TLangID

):TAbstractResource; overload;

function TResources.Find(

  const aType: TResID;

  const aName: TResName;

  const aLangID: TLangID

):TAbstractResource; overload;

function TResources.Find(

  const aType: TResID;

  const aName: TResID;

  const aLangID: TLangID

):TAbstractResource; overload;

function TResources.Find(

  const aType: TResName;

  const aName: TResName

):TAbstractResource; overload;

function TResources.Find(

  const aType: TResName;

  const aName: TResID

):TAbstractResource; overload;

function TResources.Find(

  const aType: TResID;

  const aName: TResName

):TAbstractResource; overload;

function TResources.Find(

  const aType: TResID;

  const aName: TResID

):TAbstractResource; overload;

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for
aLangID | The language ID of the resource to search for

Function result

The resource that matches the search criteria

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for
aLangID | The language ID of the resource to search for

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for
aLangID | The language ID of the resource to search for

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for
aLangID | The language ID of the resource to search for

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for
aLangID | The language ID of the resource to search for

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for

Description

This method searches for a resource with the given type and name. If a language ID is not provided, the first resource found that matches aType and aName is returned.

Errors

If the resource is not found, an EResourceNotFoundException exception is raised.


TResources.FindReader

Searches for a suitable resource reader

Declaration

Source position: resource.pp line 260

public class function TResources.FindReader(

  aStream: TStream;

  aExtension: string

):TAbstractResourceReader;

class function TResources.FindReader(

  aStream: TStream

):TAbstractResourceReader;

Arguments

aStream | The stream to be probed
aExtension | The extension the reader is registered for

Function result

An instance of a TAbstractResourceReader descendant.

Arguments

aStream

The stream to be probed

Description

This method tries to find a resource reader able to read the stream passed as parameter.

If an extension is specified, only readers matching that extension are tried. The extension is case-insensitive and includes the leading dot, unless the empty string is passed (which means "no extension", e.g. a unix executable, which doesn't have an extension).

If a suitable reader is found, an instance of that reader is returned.

Remark: To make a resource reader class known, add that resource reader unit to the uses clause of your program.

Errors

If no suitable reader is found, an EResourceReaderNotFoundException exception is raised.

See also

TAbstractResourceReader

Base abstract resource reader class


TResources.Items

Indexed array of resources in the object

Declaration

Source position: resource.pp line 277

public property TResources.Items[Index: Integer] : TAbstractResource
  read GetItem;
  default;

Description

This property can be used to access all resources in the object.

Remark: This array is 0-based: valid elements range from 0 to Count-1.

See also

TResources.Count | The number of resources in the object
TAbstractResource | Base abstract resource class


TResources.LoadFromFile

Loads the contents of the object from a file

Declaration

Source position: resource.pp line 269

public procedure TResources.LoadFromFile(

  aFileName: string

); overload;

procedure TResources.LoadFromFile(

  aFileName: string;

  aReader: TAbstractResourceReader

); overload;

Arguments

aFileName

The name of file to read from

Arguments

aFileName | The name of file to read from
aReader | The reader to use to read the file

Description

This method clears the TResources object and loads its contents from the file passed as parameter.

If a reader is specified, that reader is used. Otherwise, the file is probed to find a suitable reader.

Remark: If CacheData is set to true, the file will be left open and used as the underlying stream of each resource RawData stream. This means that the file will be open until the TResources object is cleared or is loaded again from a different source. If you want the file to be closed while there are still resources, disable the copy-on-write mechanism by setting CacheData property to false.

Sample code

This code extracts resources from an exe file

var
  resources : TResources;
begin
  resources:=TResources.Create;
  resources.LoadFromFile('myexe.exe');
  resources.WriteToFile('myexe.res');
  resources.Free;
end;

Errors

If no reader is passed and probing fails, an EResourceReaderNotFoundException exception is raised.

See also

TAbstractResourceReader | Base abstract resource reader class
TAbstractResource.RawData | The raw resource data stream
TAbstractResource.CacheData | Controls the copy-on-write behaviour of the resource
TResources.CacheData | Controls the copy-on-write behaviour of all resources
TResources.LoadFromStream | Loads the contents of the object from a stream
TResources.Clear | Deletes all resources
TResources.FindReader | Searches for a suitable resource reader


TResources.LoadFromStream

Loads the contents of the object from a stream

Declaration

Source position: resource.pp line 267

public procedure TResources.LoadFromStream(

  aStream: TStream

); overload;

procedure TResources.LoadFromStream(

  aStream: TStream;

  aReader: TAbstractResourceReader

); overload;

Arguments

aStream

The stream to read from

Arguments

aStream | The stream to read from
aReader | The resource reader to use to read the stream

Description

This method clears the TResources object and loads its contents from the stream passed as parameter.

If a reader is specified, that reader is used. Otherwise, the stream is probed to find a suitable reader.

Remark: If CacheData is set to true, the stream will be used as the underlying stream of each resource RawData stream. This means that the stream must not be freed until all resources in the TResources object are freed: this happens when the TResources object is cleared or is loaded again from a different source. If you need to free the stream while there are still resources, disable the copy-on-write mechanism by setting CacheData property to false.

Errors

If no reader is passed and probing fails, an EResourceReaderNotFoundException exception is raised.

See also

TAbstractResourceReader | Base abstract resource reader class
TAbstractResource.RawData | The raw resource data stream
TAbstractResource.CacheData | Controls the copy-on-write behaviour of the resource
TResources.CacheData | Controls the copy-on-write behaviour of all resources
TResources.LoadFromFile | Loads the contents of the object from a file
TResources.Clear | Deletes all resources
TResources.FindReader | Searches for a suitable resource reader


TResources.MoveFrom

Moves all resources of another TResources object to itself

Declaration

Source position: resource.pp line 262

public procedure TResources.MoveFrom(

  aResources: TResources

);

Arguments

aResources

The TResources object from which resources must be taken

Description

This method takes all resources from object aResources and adds them to this object. aResources object is left empty.

Errors

If a resource with the same type, name and language ID already exists, an EResourceDuplicateException exception is raised.

See also

TResources.Add

Adds a resource


TResources.RegisterReader

Registers a resource reader class

Declaration

Source position: resource.pp line 271

public class procedure TResources.RegisterReader(

  const aExtension: string;

  aClass: TResourceReaderClass

);

Arguments

aExtension | The extension for which the class must be registered
aClass | The TAbstractResourceReader descendant to register

Description

This class method registers a resource reader class.

When registered, a class is known to TResources class, and can be used by FindReader, LoadFromStream and LoadFromFile methods when probing.

Usually this method is called in the initialization section of the unit implementing a TAbstractResourceReader descendant.

A class can be registered multiple times, one for each extension it is able to read. Multiple class can be registered for the same extension (e.g. both a coff and a elf reader can be registered for the .o extension). The extension must include the leading dot unless the empty string is used (which means "no extension", e.g. a unix executable, which doesn't have an extension).

See also

TAbstractResourceReader | Base abstract resource reader class
TResources.FindReader | Searches for a suitable resource reader
TResources.LoadFromStream | Loads the contents of the object from a stream
TResources.LoadFromFile | Loads the contents of the object from a file


TResources.RegisterWriter

Registers a resource writer class

Declaration

Source position: resource.pp line 272

public class procedure TResources.RegisterWriter(

  const aExtension: string;

  aClass: TResourceWriterClass

);

Arguments

aExtension | The extension for which the class must be registered
aClass | The TAbstractResourceWriter descendant to register

Description

This class method registers a resource writer class.

When registered, a class is known to TResources class, and can be used by WriteToFile method when probing.

Usually this method is called in the initialization section of the unit implementing a TAbstractResourceWriter descendant.

A class can be registered multiple times, one for each extension it is able to write. Multiple class can be registered for the same extension (e.g. both a coff and a elf writer can be registered for the .o extension) although only the first one found will be used when probing. The extension must include the leading dot unless the empty string is used (which means "no extension", e.g. a unix executable, which doesn't have an extension).

See also

TAbstractResourceWriter | Base abstract resource writer class
TResources.WriteToFile | Writes the contents of the object to a file


TResources.Remove

Removes a resource

Declaration

Source position: resource.pp line 263

public function TResources.Remove(

  aType: TResourceDesc;

  aName: TResourceDesc;

  const aLangID: TLangID

):TAbstractResource; overload;

function TResources.Remove(

  aType: TResourceDesc;

  aName: TResourceDesc

):TAbstractResource; overload;

function TResources.Remove(

  aResource: TAbstractResource

):TAbstractResource; overload;

function TResources.Remove(

  aIndex: Integer

):TAbstractResource; overload;

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for
aLangID | The language ID of the resource to search for

Function result

The removed resource

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for

Arguments

aResource

The resource to remove

Arguments

aIndex

The index of the resource to remove

Description

This method searches for a resource based on passed parameters and removes it from the object.

The removed resource is then returned.

Errors

If no matching resource is found, an EResourceNotFoundException exception is raised.

See also

TResources.Find

Searches for a resource


TResources.WriteToFile

Writes the contents of the object to a file

Declaration

Source position: resource.pp line 274

public procedure TResources.WriteToFile(

  aFileName: string

); overload;

procedure TResources.WriteToFile(

  aFileName: string;

  aWriter: TAbstractResourceWriter

); overload;

Arguments

aFileName

The name of the file to write to

Arguments

aFileName | The name of the file to write to
aWriter | The resource writer to use to write to the file

Description

This method writes the contents of the object to a file whose name is passed as parameter.

If a writer is specified, that writer is used. Otherwise, the first registered writer matching the file name extension is used.

Errors

If no writer is passed and no suitable writer is found, an EResourceWriterNotFoundException exception is raised.

See also

TAbstractResourceWriter | Base abstract resource writer class
TResources.WriteToStream | Writes the contents of the object to a stream


TResources.WriteToStream

Writes the contents of the object to a stream

Declaration

Source position: resource.pp line 273

public procedure TResources.WriteToStream(

  aStream: TStream;

  aWriter: TAbstractResourceWriter

);

Arguments

aStream | The stream to write to
aWriter | The resource writer to use to write the stream

Description

This method writes the contents of the object to a stream via the specified TAbstractResourceWriter descendant

See also

TAbstractResourceWriter | Base abstract resource writer class
TResources.WriteToFile | Writes the contents of the object to a file


TResourceTreeNode

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Abstract class representing a resource tree node.

Declaration

Source position: resourcetree.pp line 29

type TResourceTreeNode = class
protected
fParent: TResourceTreeNode;
fNamedEntries: TFPList;
fIDEntries: TFPList;
fSubDirRVA: LongWord;
fDataRVA: LongWord;
fNameRva: LongWord;
fDesc: TResourceDesc;
function GetNamedCount;
function GetNamedEntry();
function GetIDCount;
function GetIDEntry();
function GetData; virtual;
function InternalFind();
constructor Create; virtual; overload;
property Parent: TResourceTreeNode; [r]
public
destructor Destroy; override; | Destroys the object.
procedure Add(); virtual; abstract; | Adds a new resource to the tree
function CreateSubNode(); virtual; abstract; | Creates a subnode
function CreateResource; virtual; | Creates a new resource
procedure Clear; | Destroys all sub nodes
function Remove(); | Removes a resource from the tree
function Find(); | Searches for a resource
function FindFreeID(); virtual; | Find a free ID to be used as a resource name
function IsLeaf; virtual; | Reports whether the node is a leaf node.
property Desc: TResourceDesc; [r] | The description of the node
property NamedCount: LongWord; [r] | The number of named sub nodes of the node
property NamedEntries []: TResourceTreeNode; [r] | Indexed array of named sub nodes of the node
property IDCount: LongWord; [r] | The number of ID sub nodes of the node
property IDEntries []: TResourceTreeNode; [r] | Indexed array of ID sub nodes of the node
property NameRVA: LongWord; [rw] | To be used by readers and writers
property SubDirRVA: LongWord; [rw] | To be used by readers and writers
property DataRVA: LongWord; [rw] | To be used by readers and writers
property Data: TAbstractResource; [r] | The resource contained in this node
end;

Inheritance

TResourceTreeNode

Abstract class representing a resource tree node.
|

TObject

Description

This class represents a node in a resource tree.

Remark: An object of this class should never be directly instantiated. To create a node, call CreateSubNode method of an already existing node.


TResourceTreeNode
pt | ro | Parent
 | ro | Desc
 | ro | NamedCount
 | ro | NamedEntries
 | ro | IDCount
 | ro | IDEntries
 |  | NameRVA
 |  | SubDirRVA
 |  | DataRVA
 | ro | Data


 | ro | Data (TResourceTreeNode)
 |  | DataRVA (TResourceTreeNode)
 | ro | Desc (TResourceTreeNode)
 | ro | IDCount (TResourceTreeNode)
 | ro | IDEntries (TResourceTreeNode)
 | ro | NamedCount (TResourceTreeNode)
 | ro | NamedEntries (TResourceTreeNode)
 |  | NameRVA (TResourceTreeNode)
pt | ro |


TResourceTreeNode
pt | GetNamedCount
pt | GetNamedEntry
pt | GetIDCount
pt | GetIDEntry
pt | GetData
pt | InternalFind
pt | Create
 | Destroy
 | Add
 | CreateSubNode
 | CreateResource
 | Clear
 | Remove
 | Find
 | FindFreeID
 | IsLeaf


pt | Create (TResourceTreeNode)
 | CreateResource (TResourceTreeNode)
 | CreateSubNode (TResourceTreeNode)
 | Destroy (TResourceTreeNode)
 | Find (TResourceTreeNode)
 | FindFreeID (TResourceTreeNode)
pt | GetData (TResourceTreeNode)
pt | GetIDCount (TResourceTreeNode)
pt | GetIDEntry (TResourceTreeNode)
pt | GetNamedCount (TResourceTreeNode)
pt | GetNamedEntry (TResourceTreeNode)
pt |


TResourceTreeNode


TResourceTreeNode.Add

Adds a new resource to the tree

Declaration

Source position: resourcetree.pp line 50

public procedure TResourceTreeNode.Add(

  aResource: TAbstractResource

); virtual; abstract;

Arguments

aResource

The resource to add

Description

This method adds a new resource to the tree, creating all needed sub nodes

Remark: This method should only be called on root nodes (instances of TRootResTreeNode).

Errors

If a resource with the same type, name and language ID already exists, an EResourceDuplicateException exception is raised.

See also

TResourceTreeNode.Remove

Removes a resource from the tree


TResourceTreeNode.Clear

Destroys all sub nodes

Declaration

Source position: resourcetree.pp line 53

public procedure TResourceTreeNode.Clear;

Description

This method destroys all sub nodes of the node.


TResourceTreeNode.Create

Declaration

Source position: resourcetree.pp line 46

protected constructor TResourceTreeNode.Create; virtual; overload;


TResourceTreeNode.CreateResource

Creates a new resource

Declaration

Source position: resourcetree.pp line 52

public function TResourceTreeNode.CreateResource: TAbstractResource; virtual;

Function result

The newly created resource

Description

This method creates a new resource.

A new resource is created and its type, name and language id are determined from the ancestor nodes in the tree hierarchy.

Usually CreateResource is called by resource readers that read files in which resources are stored as trees.

Remark: This method is meaningful only when called on leaf nodes (language id nodes).

See also

TResourceTreeNode.IsLeaf

Reports whether the node is a leaf node.


TResourceTreeNode.CreateSubNode

Creates a subnode

Declaration

Source position: resourcetree.pp line 51

public function TResourceTreeNode.CreateSubNode(

  aDesc: TResourceDesc

):TResourceTreeNode; virtual; abstract;

Arguments

aDesc

The description of the sub node

Function result

The newly created sub node

Description

This method creates a subnode, identified by the given resource description.

See also

TResourceTreeNode.Desc

The description of the node


TResourceTreeNode.Data

The resource contained in this node

Declaration

Source position: resourcetree.pp line 68

public property TResourceTreeNode.Data : TAbstractResource
  read GetData;

Description

This property references the resource contained in this node.

Remark: This property is meaningful only on leaf nodes (language id nodes).

See also

TResourceTreeNode.IsLeaf

Reports whether the node is a leaf node.


TResourceTreeNode.DataRVA

To be used by readers and writers

Declaration

Source position: resourcetree.pp line 67

public property TResourceTreeNode.DataRVA : LongWord
  read fDataRVA
  write fDataRVA;

Description

This property can be freely used by resource readers and writers to store a file offset or address needed to load or write other data, since it isn't used by TResourceTreeNode or TResources.

Remark: Do not rely on the value of this property when accessing a new tree: other readers or writers could have changed it for their internal operations.

See also

TResourceTreeNode.NameRVA | To be used by readers and writers
TResourceTreeNode.SubDirRVA | To be used by readers and writers


TResourceTreeNode.Desc

The description of the node

Declaration

Source position: resourcetree.pp line 60

public property TResourceTreeNode.Desc : TResourceDesc
  read fDesc;

Description

The description of a node identifies that node. According to the type of the node, it can be a resource type, name or language id.


TResourceTreeNode.Destroy

Destroys the object.

Declaration

Source position: resourcetree.pp line 49

public destructor TResourceTreeNode.Destroy; override;

Description

Remark: Only root nodes (instances of TRootResTreeNode) should be destroyed. Children nodes are destroyed by their parent when needed.


TResourceTreeNode.fDataRVA

Declaration

Source position: resourcetree.pp line 35

protected TResourceTreeNode.fDataRVA : LongWord;


TResourceTreeNode.fDesc

Declaration

Source position: resourcetree.pp line 37

protected TResourceTreeNode.fDesc : TResourceDesc;


TResourceTreeNode.fIDEntries

Declaration

Source position: resourcetree.pp line 33

protected TResourceTreeNode.fIDEntries : TFPList;


TResourceTreeNode.Find

Searches for a resource

Declaration

Source position: resourcetree.pp line 56

public function TResourceTreeNode.Find(

  aType: TResourceDesc;

  aName: TResourceDesc

):TAbstractResource; overload;

function TResourceTreeNode.Find(

  aType: TResourceDesc;

  aName: TResourceDesc;

  const aLangID: TLangID

):TAbstractResource; overload;

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for

Function result

The resource that matches the search criteria

Arguments

aType | The type of the resource to search for
aName | The name of the resource to search for
aLangID | The language ID of the resource to search for

Description

This method searches for a resource with the given type and name in the tree. If a language ID is not provided, the first resource found that matches aType and aName is returned.

If no resource is found, nil is returned.

Remark: This method should only be called on root nodes (instances of TRootResTreeNode).


TResourceTreeNode.FindFreeID

Find a free ID to be used as a resource name

Declaration

Source position: resourcetree.pp line 58

public function TResourceTreeNode.FindFreeID(

  aType: TResourceDesc

):TResID; virtual;

Arguments

aType

The type of the resource

Function result

A new resource ID

Description

This method is used to find an available ID to be used as a name for a resource, given a resource type. It is used internally by AddAutoID method of TResources.

Remark: This method should only be called on root nodes (instances of TRootResTreeNode).

Errors

If there are no free ids left for the given resource type, an ENoMoreFreeIDsException is raised.


TResourceTreeNode.fNamedEntries

Declaration

Source position: resourcetree.pp line 32

protected TResourceTreeNode.fNamedEntries : TFPList;


TResourceTreeNode.fNameRva

Declaration

Source position: resourcetree.pp line 36

protected TResourceTreeNode.fNameRva : LongWord;


TResourceTreeNode.fParent

Declaration

Source position: resourcetree.pp line 31

protected TResourceTreeNode.fParent : TResourceTreeNode;


TResourceTreeNode.fSubDirRVA

Declaration

Source position: resourcetree.pp line 34

protected TResourceTreeNode.fSubDirRVA : LongWord;


TResourceTreeNode.GetData

Declaration

Source position: resourcetree.pp line 42

protected function TResourceTreeNode.GetData: TAbstractResource; virtual;


TResourceTreeNode.GetIDCount

Declaration

Source position: resourcetree.pp line 40

protected function TResourceTreeNode.GetIDCount: LongWord;


TResourceTreeNode.GetIDEntry

Declaration

Source position: resourcetree.pp line 41

protected function TResourceTreeNode.GetIDEntry(

  index: Integer

):TResourceTreeNode;


TResourceTreeNode.GetNamedCount

Declaration

Source position: resourcetree.pp line 38

protected function TResourceTreeNode.GetNamedCount: LongWord;


TResourceTreeNode.GetNamedEntry

Declaration

Source position: resourcetree.pp line 39

protected function TResourceTreeNode.GetNamedEntry(

  index: Integer

):TResourceTreeNode;


TResourceTreeNode.IDCount

The number of ID sub nodes of the node

Declaration

Source position: resourcetree.pp line 63

public property TResourceTreeNode.IDCount : LongWord
  read GetIDCount;

See also

TResourceTreeNode.IDEntries | Indexed array of ID sub nodes of the node
TResourceTreeNode.NamedCount | The number of named sub nodes of the node


TResourceTreeNode.IDEntries

Indexed array of ID sub nodes of the node

Declaration

Source position: resourcetree.pp line 64

public property TResourceTreeNode.IDEntries[index: Integer] : TResourceTreeNode
  read GetIDEntry;

Description

This property can be used to access all ID sub nodes in the node.

Remark: This array is 0-based: valid elements range from 0 to IDCount-1.

See also

TResourceTreeNode.IDCount | The number of ID sub nodes of the node
TResourceTreeNode.NamedEntries | Indexed array of named sub nodes of the node


TResourceTreeNode.InternalFind

Declaration

Source position: resourcetree.pp line 43

protected function TResourceTreeNode.InternalFind(

  aList: TFPList;

  aDesc: TResourceDesc;

  out index: Integer

):Boolean; overload;

function TResourceTreeNode.InternalFind(

  aList: TFPList;

  aLangID: TLangID;

  out index: Integer

):Boolean; overload;

function TResourceTreeNode.InternalFind(

  aType: TResourceDesc;

  aName: TResourceDesc;

  const aLangID: TLangID;

  const noLangID: Boolean;

  const toDelete: Boolean

):TAbstractResource; virtual; abstract; overload;


TResourceTreeNode.IsLeaf

Reports whether the node is a leaf node.

Declaration

Source position: resourcetree.pp line 59

public function TResourceTreeNode.IsLeaf: Boolean; virtual;

Function result

True if the node is a leaf node

Description

Returns true if the node is a leaf node. A leaf node is a language ID node.


TResourceTreeNode.NamedCount

The number of named sub nodes of the node

Declaration

Source position: resourcetree.pp line 61

public property TResourceTreeNode.NamedCount : LongWord
  read GetNamedCount;

See also

TResourceTreeNode.NamedEntries | Indexed array of named sub nodes of the node
TResourceTreeNode.IDCount | The number of ID sub nodes of the node


TResourceTreeNode.NamedEntries

Indexed array of named sub nodes of the node

Declaration

Source position: resourcetree.pp line 62

public property TResourceTreeNode.NamedEntries[index: Integer] : TResourceTreeNode
  read GetNamedEntry;

Description

This property can be used to access all named sub nodes in the node.

Remark: This array is 0-based: valid elements range from 0 to NamedCount-1.

See also

TResourceTreeNode.NamedCount | The number of named sub nodes of the node
TResourceTreeNode.IDEntries | Indexed array of ID sub nodes of the node


TResourceTreeNode.NameRVA

To be used by readers and writers

Declaration

Source position: resourcetree.pp line 65

public property TResourceTreeNode.NameRVA : LongWord
  read fNameRVA
  write fNameRVA;

Description

This property can be freely used by resource readers and writers to store a file offset or address needed to load or write other data, since it isn't used by TResourceTreeNode or TResources.

Remark: Do not rely on the value of this property when accessing a new tree: other readers or writers could have changed it for their internal operations.

See also

TResourceTreeNode.SubDirRVA | To be used by readers and writers
TResourceTreeNode.DataRVA | To be used by readers and writers


TResourceTreeNode.Parent

Declaration

Source position: resourcetree.pp line 47

protected property TResourceTreeNode.Parent : TResourceTreeNode
  read fParent;


TResourceTreeNode.Remove

Removes a resource from the tree

Declaration

Source position: resourcetree.pp line 54

public function TResourceTreeNode.Remove(

  aType: TResourceDesc;

  aName: TResourceDesc

):TAbstractResource; overload;

function TResourceTreeNode.Remove(

  aType: TResourceDesc;

  aName: TResourceDesc;

  const aLangID: TLangID

):TAbstractResource; overload;

Arguments

aType | The type of the resource to remove
aName | The name of the resource to remove

Function result

The removed resource, or nil if not found

Arguments

aType | The type of the resource to remove
aName | The name of the resource to remove
aLangID | The language ID of the resource to remove

Description

This method searches for the specified resource and removes it from the tree. If a language ID is not provided, the first resource found that matches aType and aName is returned. The removed resource is then returned.

If no resource is found, nil is returned.

Remark: This method should only be called on root nodes (instances of TRootResTreeNode).

See also

TResourceTreeNode.Add

Adds a new resource to the tree


TResourceTreeNode.SubDirRVA

To be used by readers and writers

Declaration

Source position: resourcetree.pp line 66

public property TResourceTreeNode.SubDirRVA : LongWord
  read fSubDirRVA
  write fSubDirRVA;

Description

This property can be freely used by resource readers and writers to store a file offset or address needed to load or write other data, since it isn't used by TResourceTreeNode or TResources.

Remark: Do not rely on the value of this property when accessing a new tree: other readers or writers could have changed it for their internal operations.

See also

TResourceTreeNode.NameRVA | To be used by readers and writers
TResourceTreeNode.DataRVA | To be used by readers and writers


TRootResTreeNode

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

The root node in a resource tree

Declaration

Source position: resourcetree.pp line 73

type TRootResTreeNode = class(TResourceTreeNode)

protected

  function InternalFind(); override;

public

  constructor Create; override;

Creates a new root node

  function CreateSubNode(); override;

  procedure Add(); override;

  function FindFreeID(); override;

end;

Inheritance

TRootResTreeNode | The root node in a resource tree
|
TResourceTreeNode | Abstract class representing a resource tree node.
|
TObject

Description

This node represents the root node of a resource tree.

It is the only node which must be created with its constructor: other nodes in the tree are automatically created when adding a resource, or calling CreateSubNode method of their parent.

Normally all search, add and delete operations on the tree are performed by calling methods of this node.


TRootResTreeNode
TResourceTreeNode
pt | ro | Parent
 | ro | Desc
 | ro | NamedCount
 | ro | NamedEntries
 | ro | IDCount
 | ro | IDEntries
 |  | NameRVA
 |  | SubDirRVA
 |  | DataRVA
 | ro | Data


TRootResTreeNode
pt | InternalFind
 | Create
 | CreateSubNode
 | Add
 | FindFreeID
TResourceTreeNode
pt | GetNamedCount
pt | GetNamedEntry
pt | GetIDCount
pt | GetIDEntry
pt | GetData
pt | InternalFind
pt | Create
 | Destroy
 | Add
 | CreateSubNode
 | CreateResource
 | Clear
 | Remove
 | Find
 | FindFreeID
 | IsLeaf


pt | Create (TResourceTreeNode)
 | Create (TRootResTreeNode)
 | CreateResource (TResourceTreeNode)
 | CreateSubNode (TResourceTreeNode)
 | CreateSubNode (TRootResTreeNode)
 | Destroy (TResourceTreeNode)
 | Find (TResourceTreeNode)
 | FindFreeID (TResourceTreeNode)
 | FindFreeID (TRootResTreeNode)
pt | GetData (TResourceTreeNode)
pt | GetIDCount (TResourceTreeNode)
pt | GetIDEntry (TResourceTreeNode)
pt | GetNamedCount (TResourceTreeNode)
pt | GetNamedEntry (TResourceTreeNode)
pt | InternalFind (TResourceTreeNode)
pt |


TRootResTreeNode

TResourceTreeNode


TRootResTreeNode.Create

Creates a new root node

Declaration

Source position: resourcetree.pp line 77

public constructor TRootResTreeNode.Create; override;

Description

This method creates a new tree, represented by a root node without children.

Other nodes in the tree are automatically created when adding a resource, or calling CreateSubNode method of their parent.

See also

TResourceTreeNode.CreateSubNode | Creates a subnode
TResourceTreeNode.Add | Adds a new resource to the tree


TRootResTreeNode.InternalFind

Declaration

Source position: resourcetree.pp line 75

protected function TRootResTreeNode.InternalFind(

  aType: TResourceDesc;

  aName: TResourceDesc;

  const aLangID: TLangID;

  const noLangID: Boolean;

  const toDelete: Boolean

):TAbstractResource; override;


TResResourceReader

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

.res resource reader

Declaration

Source position: resreader.pp line 29

type TResResourceReader = class(TAbstractResourceReader)

protected

  function GetExtensions; override;

  function GetDescription; override;

  procedure Load(); override;

  function CheckMagic(); override;

public

  constructor Create; override;

  destructor Destroy; override;

end;

Inheritance

TResResourceReader | .res resource reader
|
TAbstractResourceReader | Base abstract resource reader class
|
TObject

Description

This class provides a reader for .res resource files.

A .res file is a standard Windows file type that contains resources. This is not an object file format, so it's not suitable for being linked with other object files. For this reason, it is a good choice for a platform-independent format to store resources.

See also

TAbstractResourceReader | Base abstract resource reader class
TResResourceWriter | .res resource writer


TResResourceReader
TAbstractResourceReader
 | ro | Extensions
 | ro | Description


TResResourceReader
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create
 | Destroy
TAbstractResourceReader
pt | SetDataSize
pt | SetHeaderSize
pt | SetDataOffset
pt | SetRawData
pt | CallSubReaderLoad
pt | AddNoTree
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create


pt | AddNoTree (TAbstractResourceReader)
pt | CallSubReaderLoad (TAbstractResourceReader)
pt | CheckMagic (TAbstractResourceReader)
pt | CheckMagic (TResResourceReader)
 | Create (TAbstractResourceReader)
 | Create (TResResourceReader)
 | Destroy (TResResourceReader)
pt | GetDescription (TAbstractResourceReader)
pt | GetDescription (TResResourceReader)
pt | GetExtensions (TAbstractResourceReader)
pt | GetExtensions (TResResourceReader)
pt | GetTree (TAbstractResourceReader)
pt | Load (TAbstractResourceReader)
pt | Load (TResResourceReader)
pt | SetDataOffset (TAbstractResourceReader)
pt | SetDataSize (TAbstractResourceReader)
pt | SetHeaderSize (TAbstractResourceReader)
pt |


TResResourceReader

TAbstractResourceReader


TResResourceReader.Destroy

Declaration

Source position: resreader.pp line 46

public destructor TResResourceReader.Destroy; override;


TResResourceWriter

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

.res resource writer

Declaration

Source position: reswriter.pp line 29

type TResResourceWriter = class(TAbstractResourceWriter)

protected

  function GetExtensions; override;

  function GetDescription; override;

  procedure Write(); override;

public

  constructor Create; override;

end;

Inheritance

TResResourceWriter | .res resource writer
|
TAbstractResourceWriter | Base abstract resource writer class
|
TObject

Description

This class provides a writer for .res resource files.

A .res file is a standard Windows file type that contains resources. This is not an object file format, so it's not suitable for being linked with other object files. For this reason, it is a good choice for a platform-independent format to store resources.

See also

TAbstractResourceWriter | Base abstract resource writer class
TResResourceReader | .res resource reader


TResResourceWriter
TAbstractResourceWriter
 | ro | Extensions
 | ro | Description


TResResourceWriter
pt | GetExtensions
pt | GetDescription
pt | Write
 | Create
TAbstractResourceWriter
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Write
 | Create


pt | GetDescription (TAbstractResourceWriter)
pt | GetDescription (TResResourceWriter)
pt | GetExtensions (TAbstractResourceWriter)
pt | GetExtensions (TResResourceWriter)
pt | GetTree (TAbstractResourceWriter)
pt | Write (TAbstractResourceWriter)
pt |


TResResourceWriter

TAbstractResourceWriter


EStringTableIndexOutOfBoundsException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

The ID of the string is out of range

Declaration

Source position: stringtableresource.pp line 28

type EStringTableIndexOutOfBoundsException = class(EStringTableResourceException)

Inheritance

EStringTableIndexOutOfBoundsException | The ID of the string is out of range
|
EStringTableResourceException | Base class for string table resource-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised when the id specified to access a string of TStringTableResource.Strings property is not in the range TStringTableResource.FirstID - TStringTableResource.LastID.

See also

TStringTableResource | String table resource type
TStringTableResource.Strings | Indexed array of strings in the string table
TStringTableResource.FirstID | The ID of first the string contained in the string table
TStringTableResource.LastID | The ID of the last string contained in the string table


EStringTableIndexOutOfBoundsException
EStringTableResourceException
EResourceException
Exception
 | HelpContext
 | Message


EStringTableIndexOutOfBoundsException
EStringTableResourceException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EStringTableIndexOutOfBoundsException

EStringTableResourceException

EResourceException

Exception


EStringTableNameNotAllowedException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

The name of the resource isn't allowed

Declaration

Source position: stringtableresource.pp line 27

type EStringTableNameNotAllowedException = class(EStringTableResourceException)

Inheritance

EStringTableNameNotAllowedException | The name of the resource isn't allowed
|
EStringTableResourceException | Base class for string table resource-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject

Description

This exception is raised by constructor TStringTableResource.Create if the name of the resource isn't of type dtID and/or its name is not in the range 1-4096.

See also

TStringTableResource.Create

Creates a new string table resource


EStringTableNameNotAllowedException
EStringTableResourceException
EResourceException
Exception
 | HelpContext
 | Message


EStringTableNameNotAllowedException
EStringTableResourceException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EStringTableNameNotAllowedException

EStringTableResourceException

EResourceException

Exception


EStringTableResourceException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for string table resource-related exceptions

Declaration

Source position: stringtableresource.pp line 26

type EStringTableResourceException = class(EResourceException)

Inheritance

EStringTableResourceException | Base class for string table resource-related exceptions
|
EResourceException | Base class for resource-related exceptions
|
Exception
|
TObject


EStringTableResourceException
EResourceException
Exception
 | HelpContext
 | Message


EStringTableResourceException
EResourceException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EStringTableResourceException

EResourceException

Exception


TStringTableResource

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

String table resource type

Declaration

Source position: stringtableresource.pp line 39

type TStringTableResource = class(TAbstractResource)
protected
function GetType; override;
function GetName; override;
function ChangeDescTypeAllowed(); override;
function ChangeDescValueAllowed(); override;
procedure NotifyResourcesLoaded; override;
public
constructor Create(); | Creates a new string table resource
destructor Destroy; override;
procedure UpdateRawData; override;
property FirstID: Word; [rw] | The ID of first the string contained in the string table
property LastID: Word; [r] | The ID of the last string contained in the string table
property Count: Integer; [r] | The number of strings contained in the string table
property Strings []: string; default; [rw] | Indexed array of strings in the string table
end;

Inheritance

TStringTableResource | String table resource type
|
TAbstractResource | Base abstract resource class
|
TObject

Description

This class represents a resource of type RT_STRING.

A string table is a resource containing strings, identified by an integer id in the range 0-65535. A string table contains exactly 16 strings, and its name is an ID in the range 1-4096, determined by the highest 12 bits of the strings ID it contains, plus one. That is, a string table with 1 as name holds strings with IDs from 0 to 15, string table 2 contains strings with IDs from 16 to 31 and so on. There is no difference between an empty string and a non-existant string.

For these reasons, it is not possible to set the name of a string table: it is autogenerated from the value of FirstID property. Moreover, Count property is always 16.

Strings property is provided to access and modify individual strings.

Remark: This class doesn't allow its type to be changed to anything else than RT_BITMAP. Its name can't be changed too. Attempts to do so result in a EResourceDescChangeNotAllowedException.


TStringTableResource
 |  | FirstID
 | ro | LastID
 | ro | Count
 |  | Strings
TAbstractResource
 | ro | _Type
 | ro | Name
 |  | LangID
 | ro | DataSize
 | ro | HeaderSize
 |  | DataVersion
 |  | MemoryFlags
 |  | Version
 |  | Characteristics
 | ro | DataOffset
 |  | CodePage
 | ro | RawData
 |  | CacheData
 | ro | OwnerList
 | ro | Owner


ro | Count (TStringTableResource)
ro | DataOffset (TAbstractResource)
ro | DataSize (TAbstractResource)
 | DataVersion (TAbstractResource)
 | FirstID (TStringTableResource)
ro | HeaderSize (TAbstractResource)
 | LangID (TAbstractResource)
ro | LastID (TStringTableResource)
 | MemoryFlags (TAbstractResource)
ro | Name (TAbstractResource)
ro | Owner (TAbstractResource)
ro | OwnerList (TAbstractResource)
ro | RawData (TAbstractResource)
 | Strings (TStringTableResource)
 | Version (TAbstractResource)
ro |


TStringTableResource
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
 | Create
 | Destroy
 | UpdateRawData
TAbstractResource
pt | SetDescOwner
pt | SetOwnerList
pt | SetChildOwner
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
pt | Create
 | Destroy
 | CompareContents
 | UpdateRawData
 | SetCustomRawDataStream


pt | ChangeDescTypeAllowed (TAbstractResource)
pt | ChangeDescTypeAllowed (TStringTableResource)
pt | ChangeDescValueAllowed (TAbstractResource)
pt | ChangeDescValueAllowed (TStringTableResource)
 | CompareContents (TAbstractResource)
pt | Create (TAbstractResource)
 | Create (TStringTableResource)
 | Destroy (TAbstractResource)
 | Destroy (TStringTableResource)
pt | GetName (TAbstractResource)
pt | GetName (TStringTableResource)
pt | GetType (TAbstractResource)
pt | GetType (TStringTableResource)
pt | NotifyResourcesLoaded (TAbstractResource)
pt | NotifyResourcesLoaded (TStringTableResource)
pt | SetChildOwner (TAbstractResource)
 | SetCustomRawDataStream (TAbstractResource)
pt | SetDescOwner (TAbstractResource)
pt |


TStringTableResource

TAbstractResource


TStringTableResource.Count

The number of strings contained in the string table

Declaration

Source position: stringtableresource.pp line 69

public property TStringTableResource.Count : Integer
  read fCount;

Description

Since a string table resource always contains exactly 16 strings, this property is always 16

See also

TStringTableResource | String table resource type
TStringTableResource.FirstID | The ID of first the string contained in the string table


TStringTableResource.Create

Creates a new string table resource

Declaration

Source position: stringtableresource.pp line 63

public constructor TStringTableResource.Create; override;

constructor TStringTableResource.Create(

  aType: TResourceDesc;

  aName: TResourceDesc

); override;

Arguments

aType | Ignored. Can be nil.
aName | The name of the resource. Must be of type dtID and in the range 1-4096

Description

Please note that aType parameter is not used, since this class always uses RT_STRING as type.

Remark: aName must be a TResourceDesc of type dtID and its value must be in the range 1-4096, otherwise an EStringTableNameNotAllowedException exception is raised.

Errors

If aName is not of type dtID and/or its value isn't in the range 1-4096, an EStringTableNameNotAllowedException exception is raised.

See also

TStringTableResource.FirstID

The ID of first the string contained in the string table


TStringTableResource.FirstID

The ID of first the string contained in the string table

Declaration

Source position: stringtableresource.pp line 67

public property TStringTableResource.FirstID : Word
  read fFirstID
  write SetFirstID;

Description

This property holds the value of the ID of the first string of the table. It is a multiple of 16.

The name of the resource is determined by this property, so changing FirstID also changes the resource name.

Remark: If an attempt of setting this property to an integer that isn't a multiple of 16 is made, the value is automatically corrected to the closest multiple of 16 less than the value specified (e.g. setting it to 36 sets it to 32).

See also

TStringTableResource | String table resource type
TStringTableResource.LastID | The ID of the last string contained in the string table
TStringTableResource.Strings | Indexed array of strings in the string table


TStringTableResource.LastID

The ID of the last string contained in the string table

Declaration

Source position: stringtableresource.pp line 68

public property TStringTableResource.LastID : Word
  read GetLastID;

Description

The value of this property is always FirstID+15.

See also

TStringTableResource | String table resource type
TStringTableResource.FirstID | The ID of first the string contained in the string table
TStringTableResource.Strings | Indexed array of strings in the string table


TStringTableResource.Strings

Indexed array of strings in the string table

Declaration

Source position: stringtableresource.pp line 70

public property TStringTableResource.Strings[id: Word] : string
  read GetString
  write SetString;
  default;

Description

This property can be used to access all strings in the object.

Remark: Strings are accessed by their ID: valid elements range from FirstID to LastID. If the index specified isn't in this range, an EStringTableIndexOutOfBoundsException exception is raised.
Remark: If you need to access RawData after you modified strings, be sure to call UpdateRawData first. This isn't needed however when resource is written to a stream, since TResources takes care of it.

See also

TStringTableResource | String table resource type
TStringTableResource.FirstID | The ID of first the string contained in the string table
TStringTableResource.LastID | The ID of the last string contained in the string table


TVersionResource

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Version information resource type

Declaration

Source position: versionresource.pp line 37

type TVersionResource = class(TAbstractResource)
protected
function GetType; override;
function GetName; override;
function ChangeDescTypeAllowed(); override;
function ChangeDescValueAllowed(); override;
procedure NotifyResourcesLoaded; override;
public
constructor Create(); | Creates a new version information resource
destructor Destroy; override;
procedure UpdateRawData; override;
property FixedInfo: TVersionFixedInfo; [r] | Language independent part of version information
property StringFileInfo: TVersionStringFileInfo; [r] | Language dependent part of version information
property VarFileInfo: TVersionVarFileInfo; [r] | List of supported languages
end;

Inheritance

TVersionResource | Version information resource type
|
TAbstractResource | Base abstract resource class
|
TObject

Description

This class represents a resource of type RT_VERSION.

A resource of this type provides version information for a Microsoft Windows executable or dll, which is shown when checking properties of a file in Windows Explorer.

Information is stored in FixedInfo, StringFileInfo and VarFileInfo.

Remark: This class doesn't allow its type to be changed to anything else than RT_VERSION, and its name to be different from 1. Attempts to do so result in a EResourceDescChangeNotAllowedException.
Remark: If you need to access RawData after you modified something, be sure to call UpdateRawData first. This isn't needed however when resource is written to a stream, since TResources takes care of it.

Sample code

This code creates a version information resource

const
  myVersion : TFileProductVersion = (1,2,0,0);

var
  resources : TResources;
  aRes : TVersionResource;
  st : TVersionStringTable;
  ti : TVerTranslationInfo;
begin
  aRes:=TVersionResource.Create(nil,nil); //it's always RT_VERSION and 1 respectively
  resources:=TResources.Create;
  resources.Add(aRes);

  aRes.FixedInfo.FileVersion:=myversion;
  aRes.FixedInfo.ProductVersion:=myversion;
  aRes.FixedInfo.FileFlagsMask:=VS_FFI_FILEFLAGSMASK;
  aRes.FixedInfo.FileFlags:=0;
  aRes.FixedInfo.FileOS:=VOS_NT_WINDOWS32;
  aRes.FixedInfo.FileType:=VFT_APP;
  aRes.FixedInfo.FileSubType:=0;
  aRes.FixedInfo.FileDate:=0;

  st:=TVersionStringTable.Create('041004B0'); //Italian, unicode codepage
  st.Add('CompanyName','Foo Corporation');
  st.Add('FileDescription','Foo suite core program');
  st.Add('FileVersion','1.2');
  st.Add('ProductVersion','1.2');
  aRes.StringFileInfo.Add(st);

  ti.language:=$0410; //Italian
  ti.codepage:=$04B0; //Unicode codepage
  aRes.VarFileInfo.Add(ti);

  resources.WriteToFile('myresource.res');
  resources.Free; //destroys aRes as well.
end;

See also

TVersionResource.FixedInfo | Language independent part of version information
TVersionResource.StringFileInfo | Language dependent part of version information
TVersionResource.VarFileInfo | List of supported languages


TVersionResource
 | ro | FixedInfo
 | ro | StringFileInfo
 | ro | VarFileInfo
TAbstractResource
 | ro | _Type
 | ro | Name
 |  | LangID
 | ro | DataSize
 | ro | HeaderSize
 |  | DataVersion
 |  | MemoryFlags
 |  | Version
 |  | Characteristics
 | ro | DataOffset
 |  | CodePage
 | ro | RawData
 |  | CacheData
 | ro | OwnerList
 | ro | Owner


ro | DataOffset (TAbstractResource)
ro | DataSize (TAbstractResource)
 | DataVersion (TAbstractResource)
ro | FixedInfo (TVersionResource)
ro | HeaderSize (TAbstractResource)
 | LangID (TAbstractResource)
 | MemoryFlags (TAbstractResource)
ro | Name (TAbstractResource)
ro | Owner (TAbstractResource)
ro | OwnerList (TAbstractResource)
ro | RawData (TAbstractResource)
ro | StringFileInfo (TVersionResource)
ro | VarFileInfo (TVersionResource)
 | Version (TAbstractResource)
ro |


TVersionResource
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
 | Create
 | Destroy
 | UpdateRawData
TAbstractResource
pt | SetDescOwner
pt | SetOwnerList
pt | SetChildOwner
pt | GetType
pt | GetName
pt | ChangeDescTypeAllowed
pt | ChangeDescValueAllowed
pt | NotifyResourcesLoaded
pt | Create
 | Destroy
 | CompareContents
 | UpdateRawData
 | SetCustomRawDataStream


pt | ChangeDescTypeAllowed (TAbstractResource)
pt | ChangeDescTypeAllowed (TVersionResource)
pt | ChangeDescValueAllowed (TAbstractResource)
pt | ChangeDescValueAllowed (TVersionResource)
 | CompareContents (TAbstractResource)
pt | Create (TAbstractResource)
 | Create (TVersionResource)
 | Destroy (TAbstractResource)
 | Destroy (TVersionResource)
pt | GetName (TAbstractResource)
pt | GetName (TVersionResource)
pt | GetType (TAbstractResource)
pt | GetType (TVersionResource)
pt | NotifyResourcesLoaded (TAbstractResource)
pt | NotifyResourcesLoaded (TVersionResource)
pt | SetChildOwner (TAbstractResource)
 | SetCustomRawDataStream (TAbstractResource)
pt | SetDescOwner (TAbstractResource)
pt |


TVersionResource

TAbstractResource


TVersionResource.Create

Creates a new version information resource

Declaration

Source position: versionresource.pp line 74

public constructor TVersionResource.Create; override;

constructor TVersionResource.Create(

  aType: TResourceDesc;

  aName: TResourceDesc

); override;

Arguments

aType | Ignored. Can be nil.
aName | Ignored. Can be nil.

Description

Please note that aType and aName parameters are not used, since this class always uses RT_VERSION as type and 1 as name.


TVersionResource.FixedInfo

Language independent part of version information

Declaration

Source position: versionresource.pp line 78

public property TVersionResource.FixedInfo : TVersionFixedInfo
  read GetFixedInfo;

See also

TVersionFixedInfo

Language independent part of version information


TVersionResource.StringFileInfo

Language dependent part of version information

Declaration

Source position: versionresource.pp line 79

public property TVersionResource.StringFileInfo : TVersionStringFileInfo
  read GetFileInfo;

See also

TVersionStringFileInfo

Language dependent part of version information


TVersionResource.VarFileInfo

List of supported languages

Declaration

Source position: versionresource.pp line 80

public property TVersionResource.VarFileInfo : TVersionVarFileInfo
  read GetVarInfo;

See also

TVersionVarFileInfo

List of supported languages


EDuplicateKeyException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Duplicate key error

Declaration

Source position: versiontypes.pp line 29

type EDuplicateKeyException = class(EVersionStringTableException)

Inheritance

EDuplicateKeyException | Duplicate key error
|
EVersionStringTableException | Base class for version string table - related exceptions
|
Exception
|
TObject

Description

This exception is raised when an attempt is made to add an item to a TVersionStringTable object and the specified key is already present.

See also

TVersionStringTable.Add

Adds a new item to the string table


EDuplicateKeyException
EVersionStringTableException
Exception
 | HelpContext
 | Message


EDuplicateKeyException
EVersionStringTableException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EDuplicateKeyException

EVersionStringTableException

Exception


EKeyNotFoundException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Key not found error

Declaration

Source position: versiontypes.pp line 28

type EKeyNotFoundException = class(EVersionStringTableException)

Inheritance

EKeyNotFoundException | Key not found error
|
EVersionStringTableException | Base class for version string table - related exceptions
|
Exception
|
TObject

Description

This exception is raised when the specified key is not found in the TVersionStringTable object.

See also

TVersionStringTable.Delete | Deletes an item
TVersionStringTable.Values | Array of values in the object, accessed by key


EKeyNotFoundException
EVersionStringTableException
Exception
 | HelpContext
 | Message


EKeyNotFoundException
EVersionStringTableException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EKeyNotFoundException

EVersionStringTableException

Exception


ENameNotAllowedException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

String table name not allowed error

Declaration

Source position: versiontypes.pp line 27

type ENameNotAllowedException = class(EVersionStringTableException)

Inheritance

ENameNotAllowedException | String table name not allowed error
|
EVersionStringTableException | Base class for version string table - related exceptions
|
Exception
|
TObject

Description

This exception is raised when an attempt is made to set Name property of TVersionStringTable with a string that isn't an 8-cipher hexadecimal string.

See also

TVersionStringTable.Create | Creates a new string table
TVersionStringTable.Name | The name of the string table


ENameNotAllowedException
EVersionStringTableException
Exception
 | HelpContext
 | Message


ENameNotAllowedException
EVersionStringTableException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


ENameNotAllowedException

EVersionStringTableException

Exception


EVersionStringTableException

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for version string table - related exceptions

Declaration

Source position: versiontypes.pp line 26

type EVersionStringTableException = class(Exception)

Inheritance

EVersionStringTableException

Base class for version string table - related exceptions
|

Exception
|

TObject


EVersionStringTableException
Exception
 | HelpContext
 | Message


EVersionStringTableException
Exception
 | Create
 | CreateFmt
 | CreateRes
 | CreateResFmt
 | CreateHelp
 | CreateFmtHelp
 | CreateResHelp
 | CreateResFmtHelp
 | ToString


EVersionStringTableException

Exception


TVersionFixedInfo

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Language independent part of version information

Declaration

Source position: versiontypes.pp line 49

type TVersionFixedInfo = class
public
constructor Create;
property FileVersion: TFileProductVersion; [rw] | The file version
property ProductVersion: TFileProductVersion; [rw] | The product version
property FileFlagsMask: LongWord; [rw] | Mask for FileFlags
property FileFlags: LongWord; [rw] | The file flags
property FileOS: LongWord; [rw] | The operating system the file was designed to run on
property FileType: LongWord; [rw] | The type of the file
property FileSubType: LongWord; [rw] | Additional type information
property FileDate: QWord; [rw] | The file creation timestamp.
end;

Inheritance

TVersionFixedInfo

Language independent part of version information
|

TObject

Description

This class represents the language independent part of version information, and is always present in a version information resource.

See also

TVersionResource | Version information resource type
TVersionResource.FixedInfo | Language independent part of version information


TVersionFixedInfo
 | FileVersion
 | ProductVersion
 | FileFlagsMask
 | FileFlags
 | FileOS
 | FileType
 | FileSubType
 | FileDate


FileDate (TVersionFixedInfo)

FileFlags (TVersionFixedInfo)

FileFlagsMask (TVersionFixedInfo)

FileOS (TVersionFixedInfo)

FileSubType (TVersionFixedInfo)

FileType (TVersionFixedInfo)

FileVersion (TVersionFixedInfo)

ProductVersion (TVersionFixedInfo)


TVersionFixedInfo

Create


Create (TVersionFixedInfo)


TVersionFixedInfo


TVersionFixedInfo.Create

Declaration

Source position: versiontypes.pp line 61

public constructor TVersionFixedInfo.Create;


TVersionFixedInfo.FileDate

The file creation timestamp.

Declaration

Source position: versiontypes.pp line 69

public property TVersionFixedInfo.FileDate : QWord
  read fFileDate
  write fFileDate;

Description

It is a 64 bit timestamp.


TVersionFixedInfo.FileFlags

The file flags

Declaration

Source position: versiontypes.pp line 65

public property TVersionFixedInfo.FileFlags : LongWord
  read fFileFlags
  write fFileFlags;

Description

It is a combination of the following values:

  • VS_FF_DEBUG.
  • VS_FF_INFOINFERRED.
  • VS_FF_PATCHED.
  • VS_FF_PRERELEASE.
  • VS_FF_PRIVATEBUILD.
  • VS_FF_SPECIALBUILD.

See also

TVersionFixedInfo.FileFlagsMask

Mask for FileFlags


TVersionFixedInfo.FileFlagsMask

Mask for FileFlags

Declaration

Source position: versiontypes.pp line 64

public property TVersionFixedInfo.FileFlagsMask : LongWord
  read fFileFlagsMask
  write fFileFlagsMask;

Description

This property specifies which bits of FileFlags are valid.

Usually it is VS_FFI_FILEFLAGSMASK.

See also

TVersionFixedInfo.FileFlags

The file flags


TVersionFixedInfo.FileOS

The operating system the file was designed to run on

Declaration

Source position: versiontypes.pp line 66

public property TVersionFixedInfo.FileOS : LongWord
  read fFileOS
  write fFileOS;

Description

It is one of the following values:

  • VOS_UNKNOWN
  • VOS_DOS
  • VOS_OS216
  • VOS_OS232
  • VOS_NT

combined with one of the following values:

  • VOS__WINDOWS16
  • VOS__WINDOWS32
  • VOS__PM16
  • VOS__PM32

Note: some predefined combinations do exist:

  • VOS_DOS_WINDOWS16
  • VOS_DOS_WINDOWS32
  • VOS_OS216_PM16
  • VOS_OS232_PM32
  • VOS_NT_WINDOWS32


TVersionFixedInfo.FileSubType

Additional type information

Declaration

Source position: versiontypes.pp line 68

public property TVersionFixedInfo.FileSubType : LongWord
  read fFileSubType
  write fFileSubType;

Description

This property is meaningful only for some values of FileSubType. For all other types, this property must be zero.

If FileSubType is VFT_DRV:

  • VFT2_UNKNOWN
  • VFT2_DRV_COMM
  • VFT2_DRV_PRINTER
  • VFT2_DRV_KEYBOARD
  • VFT2_DRV_LANGUAGE
  • VFT2_DRV_DISPLAY
  • VFT2_DRV_MOUSE
  • VFT2_DRV_NETWORK
  • VFT2_DRV_SYSTEM
  • VFT2_DRV_INSTALLABLE
  • VFT2_DRV_SOUND

If FileSubType is VFT_FONT:

  • VFT2_UNKNOWN
  • VFT2_FONT_RASTER
  • VFT2_FONT_VECTOR
  • VFT2_FONT_TRUETYPE

See also

TVersionFixedInfo.FileType

The type of the file


TVersionFixedInfo.FileType

The type of the file

Declaration

Source position: versiontypes.pp line 67

public property TVersionFixedInfo.FileType : LongWord
  read fFileType
  write fFileType;

Description

It can be one of the following values:

  • VFT_UNKNOWN
  • VFT_APP
  • VFT_DLL
  • VFT_DRV
  • VFT_FONT
  • VFT_VXD
  • VFT_STATIC_LIB

See also

TVersionFixedInfo.FileSubType

Additional type information


TVersionFixedInfo.FileVersion

The file version

Declaration

Source position: versiontypes.pp line 62

public property TVersionFixedInfo.FileVersion : TFileProductVersion
  read fFileVersion
  write fFileVersion;

See also

TFileProductVersion

File or Product version type


TVersionFixedInfo.ProductVersion

The product version

Declaration

Source position: versiontypes.pp line 63

public property TVersionFixedInfo.ProductVersion : TFileProductVersion
  read fProductVersion
  write fProductVersion;

See also

TFileProductVersion

File or Product version type


TVersionStringFileInfo

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Language dependent part of version information

Declaration

Source position: versiontypes.pp line 105

type TVersionStringFileInfo = class
protected
function GetCount;
function GetItem();
procedure SetItem();
public
constructor Create;
destructor Destroy; override; | Destroys the object
procedure Add(); | Adds a new string table
procedure Clear; | Deletes all string tables in the list
procedure Delete(); | Deletes a string table
property Count: Integer; [r] | The number of string tables in the object
property Items []: TVersionStringTable; default; [rw] | Indexed array of string tables in the object
end;

Inheritance

TVersionStringFileInfo

Language dependent part of version information
|

TObject

Description

This class represents the language dependent part of version information.

It is a list of TVersionStringTable objects, each representing information for a specific language-codepage combination.

See also

TVersionResource | Version information resource type
TVersionResource.StringFileInfo | Language dependent part of version information
TVersionStringTable | Version information for a specific language-codepage combination


TVersionStringFileInfo
 | ro | Count
 |  | Items


TVersionStringFileInfo
pt | GetCount
pt | GetItem
pt | SetItem
 | Create
 | Destroy
 | Add
 | Clear
 | Delete


 | Add (TVersionStringFileInfo)
 | Clear (TVersionStringFileInfo)
 | Create (TVersionStringFileInfo)
 | Delete (TVersionStringFileInfo)
 | Destroy (TVersionStringFileInfo)
pt | GetCount (TVersionStringFileInfo)
pt | GetItem (TVersionStringFileInfo)
pt |


TVersionStringFileInfo


TVersionStringFileInfo.Add

Adds a new string table

Declaration

Source position: versiontypes.pp line 115

public procedure TVersionStringFileInfo.Add(

  aStrTable: TVersionStringTable

);

Arguments

aStrTable

The string table to add

See also

TVersionStringFileInfo.Delete

Deletes a string table


TVersionStringFileInfo.Clear

Deletes all string tables in the list

Declaration

Source position: versiontypes.pp line 116

public procedure TVersionStringFileInfo.Clear;

Description

This method empties the object. All string tables are freed.

See also

TVersionStringFileInfo.Delete | Deletes a string table
TVersionStringFileInfo.Add | Adds a new string table


TVersionStringFileInfo.Count

The number of string tables in the object

Declaration

Source position: versiontypes.pp line 118

public property TVersionStringFileInfo.Count : Integer
  read GetCount;

See also

TVersionStringFileInfo.Items

Indexed array of string tables in the object


TVersionStringFileInfo.Create

Declaration

Source position: versiontypes.pp line 113

public constructor TVersionStringFileInfo.Create;


TVersionStringFileInfo.Delete

Deletes a string table

Declaration

Source position: versiontypes.pp line 117

public procedure TVersionStringFileInfo.Delete(

  const aIndex: Integer

);

Arguments

aIndex

The index of the string table to delete.

Description

This method removes the string table identified by aIndex from the list. The string table is freed.

See also

TVersionStringFileInfo.Clear | Deletes all string tables in the list
TVersionStringFileInfo.Add | Adds a new string table


TVersionStringFileInfo.Destroy

Destroys the object

Declaration

Source position: versiontypes.pp line 114

public destructor TVersionStringFileInfo.Destroy; override;

Description

Remark: All items are destroyed as well.

See also

TVersionStringFileInfo.Clear

Deletes all string tables in the list


TVersionStringFileInfo.GetCount

Declaration

Source position: versiontypes.pp line 109

protected function TVersionStringFileInfo.GetCount: Integer;


TVersionStringFileInfo.GetItem

Declaration

Source position: versiontypes.pp line 110

protected function TVersionStringFileInfo.GetItem(

  index: Integer

):TVersionStringTable;


TVersionStringFileInfo.Items

Indexed array of string tables in the object

Declaration

Source position: versiontypes.pp line 119

public property TVersionStringFileInfo.Items[index: Integer] : TVersionStringTable
  read GetItem
  write SetItem;
  default;

Description

This property can be used to access all string tables in the object.

Remark: This array is 0-based: valid elements range from 0 to Count-1.

See also

TVersionStringFileInfo.Count | The number of string tables in the object
TVersionStringTable | Version information for a specific language-codepage combination


TVersionStringFileInfo.SetItem

Declaration

Source position: versiontypes.pp line 111

protected procedure TVersionStringFileInfo.SetItem(

  index: Integer;

  aValue: TVersionStringTable

);


TVersionStringTable

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Version information for a specific language-codepage combination

Declaration

Source position: versiontypes.pp line 74

type TVersionStringTable = class
public
constructor Create(); | Creates a new string table
destructor Destroy; override; | Destroys the string table
procedure Add(); | Adds a new item to the string table
procedure Clear; | Deletes all items
procedure Delete(); | Deletes an item
property Name: string; [r] | The name of the string table
property Count: Integer; [r] | The number of items in the object
property Keys []: string; [r] | Indexed array of keys in the object
property ValuesByIndex []: string; [rw] | Indexed array of values in the object
property Values []: string; default; [rw] | Array of values in the object, accessed by key
end;

Inheritance

TVersionStringTable

Version information for a specific language-codepage combination
|

TObject

Description

This class represents version information for a specific language-codepage combination.

It is contained in a TVersionStringFileInfo object.

Information is stored as key-value pairs. The name of the string table specifies the language id - codepage to which the object applies.

There are some predefined keys that Microsoft Windows searches for. They are:

  • Comments
  • CompanyName
  • FileDescription
  • FileVersion
  • InternalName
  • LegalCopyright
  • LegalTrademarks
  • OriginalFilename
  • PrivateBuild (only if VS_FF_PRIVATEBUILD is set in TVersionFixedInfo.FileFlags)
  • ProductName
  • ProductVersion
  • SpecialBuild (only if VS_FF_SPECIALBUILD is set in TVersionFixedInfo.FileFlags)

See also

TVersionStringFileInfo | Language dependent part of version information
TVersionStringTable.Name | The name of the string table
TVersionStringTable.Keys | Indexed array of keys in the object
TVersionStringTable.Values | Array of values in the object, accessed by key
TVersionStringTable.ValuesByIndex | Indexed array of values in the object


TVersionStringTable
 | ro | Name
 | ro | Count
 | ro | Keys
 |  | ValuesByIndex
 |  | Values


ro | Count (TVersionStringTable)
ro | Keys (TVersionStringTable)
ro |


TVersionStringTable
 | Create
 | Destroy
 | Add
 | Clear
 | Delete


Add (TVersionStringTable)

Clear (TVersionStringTable)

Create (TVersionStringTable)

Delete (TVersionStringTable)

Destroy (TVersionStringTable)


TVersionStringTable


TVersionStringTable.Add

Adds a new item to the string table

Declaration

Source position: versiontypes.pp line 91

public procedure TVersionStringTable.Add(

  const aKey: string;

  const aValue: string

);

Arguments

aKey | The key of the item to add
aValue | The value of the item to add

Description

This methods adds a new key-value pair to the string table.

Note that some predefined keys do exist. See TVersionStringTable for further information.

Errors

If an item with the same key already exists, an EDuplicateKeyException exception is raised.

See also

TVersionStringTable | Version information for a specific language-codepage combination
TVersionStringTable.Keys | Indexed array of keys in the object
TVersionStringTable.Values | Array of values in the object, accessed by key
TVersionStringTable.ValuesByIndex | Indexed array of values in the object


TVersionStringTable.Clear

Deletes all items

Declaration

Source position: versiontypes.pp line 92

public procedure TVersionStringTable.Clear;

Description

This method empties the object deleting all items.

See also

TVersionStringTable.Delete

Deletes an item


TVersionStringTable.Count

The number of items in the object

Declaration

Source position: versiontypes.pp line 96

public property TVersionStringTable.Count : Integer
  read GetCount;

See also

TVersionStringTable.ValuesByIndex

Indexed array of values in the object


TVersionStringTable.Create

Creates a new string table

Declaration

Source position: versiontypes.pp line 89

public constructor TVersionStringTable.Create(

  const aName: string

);

Arguments

aName

The name of the string table

Description

Creates a new string table with the name passed as aName parameter.

aName must be a hex representation of a 4-bytes unsigned number: first 4 ciphers represent the language id, and last 4 the codepage.

Sample code

This code creates a string table for Italian, with unicode codepage.

var
  st : TVersionStringTable;
begin
  //0410 = Italian
  //04B0 = unicode codepage
  st:=TVersionStringTable.Create('041004B0');

  //do something useful...

  st.Free;
end;

Errors

If name is not a valid 8-cipher hexadecimal string, an ENameNotAllowedException exception is raised.

See also

TVersionStringTable.Name

The name of the string table


TVersionStringTable.Delete

Deletes an item

Declaration

Source position: versiontypes.pp line 93

public procedure TVersionStringTable.Delete(

  const aIndex: Integer

); overload;

procedure TVersionStringTable.Delete(

  const aKey: string

); overload;

Arguments

aIndex

The index of the item to delete

Arguments

aKey

The key of the item to delete

Description

The item to delete can be specified by its index or by its key.

Errors

If aKey is not found, an EKeyNotFoundException exception is raised.

See also

TVersionStringTable.Keys | Indexed array of keys in the object
TVersionStringTable.Values | Array of values in the object, accessed by key
TVersionStringTable.ValuesByIndex | Indexed array of values in the object


TVersionStringTable.Destroy

Destroys the string table

Declaration

Source position: versiontypes.pp line 90

public destructor TVersionStringTable.Destroy; override;


TVersionStringTable.Keys

Indexed array of keys in the object

Declaration

Source position: versiontypes.pp line 97

public property TVersionStringTable.Keys[index: Integer] : string
  read GetKey;

Description

This property can be used to access all keys in the object.

Values associated to keys are stored in ValuesByIndex property: a key and its value have the same index in the two properties.

Remark: This array is 0-based: valid elements range from 0 to Count-1.

Note that some predefined keys do exist. See TVersionStringTable for further information.

See also

TVersionStringTable | Version information for a specific language-codepage combination
TVersionStringTable.Values | Array of values in the object, accessed by key
TVersionStringTable.ValuesByIndex | Indexed array of values in the object


TVersionStringTable.Name

The name of the string table

Declaration

Source position: versiontypes.pp line 95

public property TVersionStringTable.Name : string
  read fName;

Description

Name must be a hex representation of a 4-bytes unsigned number: first 4 ciphers represent the language id, and last 4 the codepage.

Errors

If an attempt is made to set Name with a string that isn't an 8-cipher hexadecimal string, an ENameNotAllowedException exception is raised.

See also

TVersionStringTable.Create

Creates a new string table


TVersionStringTable.Values

Array of values in the object, accessed by key

Declaration

Source position: versiontypes.pp line 99

public property TVersionStringTable.Values[Key: string] : string
  read GetValue
  write SetValue;
  default;

Description

This property can be used to retrieve the value of an item when the corresponding key is known.

If you need to iterate over all values of the string table, use ValuesByIndex instead.

If the key is not found, an EKeyNotFoundException exception is raised.

See also

TVersionStringTable.Keys | Indexed array of keys in the object
TVersionStringTable.ValuesByIndex | Indexed array of values in the object


TVersionStringTable.ValuesByIndex

Indexed array of values in the object

Declaration

Source position: versiontypes.pp line 98

public property TVersionStringTable.ValuesByIndex[index: Integer] : string
  read GetValue
  write SetValue;

Description

This property can be used to access all values in the object.

Keys associated to values are stored in Keys property: a key and its value have the same index in the two properties.

Remark: This array is 0-based: valid elements range from 0 to Count-1.

See also

TVersionStringTable.Keys | Indexed array of keys in the object
TVersionStringTable.Values | Array of values in the object, accessed by key


TVersionVarFileInfo

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

List of supported languages

Declaration

Source position: versiontypes.pp line 124

type TVersionVarFileInfo = class
protected
function GetCount;
function GetItem();
procedure SetItem();
public
constructor Create;
destructor Destroy; override; | Destroys the object
procedure Add(); | Adds a new translation information item
procedure Clear; | Deletes all items
procedure Delete(); | Deletes an item
property Count: Integer; [r] | The number of items in the object
property Items []: TVerTranslationInfo; default; [rw] | Indexed array of items in the object
end;

Inheritance

TVersionVarFileInfo

List of supported languages
|

TObject

Description

This class represents the language-codepage pairs that the program or dll supports. It can be used to avoid including several RT_VERSION resources for each language-codepage supported.

It is a list of TVerTranslationInfo records.

See also

TVersionResource.VarFileInfo | List of supported languages
TVerTranslationInfo | A language - codepage pair


TVersionVarFileInfo
 | ro | Count
 |  | Items


TVersionVarFileInfo
pt | GetCount
pt | GetItem
pt | SetItem
 | Create
 | Destroy
 | Add
 | Clear
 | Delete


 | Add (TVersionVarFileInfo)
 | Clear (TVersionVarFileInfo)
 | Create (TVersionVarFileInfo)
 | Delete (TVersionVarFileInfo)
 | Destroy (TVersionVarFileInfo)
pt | GetCount (TVersionVarFileInfo)
pt | GetItem (TVersionVarFileInfo)
pt |


TVersionVarFileInfo


TVersionVarFileInfo.Add

Adds a new translation information item

Declaration

Source position: versiontypes.pp line 134

public procedure TVersionVarFileInfo.Add(

  aInfo: TVerTranslationInfo

);

Arguments

aInfo

The element to add

See also

TVersionVarFileInfo.Items

Indexed array of items in the object


TVersionVarFileInfo.Clear

Deletes all items

Declaration

Source position: versiontypes.pp line 135

public procedure TVersionVarFileInfo.Clear;

Description

This method empties the object deleting all items.

See also

TVersionVarFileInfo.Delete

Deletes an item


TVersionVarFileInfo.Count

The number of items in the object

Declaration

Source position: versiontypes.pp line 137

public property TVersionVarFileInfo.Count : Integer
  read GetCount;

See also

TVersionVarFileInfo.Items

Indexed array of items in the object


TVersionVarFileInfo.Create

Declaration

Source position: versiontypes.pp line 132

public constructor TVersionVarFileInfo.Create;


TVersionVarFileInfo.Delete

Deletes an item

Declaration

Source position: versiontypes.pp line 136

public procedure TVersionVarFileInfo.Delete(

  const aIndex: Integer

);

Arguments

aIndex

The index of the item to delete

See also

TVersionVarFileInfo.Items

Indexed array of items in the object


TVersionVarFileInfo.Destroy

Destroys the object

Declaration

Source position: versiontypes.pp line 133

public destructor TVersionVarFileInfo.Destroy; override;

Description

All items are destroyed as well.

See also

TVersionVarFileInfo.Clear

Deletes all items


TVersionVarFileInfo.GetCount

Declaration

Source position: versiontypes.pp line 128

protected function TVersionVarFileInfo.GetCount: Integer;


TVersionVarFileInfo.GetItem

Declaration

Source position: versiontypes.pp line 129

protected function TVersionVarFileInfo.GetItem(

  index: Integer

):TVerTranslationInfo;


TVersionVarFileInfo.Items

Indexed array of items in the object

Declaration

Source position: versiontypes.pp line 138

public property TVersionVarFileInfo.Items[index: Integer] : TVerTranslationInfo
  read GetItem
  write SetItem;
  default;

Description

This property can be used to access all translation information items in the object.

Remark: This array is 0-based: valid elements range from 0 to Count-1.

See also

TVersionVarFileInfo.Count

The number of items in the object


TVersionVarFileInfo.SetItem

Declaration

Source position: versiontypes.pp line 130

protected procedure TVersionVarFileInfo.SetItem(

  index: Integer;

  aValue: TVerTranslationInfo

);


TWinPEImageResourceReader

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

PE image file resource reader

Declaration

Source position: winpeimagereader.pp line 29

type TWinPEImageResourceReader = class(TAbstractResourceReader)

protected

  function CheckDosStub();

  function CheckPESignature();

  function GetExtensions; override;

  function GetDescription; override;

  procedure Load(); override;

  function CheckMagic(); override;

public

  constructor Create; override;

  destructor Destroy; override;

end;

Inheritance

TWinPEImageResourceReader | PE image file resource reader
|
TAbstractResourceReader | Base abstract resource reader class
|
TObject

Description

This class provides a reader for Microsoft Windows PE image files containing resources.

PE is the file format used by Microsoft Windows executables, dynamic link libraries and so on.

Remark: This reader can only read full PE images, not COFF object files. Use TCoffResourceReader instead.

See also

TAbstractResourceReader | Base abstract resource reader class
TCoffResourceReader | COFF resource reader


TWinPEImageResourceReader
TAbstractResourceReader
 | ro | Extensions
 | ro | Description


TWinPEImageResourceReader
pt | CheckDosStub
pt | CheckPESignature
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create
 | Destroy
TAbstractResourceReader
pt | SetDataSize
pt | SetHeaderSize
pt | SetDataOffset
pt | SetRawData
pt | CallSubReaderLoad
pt | AddNoTree
pt | GetTree
pt | GetExtensions
pt | GetDescription
pt | Load
pt | CheckMagic
 | Create


pt | AddNoTree (TAbstractResourceReader)
pt | CallSubReaderLoad (TAbstractResourceReader)
pt | CheckDosStub (TWinPEImageResourceReader)
pt | CheckMagic (TAbstractResourceReader)
pt | CheckMagic (TWinPEImageResourceReader)
pt | CheckPESignature (TWinPEImageResourceReader)
 | Create (TAbstractResourceReader)
 | Create (TWinPEImageResourceReader)
 | Destroy (TWinPEImageResourceReader)
pt | GetDescription (TAbstractResourceReader)
pt | GetDescription (TWinPEImageResourceReader)
pt | GetExtensions (TAbstractResourceReader)
pt | GetExtensions (TWinPEImageResourceReader)
pt | GetTree (TAbstractResourceReader)
pt | Load (TAbstractResourceReader)
pt | Load (TWinPEImageResourceReader)
pt | SetDataOffset (TAbstractResourceReader)
pt | SetDataSize (TAbstractResourceReader)
pt | SetHeaderSize (TAbstractResourceReader)
pt |


TWinPEImageResourceReader

TAbstractResourceReader


TWinPEImageResourceReader.CheckDosStub

Declaration

Source position: winpeimagereader.pp line 35

protected function TWinPEImageResourceReader.CheckDosStub(

  aStream: TStream

):Boolean;


TWinPEImageResourceReader.CheckPESignature

Declaration

Source position: winpeimagereader.pp line 36

protected function TWinPEImageResourceReader.CheckPESignature(

  aStream: TStream

):Boolean;


TWinPEImageResourceReader.Destroy

Declaration

Source position: winpeimagereader.pp line 43

public destructor TWinPEImageResourceReader.Destroy; override;


Basic Usage

Resource files and TResources class

One of the most important classes is TResources class, contained in resource unit, which represents a format-independent view of a resource file. In fact, while single resources are important, they are of little use alone, since they can't be read or written to file directly: they need to be contained in a TResources object.

TResources provides methods to read itself from a file or stream, using specific objects that are able to read resource data from such a stream: these are the so called resource readers, that descend from TAbstractResourceReader.

There are also resource writers that do the opposite, and that descend from TAbstractResourceWriter.

Usually readers and writers register themselves with TResources in the initialization section of the unit they are implemented in, so you only need to add a certain unit to your program uses clause to let TResources "know" about a particular file format.

Let's see a very simple example: a program that converts a .res file to an object file in COFF format (the object file format used by Microsoft Windows).

program res1;

{$mode objfpc}

uses
  Classes, SysUtils, resource, resreader, coffwriter;

var
  resources : TResources;
begin
  resources:=TResources.Create;
  resources.LoadFromFile('myresource.res');
  resources.WriteToFile('myobject.o');
  resources.Free;
end.

As you can see, the code is trivial. Note that resreader and coffwriter units were added to the uses clause of the program: this way, the resource reader for .res files and the resource writer for COFF files have been registered, letting the resources object know how to handle these file types.

There are cases where one doesn't want to let the TResources object to choose readers and writers by itself. In fact, while generally it is a good idea to let TResources probe all readers it knows to find one able to read the input file, this isn't true when it comes to write files: writers are selected based on the file extension, so if you are trying to write a file with .o extension you can't be sure about which writer will be selected: it could be the COFF or the ELF writer (it depends on which writer gets registered first). Moreover, writers generally make an object file for the host architecture, so if you are running the program on a i386 machine it will produce a COFF or ELF file for i386.

The solution is to provide TResources with a specific writer. In the following example the reader is automatically chosen among various readers, and we use a specific writer to produce an ELF file for SPARC.

program res2;

{$mode objfpc}

uses
  Classes, SysUtils, resource,
  resreader, coffreader, elfreader, winpeimagereader, //readers
  elfwriter, elfconsts;

var
  resources : TResources;
  writer : TElfResourceWriter;
begin
  resources:=TResources.Create;
  resources.LoadFromFile(paramstr(1));
  writer:=TElfResourceWriter.Create;
  writer.MachineType:=emtsparc;
  resources.WriteToFile(ChangeFileExt(paramstr(1),'.o'),writer);
  resources.Free;
  writer.Free;
end.

Note that the file to convert is taken from the command line. Its format is automatically detected among res (resreader), coff (coffreader), elf (elfreader), PE (winpeimagereader, e.g. a Windows exe or dll), and is written as an ELF file for SPARC. Note that we had to use elfconsts unit since we used emtsparc constant to specify the machine type of the object file to generate.

With a small change to the above program we can let the user know which reader was selected to read the input file: we can use TResources.FindReader class method to obtain the appropriate reader for a given stream.

program res3;

{$mode objfpc}

uses
  Classes, SysUtils, resource,
  resreader, coffreader, elfreader, winpeimagereader, //readers
  elfwriter, elfconsts;

var
  resources : TResources;
  writer : TElfResourceWriter;
  reader : TAbstractResourceReader;
  inFile : TFileStream;
begin
  resources:=TResources.Create;
  inFile:=TFileStream.Create(paramstr(1), fmOpenRead or fmShareDenyNone);
  reader:=TResources.FindReader(inFile);
  writeln('Selected reader: ',reader.Description);
  resources.LoadFromStream(inFile,reader);
  writer:=TElfResourceWriter.Create;
  writer.MachineType:=emtsparc;
  resources.WriteToFile(ChangeFileExt(paramstr(1),'.o'),writer);
  resources.Free;
  reader.Free;
  writer.Free;
  inFile.Free;
end.

Output example:

user@localhost:~$ ./res3 myresource.res
Selected reader: .res resource reader
user@localhost:~$

Single resources

You can do more with resources than simply converting between file formats.

TResources.Items property provides a simple way to access all resources contained in the TResources object.

In the following example we read a resource file and then dump each resource data in a file whose name is built from type and name of the dumped resource.

program res4;

{$mode objfpc}

uses
  Classes, SysUtils, resource, resreader;

var
  resources : TResources;
  dumpFile : TFileStream;
  i : integer;
  fname : string;
begin
  resources:=TResources.Create;
  resources.LoadFromFile('myresource.res');
  for i:=0 to resources.Count-1 do
  begin
    fname:=resources[i]._Type.Name+'_'+resources[i].Name.Name;
    dumpFile:=TFileStream.Create(fname,fmCreate or fmShareDenyWrite);
    dumpFile.CopyFrom(resources[i].RawData,resources[i].RawData.Size);
    dumpFile.Free;
  end;
  resources.Free;
end.

This code simply copies the content of each resource's RawData stream to a file stream, whose name is resourcetype_resourcename.

Resource raw data isn't always what one expected, however. While some resource types simply contain a copy of a file in their raw data, other types do some processing, so that dumping raw data doesn't result in a file in the format one expected.

E.g. a resource of type RT_MANIFEST is of the former type: its raw data is like an XML manifest file. On the other hand, in a resource of type RT_BITMAP the RawData stream isn't like a BMP file.

For this reason, several classes (descendants of TAbstractResource) are provided to handle the peculiarities of this or that resource type. Much like it's done with readers and writers, resource classes can be registered: adding the unit that contains a resource class to the uses clause of your program registers that class. This way, when resources are read from a file, they are created with the class that is registered for their type (the class responsible to do this is TResourceFactory, but probably you won't need to use it unless you're implementing a new resource reader or resource class).

In the following example, we read a resource file and then dump data of each resource of type RT_BITMAP as a BMP file.

program res5;

{$mode objfpc}

uses
  Classes, SysUtils, resource, resreader, bitmapresource;

var
  resources : TResources;
  dumpFile : TFileStream;
  i : integer;
  fname : string;
begin
  resources:=TResources.Create;
  resources.LoadFromFile('myresource.res');
  for i:=0 to resources.Count-1 do
    if resources[i] is TBitmapResource then
      with resources[i] as TBitmapResource do
      begin
        fname:=Name.Name+'.bmp';
        dumpFile:=TFileStream.Create(fname,fmCreate or fmShareDenyWrite);
        dumpFile.CopyFrom(BitmapData,BitmapData.Size);
        dumpFile.Free;
      end;
  resources.Free;
end.

Note that we included bitmapresource in the uses clause of our program. This way, resources of type RT_BITMAP are created from TBitmapResource class. This class provides a stream, BitmapData that allows resource raw data to be accessed as if it was a bmp file.

We can of course do the opposite. In the following code we are creating a manifest resource from manifest.xml file.

program res6;

{$mode objfpc}

uses
  Classes, SysUtils, resource, reswriter;

var
  resources : TResources;
  inFile : TFileStream;
  res : TGenericResource;
  rname,rtype : TResourceDesc;
begin
  inFile:=TFileStream.Create('manifest.xml',fmOpenRead or fmShareDenyNone);
  rtype:=TResourceDesc.Create(RT_MANIFEST);
  rname:=TResourceDesc.Create(1);
  res:=TGenericResource.Create(rtype,rname);
  rtype.Free; //no longer needed
  rname.Free;
  res.SetCustomRawDataStream(inFile);
  resources:=TResources.Create;
  resources.Add(res);
  resources.WriteToFile('myresource.res');
  resources.Free;  //frees res as well
  inFile.Free;
end.

Note that resources of type RT_MANIFEST contain a straight copy of a xml file, so TGenericResource class fits our needs. TGenericResource is a basic implementation of TAbstractResource. It is the default class used by TResourceFactory when it must create a resource whose type wasn't registered with any resource class.

Please note that instead of copying inFile contents to RawData we used SetCustomRawDataStream method: it sets a stream as the underlying stream for RawData, so that when final resource file is written, data is read directly from the original file.

Let's see a similar example, in which we use a specific class instead of TGenericResource. In the following code we are creating a resource containing the main program icon, which is read from mainicon.ico file.

program res7;

{$mode objfpc}

uses
  Classes, SysUtils, resource, reswriter, groupiconresource;

var
  resources : TResources;
  inFile : TFileStream;
  iconres : TGroupIconResource;
  name : TResourceDesc;
begin
  inFile:=TFileStream.Create('mainicon.ico',fmOpenRead or fmShareDenyNone);
  name:=TResourceDesc.Create('MAINICON');
  //type is always RT_GROUP_ICON for this resource class
  iconres:=TGroupIconResource.Create(nil,name);
  iconres.SetCustomItemDataStream(inFile);
  resources:=TResources.Create;
  resources.Add(iconres);
  resources.WriteToFile('myicon.res');
  resources.Free;  //frees iconres as well
  inFile.Free;
  name.Free;
end.

In this program we created a new TGroupIconResource with 'MAINICON' as name, and we loaded its contents from file 'mainicon.ico'. Please note that RT_GROUP_ICON resource raw data doesn't contain a .ico file, so we have to write to ItemData which is a ico-like stream. As we did for res6 program, we tell the resource to use our stream as the underlying stream for resource data: the only difference is that we are using TGroupResource.SetCustomItemDataStream instead of TAbstractResource.SetCustomRawDataStream method, for obvious reasons.

Other resource types

There are other resource types that allow to easily deal with resource data. E.g. TVersionResource makes it easy to create and read version information for Windows executables and dlls, TStringTableResource deals with string tables, and so on.

Data caching

Whenever possible, fcl-res tries to avoid to duplicate data. Generally a reader doesn't copy resource data from the original stream to RawData stream: instead, it only informs the resource about where its raw data is in the original stream. RawData uses a caching system so that it appears as a stream while it only redirects operations to its underlying stream, with a copy-on-write mechanism. Of course this behaviour can be controlled by the user. For further information, see TAbstractResource and TAbstractResource.RawData.


Format of resources in object files

Introduction

This appendix describes the format in which resources are stored in object files. This doesn't apply to PECOFF file format, where a format already exists and is well described in documentation from Microsoft.

On Microsoft Windows, resources are natively supported by the operating system. On other systems, Free Pascal RTL provides access to resources, which are embedded in the executable file in the format that is here described.

This appendix doesn't describe a particular object file format implementation (e.g. ELF or Mach-O), but the layout of the sections involved in supporting resources: the way these sections are actually laid out on a file are subject to the rules of the hosting object file format.

For external resource file details, see Description of external resource file format

Conventions

In this document, data sizes are specified with pascal-style data types. They are the following:

Name | Meaning
longword | Unsigned 32 bit integer.
ptruint | Unsigned integer of the size of a pointer

Byte order is the one of the target machine.

All data structures in the sections must be aligned on machine boundaries (4 bytes for 32 bit machines, 8 bytes for 64 bit machines).

Note that all pointers must be valid at runtime. This means that relocations must be written to the object file so that the linker can relocate pointers to the addresses they will have at runtime. Note also that pointers to strings are really pointers, and not offsets to the beginning of the string table.

Resource sections

Free Pascal uses two sections to store resource information:

  • fpc.resources. This is a data section that contains all required structures. It must be writable.
  • fpc.rehandles. This is a bss section whose size must be equal to (total number of resources)*(size of pointer). It must be writable.

The rest of this chapter will describe the contents of fpc.resources section.

Resource section layout

The fpc.resources section consists of these parts:

  • The initial header
  • The resource tree, in the form of nodes
  • The string table, which can be optional
  • The resource data

The initial header

The fpc.resources section starts with this header:

Name | Offset | Length | Description
rootptr | 0 | ptruint | Pointer to the root node.
count | 4/8 | longword | Total number of resources.
usedhandles | 8/12 | longword | Used at runtime. Set to zero in object files.
handles | 12/16 | ptruint | Pointer to the first byte of fpc.reshandles section.

The resource tree

Immediately following the initial header, the resource tree comes. It is made up by nodes that represent resource types, names and language ids.

Data is organized so that resource information (type, name and language id) is represented by a tree: root node contains resource types, that in turn contain resource names, which contain language ids, which describe resource data.

Given a node, its sub-nodes are ordered as follows:

  • First the "named" nodes (nodes that use a string as identifier) come, then the id ones (nodes that use an integer as identifier).
  • Named nodes are alphabetically sorted, in ascending order.
  • Id nodes are sorted in ascending order.

In the file, all sub-nodes of a node are written in the order described above. Then, all sub-nodes of the first sub-node are written, and so on.

Example:

There are three resources:

  1. a BITMAP resource with name MYBITMAP and language id $0409
  2. a BITMAP resource with name 1 and language id 0
  3. a resource with type MYTYPE and name 1 and language id 0

Nodes are laid out this way (note that BITMAP resources have type 2):

root | MYTYPE 2 | 1 | 0 | MYBITMAP 1 | $0409 | 0

That is, types (MYTYPE is a string, so it comes before 2 which is BITMAP), then names for MYTYPE (1), then language id for resource 3 (0), then names for BITMAP (MYBITMAP and 1), then language id for resource 1 ($0409), then language id for resource 2 (0).

Node format

Name | Offset | Length | Description
nameid | 0 | ptruint | name pointer, integer id or language id
ncount | 4/8 | longword | named sub-nodes count
idcountsize | 8/12 | longword | id sub-nodes count or resource size
subptr | 12/16 | ptruint | pointer to first sub-node

If the node is identified by a string, nameid is a pointer to the null-terminated string holding the name. If it is identified by an id, nameid is that id. Language id nodes are always identified by and ID.

ncount is the number of named sub-nodes of this node (nodes that are identified by a string).

idcountsize is the number of id sub-nodes of this node (nodes that are identified by an integer id). For language id nodes, this field holds the size of the resource data.

subptr is an pointer to the first subnode of this node. Note that it allows to access every subnode of this node, since subnodes of a node always come one after the other. For language id nodes, subptr is the pointer to the resource data.

The string table

The string table is used to store strings used for resource types and names. If all resources use integer ids for name and types, it may not be present in the file.

The string table simply contains null-terminated strings, one after the other.

If present, the string table always contains a 0 (zero) at the beginning. This way, the empty string is located at the first byte of the string table.

The resource data

This part of the file contains raw resource data. As written before, all data structures must be aligned on machine boundaries, so if a resource data size is not a multiple of 4 (for 32 bit machines) or 8 (for 64 bit machines), bytes of padding must be inserted after that resource data.

Exported symbols

Object files containing resources must export a pointer to the first byte of fpc.resources section. The name of this symbol is FPC_RESSYMBOL.

Mach-O specific notes

fpc.resources and fpc.reshandles sections are to be contained in a __DATA segment.


How to implement a new resource class

Remark: This chapter assumes you have some experience in using this library.

Some considerations

Usually, a specific resource class is needed when resource data is encoded in a specific binary format that makes working with RawData uncomfortable.

However, there aren't many reasons to design a new binary format requiring a specific resource class: the classes provided with this package exist for compatibility with Microsoft Windows, but in the general case one should avoid such approach.

In Microsoft Windows, some resource types have a specific format, and the operating system supports them at runtime making it easy to access that kind of data: e.g. icons and bitmaps are stored in resources in a format that is slightly different from the one found in regular files, but the operating system allows the user to easily load them using LoadImage function, without having to deal with their internal format. Other resource types are used to obtain information about the executable: RT_VERSION resource type and RT_GROUP_ICON contain version information and program icon that can be displayed in Windows Explorer, respectively.

Using this kind of resources in a cross-platform perspective doesn't make much sense however, since there is no support by other operating systems for these types of resources (and for resources in general), and this means that it's up to you to provide support at runtime for these binary formats. So if you need to store images as resources it's better to use TGenericResource and store an image in PNG format (for instance), which can be read by existing libraries at runtime, instead of creating a RT_BITMAP resource with TBitmapResource, since libraries that read BMP files can't handle that resource contents.

New resource classes thus make sense when you want to add support for existing Windows-specific resources, e.g. because you are writing a resource compiler or editor, but in the general case they should be avoided.

Now that you've been warned, let's start with the topic of this chapter.

How to implement a new resource class

A resource class is a descendant of TAbstractResource, and it's usually implemented in a unit named typeresource, where type is resource type.

If you are implementing a new resource class, you are doing it to provide additional methods or properties to utilize resource data. You resource class must thus be able to read its RawData stream format and write data back to it when it is requested to do so.

Generally, your class shouldn't create private objects, records or memory buffers to provide these specific means of accessing data until it's requested to do so (lazy loading), and it should free these things when it is requested to write back data to the RawData stream.

We'll see these points in more detail, using TAcceleratorsResource as an example.

TAcceleratorsResource holds a collection of accelerators. An accelerator is a record defined as follows:

type
  TAccelerator = packed record
    Flags : word;
    Ansi : word;
    Id : word;
    padding : word;
  end;

The resource simply contains accelerators, one immediately following the other. Last accelerator must have $80 in its flags.

To provide easy access to the elements it contains, our accelerator resource class exposes these methods and properties in its public section:

procedure Add(aItem : TAccelerator);
procedure Clear;
procedure Delete(aIndex : integer);
property Count : integer read GetCount;
property Items[index : integer] : TAccelerator read GetItem write SetItem; default;

We must also implement abstract methods (and an abstract constructor) of TAbstractResource:

protected
  function GetType : TResourceDesc; override;
  function GetName : TResourceDesc; override;
  function ChangeDescTypeAllowed(aDesc : TResourceDesc) : boolean; override;
  function ChangeDescValueAllowed(aDesc : TResourceDesc) : boolean; override;
  procedure NotifyResourcesLoaded; override;
public
  constructor Create(aType,aName : TResourceDesc); override;
  procedure UpdateRawData; override;

The protected methods are very easy to implement, so let's start from them. For GetType and GetName, we need to add two private fields, fType and fName, of type TResourceDesc. We create them in the constructor and destroy them in the destructor. Type will always be RT_ACCELERATOR. We make the parameterless constructor of TAbstractResource public, using 1 as the resource name, while in the other constructor we use the name passed as parameter, ignoring the type (since it must always be RT_ACCELERATOR).

So, GetType, GetName, the constructors and the destructor are implemented as follows:

function TAcceleratorsResource.GetType: TResourceDesc;
begin
  Result:=fType;
end;

function TAcceleratorsResource.GetName: TResourceDesc;
begin
  Result:=fName;
end;

constructor TAcceleratorsResource.Create;
begin
  inherited Create;
  fType:=TResourceDesc.Create(RT_ACCELERATOR);
  fName:=TResourceDesc.Create(1);
  SetDescOwner(fType);
  SetDescOwner(fName);
end;

constructor TAcceleratorsResource.Create(aType, aName: TResourceDesc);
begin
  Create;
  fName.Assign(aName);
end;

destructor TAcceleratorsResource.Destroy;
begin
  fType.Free;
  fName.Free;
  inherited Destroy;
end;

Note that we used SetDescOwner to let type and name know the resource that owns them.

Now ChangeDescTypeAllowed and ChangeDescValueAllowed come. As we said, resource type must be RT_ACCELERATOR, always. Thus, we only allow name to change value or type:

function TAcceleratorsResource.ChangeDescTypeAllowed(aDesc: TResourceDesc): boolean;
begin
  Result:=aDesc=fName;
end;

function TAcceleratorsResource.ChangeDescValueAllowed(aDesc: TResourceDesc): boolean;
begin
  Result:=aDesc=fName;
end;

NotifyResourcesLoaded is called by TResources when it finishes loading all resources. Since we are not interested in this fact, we simply leave this method empty. This method is useful for resources that "own" other resources, like TGroupIconResource and TGroupCursorResource (note: you should not implement resource types that depend on other resources: it complicates things a lot and gives you a lot of headaches).

Now, let's see the more interesting - and more difficult - part: providing an easy way to deal with accelerators.

As we said earlier, we must implement some methods and properties to do so. Surely we'll need a list to hold pointers to accelerator records, but we must think a little bit about how this list is created, populated, written to RawData and so on.

When the object is created, we don't have to create (yet) single accelerator records, as said before; but if the user tries to access them we must do it. If the object is created and its RawData contains data (e.g. because a reader has created the resource when loading a resource file) and the user tries to access an accelerator, we must create accelerators from RawData contents. So, until a user tries to access accelerators our class doesn't do anything, while when the user does so it "lazy-loads" data, or creates empty structures if RawData is empty.

When data is loaded, RawData contents aren't considered anymore. When, however, our resource is requested to update RawData (that is, when UpdateRawData method is invoked), our "lazy-loaded" data must be freed. In fact, a user could ask our resource to update raw data, then he/she could modify it directly and then could use our resource's specialized methods and properties to do further processing: for this reason, when RawData is written, other buffered things must be freed, so that they'll created again from RawData if needed.

Note that other resource classes could behave differently: e.g. TBitmapResource uses a copy-on-write mechanism on top of RawData to insert a BMP file header at the beginning of the stream, but it doesn't copy RawData contents whenever possible.

Coming back to our TAcceleratorsResource example, let's see how to implement this behaviour.

Let's add a fList field in the private section of our class:

fList : TFPList;

In the constructor, we set this field to nil: we use it to check if data has been loaded from RawData or not. Consequently in the destructor we'll free the list only if it's not nil:

destructor TAcceleratorsResource.Destroy;
begin
  fType.Free;
  fName.Free;
  if fList<>nil then
  begin
    Clear;
    fList.Free;
  end;
  inherited Destroy;
end;

(we did not implement Clear method yet: we'll see it later).

We said that our resource must load data only when needed; to do this we add a private method, CheckDataLoaded that ensures that data is loaded. This method is called by whatever method needs to operate on the list: if data has already been loaded it will quickly return, otherwise it will load data.

procedure TAcceleratorsResource.CheckDataLoaded;
var acc : TAccelerator;
    tot, i : integer;
    p : PAccelerator;
begin
  if fList<>nil then exit;
  fList:=TFPList.Create;
  if RawData.Size=0 then exit;
  RawData.Position:=0;
  tot:=RawData.Size div 8;
  for i:=1 to tot do
  begin
    RawData.ReadBuffer(acc,sizeof(acc));
    GetMem(p,sizeof(TAccelerator));
    p^:=acc;
    fList.Add(p);
  end;
end;

If fList is not nil data is already loaded, so exit. Otherwise, create the list. If RawData is empty we don't need to load anything, so exit. Otherwise allocate room for accelerators, read them from the stream, and add them to the list.

Note that if we are running on a big endian system we should swap the bytes we read, e.g. calling SwapEndian function, but for simplicity this is omitted.

The counterpart of CheckDataLoaded is UpdateRawData. When it is called, data from the list must be written back to RawData, and the list and its contents must be freed:

procedure TAcceleratorsResource.UpdateRawData;
var acc : TAccelerator;
    i : integer;
begin
  if fList=nil then exit;
  RawData.Size:=0;
  RawData.Position:=0;

  for i:=0 to fList.Count-1 do
  begin
    acc:=PAccelerator(fList[i])^;
    // $80 means 'this is the last entry', so be sure only the last one has this bit set.
    if i=Count-1 then acc.Flags:=acc.Flags or $80
    else acc.Flags:=acc.Flags and $7F;
    RawData.WriteBuffer(acc,sizeof(acc));
  end;
  Clear;
  FreeAndNil(fList);
end;

If fList is nil data hasn't been loaded, so RawData is up to date, so exit. Otherwise, write each accelerator (ensuring that only last one has $80 flag set), clear the list, free it and set it to nil. Again, if we are on a big endian system we should swap each accelerator contents before writing it, but for simplicity this is omitted.

Other methods we named earlier (Add, Delete, Clear) are trivial to implement: remember only to call CheckDataLoaded before doing anything. The same is true for accessor methods of relevant properties (Count, Items).

If you are curious, you can check the full implementation of TAcceleratorsResource looking at source code.


How to implement a new resource reader

Remark: This chapter assumes you have some experience in using this library.

We'll see how to implement a reader for a new resource file format. A resource reader is a descendant of TAbstractResourceReader, and it's usually implemented in a unit named namereader, where name is file format name.

Suppose we must write a reader for file format foo; we could start with a unit like this:

unit fooreader;

{$MODE OBJFPC} {$H+}

interface

uses
  Classes, SysUtils, resource;

type
  TFooResourceReader = class(TAbstractResourceReader)
  protected
    function GetExtensions : string; override;
    function GetDescription : string; override;
    procedure Load(aResources : TResources; aStream : TStream); override;
    function CheckMagic(aStream : TStream) : boolean; override;
  public
    constructor Create; override;
  end;

implementation

function TFooResourceReader.GetExtensions: string;
begin

end;

function TFooResourceReader.GetDescription: string;
begin

end;

procedure TFooResourceReader.Load(aResources: TResources; aStream: TStream);
begin

end;

function TFooResourceReader.CheckMagic(aStream: TStream): boolean;
begin

end;

constructor TFooResourceReader.Create;
begin

end;

initialization
  TResources.RegisterReader('.foo',TFooResourceReader);

end.

Note that in the initialization section, TFooResourceReader is registered for extension .foo.

We must implement abstract methods of TAbstractResourceReader. Let's start with the simpler ones, GetExtensions and GetDescription.

function TFooResourceReader.GetExtensions: string;
begin
  Result:='.foo';
end;

function TFooResourceReader.GetDescription: string;
begin
  Result:='FOO resource reader';
end;

Now let's see CheckMagic method. This method is called with a stream as a parameter, and the reader must return true if it recognizes the stream as a valid one. Usually this means checking some magic number or header.

function TFooResourceReader.CheckMagic(aStream: TStream): boolean;
var signature : array[0..3] of char;
begin
  Result:=false;
  try
    aStream.ReadBuffer(signature[0],4);
  except
    on e : EReadError do exit;
  end;
  Result:=signature='FOO*';
end;

Suppose our foo files start with a 4-byte signature 'FOO*'. This method checks the signature and returns true if it is verified. Note that it catches EReadError exception raised by TStream: this way, if the stream is too short it returns false (as it should, since magic is not valid) instead of letting the exception to propagate.

Now let's see Load. This method must read the stream and create resources in the TResources object, with information about their name, type, position and size of their raw data, and so on.

procedure TFooResourceReader.Load(aResources: TResources; aStream: TStream);
begin
  if not CheckMagic(aStream) then
    raise EResourceReaderWrongFormatException.Create('');
  try
    ReadResources(aResources,aStream);
  except
    on e : EReadError do
      raise EResourceReaderUnexpectedEndOfStreamException.Create('');
  end;
end;

First of all, this method checks file magic number, calling CheckMagic method we already implemented. This is necessary since CheckMagic is not called before Load: CheckMagic is invoked by TResources when probing a stream, while Load is invoked when loading resources (so if the user passed a reader object to a TResources object, CheckMagic is never called). Note also that the stream is always at its starting position when these methods are called.

If magic number is ok, our method invokes another method to do the actual loading. If during this process the stream can't be read, an EResourceReaderUnexpectedEndOfStreamException exception is raised.

So, let's implement the private method which will load resources.

Suppose that our foo format is very simple:

  • the header is made by the 4-byte signature we already saw, a longword holding the number of resources in the file, and other 8 bytes of padding.

  • each resource has a 16-byte header containing:

    • a longword for the resource type (only IDs are allowed for types)
    • a longword for the resource name (only IDs are allowed for names)
    • a longword for the language ID
    • a longword for the size of the resource data
  • after the resource header immediately comes the resource data, possibly padded so that it ends on a 4 byte boundary.
  • file format is little-endian

To start with, our method will be:

procedure TFooResourceReader.ReadResources(aResources: TResources; aStream: TStream);
var Count, i: longword;
    aType, aName, aLangID : longword;
    aDataSize : longword;
begin
  //read remaining file header
  aStream.ReadBuffer(Count,sizeof(Count));
  aStream.Seek(8,soFromCurrent);

  for i:=1 to Count do
  begin
    //read resource header
    aStream.ReadBuffer(aType,sizeof(aType));
    aStream.ReadBuffer(aName,sizeof(aName));
    aStream.ReadBuffer(aLangID,sizeof(aLangID));
    aStream.ReadBuffer(aDataSize,sizeof(aDataSize));

  end;
end;

Since in Load we called CheckMagic, which read the first 4 bytes of the header, we must read the remaining 12: we read the number of resources, and we skip the other 8 bytes of padding.

Then, for each resource, we read the resource header. Note that if we are running on a big endian system we should swap the bytes we read, e.g. calling SwapEndian function, but for simplicity this is omitted.

Now, we should create a resource. Of which class? Well, we must use resfactory unit. In fact it contains TResourceFactory class, which is an expert in creating resources of the right class: when the user adds a unit containing a resource class to the uses clause of its program, the resource class registers itself with TResourceFactory. This way it knows how to map resource types to resource classes.

We need to have type and name of the resource to create as TResourceDesc objects: instead of creating and destroying these objects for each resource, we'll create a couple in the creator of our reader and we'll destroy them in the destructor, so that they will live for the whole life of our reader. Let's name them workType and workName.

Our code becomes:

uses
  resfactory;

procedure TFooResourceReader.ReadResources(aResources: TResources; aStream: TStream);
var Count, i: longword;
    aType, aName, aLangID : longword;
    aDataSize : longword;
    aRes : TAbstractResource;
begin
  //read remaining file header
  aStream.ReadBuffer(Count,sizeof(Count));
  aStream.Seek(8,soFromCurrent);

  for i:=1 to Count do
  begin
    //read resource header
    aStream.ReadBuffer(aType,sizeof(aType));
    aStream.ReadBuffer(aName,sizeof(aName));
    aStream.ReadBuffer(aLangID,sizeof(aLangID));
    aStream.ReadBuffer(aDataSize,sizeof(aDataSize));

    //create the resource
    workType.ID:=aType;
    workName.ID:=aName;
    aRes:=TResourceFactory.CreateResource(workType,workName);
    SetDataSize(aRes,aDataSize);
    SetDataOffset(aRes,aStream.Position);
    aRes.LangID:=aLangID;

  end;
end;

Note that after the resource has been created we set its data size and data offset. Data offset is the current position in the stream, since in our FOO file format resource data immediately follows resource header.

What else do we need to do? Of course we must create RawData stream for our resource, so that raw data can be accessed with the caching mechanism. We will create a TResourceDataStream object, telling it which resource and stream it is associated to, which its size will be and which class its underlying cached stream must be created from.

So we add resdatastream to the uses clause, declare another local variable

aRawData : TResourceDataStream;

and add these lines in the for loop

aRawData:=TResourceDataStream.Create(aStream,aRes,aRes.DataSize,TCachedResourceDataStream);
SetRawData(aRes,aRawData);

That is, aRawData will create its underlying stream as a TCachedResourceDataStream over the portion of aStream that starts at current position and ends after aRes.DataSize bytes.

We almost finished: now we must add the newly created resource to the TResources object and move stream position to the next resource header. Complete code for ReadResources method is:

procedure TFooResourceReader.ReadResources(aResources: TResources; aStream: TStream);
var Count, i: longword;
    aType, aName, aLangID : longword;
    aDataSize : longword;
    aRes : TAbstractResource;
    aRawData : TResourceDataStream;
begin
  //read remaining file header
  aStream.ReadBuffer(Count,sizeof(Count));
  aStream.Seek(8,soFromCurrent);

  for i:=1 to Count do
  begin
    //read resource header
    aStream.ReadBuffer(aType,sizeof(aType));
    aStream.ReadBuffer(aName,sizeof(aName));
    aStream.ReadBuffer(aLangID,sizeof(aLangID));
    aStream.ReadBuffer(aDataSize,sizeof(aDataSize));

    //create the resource
    workType.ID:=aType;
    workName.ID:=aName;
    aRes:=TResourceFactory.CreateResource(workType,workName);
    SetDataSize(aRes,aDataSize);
    SetDataOffset(aRes,aStream.Position);
    aRes.LangID:=aLangID;

    //set raw data
    aRawData:=TResourceDataStream.Create(aStream,aRes,aRes.DataSize,TCachedResourceDataStream);
    SetRawData(aRes,aRawData);

    //add to aResources
    try
      aResources.Add(aRes);
    except
      on e : EResourceDuplicateException do
      begin
        aRes.Free;
        raise;
      end;
    end;

    //go to next resource header
    aStream.Seek(aDataSize,soFromCurrent);
    Align4Bytes(aStream);
  end;
end;

Align4Bytes is a private method (not shown for simplicity) that sets stream position to the next multiple of 4 if needed, since FOO file format specifies that resource data must be padded to end on a 4 byte boundary.

Note: We have used Add method to populate the TResources object. More complex file formats store resources in a tree hierarchy; since TResources internally stores resources in this way too, a reader can choose to acquire a reference to the internal tree used by the TResources object (see TAbstractResourceReader.GetTree), populate it and notify the TResources object about the added resources (see TAbstractResourceReader.AddNoTree). For these file formats resources can be loaded faster, since there is no overhead involved in keeping a separate resource tree in the reader.

That's all. Now you should be able to create a real resource reader.


How to implement a new resource writer

Remark: This chapter assumes you have some experience in using this library.

We'll see how to implement a writer for a new resource file format. A resource writer is a descendant of TAbstractResourceWriter, and it's usually implemented in a unit named namewriter, where name is file format name.

Suppose we must write a writer for file format foo; we could start with a unit like this:

unit foowriter;

{$MODE OBJFPC} {$H+}

interface

uses
  Classes, SysUtils, resource;

type
  TFooResourceWriter = class (TAbstractResourceWriter)
  protected
    function GetExtensions : string; override;
    function GetDescription : string; override;
    procedure Write(aResources : TResources; aStream : TStream); override;
  public
    constructor Create; override;
  end;

implementation

function TFooResourceWriter.GetExtensions: string;
begin

end;

function TFooResourceWriter.GetDescription: string;
begin

end;

procedure TFooResourceWriter.Write(aResources: TResources; aStream: TStream);
begin

end;

constructor TFooResourceWriter.Create;
begin

end;

initialization
  TResources.RegisterWriter('.foo',TFooResourceWriter);

end.

Note that in the initialization section, TFooResourceWriter is registered for extension .foo.

We must implement abstract methods of TAbstractResourceWriter. Let's start with the simpler ones, GetExtensions and GetDescription.

function TFooResourceWriter.GetExtensions: string;
begin
  Result:='.foo';
end;

function TFooResourceWriter.GetDescription: string;
begin
  Result:='FOO resource writer';
end;

Now let's see Write. This method must write all resources in the TResources object to the stream.

Suppose that our foo format is very simple:

  • the header is made by a 4-byte signature (FOO*), a longword holding the number of resources in the file, and other 8 bytes of padding.

  • each resource has a 16-byte header containing:

    • a longword for the resource type (only IDs are allowed for types)
    • a longword for the resource name (only IDs are allowed for names)
    • a longword for the language ID
    • a longword for the size of the resource data
  • after the resource header immediately comes the resource data, possibly padded so that it ends on a 4 byte boundary.
  • file format is little-endian

Our Write method could be something like this:

procedure TFooResourceWriter.Write(aResources: TResources; aStream: TStream);
var i : integer;
begin
  WriteFileHeader(aStream,aResources);
  for i:=0 to aResources.Count-1 do
    WriteResource(aStream,aResources[i]);
end;

So we must implement WriteFileHeader, which writes the 16-byte file header, and WriteResource, which writes a single resource with its header.

Let's start from the first one:

procedure TFooResourceWriter.WriteFileHeader(aStream: TStream; aResources: TResources);
var signature : array[0..3] of char;
    rescount : longword;
    padding : qword;
begin
  signature:='FOO*';
  rescount:=aResources.Count;
  padding:=0;

  aStream.WriteBuffer(signature[0],4);
  aStream.WriteBuffer(rescount,sizeof(rescount));
  aStream.WriteBuffer(padding,sizeof(padding));
end;

This code simply writes the file header as defined in foo format. Note that if we are running on a big endian system we should swap bytes before writing, e.g. calling SwapEndian function, but for simplicity this is omitted.

Now WriteResource comes. This method could be like this:

procedure TFooResourceWriter.WriteResource(aStream: TStream; aResource: TAbstractResource);
var aType : longword;
    aName : longword;
    aLangID : longword;
    aDataSize : longword;
begin
  aType:=aResource._Type.ID;
  aName:=aResource.Name.ID;
  aLangID:=aResource.LangID;
  aDataSize:=aResource.RawData.Size;

  //write resource header
  aStream.WriteBuffer(aType,sizeof(aType));
  aStream.WriteBuffer(aName,sizeof(aName));
  aStream.WriteBuffer(aLangID,sizeof(aLangID));
  aStream.WriteBuffer(aDataSize,sizeof(aDataSize));

  //write resource data
  aResource.RawData.Position:=0;
  aStream.CopyFrom(aResource.RawData,aResource.RawData.Size);

  //align data so that it ends on a 4-byte boundary
  Align4Bytes(aStream);
end;

We write the 16-byte resource header, and then resource data. Note that if resources have been loaded from a stream and the user didn't modify resource data, we are copying data directly from the original stream.

Align4Bytes is a private method (not shown for simplicity) that writes some padding bytes to the stream if needed, since FOO file format specifies that resource data must be padded to end on a 4 byte boundary. Again, we didn't consider endianess for simplicity. And finally, note that foo format only supports IDs for types and names, so if one of them is a name (that is, a string) this code might cause exceptions to be raised.

Note: More complex file formats store resources in a tree hierarchy; since TResources internally stores resources in this way too, a writer can choose to acquire a reference to the internal tree used by the TResources object (see TAbstractResourceWriter.GetTree) and use it directly. For these file formats resources can be written faster, since there is no overhead involved in building a separate resource tree in the writer.

That's all. Now you should be able to create a real resource writer.


Reference for package 'fcl-res'

Units

acceleratorsresource | Contains an accelerator table resource type
bitmapresource | Contains a bitmap resource type
coffreader | Contains a resource reader for COFF files
cofftypes | Contains types used by COFF resource reader and writer
coffwriter | Contains a resource writer for COFF files
dfmreader | Contains a resource reader for DFM files
elfconsts | Contains constants used by ELF reader and writer
elfreader | Contains a resource reader for ELF files
elfwriter | Contains a resource writer for ELF files
externalreader | Contains a resource reader for external resource files
externaltypes | Contains types and constants used by external resource reader and writer
externalwriter | Contains a resource writer for external resource files
groupcursorresource | Contains a group cursor resource type
groupiconresource | Contains a group icon resource type
groupresource | Contains group resource classes
machoreader | Contains a resource reader for Mach-O files
machotypes | Contains types used by Mach-O reader and writer
machowriter | Contains a resource writer for Mach-O files
resdatastream | Contains stream classes to provide copy-on-write functionality
resfactory | Contains a factory class for resources
resource | Contains base classes for resource handling
resourcetree | Implements an ordered tree of resources
resreader | Contains a resource reader for .res files
reswriter | Contains a resource writer for .res files
stringtableresource | Contains a string table resource type
versionconsts | Contains constants used by version information resource
versionresource | Contains a version information resource type
versiontypes | Contains classes used by version information resource
winpeimagereader | Contains a resource reader for PE image files

Related topics

Introduction | Introduction
Basic Usage | Basic Usage
How to implement a new resource class | How to implement a new resource class
How to implement a new resource reader | How to implement a new resource reader
How to implement a new resource writer | How to implement a new resource writer
Format of resources in object files | Format of resources in object files


Index of all identifiers in package 'fcl-res'

A B C D E F G H I M P R S T U V W

A

acceleratorsresource

B

bitmapresource

C

cmtarm | cmtppc64aix | cofftypes
cmti386 | cmtx8664 | coffwriter
cmtppc32aix | coffreader | CREATEPROCESS_MANIFEST_RESOURCE_ID

D

dfmreader dtID dtName

E

EDuplicateKeyException | EMachOResourceWriterUnknownBitSizeException | EResourceException
EElfResourceReaderException | EM_ALPHA | EResourceFactoryException
EElfResourceReaderNoSectionsException | EM_ARM | EResourceLangIDChangeNotAllowedException
EElfResourceReaderNoStringTableException | EM_IA_64 | EResourceNotFoundException
EElfResourceReaderUnknownClassException | EM_MIPS | EResourceReaderException
EElfResourceReaderUnknownVersionException | EM_MIPS_RS3_LE | EResourceReaderNotFoundException
EElfResourceWriterException | EM_MIPS_X | EResourceReaderUnexpectedEndOfStreamException
EElfResourceWriterUnknownClassException | EM_NONE | EResourceReaderWrongFormatException
EElfResourceWriterUnknownMachineException | EM_PPC | EResourceWriterException
EElfResourceWriterUnknownSectionException | EM_PPC64 | EResourceWriterNotFoundException
EExternalResInvalidEndianessException | EM_SPARC | EStringTableIndexOutOfBoundsException
EExternalResourceWriterException | emtaarch64 | EStringTableNameNotAllowedException
EF_IA_64_ABI64 | emtalpha | EStringTableResourceException
EKeyNotFoundException | emtarm | ET_CORE
ELFCLASS32 | emtarmeb | ET_DYN
ELFCLASS64 | emti386 | ET_EXEC
ELFCLASSNONE | emtia64 | ET_HIOS
elfconsts | emtm68k | ET_HIPROC
ELFDATA2LSB | emtmips | ET_LOOS
ELFDATA2MSB | emtmipsel | ET_LOPROC
ELFDATANONE | emtnone | ET_NONE
ELFMAGIC | emtppc | ET_REL
ELFOSABI_ARM | emtppc64 | EV_CURRENT
ELFOSABI_FREEBSD | emtppc64le | EVersionStringTableException
ELFOSABI_LINUX | emtsparc | EV_NONE
ELFOSABI_NONE | emtx86_64 | EXT_CURRENT_VERSION
elfreader | EM_X86_64 | EXT_ENDIAN_BIG
elfwriter | ENameNotAllowedException | EXT_ENDIAN_LITTLE
EM_386 | ENoMoreFreeIDsException | externalreader
EM_68K | EResourceClassAlreadyRegisteredException | EXTERNAL_RESMAGIC
EM_AARCH64 | EResourceDescChangeNotAllowedException | externaltypes
EMachOResourceWriterException | EResourceDescTypeException | externalwriter
EMachOResourceWriterSymbolTableWrongOrderException | EResourceDuplicateException |

F

FAlt | FNoInvert | FVirtKey
FControl | FShift |

G

groupcursorresource groupiconresource groupresource

H

HANDLESECT_IDX HandlesSectName

I

ISOLATIONAWARE_MANIFEST_RESOURCE_ID ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID

M

machoreader | mmtarm | msmarm_v4t
machotypes | mmtarm64 | msmarm_v5tej
machowriter | mmti386 | msmarm_v6
MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID | mmtpowerpc | msmarm_v7
MF_DISCARDABLE | mmtpowerpc64 | msmarm_xscale
MF_MOVEABLE | mmtx86_64 | msmppc64_all
MF_PRELOAD | msm386_all | msmppc_all
MF_PURE | msmaarch64_all | msmx64_all
MINIMUM_RESERVED_MANIFEST_RESOURCE_ID | msmarm_all |

P

PAccelerator | PNList32 | PRelocationInfo
PCoffRelocation | PNList64 | PVerTranslationInfo

R

R_386_32 | R_PPC_ADDR32 | RT_GROUP_CURSOR
R_68K_32 | R_SPARC_32 | RT_GROUP_ICON
R_AARCH64_ABS64 | RSRCSECT_IDX | RT_HTML
R_ALPHA_REFQUAD | RSRCSectName | RT_ICON
R_ARM_ABS32 | RsrcSectName | RT_MANIFEST
resdatastream | RT_ACCELERATOR | RT_MENU
resfactory | RT_ANICURSOR | RT_MESSAGETABLE
resource | RT_ANIICON | RT_PLUGPLAY
resourcetree | RT_BITMAP | RT_RCDATA
resreader | RT_CURSOR | RT_STRING
reswriter | RT_DIALOG | RT_VERSION
R_IA64_DIR64LSB | RT_DLGINCLUDE | RT_VXD
R_MIPS_32 | RT_FONT | R_x86_64_64
R_PPC64_ADDR64 | RT_FONTDIR |

S

SAlreadyRegistered | SHT_RELA | stringtableresource
SDescChangeNotAllowed | SHT_SHLIB | STT_COMMON
SHF_ALLOC | SHT_STRTAB | STT_FILE
SHF_EXECINSTR | SHT_SYMTAB | STT_FUNC
SHF_MASKOS | SIndexOutOfBounds | STT_HIOS
SHF_MASKPROC | SLangIDChangeNotAllowed | STT_HIPROC
SHF_WRITE | SNameNotAllowed | STT_LOOS
SHT_DYNAMIC | SReaderNotFoundExt | STT_LOPROC
SHT_DYNSYM | SReaderNotFoundProbe | STT_NOTYPE
SHT_HASH | SResDuplicate | STT_OBJECT
SHT_HIOS | SResourceNotFound | STT_SECTION
SHT_HIPROC | SResourceNotFoundLang | STT_SPARC_REGISTER
SHT_LOOS | STB_GLOBAL | STT_TLS
SHT_LOPROC | STB_HIOS | SVerStrTableDuplicateKey
SHT_NOBITS | STB_HIPROC | SVerStrTableKeyNotFound
SHT_NOTE | STB_LOCAL | SVerStrTableNameNotAllowed
SHT_NULL | STB_LOOS | SWriterNotFoundExt
SHT_PROGBITS | STB_LOPROC |
SHT_REL | STB_WEAK |

T

TAbstractResource | TGenericResource | TResourceFactory
TAbstractResourceReader | TGroupCachedDataStream | TResourceReaderClass
TAbstractResourceWriter | TGroupCursorResource | TResources
TAccelerator | TGroupIconResource | TResourceStringTable
TAcceleratorsResource | TGroupResource | TResourceTreeNode
TBitmapResource | TLangID | TResourceWriterClass
TCachedDataStream | TLoadCommand | TResResourceReader
TCachedResourceDataStream | TMachHdr | TResResourceWriter
TCachedStreamClass | TMachOMachineType | TRootResTreeNode
TCoffHeader | TMachOResourceReader | TSection32
TCoffMachineType | TMachOResourceWriter | TSection64
TCoffRelocation | TMachoSubMachineType | TSectionName
TCoffRelocations | TMachOSubMachineType386 | TSegmentCommand32
TCoffResourceReader | TMachOSubMachineTypeAarch64 | TSegmentCommand64
TCoffResourceWriter | TMachOSubMachineTypeArm | TSegSectName
TCoffSectionHeader | TMachOSubMachineTypePowerPC | TStringTableResource
TCoffSectionTable | TMachOSubMachineTypePowerPC64 | TSymtabCommand
TCoffStringTable | TMachOSubMachineTypex64 | TUnderlyingStreamType
TCoffSymtableEntry | TNList32 | TVerBlockHeader
TDescType | TNList64 | TVersionFixedInfo
TDfmResourceReader | TRelocationInfo | TVersionResource
TDySymtabCommand | TResDataEntry | TVersionStringFileInfo
TElfMachineType | TResDirEntry | TVersionStringTable
TElfResourceReader | TResDirTable | TVersionVarFileInfo
TElfResourceWriter | TResID | TVerTranslationInfo
TExternalResMagic | TResInfoNode | TWinPEImageResourceReader
TExternalResourceReader | TResName | TXCoff32SectionHeader
TExternalResourceWriter | TResourceClass | TXCoffAuxSymbol32
TExtHeader | TResourceDataStream |
TFileProductVersion | TResourceDesc |

U

usCached usCustom usMemory

V

versionconsts | VFT2_UNKNOWN | VOS_OS232
versionresource | VFT_APP | VOS_OS232_PM32
versiontypes | VFT_DLL | VOS__PM16
VFT2_DRV_COMM | VFT_DRV | VOS__PM32
VFT2_DRV_DISPLAY | VFT_FONT | VOS_UNKNOWN
VFT2_DRV_INSTALLABLE | VFT_STATIC_LIB | VOS__WINDOWS16
VFT2_DRV_KEYBOARD | VFT_UNKNOWN | VOS__WINDOWS32
VFT2_DRV_LANGUAGE | VFT_VXD | VS_FF_DEBUG
VFT2_DRV_MOUSE | VOS__BASE | VS_FFI_FILEFLAGSMASK
VFT2_DRV_NETWORK | VOS_DOS | VS_FF_INFOINFERRED
VFT2_DRV_PRINTER | VOS_DOS_WINDOWS16 | VS_FF_PATCHED
VFT2_DRV_SOUND | VOS_DOS_WINDOWS32 | VS_FF_PRERELEASE
VFT2_DRV_SYSTEM | VOS_NT | VS_FF_PRIVATEBUILD
VFT2_FONT_RASTER | VOS_NT_WINDOWS32 | VS_FF_SPECIALBUILD
VFT2_FONT_TRUETYPE | VOS_OS216 |
VFT2_FONT_VECTOR | VOS_OS216_PM16 |

W

winpeimagereader


Class hierarchy

  • TObject
    • Exception
      • EResourceException (resource)
        • ENoMoreFreeIDsException (resource)
    • Exception
      • EResourceException (resource)
        • EStringTableResourceException (stringtableresource)
          • EStringTableNameNotAllowedException (stringtableresource)
    • Exception
      • EResourceException (resource)
        • EResourceDescChangeNotAllowedException (resource)
    • Exception
      • EResourceException (resource)
        • EResourceDuplicateException (resource)
    • Exception
      • EResourceException (resource)
        • EResourceDescTypeException (resource)
    • Exception
      • EResourceException (resource)
        • EResourceFactoryException (resfactory)
    • Exception
      • EVersionStringTableException (versiontypes)
        • EDuplicateKeyException (versiontypes)
    • Exception
      • EVersionStringTableException (versiontypes)
        • EKeyNotFoundException (versiontypes)
    • Exception
      • EResourceException (resource)
        • EStringTableResourceException (stringtableresource)
    • Exception
      • EResourceException (resource)
        • EResourceFactoryException (resfactory)
          • EResourceClassAlreadyRegisteredException (resfactory)
    • Exception
      • EResourceException (resource)
    • Exception
      • EResourceException (resource)
        • EResourceWriterException (resource)
    • Exception
      • EResourceException (resource)
        • EResourceReaderException (resource)
          • EResourceReaderWrongFormatException (resource)
    • Exception
      • EResourceException (resource)
        • EResourceWriterException (resource)
          • EResourceWriterNotFoundException (resource)
    • Exception
      • EResourceException (resource)
        • EStringTableResourceException (stringtableresource)
          • EStringTableIndexOutOfBoundsException (stringtableresource)
    • Exception
      • EResourceException (resource)
        • EResourceReaderException (resource)
          • EResourceReaderUnexpectedEndOfStreamException (resource)
    • Exception
      • EResourceException (resource)
        • EResourceNotFoundException (resource)
    • Exception
      • EResourceException (resource)
        • EResourceLangIDChangeNotAllowedException (resource)
    • Exception
      • EResourceException (resource)
        • EResourceReaderException (resource)
    • Exception
      • EResourceException (resource)
        • EResourceReaderException (resource)
          • EResourceReaderNotFoundException (resource)
    • Exception
      • EResourceException (resource)
        • EResourceWriterException (resource)
          • EMachOResourceWriterException (machowriter)
            • EMachOResourceWriterUnknownBitSizeException (machowriter)
    • Exception
      • EResourceException (resource)
        • EResourceReaderException (resource)
          • EElfResourceReaderException (elfreader)
            • EElfResourceReaderUnknownVersionException (elfreader)
    • Exception
      • EResourceException (resource)
        • EResourceWriterException (resource)
          • EElfResourceWriterException (elfwriter)
    • Exception
      • EResourceException (resource)
        • EResourceWriterException (resource)
          • EElfResourceWriterException (elfwriter)
            • EElfResourceWriterUnknownClassException (elfwriter)
    • Exception
      • EResourceException (resource)
        • EResourceReaderException (resource)
          • EElfResourceReaderException (elfreader)
            • EElfResourceReaderNoStringTableException (elfreader)
    • Exception
      • EVersionStringTableException (versiontypes)
    • Exception
      • EResourceException (resource)
        • EResourceReaderException (resource)
          • EElfResourceReaderException (elfreader)
    • Exception
      • EResourceException (resource)
        • EResourceReaderException (resource)
          • EElfResourceReaderException (elfreader)
            • EElfResourceReaderNoSectionsException (elfreader)
    • Exception
      • EResourceException (resource)
        • EResourceReaderException (resource)
          • EElfResourceReaderException (elfreader)
            • EElfResourceReaderUnknownClassException (elfreader)
    • Exception
      • EResourceException (resource)
        • EResourceWriterException (resource)
          • EExternalResourceWriterException (externalwriter)
    • Exception
      • EVersionStringTableException (versiontypes)
        • ENameNotAllowedException (versiontypes)
    • Exception
      • EResourceException (resource)
        • EResourceWriterException (resource)
          • EMachOResourceWriterException (machowriter)
    • Exception
      • EResourceException (resource)
        • EResourceWriterException (resource)
          • EMachOResourceWriterException (machowriter)
            • EMachOResourceWriterSymbolTableWrongOrderException (machowriter)
    • Exception
      • EResourceException (resource)
        • EResourceWriterException (resource)
          • EElfResourceWriterException (elfwriter)
            • EElfResourceWriterUnknownSectionException (elfwriter)
    • Exception
      • EResourceException (resource)
        • EResourceWriterException (resource)
          • EElfResourceWriterException (elfwriter)
            • EElfResourceWriterUnknownMachineException (elfwriter)
    • Exception
      • EResourceException (resource)
        • EResourceWriterException (resource)
          • EExternalResourceWriterException (externalwriter)
            • EExternalResInvalidEndianessException (externalwriter)
    • TAbstractResource (resource)
      • TAcceleratorsResource (acceleratorsresource)
      • TBitmapResource (bitmapresource)
      • TGenericResource (resource)
      • TGroupResource (groupresource)
        • TGroupCursorResource (groupcursorresource)
        • TGroupIconResource (groupiconresource)
      • TStringTableResource (stringtableresource)
      • TVersionResource (versionresource)
    • TAbstractResourceReader (resource)
      • TCoffResourceReader (coffreader)
      • TDfmResourceReader (dfmreader)
      • TElfResourceReader (elfreader)
      • TExternalResourceReader (externalreader)
      • TMachOResourceReader (machoreader)
      • TResResourceReader (resreader)
      • TWinPEImageResourceReader (winpeimagereader)
    • TAbstractResourceWriter (resource)
      • TCoffResourceWriter (coffwriter)
      • TElfResourceWriter (elfwriter)
      • TExternalResourceWriter (externalwriter)
      • TMachOResourceWriter (machowriter)
      • TResResourceWriter (reswriter)
    • TCoffRelocations (coffwriter)
    • TPersistent
      • TStrings
        • TStringList
          • TCoffStringTable (coffwriter)
    • TResourceDesc (resource)
    • TResourceFactory (resfactory)
    • TResources (resource)
    • TResourceStringTable (coffwriter)
    • TResourceTreeNode (resourcetree)
      • TRootResTreeNode (resourcetree)
    • TStream
      • TCachedDataStream (resdatastream)
    • TStream
      • TCachedDataStream (resdatastream)
        • TGroupCachedDataStream (groupresource)
    • TStream
      • TResourceDataStream (resdatastream)
    • TStream
      • TCachedDataStream (resdatastream)
        • TCachedResourceDataStream (resdatastream)
    • TVersionFixedInfo (versiontypes)
    • TVersionStringFileInfo (versiontypes)
    • TVersionStringTable (versiontypes)
    • TVersionVarFileInfo (versiontypes)


Introduction

This package contains a library to easily work with Microsoft Windows resources in a cross-platform way.

Classes are provided to create, load and write resources from/to different file formats in a transparent way, and to handle most common resource types without having to deal with their internal format.

Whenever possible data caching is performed, helped by a copy-on-write mechanism. This improves performance especially when converting big resources from a file format to another.

Since fcl-res architecture is extensible, it's always possible to extend the library with custom resource types or new file readers/writers.

Please note that resources aren't limited to Windows platform: Free Pascal can use them also on ELF and Mach-O targets. Moreover, this library can be useful for cross-compilation purposes even on other targets.

It is highly recommended to read Basic Usage topic if you are approaching this library for the first time.


FAlt

The accelerator is activated only if ALT key is pressed

Declaration

Source position: acceleratorsresource.pp line 30

const FAlt = 16;

Description

This flag is valid only if the key is a virtual key.

See also

TAccelerator

A single accelerator entry


FControl

The accelerator is activated only if CTRL key is pressed

Declaration

Source position: acceleratorsresource.pp line 29

const FControl = 8;

Description

This flag is valid only if the key is a virtual key.

See also

TAccelerator

A single accelerator entry


FNoInvert

Obsolete

Declaration

Source position: acceleratorsresource.pp line 27

const FNoInvert = 2;

Description

This flag is obsolete and is provided only for compatibility with 16 bit Windows.

See also

TAccelerator

A single accelerator entry


FShift

The accelerator is activated only if SHIFT key is pressed

Declaration

Source position: acceleratorsresource.pp line 28

const FShift = 4;

Description

This flag is valid only if the key is a virtual key.

See also

TAccelerator

A single accelerator entry


FVirtKey

The accelerator key is a virtual key code

Declaration

Source position: acceleratorsresource.pp line 26

const FVirtKey = 1;

Description

When this flag is set, the accelerator key is a virtual key code. Otherwise, it is a ASCII character

See also

TAccelerator

A single accelerator entry


Reference for unit 'acceleratorsresource'

Contains an accelerator table resource type

uses

  Classes,

  sysutils,

  resource;

Contains base classes for resource handling

Overview

This unit contains TAcceleratorsResource, a TAbstractResource descendant specialized in handling resource of type RT_ACCELERATOR.

Adding this unit to a program's uses clause registers class TAcceleratorsResource for type RT_ACCELERATOR with TResourceFactory.


Reference for unit 'acceleratorsresource': Constants

FAlt | The accelerator is activated only if ALT key is pressed
FControl | The accelerator is activated only if CTRL key is pressed
FNoInvert | Obsolete
FShift | The accelerator is activated only if SHIFT key is pressed
FVirtKey | The accelerator key is a virtual key code


Reference for unit 'acceleratorsresource': Types

PAccelerator | A pointer to a TAccelerator record
TAccelerator | A single accelerator entry


Reference for unit 'acceleratorsresource': Classes

TAcceleratorsResource

Accelerator table resource type


Index of all identifiers in unit 'acceleratorsresource'

F P T

F

FAlt | FNoInvert | FVirtKey
FControl | FShift |

P

PAccelerator

T

TAccelerator TAcceleratorsResource


PAccelerator

A pointer to a TAccelerator record

Declaration

Source position: acceleratorsresource.pp line 39

type PAccelerator = ^TAccelerator;

See also

TAccelerator

A single accelerator entry


TAccelerator

A single accelerator entry

Declaration

Source position: acceleratorsresource.pp line 33

type TAccelerator = packed record
Flags: Word; | A set of flags that can be combined to specify an accelerator's characteristics.
Ansi: Word; | An ANSI character value or a virtual-key code
Id: Word; | An integer value that identifies the accelerator
padding: Word; | Used to keep record size aligned on a DWORD boundary
end;

Description

A single accelerator entry in the accelerator table resource.

The key associated with the accelerator is represented by Ansi field: it can be a character or a virtual-key code (in the latter case, FVirtKey flag must be active).

The accelerator is identified by the value of id field.

Flags is a combination of the following values:

  • FVirtKey
  • FShift
  • FNoInvert
  • FControl
  • FAlt


Reference for unit 'bitmapresource'

Contains a bitmap resource type

uses

  Classes,

  sysutils,

  resource;

Contains base classes for resource handling

Overview

This unit contains TBitmapResource, a TAbstractResource descendant specialized in handling resource of type RT_BITMAP.

Adding this unit to a program's uses clause registers class TBitmapResource for type RT_BITMAP with TResourceFactory.


Reference for unit 'bitmapresource': Classes

TBitmapResource

Bitmap resource type


Index of all identifiers in unit 'bitmapresource'

T

T

TBitmapResource


Reference for unit 'coffreader'

Contains a resource reader for COFF files

uses
Classes,
sysutils,
resource, | Contains base classes for resource handling
resourcetree, | Implements an ordered tree of resources
cofftypes; | Contains types used by COFF resource reader and writer

Overview

This unit contains TCoffResourceReader, a TAbstractResourceReader descendant that is able to read COFF object files containing resources.

Adding this unit to a program's uses clause registers class TCoffResourceReader with TResources.


Reference for unit 'coffreader': Classes

TCoffResourceReader

COFF resource reader


Index of all identifiers in unit 'coffreader'

T

T

TCoffResourceReader


Reference for unit 'cofftypes'

Contains types used by COFF resource reader and writer

Overview

These types are used internally by TCoffResourceWriter and TCoffResourceReader.

The only type of interest for the user is TCoffMachineType.


Reference for unit 'cofftypes': Constants

RSRCSectName


Reference for unit 'cofftypes': Types

TCoffHeader

TCoffMachineType

Enumeration for COFF machine type

TCoffSectionHeader

TCoffSectionTable

TCoffSymtableEntry

TResDataEntry

TResDirEntry

TResDirTable

TSectionName

TXCoff32SectionHeader

TXCoffAuxSymbol32


Index of all identifiers in unit 'cofftypes'

C R T

C

cmtarm | cmtppc32aix | cmtx8664
cmti386 | cmtppc64aix |

R

RSRCSectName

T

TCoffHeader | TCoffSymtableEntry | TSectionName
TCoffMachineType | TResDataEntry | TXCoff32SectionHeader
TCoffSectionHeader | TResDirEntry | TXCoffAuxSymbol32
TCoffSectionTable | TResDirTable |


RSRCSectName

Declaration

Source position: cofftypes.pp line 29

const RSRCSectName: TSectionName = '.rsrc' + #0 + #0 + #0;


TCoffHeader

Declaration

Source position: cofftypes.pp line 32

type TCoffHeader = packed record

  Machine: Word;

  NumSects: Word;

  TimeStamp: LongWord;

  SymTablePtr: LongWord;

  SymNum: LongWord;

  OptHdrSize: Word;

  Characteristics: Word;

end;


TCoffMachineType

Enumeration for COFF machine type

Declaration

Source position: cofftypes.pp line 23

type TCoffMachineType = (
cmti386, | Intel i386
cmtarm, | ARM
cmtx8664, | AMD x86_64
cmtppc32aix,
cmtppc64aix
);

Description

This enumeration specifies the COFF machine type.

It is used by TCoffResourceWriter to specify the machine type of the generated object file and by TCoffResourceReader to read the machine type of the object file that has been read.

See also

TCoffResourceWriter.MachineType | The machine type of the object file
TCoffResourceReader.MachineType | The machine type of the object file


TCoffSectionHeader

Declaration

Source position: cofftypes.pp line 42

type TCoffSectionHeader = packed record

  Name: TSectionName;

  VirtualSize: LongWord;

  VirtualAddress: LongWord;

  SizeOfRawData: LongWord;

  PointerToRawData: LongWord;

  PointerToRelocations: LongWord;

  PointerToLineNumbers: LongWord;

  NumberOfRelocations: Word;

  NumberOfLineNumbers: Word;

  Characteristics: LongWord;

end;


TCoffSectionTable

Declaration

Source position: cofftypes.pp line 88

type TCoffSectionTable = TCoffSymtableEntry;


TCoffSymtableEntry

Declaration

Source position: cofftypes.pp line 68

type TCoffSymtableEntry = packed record

  case Byte of

    1: (

        Name: TSectionName;

        Value: LongWord;

        SectionNumber: Word;

        _type: Word;

        StorageClass: Byte;

        NumAuxSymbol: Byte;

      );

    2: (

        n_name: TSectionName;

        n_value: LongWord;

        n_scnum: Word;

        n_type: Word;

        n_sclass: Byte;

        n_numaux: Byte;

      );

end;


TResDataEntry

Declaration

Source position: cofftypes.pp line 114

type TResDataEntry = packed record

  DataRVA: LongWord;

  Size: LongWord;

  Codepage: LongWord;

  Reserved: LongWord;

end;


TResDirEntry

Declaration

Source position: cofftypes.pp line 109

type TResDirEntry = packed record

  NameID: LongWord;

  DataSubDirRVA: LongWord;

end;


TResDirTable

Declaration

Source position: cofftypes.pp line 100

type TResDirTable = packed record

  Characteristics: LongWord;

  TimeStamp: LongWord;

  VerMajor: Word;

  VerMinor: Word;

  NamedEntriesCount: Word;

  IDEntriesCount: Word;

end;


TSectionName

Declaration

Source position: cofftypes.pp line 26

type TSectionName = array [0..7] of Char;


TXCoff32SectionHeader

Declaration

Source position: cofftypes.pp line 55

type TXCoff32SectionHeader = packed record

  s_name: TSectionName;

  s_paddr: LongWord;

  s_vaddr: LongWord;

  s_size: LongWord;

  s_scnptr: LongWord;

  s_relptr: LongWord;

  s_lnnoptr: LongWord;

  s_nreloc: Word;

  s_nlnno: Word;

  s_flags: LongWord;

end;


TXCoffAuxSymbol32

Declaration

Source position: cofftypes.pp line 90

type TXCoffAuxSymbol32 = packed record

  x_scnlen: LongWord;

  x_parmhash: LongWord;

  x_snhash: Word;

  x_smtyp: Byte;

  x_smclas: Byte;

  x_stab: LongWord;

  x_snstab: Word;

end;


Reference for unit 'coffwriter'

Contains a resource writer for COFF files

uses
Classes,
sysutils,
resource, | Contains base classes for resource handling
resourcetree, | Implements an ordered tree of resources
cofftypes; | Contains types used by COFF resource reader and writer

Overview

This unit contains TCoffResourceWriter, a TAbstractResourceWriter descendant that is able to write COFF object files containing resources.

Adding this unit to a program's uses clause registers class TCoffResourceWriter with TResources.


Reference for unit 'coffwriter': Types

PCoffRelocation | Pointer to a COFF relocation
TCoffRelocation | COFF relocation type


Reference for unit 'coffwriter': Classes

TCoffRelocations | COFF relocation table
TCoffResourceWriter | COFF resource writer
TCoffStringTable
TResourceStringTable | COFF resource string table


Index of all identifiers in unit 'coffwriter'

P T

P

PCoffRelocation

T

TCoffRelocation | TCoffResourceWriter | TResourceStringTable
TCoffRelocations | TCoffStringTable |


PCoffRelocation

Pointer to a COFF relocation

Declaration

Source position: coffwriter.pp line 67

type PCoffRelocation = ^TCoffRelocation;

Description

This type is used internally by TCoffResourceWriter.


TCoffRelocation

COFF relocation type

Declaration

Source position: coffwriter.pp line 62

type TCoffRelocation = packed record

  VirtualAddress: LongWord;

  SymTableIndex: LongWord;

  _type: Word;

end;

Description

This record is used internally by TCoffResourceWriter.


Reference for unit 'dfmreader'

Contains a resource reader for DFM files

uses

  Classes,

  sysutils,

  resource;

Contains base classes for resource handling

Overview

This unit contains TDfmResourceReader, a TAbstractResourceReader descendant used to compile DFM files to resources.

Adding this unit to a program's uses clause registers class TDfmResourceReader with TResources.


Reference for unit 'dfmreader': Classes

TDfmResourceReader

DFM resource reader


Index of all identifiers in unit 'dfmreader'

T

T

TDfmResourceReader


EF_IA_64_ABI64

Declaration

Source position: elfconsts.pp line 78

const EF_IA_64_ABI64 = $10;


ELFCLASS32

Declaration

Source position: elfconsts.pp line 31

const ELFCLASS32 = 1;


ELFCLASS64

Declaration

Source position: elfconsts.pp line 32

const ELFCLASS64 = 2;


ELFCLASSNONE

Declaration

Source position: elfconsts.pp line 30

const ELFCLASSNONE = 0;


ELFDATA2LSB

Declaration

Source position: elfconsts.pp line 36

const ELFDATA2LSB = 1;


ELFDATA2MSB

Declaration

Source position: elfconsts.pp line 37

const ELFDATA2MSB = 2;


ELFDATANONE

Declaration

Source position: elfconsts.pp line 35

const ELFDATANONE = 0;


ELFMAGIC

Declaration

Source position: elfconsts.pp line 27

const ELFMAGIC = chr($7f) + 'ELF';


ELFOSABI_ARM

Declaration

Source position: elfconsts.pp line 47

const ELFOSABI_ARM = 97;


ELFOSABI_FREEBSD

Declaration

Source position: elfconsts.pp line 46

const ELFOSABI_FREEBSD = 9;


ELFOSABI_LINUX

Declaration

Source position: elfconsts.pp line 45

const ELFOSABI_LINUX = 3;


ELFOSABI_NONE

Declaration

Source position: elfconsts.pp line 44

const ELFOSABI_NONE = 0;


EM_68K

Declaration

Source position: elfconsts.pp line 64

const EM_68K = 4;


EM_386

Declaration

Source position: elfconsts.pp line 63

const EM_386 = 3;


EM_AARCH64

Declaration

Source position: elfconsts.pp line 74

const EM_AARCH64 = 183;


EM_ALPHA

Declaration

Source position: elfconsts.pp line 75

const EM_ALPHA = $9026;


EM_ARM

Declaration

Source position: elfconsts.pp line 69

const EM_ARM = 40;


EM_IA_64

Declaration

Source position: elfconsts.pp line 71

const EM_IA_64 = 50;


EM_MIPS

Declaration

Source position: elfconsts.pp line 65

const EM_MIPS = 8;


EM_MIPS_RS3_LE

Declaration

Source position: elfconsts.pp line 66

const EM_MIPS_RS3_LE = 10;


EM_MIPS_X

Declaration

Source position: elfconsts.pp line 72

const EM_MIPS_X = 51;


EM_NONE

Declaration

Source position: elfconsts.pp line 61

const EM_NONE = 0;


EM_PPC

Declaration

Source position: elfconsts.pp line 67

const EM_PPC = 20;


EM_PPC64

Declaration

Source position: elfconsts.pp line 68

const EM_PPC64 = 21;


EM_SPARC

Declaration

Source position: elfconsts.pp line 62

const EM_SPARC = 2;


EM_X86_64

Declaration

Source position: elfconsts.pp line 73

const EM_X86_64 = 62;


ET_CORE

Declaration

Source position: elfconsts.pp line 54

const ET_CORE = 4;


ET_DYN

Declaration

Source position: elfconsts.pp line 53

const ET_DYN = 3;


ET_EXEC

Declaration

Source position: elfconsts.pp line 52

const ET_EXEC = 2;


ET_HIOS

Declaration

Source position: elfconsts.pp line 56

const ET_HIOS = $feff;


ET_HIPROC

Declaration

Source position: elfconsts.pp line 58

const ET_HIPROC = $ffff;


ET_LOOS

Declaration

Source position: elfconsts.pp line 55

const ET_LOOS = $fe00;


ET_LOPROC

Declaration

Source position: elfconsts.pp line 57

const ET_LOPROC = $ff00;


ET_NONE

Declaration

Source position: elfconsts.pp line 50

const ET_NONE = 0;


ET_REL

Declaration

Source position: elfconsts.pp line 51

const ET_REL = 1;


EV_CURRENT

Declaration

Source position: elfconsts.pp line 41

const EV_CURRENT = 1;


EV_NONE

Declaration

Source position: elfconsts.pp line 40

const EV_NONE = 0;


HANDLESECT_IDX

Declaration

Source position: elfconsts.pp line 147

const HANDLESECT_IDX = 2;


HandlesSectName

Declaration

Source position: elfconsts.pp line 144

const HandlesSectName = 'fpc.reshandles';


Reference for unit 'elfconsts'

Contains constants used by ELF reader and writer

Overview

These constants are used internally by TElfResourceWriter and TElfResourceReader.

The only type of interest for the user is TElfMachineType.


Reference for unit 'elfconsts': Constants

EF_IA_64_ABI64

ELFCLASS32

ELFCLASS64

ELFCLASSNONE

ELFDATA2LSB

ELFDATA2MSB

ELFDATANONE

ELFMAGIC

ELFOSABI_ARM

ELFOSABI_FREEBSD

ELFOSABI_LINUX

ELFOSABI_NONE

EM_386

EM_68K

EM_AARCH64

EM_ALPHA

EM_ARM

EM_IA_64

EM_MIPS

EM_MIPS_RS3_LE

EM_MIPS_X

EM_NONE

EM_PPC

EM_PPC64

EM_SPARC

EM_X86_64

ET_CORE

ET_DYN

ET_EXEC

ET_HIOS

ET_HIPROC

ET_LOOS

ET_LOPROC

ET_NONE

ET_REL

EV_CURRENT

EV_NONE

HANDLESECT_IDX

HandlesSectName

RsrcSectName

RSRCSECT_IDX

R_386_32

R_68K_32

R_AARCH64_ABS64

R_ALPHA_REFQUAD

R_ARM_ABS32

R_IA64_DIR64LSB

R_MIPS_32

R_PPC64_ADDR64

R_PPC_ADDR32

R_SPARC_32

R_x86_64_64

SHF_ALLOC

SHF_EXECINSTR

SHF_MASKOS

SHF_MASKPROC

SHF_WRITE

SHT_DYNAMIC

SHT_DYNSYM

SHT_HASH

SHT_HIOS

SHT_HIPROC

SHT_LOOS

SHT_LOPROC

SHT_NOBITS

SHT_NOTE

SHT_NULL

SHT_PROGBITS

SHT_REL

SHT_RELA

SHT_SHLIB

SHT_STRTAB

SHT_SYMTAB

STB_GLOBAL

STB_HIOS

STB_HIPROC

STB_LOCAL

STB_LOOS

STB_LOPROC

STB_WEAK

STT_COMMON

STT_FILE

STT_FUNC

STT_HIOS

STT_HIPROC

STT_LOOS

STT_LOPROC

STT_NOTYPE

STT_OBJECT

STT_SECTION

STT_SPARC_REGISTER

STT_TLS


Reference for unit 'elfconsts': Types

TElfMachineType

Enumeration for ELF machine type


Index of all identifiers in unit 'elfconsts'

E H R S T

E

EF_IA_64_ABI64 | EM_MIPS | emtppc64
ELFCLASS32 | EM_MIPS_RS3_LE | emtppc64le
ELFCLASS64 | EM_MIPS_X | emtsparc
ELFCLASSNONE | EM_NONE | emtx86_64
ELFDATA2LSB | EM_PPC | EM_X86_64
ELFDATA2MSB | EM_PPC64 | ET_CORE
ELFDATANONE | EM_SPARC | ET_DYN
ELFMAGIC | emtaarch64 | ET_EXEC
ELFOSABI_ARM | emtalpha | ET_HIOS
ELFOSABI_FREEBSD | emtarm | ET_HIPROC
ELFOSABI_LINUX | emtarmeb | ET_LOOS
ELFOSABI_NONE | emti386 | ET_LOPROC
EM_386 | emtia64 | ET_NONE
EM_68K | emtm68k | ET_REL
EM_AARCH64 | emtmips | EV_CURRENT
EM_ALPHA | emtmipsel | EV_NONE
EM_ARM | emtnone |
EM_IA_64 | emtppc |

H

HANDLESECT_IDX HandlesSectName

R

R_386_32 | R_IA64_DIR64LSB | RSRCSECT_IDX
R_68K_32 | R_MIPS_32 | RsrcSectName
R_AARCH64_ABS64 | R_PPC64_ADDR64 | R_x86_64_64
R_ALPHA_REFQUAD | R_PPC_ADDR32 |
R_ARM_ABS32 | R_SPARC_32 |

S

SHF_ALLOC | SHT_NULL | STT_COMMON
SHF_EXECINSTR | SHT_PROGBITS | STT_FILE
SHF_MASKOS | SHT_REL | STT_FUNC
SHF_MASKPROC | SHT_RELA | STT_HIOS
SHF_WRITE | SHT_SHLIB | STT_HIPROC
SHT_DYNAMIC | SHT_STRTAB | STT_LOOS
SHT_DYNSYM | SHT_SYMTAB | STT_LOPROC
SHT_HASH | STB_GLOBAL | STT_NOTYPE
SHT_HIOS | STB_HIOS | STT_OBJECT
SHT_HIPROC | STB_HIPROC | STT_SECTION
SHT_LOOS | STB_LOCAL | STT_SPARC_REGISTER
SHT_LOPROC | STB_LOOS | STT_TLS
SHT_NOBITS | STB_LOPROC |
SHT_NOTE | STB_WEAK |

T

TElfMachineType


R_68K_32

Declaration

Source position: elfconsts.pp line 135

const R_68K_32 = 1;


R_386_32

Declaration

Source position: elfconsts.pp line 129

const R_386_32 = 1;


R_AARCH64_ABS64

Declaration

Source position: elfconsts.pp line 134

const R_AARCH64_ABS64 = 257;


R_ALPHA_REFQUAD

Declaration

Source position: elfconsts.pp line 137

const R_ALPHA_REFQUAD = 2;


R_ARM_ABS32

Declaration

Source position: elfconsts.pp line 133

const R_ARM_ABS32 = 2;


R_IA64_DIR64LSB

Declaration

Source position: elfconsts.pp line 138

const R_IA64_DIR64LSB = $27;


R_MIPS_32

Declaration

Source position: elfconsts.pp line 139

const R_MIPS_32 = 2;


R_PPC64_ADDR64

Declaration

Source position: elfconsts.pp line 132

const R_PPC64_ADDR64 = 38;


R_PPC_ADDR32

Declaration

Source position: elfconsts.pp line 131

const R_PPC_ADDR32 = 1;


R_SPARC_32

Declaration

Source position: elfconsts.pp line 136

const R_SPARC_32 = 3;


R_x86_64_64

Declaration

Source position: elfconsts.pp line 130

const R_x86_64_64 = 1;


RSRCSECT_IDX

Declaration

Source position: elfconsts.pp line 146

const RSRCSECT_IDX = 1;


RsrcSectName

Declaration

Source position: elfconsts.pp line 143

const RsrcSectName = 'fpc.resources';


SHF_ALLOC

Declaration

Source position: elfconsts.pp line 100

const SHF_ALLOC = 2;


SHF_EXECINSTR

Declaration

Source position: elfconsts.pp line 101

const SHF_EXECINSTR = 4;


SHF_MASKOS

Declaration

Source position: elfconsts.pp line 102

const SHF_MASKOS = $0f000000;


SHF_MASKPROC

Declaration

Source position: elfconsts.pp line 103

const SHF_MASKPROC = $f0000000;


SHF_WRITE

Declaration

Source position: elfconsts.pp line 99

const SHF_WRITE = 1;


SHT_DYNAMIC

Declaration

Source position: elfconsts.pp line 87

const SHT_DYNAMIC = 6;


SHT_DYNSYM

Declaration

Source position: elfconsts.pp line 92

const SHT_DYNSYM = 11;


SHT_HASH

Declaration

Source position: elfconsts.pp line 86

const SHT_HASH = 5;


SHT_HIOS

Declaration

Source position: elfconsts.pp line 96

const SHT_HIOS = $ffffffff;


SHT_HIPROC

Declaration

Source position: elfconsts.pp line 94

const SHT_HIPROC = $7fffffff;


SHT_LOOS

Declaration

Source position: elfconsts.pp line 95

const SHT_LOOS = $80000000;


SHT_LOPROC

Declaration

Source position: elfconsts.pp line 93

const SHT_LOPROC = $70000000;


SHT_NOBITS

Declaration

Source position: elfconsts.pp line 89

const SHT_NOBITS = 8;


SHT_NOTE

Declaration

Source position: elfconsts.pp line 88

const SHT_NOTE = 7;


SHT_NULL

Declaration

Source position: elfconsts.pp line 81

const SHT_NULL = 0;


SHT_PROGBITS

Declaration

Source position: elfconsts.pp line 82

const SHT_PROGBITS = 1;


SHT_REL

Declaration

Source position: elfconsts.pp line 90

const SHT_REL = 9;


SHT_RELA

Declaration

Source position: elfconsts.pp line 85

const SHT_RELA = 4;


SHT_SHLIB

Declaration

Source position: elfconsts.pp line 91

const SHT_SHLIB = 10;


SHT_STRTAB

Declaration

Source position: elfconsts.pp line 84

const SHT_STRTAB = 3;


SHT_SYMTAB

Declaration

Source position: elfconsts.pp line 83

const SHT_SYMTAB = 2;


STB_GLOBAL

Declaration

Source position: elfconsts.pp line 107

const STB_GLOBAL = 1;


STB_HIOS

Declaration

Source position: elfconsts.pp line 110

const STB_HIOS = 12;


STB_HIPROC

Declaration

Source position: elfconsts.pp line 112

const STB_HIPROC = 15;


STB_LOCAL

Declaration

Source position: elfconsts.pp line 106

const STB_LOCAL = 0;


STB_LOOS

Declaration

Source position: elfconsts.pp line 109

const STB_LOOS = 10;


STB_LOPROC

Declaration

Source position: elfconsts.pp line 111

const STB_LOPROC = 13;


STB_WEAK

Declaration

Source position: elfconsts.pp line 108

const STB_WEAK = 2;


STT_COMMON

Declaration

Source position: elfconsts.pp line 120

const STT_COMMON = 5;


STT_FILE

Declaration

Source position: elfconsts.pp line 119

const STT_FILE = 4;


STT_FUNC

Declaration

Source position: elfconsts.pp line 117

const STT_FUNC = 2;


STT_HIOS

Declaration

Source position: elfconsts.pp line 123

const STT_HIOS = 12;


STT_HIPROC

Declaration

Source position: elfconsts.pp line 126

const STT_HIPROC = 15;


STT_LOOS

Declaration

Source position: elfconsts.pp line 122

const STT_LOOS = 10;


STT_LOPROC

Declaration

Source position: elfconsts.pp line 124

const STT_LOPROC = 13;


STT_NOTYPE

Declaration

Source position: elfconsts.pp line 115

const STT_NOTYPE = 0;


STT_OBJECT

Declaration

Source position: elfconsts.pp line 116

const STT_OBJECT = 1;


STT_SECTION

Declaration

Source position: elfconsts.pp line 118

const STT_SECTION = 3;


STT_SPARC_REGISTER

Declaration

Source position: elfconsts.pp line 125

const STT_SPARC_REGISTER = 13;


STT_TLS

Declaration

Source position: elfconsts.pp line 121

const STT_TLS = 6;


TElfMachineType

Enumeration for ELF machine type

Declaration

Source position: elfconsts.pp line 23

type TElfMachineType = (
emtnone, | Invalid machine type
emtsparc, | Sparc machine type
emti386, | Intel 386 machine type
emtm68k, | Motorola 68000 machine type
emtppc, | PowerPC machine type
emtppc64, | PowerPC 64 machine type
emtarm, | ARM machine type
emtarmeb, | ARM Big Endian machine type
emtia64, | Intel IA-64 machine type
emtx86_64, | AMD x86_64 machine type
emtalpha, | DEC Alpha machine type
emtmips,
emtmipsel,
emtppc64le,
emtaarch64
);

Description

This enumeration specifies the ELF machine type.

It is used by TElfResourceWriter to specify the machine type of the generated object file and by TElfResourceReader to read the machine type of the object file that has been read.

See also

TElfResourceWriter.MachineType | The machine type of the object file
TElfResourceReader.MachineType | The machine type of the object file


Reference for unit 'elfreader'

Contains a resource reader for ELF files

uses
Classes,
sysutils,
resource, | Contains base classes for resource handling
elfconsts, | Contains constants used by ELF reader and writer
elftypes;

Overview

This unit contains TElfResourceReader, a TAbstractResourceReader descendant that is able to read ELF object files containing resources.

Adding this unit to a program's uses clause registers class TElfResourceReader with TResources.


Reference for unit 'elfreader': Classes

EElfResourceReaderException | Base class for elf resource reader-related exceptions
EElfResourceReaderNoSectionsException | No section headers error
EElfResourceReaderNoStringTableException | No string table error
EElfResourceReaderUnknownClassException | Unknown ELF class error
EElfResourceReaderUnknownVersionException | Unknown ELF version error
TElfResourceReader | ELF resource reader


Index of all identifiers in unit 'elfreader'

E T

E

EElfResourceReaderException | EElfResourceReaderNoStringTableException | EElfResourceReaderUnknownVersionException
EElfResourceReaderNoSectionsException | EElfResourceReaderUnknownClassException |

T

TElfResourceReader


Reference for unit 'elfwriter'

Contains a resource writer for ELF files

uses
Classes,
sysutils,
resource, | Contains base classes for resource handling
elfconsts, | Contains constants used by ELF reader and writer
elftypes;

Overview

This unit contains TElfResourceWriter, a TAbstractResourceWriter descendant that is able to write ELF object files containing resources.

Adding this unit to a program's uses clause registers class TElfResourceWriter with TResources.


Reference for unit 'elfwriter': Classes

EElfResourceWriterException | Base class for elf resource writer-related exceptions
EElfResourceWriterUnknownClassException | Internal error
EElfResourceWriterUnknownMachineException | Unknown machine type error
EElfResourceWriterUnknownSectionException | Internal error
TElfResourceWriter | ELF resource writer


Index of all identifiers in unit 'elfwriter'

E T

E

EElfResourceWriterException | EElfResourceWriterUnknownMachineException
EElfResourceWriterUnknownClassException | EElfResourceWriterUnknownSectionException

T

TElfResourceWriter


Reference for unit 'externalreader'

Contains a resource reader for external resource files

uses
Classes,
sysutils,
resource, | Contains base classes for resource handling
resourcetree, | Implements an ordered tree of resources
externaltypes; | Contains types and constants used by external resource reader and writer

Overview

This unit contains TExternalResourceReader, a TAbstractResourceReader descendant that is able to read standalone resource files in a Free Pascal-specific format.

Adding this unit to a program's uses clause registers class TExternalResourceReader with TResources.

See also

Free Pascal external resource file format description


Reference for unit 'externalreader': Classes

TExternalResourceReader

External file resource reader


Index of all identifiers in unit 'externalreader'

T

T

TExternalResourceReader


Description of external resource file format

Introduction

An external resource file (.fpcres extension) provides resource support for those systems where a resource format suitable to be embedded in an object file isn't available.

The file format is designed in a way similar to other internal resource formats. The file is opened at program startup and is mapped in the program address space. Offsets in the file are easily converted to pointers at runtime since those offsets represent a displacement from a base address (the starting address where the file is mapped). Differences from an internal file format hence lie in the fact that resources aren't mapped in the program address space by the program loader but by Free Pascal RTL, and data must be accessed with a displacement mechanism instead of absolute pointers.

For internal resources details, see Format of resources in object files

File layout

An external resource file consists of these parts:

  • The initial header, containing various file information
  • The resource tree, in the form of nodes
  • The string table, which can be optional
  • The resource data

The header is made up by initial header, resource tree and string table (if present).

Conventions

In this document, data sizes are specified with pascal-style data types. They are the following:

Name | Meaning
byte | Unsigned 8 bit integer.
longword | Unsigned 32 bit integer.
qword | Unsigned 64 bit integer.

Byte order used in the file is specified in the initial header.

All data structures in the file must be aligned on qword boundaries.

The initial header

An external resource file starts with this header:

Name | Offset | Length | Description
magic | 0 | 6 | Six ASCII characters that form the string FPCRES
version | 6 | byte | File format version. Currently it is 1.
endianess | 7 | byte | Byte order. 1 for big endian, 2 for little endian
count | 8 | longword | Number of resources in the file
nodesize | 12 | longword | Size of header up to the string table, excluded
hdrsize | 16 | longword | Full size of header (up to the string table, included)
reserved | 20 | 12 | Must be zero

Note that byte order of the file can be read in the endianess field of the header. All data fields longer than a byte are written with the byte order specified in endianess.

If no resource name or type is identified by strings, string table is optional. When this is the case, nodesize and hdrsize have the same value.

The resource tree

Immediately following the initial header, the resource tree comes. It is made up by nodes that represent resource types, names and language ids.

Data is organized so that resource information (type, name and language id) is represented by a tree: root node contains resource types, that in turn contain resource names, which contain language ids, which describe resource data.

Given a node, its sub-nodes are ordered as follows:

  • First the "named" nodes (nodes that use a string as identifier) come, then the id ones (nodes that use an integer as identifier).
  • Named nodes are alphabetically sorted, in ascending order.
  • Id nodes are sorted in ascending order.

In the file, all sub-nodes of a node are written in the order described above. Then, all sub-nodes of the first sub-node are written, and so on.

Example:

There are three resources:

  1. a BITMAP resource with name MYBITMAP and language id $0409
  2. a BITMAP resource with name 1 and language id 0
  3. a resource with type MYTYPE and name 1 and language id 0

Nodes are laid out this way (note that BITMAP resources have type 2):

root | MYTYPE 2 | 1 | 0 | MYBITMAP 1 | $0409 | 0

That is, types (MYTYPE is a string, so it comes before 2 which is BITMAP), then names for MYTYPE (1), then language id for resource 3 (0), then names for BITMAP (MYBITMAP and 1), then language id for resource 1 ($0409), then language id for resource 2 (0).

Node format

Name | Offset | Length | Description
nameid | 0 | longword | name offset, integer id or language id
ncount | 4 | longword | named sub-nodes count
idcountsize | 8 | longword | id sub-nodes count or resource size
subptr | 12 | longword | offset to first sub-node

Note that all offset are always relative to the beginning of the file.

If the node is identified by a string, nameid is an offset to the null-terminated string holding the name. If it is identified by an id, nameid is that id. Language id nodes are always identified by and ID.

ncount is the number of named sub-nodes of this node (nodes that are identified by a string).

idcountsize is the number of id sub-nodes of this node (nodes that are identified by an integer id). For language id nodes, this field holds the size of the resource data.

subptr is an offset to the first subnode of this node. Note that it allows to access every subnode of this node, since subnodes of a node always come one after the other. For language id nodes, subptr is the offset to the resource data.

The string table

The string table is used to store strings used for resource types and names. If all resources use integer ids for name and types, it may not be present in the file.

The string table simply contains null-terminated strings, one after the other.

If present, the string table always contains a 0 (zero) at the beginning. This way, the empty string is located at the offset of the string table (whose value is held in nodesize field of the initial header).

The resource data

This part of the file contains raw resource data. As written before, all data structures must be aligned on qword boundaries, so if a resource data size is not a multiple of 8, bytes of padding must be inserted after that resource data.


EXT_CURRENT_VERSION

Current version of file format

Declaration

Source position: externaltypes.pp line 48

const EXT_CURRENT_VERSION = 1;

Description

This value is used for TExtHeader.version.

See also

TExtHeader

Header of an external resource file


EXT_ENDIAN_BIG

The file uses big endian byte order

Declaration

Source position: externaltypes.pp line 50

const EXT_ENDIAN_BIG = 1;

Description

This value is used for TExtHeader.endianess.

See also

TExtHeader | Header of an external resource file
EXT_ENDIAN_LITTLE | The file uses little endian byte order


EXT_ENDIAN_LITTLE

The file uses little endian byte order

Declaration

Source position: externaltypes.pp line 51

const EXT_ENDIAN_LITTLE = 2;

Description

This value is used for TExtHeader.endianess.

See also

TExtHeader | Header of an external resource file
EXT_ENDIAN_BIG | The file uses big endian byte order


EXTERNAL_RESMAGIC

Magic identifier for the external resource file type

Declaration

Source position: externaltypes.pp line 46

const EXTERNAL_RESMAGIC: TExternalResMagic = 'FPCRES';

Description

This value is used for TExtHeader.magic.

See also

TExternalResMagic | Type used for the magic identifier in external resource files
TExtHeader | Header of an external resource file


Reference for unit 'externaltypes'

Contains types and constants used by external resource reader and writer

Overview

These types are used internally by TExternalResourceReader and TExternalResourceWriter.

Two constants are of interest: EXT_ENDIAN_BIG and EXT_ENDIAN_LITTLE.

Related topics

Description of external resource file format

Description of external resource file format


Reference for unit 'externaltypes': Constants

EXTERNAL_RESMAGIC | Magic identifier for the external resource file type
EXT_CURRENT_VERSION | Current version of file format
EXT_ENDIAN_BIG | The file uses big endian byte order
EXT_ENDIAN_LITTLE | The file uses little endian byte order


Reference for unit 'externaltypes': Types

TExternalResMagic | Type used for the magic identifier in external resource files
TExtHeader | Header of an external resource file
TResInfoNode | A node of a resource tree


Index of all identifiers in unit 'externaltypes'

E T

E

EXT_CURRENT_VERSION | EXT_ENDIAN_LITTLE
EXT_ENDIAN_BIG | EXTERNAL_RESMAGIC

T

TExternalResMagic TExtHeader TResInfoNode


TExternalResMagic

Type used for the magic identifier in external resource files

Declaration

Source position: externaltypes.pp line 23

type TExternalResMagic = array [1..6] of Char;

See also

EXTERNAL_RESMAGIC

Magic identifier for the external resource file type


TExtHeader

Header of an external resource file

Declaration

Source position: externaltypes.pp line 26

type TExtHeader = packed record
magic: TExternalResMagic; | String identifying the file format
version: Byte; | File format version
endianess: Byte; | Byte order of the file
count: LongWord; | Number of resources in the file
nodesize: LongWord; | Size of header up to string table, excluded
hdrsize: LongWord; | Size of header up to string table, included
reserved1: LongWord; | Unused as of version 1
reserved2: LongWord; | Unused as of version 1
reserved3: LongWord; | Unused as of version 1
end;

Description

This header describes the data structure present at the beginning of an external resource file.

See also

EXTERNAL_RESMAGIC | Magic identifier for the external resource file type
EXT_CURRENT_VERSION | Current version of file format
EXT_ENDIAN_BIG | The file uses big endian byte order
EXT_ENDIAN_LITTLE | The file uses little endian byte order


TResInfoNode

A node of a resource tree

Declaration

Source position: externaltypes.pp line 38

type TResInfoNode = packed record
nameid: LongWord; | Name or ID of the node
ncount: LongWord; | Number of named sub-entries
idcountsize: LongWord; | Number of ID sub-entries or resource size
subptr: LongWord; | Offset to first subnode or resource data
end;

Description

This record represents a node used in a resource tree. A node contains information about a certain resource type, name or language id.


Reference for unit 'externalwriter'

Contains a resource writer for external resource files

uses
Classes,
sysutils,
resource, | Contains base classes for resource handling
resourcetree, | Implements an ordered tree of resources
externaltypes, | Contains types and constants used by external resource reader and writer
strtable;

Overview

This unit contains TExternalResourceWriter, a TAbstractResourceWriter descendant that is able to write standalone resource files in a Free Pascal-specific format.

Adding this unit to a program's uses clause registers class TExternalResourceWriter with TResources.

See also

Free Pascal external resource file format description


Reference for unit 'externalwriter': Classes

EExternalResInvalidEndianessException | Invalid endianess error
EExternalResourceWriterException | Base class for external resource writer-related exceptions
TExternalResourceWriter | External file resource writer


Index of all identifiers in unit 'externalwriter'

E T

E

EExternalResInvalidEndianessException EExternalResourceWriterException

T

TExternalResourceWriter


Reference for unit 'groupcursorresource'

Contains a group cursor resource type

uses
Classes,
sysutils,
resource, | Contains base classes for resource handling
groupresource; | Contains group resource classes

Overview

This unit contains TGroupCursorResource, a TAbstractResource descendant specialized in handling resource of type RT_GROUP_CURSOR.

Adding this unit to a program's uses clause registers class TGroupCursorResource for type RT_GROUP_CURSOR with TResourceFactory.


Reference for unit 'groupcursorresource': Classes

TGroupCursorResource

Group cursor resource type


Index of all identifiers in unit 'groupcursorresource'

T

T

TGroupCursorResource


Reference for unit 'groupiconresource'

Contains a group icon resource type

uses
Classes,
sysutils,
resource, | Contains base classes for resource handling
groupresource; | Contains group resource classes

Overview

This unit contains TGroupIconResource, a TAbstractResource descendant specialized in handling resource of type RT_GROUP_ICON.

Adding this unit to a program's uses clause registers class TGroupIconResource for type RT_GROUP_ICON with TResourceFactory.


Reference for unit 'groupiconresource': Classes

TGroupIconResource

Group icon resource type


Index of all identifiers in unit 'groupiconresource'

T

T

TGroupIconResource


Reference for unit 'groupresource'

Contains group resource classes

uses
Classes,
sysutils,
resource, | Contains base classes for resource handling
resdatastream; | Contains stream classes to provide copy-on-write functionality

Overview

This unit contains TGroupResource and TGroupCachedDataStream, two classes used for resources of type RT_GROUP_ICON and RT_GROUP_CURSOR.

The former is an abstract resource class which is implemented by TGroupIconResource and TGroupCursorResource, and the latter is a TCachedDataStream descendant used to provide .ico/.cur like streams for resource classes mentioned earlier.

This unit shouldn't be of interest for the user, who should look at documentation for groupiconresource and groupcursorresource units instead.


Reference for unit 'groupresource': Classes

TGroupCachedDataStream | Cached stream for group classes
TGroupResource | Abstract common class for group icon and group cursor classes


Index of all identifiers in unit 'groupresource'

T

T

TGroupCachedDataStream TGroupResource


Reference for unit 'machoreader'

Contains a resource reader for Mach-O files

uses
Classes,
sysutils,
resource, | Contains base classes for resource handling
machotypes; | Contains types used by Mach-O reader and writer

Overview

This unit contains TMachOResourceReader, a TAbstractResourceReader descendant that is able to read Mach-O object files containing resources.

Adding this unit to a program's uses clause registers class TMachOResourceReader with TResources.


Reference for unit 'machoreader': Classes

TMachOResourceReader

Mach-O resource reader


Index of all identifiers in unit 'machoreader'

T

T

TMachOResourceReader


Reference for unit 'machotypes'

Contains types used by Mach-O reader and writer

Overview

These constants are used internally by TMachOResourceWriter and TMachOResourceReader.

The only type of interest for the user is TMachOMachineType.


Reference for unit 'machotypes': Types

PNList32 |
PNList64 |
PRelocationInfo |
TDySymtabCommand |
TLoadCommand |
TMachHdr |
TMachOMachineType | Enumeration for Mach-O machine type
TMachOSubMachineType386
TMachOSubMachineTypeAarch64
TMachOSubMachineTypeArm
TMachOSubMachineTypePowerPC
TMachOSubMachineTypePowerPC64
TMachOSubMachineTypex64
TNList32 |
TNList64 |
TRelocationInfo |
TSection32 |
TSection64 |
TSegmentCommand32 |
TSegmentCommand64 |
TSegSectName |
TSymtabCommand |


Index of all identifiers in unit 'machotypes'

M P T

M

mmtarm | msm386_all | msmarm_v7
mmtarm64 | msmaarch64_all | msmarm_xscale
mmti386 | msmarm_all | msmppc64_all
mmtpowerpc | msmarm_v4t | msmppc_all
mmtpowerpc64 | msmarm_v5tej | msmx64_all
mmtx86_64 | msmarm_v6 |

P

PNList32 PNList64 PRelocationInfo

T

TDySymtabCommand | TMachOSubMachineTypePowerPC | TSection64
TLoadCommand | TMachOSubMachineTypePowerPC64 | TSegmentCommand32
TMachHdr | TMachOSubMachineTypex64 | TSegmentCommand64
TMachOMachineType | TNList32 | TSegSectName
TMachOSubMachineType386 | TNList64 | TSymtabCommand
TMachOSubMachineTypeAarch64 | TRelocationInfo |
TMachOSubMachineTypeArm | TSection32 |


PNList32

Declaration

Source position: machotypes.pp line 140

type PNList32 = ^TNList32;


PNList64

Declaration

Source position: machotypes.pp line 149

type PNList64 = ^TNList64;


PRelocationInfo

Declaration

Source position: machotypes.pp line 155

type PRelocationInfo = ^TRelocationInfo;


TDySymtabCommand

Declaration

Source position: machotypes.pp line 112

type TDySymtabCommand = record

  ilocalsym: LongWord;

  nlocalsym: LongWord;

  iextdefsym: LongWord;

  nextdefsym: LongWord;

  iundefsym: LongWord;

  nundefsym: LongWord;

  tocoff: LongWord;

  ntoc: LongWord;

  modtaboff: LongWord;

  nmodtab: LongWord;

  extrefsymoff: LongWord;

  nextrefsyms: LongWord;

  indirectsymoff: LongWord;

  nindirectsyms: LongWord;

  extreloff: LongWord;

  nextrel: LongWord;

  locreloff: LongWord;

  nlocrel: LongWord;

end;


TLoadCommand

Declaration

Source position: machotypes.pp line 45

type TLoadCommand = record

  cmd: LongWord;

  cmdsize: LongWord;

end;


TMachHdr

Declaration

Source position: machotypes.pp line 35

type TMachHdr = record

  magic: LongWord;

  cputype: LongInt;

  cpusubtype: LongInt;

  filetype: LongWord;

  ncmds: LongWord;

  sizeofcmds: LongWord;

  flags: LongWord;

end;


TMachOMachineType

Enumeration for Mach-O machine type

Declaration

Source position: machotypes.pp line 25

type TMachOMachineType = (
mmtpowerpc, | PowerPC machine type
mmtpowerpc64, | PowerPC 64 machine type
mmti386, | Intel 386 machine type
mmtx86_64, | AMD x86_64 machine type
mmtarm,
mmtarm64
);

Description

This enumeration specifies the Mach-O machine type.

It is used by TMachOResourceWriter to specify the machine type of the generated object file and by TMachOResourceReader to read the machine type of the object file that has been read.

See also

TMachOResourceWriter.MachineType | The machine type of the object file
TMachOResourceReader.MachineType | The machine type of the object file


TMachOSubMachineType386

Declaration

Source position: machotypes.pp line 28

type TMachOSubMachineType386 = (

  msm386_all

);


TMachOSubMachineTypeAarch64

Declaration

Source position: machotypes.pp line 31

type TMachOSubMachineTypeAarch64 = (

  msmaarch64_all

);


TMachOSubMachineTypeArm

Declaration

Source position: machotypes.pp line 30

type TMachOSubMachineTypeArm = (

  msmarm_all,

  msmarm_v4t,

  msmarm_v6,

  msmarm_v5tej,

  msmarm_xscale,

  msmarm_v7

);


TMachOSubMachineTypePowerPC

Declaration

Source position: machotypes.pp line 26

type TMachOSubMachineTypePowerPC = (

  msmppc_all

);


TMachOSubMachineTypePowerPC64

Declaration

Source position: machotypes.pp line 27

type TMachOSubMachineTypePowerPC64 = (

  msmppc64_all

);


TMachOSubMachineTypex64

Declaration

Source position: machotypes.pp line 29

type TMachOSubMachineTypex64 = (

  msmx64_all

);


TNList32

Declaration

Source position: machotypes.pp line 133

type TNList32 = record

  strx: LongWord;

  _type: Byte;

  sect: Byte;

  desc: Word;

  value: LongWord;

end;


TNList64

Declaration

Source position: machotypes.pp line 142

type TNList64 = record

  strx: LongWord;

  _type: Byte;

  sect: Byte;

  desc: Word;

  value: QWord;

end;


TRelocationInfo

Declaration

Source position: machotypes.pp line 151

type TRelocationInfo = record

  address: LongWord;

  flags: LongWord;

end;


TSection32

Declaration

Source position: machotypes.pp line 76

type TSection32 = record

  sectname: TSegSectName;

  segname: TSegSectName;

  addr: LongWord;

  size: LongWord;

  offset: LongWord;

  align: LongWord;

  reloff: LongWord;

  nreloc: LongWord;

  flags: LongWord;

  reserved1: LongWord;

  reserved2: LongWord;

end;


TSection64

Declaration

Source position: machotypes.pp line 90

type TSection64 = record

  sectname: TSegSectName;

  segname: TSegSectName;

  addr: QWord;

  size: QWord;

  offset: LongWord;

  align: LongWord;

  reloff: LongWord;

  nreloc: LongWord;

  flags: LongWord;

  reserved1: LongWord;

  reserved2: LongWord;

  reserved3: LongWord;

end;


TSegmentCommand32

Declaration

Source position: machotypes.pp line 52

type TSegmentCommand32 = record

  name: TSegSectName;

  vmaddr: LongWord;

  vmsize: LongWord;

  fileoff: LongWord;

  filesize: LongWord;

  maxprot: LongInt;

  initprot: LongInt;

  nsects: LongWord;

  flags: LongWord;

end;


TSegmentCommand64

Declaration

Source position: machotypes.pp line 64

type TSegmentCommand64 = record

  name: TSegSectName;

  vmaddr: QWord;

  vmsize: QWord;

  fileoff: QWord;

  filesize: QWord;

  maxprot: LongInt;

  initprot: LongInt;

  nsects: LongWord;

  flags: LongWord;

end;


TSegSectName

Declaration

Source position: machotypes.pp line 32

type TSegSectName = array [0..15] of Char;


TSymtabCommand

Declaration

Source position: machotypes.pp line 105

type TSymtabCommand = record

  symoff: LongWord;

  nsyms: LongWord;

  stroff: LongWord;

  strsize: LongWord;

end;


Reference for unit 'machowriter'

Contains a resource writer for Mach-O files

uses
Classes,
sysutils,
resource, | Contains base classes for resource handling
machotypes; | Contains types used by Mach-O reader and writer

Overview

This unit contains TMachOResourceWriter, a TAbstractResourceWriter descendant that is able to write Mach-O object files containing resources.

Adding this unit to a program's uses clause registers class TMachOResourceWriter with TResources.


Reference for unit 'machowriter': Types

TMachoSubMachineType


Reference for unit 'machowriter': Classes

EMachOResourceWriterException | Base class for Mach-O resource writer-related exceptions
EMachOResourceWriterSymbolTableWrongOrderException
EMachOResourceWriterUnknownBitSizeException | Internal error
TMachOResourceWriter | Mach-O resource writer


Index of all identifiers in unit 'machowriter'

E T

E

EMachOResourceWriterException EMachOResourceWriterSymbolTableWrongOrderException EMachOResourceWriterUnknownBitSizeException

T

TMachOResourceWriter TMachoSubMachineType


TMachoSubMachineType

Declaration

Source position: machowriter.pp line 34

type TMachoSubMachineType = record

  case TMachOMachineType of

    msmppc_all: (

        fPpcSubType: TMachOSubMachineTypePowerPC;

      );

    msmppc64_all: (

        fPpc64SubType: TMachOSubMachineTypePowerPC64;

      );

    msm386_all: (

        f386SubType: TMachOSubMachineType386;

      );

    msmx64_all: (

        fX64SubType: TMachOSubMachineTypex64;

      );

    mmtarm: (

        fArmSubType: TMachOSubMachineTypeArm;

      );

    mmtarm64: (

        fArm64SubType: TMachOSubMachineTypeAarch64;

      );

end;


Reference for unit 'resdatastream'

Contains stream classes to provide copy-on-write functionality

uses

  Classes,

  sysutils,

  resource;

Contains base classes for resource handling

Overview

This unit contains various streams that are used to provide copy-on-write mechanism for TAbstractResource.RawData, via more levels of indirection.

Main class is TResourceDataStream, which is the stream used for TAbstractResource.RawData. This class uses an underlying stream, to which it redirects operations.

At a lower level, a TCachedDataStream descendant provides a layer between the original stream and the TResourceDataStream.


Reference for unit 'resdatastream': Types

TCachedStreamClass | Cached stream metaclass
TUnderlyingStreamType | The type of the underlying stream of TResourceDataStream


Reference for unit 'resdatastream': Classes

TCachedDataStream | Base cached stream class
TCachedResourceDataStream | An implementation of a cached stream
TResourceDataStream | Stream class that provides copy-on-write functionality


Index of all identifiers in unit 'resdatastream'

T U

T

TCachedDataStream | TCachedStreamClass | TUnderlyingStreamType
TCachedResourceDataStream | TResourceDataStream |

U

usCached usCustom usMemory


TCachedStreamClass

Cached stream metaclass

Declaration

Source position: resdatastream.pp line 54

type TCachedStreamClass = class of TCachedDataStream;


TUnderlyingStreamType

The type of the underlying stream of TResourceDataStream

Declaration

Source position: resdatastream.pp line 57

type TUnderlyingStreamType = (
usCached, | The underlying stream is a TCachedResourceDataStream descendant
usMemory, | The underlying stream is a memory stream
usCustom | The underlying stream is a custom stream
);

See also

TResourceDataStream

Stream class that provides copy-on-write functionality


Reference for unit 'resfactory'

Contains a factory class for resources

uses

  Classes,

  sysutils,

  resource;

Contains base classes for resource handling

Overview

This unit contains a factory class that provides an easy way to create resources of the right class.

Resource classes can be registered with TResourceFactory so that the class knows how to create a resource of a specific type.


Reference for unit 'resfactory': Resource strings

SAlreadyRegistered
'A resource class for the type %s is already registered.'


Reference for unit 'resfactory': Classes

EResourceClassAlreadyRegisteredException | A resource class for a given type has already been registered
EResourceFactoryException | Base class for resource factory-related exceptions
TResourceFactory | Factory class for resources


Index of all identifiers in unit 'resfactory'

E S T

E

EResourceClassAlreadyRegisteredException EResourceFactoryException

S

SAlreadyRegistered

T

TResourceFactory


CREATEPROCESS_MANIFEST_RESOURCE_ID

Declaration

Source position: resource.pp line 48

const CREATEPROCESS_MANIFEST_RESOURCE_ID = 1;


Reference for unit 'resource'

Contains base classes for resource handling

uses

  Classes,

  sysutils;

Overview

This unit contains base classes needed to work with resources.

Single resources are represented by an instance of a TAbstractResource descendant. They are grouped in a TResources instance which can be read (written) to (from) a stream via a TAbstractResourceReader (TAbstractResourceWriter) descendant.

TGenericResource provides a basic implementation of TAbstractResource.


Reference for unit 'resource': Resource strings

SReaderNotFoundExt
'Cannot find resource reader for extension ''%s'''

SReaderNotFoundProbe
'Cannot find a resource reader: unknown format.'

SWriterNotFoundExt
'Cannot find resource writer for extension ''%s'''

SDescChangeNotAllowed
'Cannot modify %s resource description'

SLangIDChangeNotAllowed
'Cannot modify %s resource language ID'

SResDuplicate
'Duplicate resource: Type = %s, Name = %s, Lang ID = %.4x'

SResourceNotFound
'Cannot find resource: Type = %s, Name = %s'

SResourceNotFoundLang
'Cannot find resource: Type = %s, Name = %s, Lang ID = %.4x'


Reference for unit 'resource': Constants

CREATEPROCESS_MANIFEST_RESOURCE_ID
ISOLATIONAWARE_MANIFEST_RESOURCE_ID
ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID
MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID
MF_DISCARDABLE | The resource can be discarded if no longer needed
MF_MOVEABLE | The resource can be moved
MF_PRELOAD | The resource is loaded with the executable file
MF_PURE | The resource contains dword-aligned data
MINIMUM_RESERVED_MANIFEST_RESOURCE_ID
RT_ACCELERATOR | Accelerator table resource
RT_ANICURSOR | Animated cursor resource
RT_ANIICON | Animated icon resource
RT_BITMAP | Bitmap resource
RT_CURSOR | Single cursor resource
RT_DIALOG | Dialog resource
RT_DLGINCLUDE | Never present in compiled form
RT_FONT | Single font resource
RT_FONTDIR | Font directory resource
RT_GROUP_CURSOR | Cursor resource
RT_GROUP_ICON | Icon resource
RT_HTML | HTML resource
RT_ICON | Single icon resource
RT_MANIFEST | Windows XP Side-by-Side Assembly XML manifest
RT_MENU | Menu resource
RT_MESSAGETABLE | Message table resource
RT_PLUGPLAY | Plug and Play resource
RT_RCDATA | Application-defined resource (raw data)
RT_STRING | String table resource
RT_VERSION | Version resource
RT_VXD | VXD resource


Reference for unit 'resource': Types

TDescType | The type of a resource type or name
TLangID | A resource language ID
TResID | A resource type or name in ID form
TResName | A resource type or name in string form
TResourceClass | Resource metaclass
TResourceReaderClass | Resource reader metaclass
TResourceWriterClass | Resource writer metaclass


Reference for unit 'resource': Classes

ENoMoreFreeIDsException | There are no more free IDs to use as name for a resource
EResourceDescChangeNotAllowedException | Description is not allowed to change
EResourceDescTypeException | Wrong description type error
EResourceDuplicateException | There is already a resource with same type, name and language ID
EResourceException | Base class for resource-related exceptions
EResourceLangIDChangeNotAllowedException | Language ID is not allowed to change
EResourceNotFoundException | No resource matching the search criteria is found
EResourceReaderException | Base class for resource reader-related exceptions
EResourceReaderNotFoundException | No suitable resource reader was found
EResourceReaderUnexpectedEndOfStreamException | The stream ended prematurely
EResourceReaderWrongFormatException | The stream is not in the format the reader supports
EResourceWriterException | Base class for resource writer-related exceptions
EResourceWriterNotFoundException | No suitable resource writer was found
TAbstractResource | Base abstract resource class
TAbstractResourceReader | Base abstract resource reader class
TAbstractResourceWriter | Base abstract resource writer class
TGenericResource | Generic resource class
TResourceDesc | A resource description (type or name)
TResources | A collection of resources


Index of all identifiers in unit 'resource'

C D E I M R S T

C

CREATEPROCESS_MANIFEST_RESOURCE_ID

D

dtID dtName

E

ENoMoreFreeIDsException | EResourceLangIDChangeNotAllowedException | EResourceReaderWrongFormatException
EResourceDescChangeNotAllowedException | EResourceNotFoundException | EResourceWriterException
EResourceDescTypeException | EResourceReaderException | EResourceWriterNotFoundException
EResourceDuplicateException | EResourceReaderNotFoundException |
EResourceException | EResourceReaderUnexpectedEndOfStreamException |

I

ISOLATIONAWARE_MANIFEST_RESOURCE_ID ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID

M

MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID | MF_MOVEABLE | MF_PURE
MF_DISCARDABLE | MF_PRELOAD | MINIMUM_RESERVED_MANIFEST_RESOURCE_ID

R

RT_ACCELERATOR | RT_FONT | RT_MENU
RT_ANICURSOR | RT_FONTDIR | RT_MESSAGETABLE
RT_ANIICON | RT_GROUP_CURSOR | RT_PLUGPLAY
RT_BITMAP | RT_GROUP_ICON | RT_RCDATA
RT_CURSOR | RT_HTML | RT_STRING
RT_DIALOG | RT_ICON | RT_VERSION
RT_DLGINCLUDE | RT_MANIFEST | RT_VXD

S

SDescChangeNotAllowed | SReaderNotFoundProbe | SResourceNotFoundLang
SLangIDChangeNotAllowed | SResDuplicate | SWriterNotFoundExt
SReaderNotFoundExt | SResourceNotFound |

T

TAbstractResource | TLangID | TResourceReaderClass
TAbstractResourceReader | TResID | TResources
TAbstractResourceWriter | TResName | TResourceWriterClass
TDescType | TResourceClass |
TGenericResource | TResourceDesc |


ISOLATIONAWARE_MANIFEST_RESOURCE_ID

Declaration

Source position: resource.pp line 49

const ISOLATIONAWARE_MANIFEST_RESOURCE_ID = 2;


ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID

Declaration

Source position: resource.pp line 50

const ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID = 3;


MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID

Declaration

Source position: resource.pp line 52

const MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID = 16;


MF_DISCARDABLE

The resource can be discarded if no longer needed

Declaration

Source position: resource.pp line 58

const MF_DISCARDABLE = $1000;

Description

This flag is ignored by Windows and Free Pascal RTL. It's provided for compatibility with 16-bit Windows.


MF_MOVEABLE

The resource can be moved

Declaration

Source position: resource.pp line 55

const MF_MOVEABLE = $0010;

Description

This flag is ignored by Windows and Free Pascal RTL. It's provided for compatibility with 16-bit Windows.


MF_PRELOAD

The resource is loaded with the executable file

Declaration

Source position: resource.pp line 57

const MF_PRELOAD = $0040;

Description

This flag is ignored by Windows and Free Pascal RTL. It's provided for compatibility with 16-bit Windows.


MF_PURE

The resource contains dword-aligned data

Declaration

Source position: resource.pp line 56

const MF_PURE = $0020;

Description

This flag is ignored by Windows and Free Pascal RTL. It's provided for compatibility with 16-bit Windows.


MINIMUM_RESERVED_MANIFEST_RESOURCE_ID

Declaration

Source position: resource.pp line 51

const MINIMUM_RESERVED_MANIFEST_RESOURCE_ID = 1;


RT_ACCELERATOR

Accelerator table resource

Declaration

Source position: resource.pp line 34

const RT_ACCELERATOR = 9;

See also

TAcceleratorsResource

Accelerator table resource type


RT_ANICURSOR

Animated cursor resource

Declaration

Source position: resource.pp line 43

const RT_ANICURSOR = 21;

Description

This resource type contains raw binary data taken from a .ani file

See also

RT_ANIICON

Animated icon resource


RT_ANIICON

Animated icon resource

Declaration

Source position: resource.pp line 44

const RT_ANIICON = 22;

Description

This resource type contains raw binary data taken from a .ani file

See also

RT_ANICURSOR

Animated cursor resource


RT_BITMAP

Bitmap resource

Declaration

Source position: resource.pp line 27

const RT_BITMAP = 2;

See also

TBitmapResource

Bitmap resource type


RT_CURSOR

Single cursor resource

Declaration

Source position: resource.pp line 26

const RT_CURSOR = 1;

Description

A single image in a cursor. Don't use it directly.

See also

RT_GROUP_CURSOR | Cursor resource
TGroupCursorResource | Group cursor resource type


RT_DIALOG

Dialog resource

Declaration

Source position: resource.pp line 30

const RT_DIALOG = 5;


RT_DLGINCLUDE

Never present in compiled form

Declaration

Source position: resource.pp line 40

const RT_DLGINCLUDE = 17;

Description

This resource is used internally by resource compilers but will never appear in compiled form


RT_FONT

Single font resource

Declaration

Source position: resource.pp line 33

const RT_FONT = 8;

Description

This resource type is obsolete and never appears in 32 bit resources.

See also

RT_FONTDIR

Font directory resource


RT_FONTDIR

Font directory resource

Declaration

Source position: resource.pp line 32

const RT_FONTDIR = 7;

Description

This resource type is obsolete and never appears in 32 bit resources.

See also

RT_FONT

Single font resource


RT_GROUP_CURSOR

Cursor resource

Declaration

Source position: resource.pp line 37

const RT_GROUP_CURSOR = 12;

Description

This resource type contains a cursor and it's the equivalent of a .cur file

Remark: Please note that is is made up of several RT_CURSOR resources (the single cursor images) that shouldn't be accessed singularly.

See also

RT_CURSOR | Single cursor resource
TGroupCursorResource | Group cursor resource type


RT_GROUP_ICON

Icon resource

Declaration

Source position: resource.pp line 38

const RT_GROUP_ICON = 14;

Description

This resource type contains an icon and it's the equivalent of a .ico file

Remark: Please note that is is made up of several RT_ICON resources (the single icon images) that shouldn't be accessed singularly.

See also

RT_ICON | Single icon resource
TGroupIconResource | Group icon resource type


RT_HTML

HTML resource

Declaration

Source position: resource.pp line 45

const RT_HTML = 23;

Description

This resource type contains an HTML file.


RT_ICON

Single icon resource

Declaration

Source position: resource.pp line 28

const RT_ICON = 3;

Description

A single image in a icon. Don't use it directly.

See also

RT_GROUP_ICON | Icon resource
TGroupIconResource | Group icon resource type


RT_MANIFEST

Windows XP Side-by-Side Assembly XML manifest

Declaration

Source position: resource.pp line 46

const RT_MANIFEST = 24;

Description

This resource contains data taken from a .manifest file

Remark: Resource name must be one of CREATEPROCESS_MANIFEST_RESOURCE_ID (mainly used for executables), ISOLATIONAWARE_MANIFEST_RESOURCE_ID or ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID (mainly used for DLLs)


RT_MENU

Menu resource

Declaration

Source position: resource.pp line 29

const RT_MENU = 4;


RT_MESSAGETABLE

Message table resource

Declaration

Source position: resource.pp line 36

const RT_MESSAGETABLE = 11;


RT_PLUGPLAY

Plug and Play resource

Declaration

Source position: resource.pp line 41

const RT_PLUGPLAY = 19;


RT_RCDATA

Application-defined resource (raw data)

Declaration

Source position: resource.pp line 35

const RT_RCDATA = 10;

Description

This resource type contains arbitrary binary data

Note that Delphi dfm files are stored in compiled form as a RCDATA resource


RT_STRING

String table resource

Declaration

Source position: resource.pp line 31

const RT_STRING = 6;

See also

TStringTableResource

String table resource type


RT_VERSION

Version resource

Declaration

Source position: resource.pp line 39

const RT_VERSION = 16;

Description

This resource defines version information which is visible when viewing properties of a Windows executable or DLL.

See also

TVersionResource

Version information resource type


RT_VXD

VXD resource

Declaration

Source position: resource.pp line 42

const RT_VXD = 20;


TDescType

The type of a resource type or name

Declaration

Source position: resource.pp line 74

type TDescType = (
dtName, | The resource type or name is a string
dtID | The resource type or name is an ID
);

See also

TResName | A resource type or name in string form
TResID | A resource type or name in ID form
TResourceDesc | A resource description (type or name)


TLangID

A resource language ID

Declaration

Source position: resource.pp line 71

type TLangID = Word;


TResID

A resource type or name in ID form

Declaration

Source position: resource.pp line 73

type TResID = LongWord;

See also

TResName | A resource type or name in string form
TDescType | The type of a resource type or name
TResourceDesc | A resource description (type or name)


TResName

A resource type or name in string form

Declaration

Source position: resource.pp line 72

type TResName = String;

See also

TResID | A resource type or name in ID form
TDescType | The type of a resource type or name
TResourceDesc | A resource description (type or name)


TResourceClass

Resource metaclass

Declaration

Source position: resource.pp line 181

type TResourceClass = class of TAbstractResource;


TResourceReaderClass

Resource reader metaclass

Declaration

Source position: resource.pp line 204

type TResourceReaderClass = class of TAbstractResourceReader;


TResourceWriterClass

Resource writer metaclass

Declaration

Source position: resource.pp line 205

type TResourceWriterClass = class of TAbstractResourceWriter;


Reference for unit 'resourcetree'

Implements an ordered tree of resources

uses

  Classes,

  sysutils,

  resource;

Contains base classes for resource handling

Overview

This unit implements classes that represent an ordered tree of resources.

Such a tree is used internally by TResources to speed up operations, and by certain resource readers and writers that deal with resource formats where data is stored as ordered trees of resources. For this reason, only implementors of resource readers and writers should be interested in these classes.

A tree begins with a root node, which is an instance of TRootResTreeNode. The root node contains type nodes, that contain name nodes, that contain language id nodes. Finally, a language id node contains a resource.

Each node contains its sub nodes in two lists: a Named list for nodes identified by a name (a string), and an ID list for nodes identified by an ID (an integer). In each list, nodes are sorted in ascending order.

Many resource formats (PECOFF, ELF, Mach-O, and external resource files) use this exact format to store resource information.

Remark: When a tree is destroyed, the resources it references aren't destroyed.


Reference for unit 'resourcetree': Classes

TResourceTreeNode | Abstract class representing a resource tree node.
TRootResTreeNode | The root node in a resource tree


Index of all identifiers in unit 'resourcetree'

T

T

TResourceTreeNode TRootResTreeNode


Reference for unit 'resreader'

Contains a resource reader for .res files

uses

  Classes,

  sysutils,

  resource;

Contains base classes for resource handling

Overview

This unit contains TResResourceReader, a TAbstractResourceReader descendant that is able to read .res resource files.

Adding this unit to a program's uses clause registers class TResResourceReader with TResources.


Reference for unit 'resreader': Classes

TResResourceReader

.res resource reader


Index of all identifiers in unit 'resreader'

T

T

TResResourceReader


Reference for unit 'reswriter'

Contains a resource writer for .res files

uses

  Classes,

  sysutils,

  resource;

Contains base classes for resource handling

Overview

This unit contains TResResourceWriter, a TAbstractResourceWriter descendant that is able to write .res resource files.

Adding this unit to a program's uses clause registers class TResResourceWriter with TResources.


Reference for unit 'reswriter': Classes

TResResourceWriter

.res resource writer


Index of all identifiers in unit 'reswriter'

T

T

TResResourceWriter


Reference for unit 'stringtableresource'

Contains a string table resource type

uses

  Classes,

  sysutils,

  resource;

Contains base classes for resource handling

Overview

This unit contains TStringTableResource, a TAbstractResource descendant specialized in handling resource of type RT_STRING.

Adding this unit to a program's uses clause registers class TStringTableResource for type RT_STRING with TResourceFactory.


Reference for unit 'stringtableresource': Resource strings

SNameNotAllowed
'Resource ID must be an ordinal in the range 1-4096'

SIndexOutOfBounds
'String ID out of bounds: %d'


Reference for unit 'stringtableresource': Classes

EStringTableIndexOutOfBoundsException | The ID of the string is out of range
EStringTableNameNotAllowedException | The name of the resource isn't allowed
EStringTableResourceException | Base class for string table resource-related exceptions
TStringTableResource | String table resource type


Index of all identifiers in unit 'stringtableresource'

E S T

E

EStringTableIndexOutOfBoundsException EStringTableNameNotAllowedException EStringTableResourceException

S

SIndexOutOfBounds SNameNotAllowed

T

TStringTableResource


Reference for unit 'versionconsts'

Contains constants used by version information resource

Overview

This unit contains constants used by TVersionResource.

Constants for TVersionFixedInfo.FileFlags:

  • VS_FF_DEBUG.
  • VS_FF_INFOINFERRED.
  • VS_FF_PATCHED.
  • VS_FF_PRERELEASE.
  • VS_FF_PRIVATEBUILD.
  • VS_FF_SPECIALBUILD.

Constants for TVersionFixedInfo.FileOS:

  • VOS_UNKNOWN
  • VOS_DOS
  • VOS_OS216
  • VOS_OS232
  • VOS_NT
  • VOS__WINDOWS16
  • VOS__WINDOWS32
  • VOS__PM16
  • VOS__PM32
  • VOS_DOS_WINDOWS16
  • VOS_DOS_WINDOWS32
  • VOS_OS216_PM16
  • VOS_OS232_PM32
  • VOS_NT_WINDOWS32

Constants for TVersionFixedInfo.FileType:

  • VFT_UNKNOWN
  • VFT_APP
  • VFT_DLL
  • VFT_DRV
  • VFT_FONT
  • VFT_VXD
  • VFT_STATIC_LIB

Constants for TVersionFixedInfo.FileSubType:

  • VFT2_UNKNOWN
  • VFT2_DRV_COMM
  • VFT2_DRV_PRINTER
  • VFT2_DRV_KEYBOARD
  • VFT2_DRV_LANGUAGE
  • VFT2_DRV_DISPLAY
  • VFT2_DRV_MOUSE
  • VFT2_DRV_NETWORK
  • VFT2_DRV_SYSTEM
  • VFT2_DRV_INSTALLABLE
  • VFT2_DRV_SOUND
  • VFT2_FONT_RASTER
  • VFT2_FONT_VECTOR
  • VFT2_FONT_TRUETYPE


Reference for unit 'versionconsts': Constants

VFT2_DRV_COMM | The file is a communications driver
VFT2_DRV_DISPLAY | The file is a display driver
VFT2_DRV_INSTALLABLE | The file is an installable driver
VFT2_DRV_KEYBOARD | The file is a keyboard driver
VFT2_DRV_LANGUAGE | The file is a language driver
VFT2_DRV_MOUSE | The file is a mouse driver
VFT2_DRV_NETWORK | The file is a network driver
VFT2_DRV_PRINTER | The file is a printer driver
VFT2_DRV_SOUND | The file is a sound driver
VFT2_DRV_SYSTEM | The file is a system driver
VFT2_FONT_RASTER | The file is a raster font
VFT2_FONT_TRUETYPE | The file is a TrueType font
VFT2_FONT_VECTOR | The file is a vector font
VFT2_UNKNOWN | File subtype is unknown
VFT_APP | The file is an application
VFT_DLL | The file is a dynamic link library
VFT_DRV | The file is a device driver
VFT_FONT | The file is a font
VFT_STATIC_LIB | The file is a static link library
VFT_UNKNOWN | File type is unknown
VFT_VXD | The file is a virtual device
VOS_DOS | This file was designed for MS-DOS
VOS_DOS_WINDOWS16 | This file was designed for 16-bit Windows on MS-DOS
VOS_DOS_WINDOWS32 | This file was designed for 32-bit Windows on MS-DOS
VOS_NT | This file was designed for Windows NT
VOS_NT_WINDOWS32 | This file was designed for 32-bit Windows NT
VOS_OS216 | This file was designed for 16 bit OS/2
VOS_OS216_PM16 | This file was designed for 16-bit Presentation Manager on 16-bit OS/2
VOS_OS232 | This file was designed for 32 bit OS/2
VOS_OS232_PM32 | This file was designed for 32-bit Presentation Manager on 32-bit OS/2
VOS_UNKNOWN | This file was designed to run on an unknown operating system
VOS__BASE | No subsystem specified
VOS__PM16 | This file was designed for 16-bit Presentation Manager
VOS__PM32 | This file was designed for 32-bit Presentation Manager
VOS__WINDOWS16 | This file was designed for 16-bit Windows
VOS__WINDOWS32 | This file was designed for 32-bit Windows
VS_FFI_FILEFLAGSMASK | The valid bits for file flags
VS_FF_DEBUG | The file contains debugging information
VS_FF_INFOINFERRED | This flag should never be used in a resource
VS_FF_PATCHED | This file is not the original shipped one
VS_FF_PRERELEASE | This file is a development version
VS_FF_PRIVATEBUILD | This file is a private build
VS_FF_SPECIALBUILD | This file is a special build of the standard one


Index of all identifiers in unit 'versionconsts'

V

V

VFT2_DRV_COMM | VFT_DLL | VOS_OS232_PM32
VFT2_DRV_DISPLAY | VFT_DRV | VOS__PM16
VFT2_DRV_INSTALLABLE | VFT_FONT | VOS__PM32
VFT2_DRV_KEYBOARD | VFT_STATIC_LIB | VOS_UNKNOWN
VFT2_DRV_LANGUAGE | VFT_UNKNOWN | VOS__WINDOWS16
VFT2_DRV_MOUSE | VFT_VXD | VOS__WINDOWS32
VFT2_DRV_NETWORK | VOS__BASE | VS_FF_DEBUG
VFT2_DRV_PRINTER | VOS_DOS | VS_FFI_FILEFLAGSMASK
VFT2_DRV_SOUND | VOS_DOS_WINDOWS16 | VS_FF_INFOINFERRED
VFT2_DRV_SYSTEM | VOS_DOS_WINDOWS32 | VS_FF_PATCHED
VFT2_FONT_RASTER | VOS_NT | VS_FF_PRERELEASE
VFT2_FONT_TRUETYPE | VOS_NT_WINDOWS32 | VS_FF_PRIVATEBUILD
VFT2_FONT_VECTOR | VOS_OS216 | VS_FF_SPECIALBUILD
VFT2_UNKNOWN | VOS_OS216_PM16 |
VFT_APP | VOS_OS232 |


VFT2_DRV_COMM

The file is a communications driver

Declaration

Source position: versionconsts.pp line 66

const VFT2_DRV_COMM = $0000000A;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_DRV.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_DRV | The file is a device driver


VFT2_DRV_DISPLAY

The file is a display driver

Declaration

Source position: versionconsts.pp line 60

const VFT2_DRV_DISPLAY = $00000004;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_DRV.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_DRV | The file is a device driver


VFT2_DRV_INSTALLABLE

The file is an installable driver

Declaration

Source position: versionconsts.pp line 64

const VFT2_DRV_INSTALLABLE = $00000008;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_DRV.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_DRV | The file is a device driver


VFT2_DRV_KEYBOARD

The file is a keyboard driver

Declaration

Source position: versionconsts.pp line 58

const VFT2_DRV_KEYBOARD = $00000002;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_DRV.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_DRV | The file is a device driver


VFT2_DRV_LANGUAGE

The file is a language driver

Declaration

Source position: versionconsts.pp line 59

const VFT2_DRV_LANGUAGE = $00000003;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_DRV.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_DRV | The file is a device driver


VFT2_DRV_MOUSE

The file is a mouse driver

Declaration

Source position: versionconsts.pp line 61

const VFT2_DRV_MOUSE = $00000005;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_DRV.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_DRV | The file is a device driver


VFT2_DRV_NETWORK

The file is a network driver

Declaration

Source position: versionconsts.pp line 62

const VFT2_DRV_NETWORK = $00000006;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_DRV.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_DRV | The file is a device driver


VFT2_DRV_PRINTER

The file is a printer driver

Declaration

Source position: versionconsts.pp line 57

const VFT2_DRV_PRINTER = $00000001;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_DRV.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_DRV | The file is a device driver


VFT2_DRV_SOUND

The file is a sound driver

Declaration

Source position: versionconsts.pp line 65

const VFT2_DRV_SOUND = $00000009;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_DRV.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_DRV | The file is a device driver


VFT2_DRV_SYSTEM

The file is a system driver

Declaration

Source position: versionconsts.pp line 63

const VFT2_DRV_SYSTEM = $00000007;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_DRV.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_DRV | The file is a device driver


VFT2_FONT_RASTER

The file is a raster font

Declaration

Source position: versionconsts.pp line 69

const VFT2_FONT_RASTER = $00000001;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_FONT.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_FONT | The file is a font


VFT2_FONT_TRUETYPE

The file is a TrueType font

Declaration

Source position: versionconsts.pp line 71

const VFT2_FONT_TRUETYPE = $00000003;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_FONT.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_FONT | The file is a font


VFT2_FONT_VECTOR

The file is a vector font

Declaration

Source position: versionconsts.pp line 70

const VFT2_FONT_VECTOR = $00000002;

Description

This constant is used for TVersionFixedInfo.FileSubType when TVersionFixedInfo.FileType is VFT_FONT.

See also

TVersionFixedInfo.FileSubType | Additional type information
TVersionFixedInfo.FileType | The type of the file
VFT_FONT | The file is a font


VFT2_UNKNOWN

File subtype is unknown

Declaration

Source position: versionconsts.pp line 56

const VFT2_UNKNOWN = $00000000;

Description

This constant is used for TVersionFixedInfo.FileSubType.

See also

TVersionFixedInfo.FileSubType

Additional type information


VFT_APP

The file is an application

Declaration

Source position: versionconsts.pp line 49

const VFT_APP = $00000001;

Description

This constant is used for TVersionFixedInfo.FileType.

See also

TVersionFixedInfo.FileType

The type of the file


VFT_DLL

The file is a dynamic link library

Declaration

Source position: versionconsts.pp line 50

const VFT_DLL = $00000002;

Description

This constant is used for TVersionFixedInfo.FileType.

See also

TVersionFixedInfo.FileType

The type of the file


VFT_DRV

The file is a device driver

Declaration

Source position: versionconsts.pp line 51

const VFT_DRV = $00000003;

Description

This constant is used for TVersionFixedInfo.FileType.

The device driver type is specified in TVersionFixedInfo.FileSubType.

See also

TVersionFixedInfo.FileType | The type of the file
TVersionFixedInfo.FileSubType | Additional type information


VFT_FONT

The file is a font

Declaration

Source position: versionconsts.pp line 52

const VFT_FONT = $00000004;

Description

This constant is used for TVersionFixedInfo.FileType.

The font driver type is specified in TVersionFixedInfo.FileSubType.

See also

TVersionFixedInfo.FileType | The type of the file
TVersionFixedInfo.FileSubType | Additional type information


VFT_STATIC_LIB

The file is a static link library

Declaration

Source position: versionconsts.pp line 54

const VFT_STATIC_LIB = $00000007;

Description

This constant is used for TVersionFixedInfo.FileType.

See also

TVersionFixedInfo.FileType

The type of the file


VFT_UNKNOWN

File type is unknown

Declaration

Source position: versionconsts.pp line 48

const VFT_UNKNOWN = $00000000;

Description

This constant is used for TVersionFixedInfo.FileType.

See also

TVersionFixedInfo.FileType

The type of the file


VFT_VXD

The file is a virtual device

Declaration

Source position: versionconsts.pp line 53

const VFT_VXD = $00000005;

Description

This constant is used for TVersionFixedInfo.FileType.

See also

TVersionFixedInfo.FileType

The type of the file


VOS__BASE

No subsystem specified

Declaration

Source position: versionconsts.pp line 37

const VOS__BASE = $00000000;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS

The operating system the file was designed to run on


VOS__PM16

This file was designed for 16-bit Presentation Manager

Declaration

Source position: versionconsts.pp line 39

const VOS__PM16 = $00000002;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS_OS216 | This file was designed for 16 bit OS/2
VOS_OS216_PM16 | This file was designed for 16-bit Presentation Manager on 16-bit OS/2


VOS__PM32

This file was designed for 32-bit Presentation Manager

Declaration

Source position: versionconsts.pp line 40

const VOS__PM32 = $00000003;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS_OS232 | This file was designed for 32 bit OS/2
VOS_OS232_PM32 | This file was designed for 32-bit Presentation Manager on 32-bit OS/2


VOS__WINDOWS16

This file was designed for 16-bit Windows

Declaration

Source position: versionconsts.pp line 38

const VOS__WINDOWS16 = $00000001;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS_DOS | This file was designed for MS-DOS
VOS_DOS_WINDOWS16 | This file was designed for 16-bit Windows on MS-DOS


VOS__WINDOWS32

This file was designed for 32-bit Windows

Declaration

Source position: versionconsts.pp line 41

const VOS__WINDOWS32 = $00000004;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS_DOS | This file was designed for MS-DOS
VOS_NT | This file was designed for Windows NT
VOS_DOS_WINDOWS32 | This file was designed for 32-bit Windows on MS-DOS
VOS_NT_WINDOWS32 | This file was designed for 32-bit Windows NT


VOS_DOS

This file was designed for MS-DOS

Declaration

Source position: versionconsts.pp line 33

const VOS_DOS = $00010000;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS__WINDOWS16 | This file was designed for 16-bit Windows
VOS__WINDOWS32 | This file was designed for 32-bit Windows
VOS_DOS_WINDOWS16 | This file was designed for 16-bit Windows on MS-DOS
VOS_DOS_WINDOWS32 | This file was designed for 32-bit Windows on MS-DOS


VOS_DOS_WINDOWS16

This file was designed for 16-bit Windows on MS-DOS

Declaration

Source position: versionconsts.pp line 42

const VOS_DOS_WINDOWS16 = $00010001;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS_DOS | This file was designed for MS-DOS
VOS__WINDOWS16 | This file was designed for 16-bit Windows


VOS_DOS_WINDOWS32

This file was designed for 32-bit Windows on MS-DOS

Declaration

Source position: versionconsts.pp line 43

const VOS_DOS_WINDOWS32 = $00010004;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS_DOS | This file was designed for MS-DOS
VOS__WINDOWS32 | This file was designed for 32-bit Windows


VOS_NT

This file was designed for Windows NT

Declaration

Source position: versionconsts.pp line 36

const VOS_NT = $00040000;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS__WINDOWS32 | This file was designed for 32-bit Windows
VOS_NT_WINDOWS32 | This file was designed for 32-bit Windows NT


VOS_NT_WINDOWS32

This file was designed for 32-bit Windows NT

Declaration

Source position: versionconsts.pp line 46

const VOS_NT_WINDOWS32 = $00040004;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS_NT | This file was designed for Windows NT
VOS__WINDOWS32 | This file was designed for 32-bit Windows


VOS_OS216

This file was designed for 16 bit OS/2

Declaration

Source position: versionconsts.pp line 34

const VOS_OS216 = $00020000;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS__PM16 | This file was designed for 16-bit Presentation Manager
VOS_OS216_PM16 | This file was designed for 16-bit Presentation Manager on 16-bit OS/2


VOS_OS216_PM16

This file was designed for 16-bit Presentation Manager on 16-bit OS/2

Declaration

Source position: versionconsts.pp line 44

const VOS_OS216_PM16 = $00020002;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS_OS216 | This file was designed for 16 bit OS/2
VOS__PM16 | This file was designed for 16-bit Presentation Manager


VOS_OS232

This file was designed for 32 bit OS/2

Declaration

Source position: versionconsts.pp line 35

const VOS_OS232 = $00030000;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS__PM32 | This file was designed for 32-bit Presentation Manager
VOS_OS232_PM32 | This file was designed for 32-bit Presentation Manager on 32-bit OS/2


VOS_OS232_PM32

This file was designed for 32-bit Presentation Manager on 32-bit OS/2

Declaration

Source position: versionconsts.pp line 45

const VOS_OS232_PM32 = $00030003;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS | The operating system the file was designed to run on
VOS_OS232 | This file was designed for 32 bit OS/2
VOS__PM32 | This file was designed for 32-bit Presentation Manager


VOS_UNKNOWN

This file was designed to run on an unknown operating system

Declaration

Source position: versionconsts.pp line 32

const VOS_UNKNOWN = $00000000;

Description

This constant is used for TVersionFixedInfo.FileOS.

See also

TVersionFixedInfo.FileOS

The operating system the file was designed to run on


VS_FF_DEBUG

The file contains debugging information

Declaration

Source position: versionconsts.pp line 24

const VS_FF_DEBUG = $00000001;

Description

This constant is used for TVersionFixedInfo.FileFlags.

See also

TVersionFixedInfo.FileFlags

The file flags


VS_FF_INFOINFERRED

This flag should never be used in a resource

Declaration

Source position: versionconsts.pp line 28

const VS_FF_INFOINFERRED = $00000010;

Description

This constant is used for TVersionFixedInfo.FileFlags.

See also

TVersionFixedInfo.FileFlags

The file flags


VS_FF_PATCHED

This file is not the original shipped one

Declaration

Source position: versionconsts.pp line 26

const VS_FF_PATCHED = $00000004;

Description

This constant is used for TVersionFixedInfo.FileFlags.

See also

TVersionFixedInfo.FileFlags

The file flags


VS_FF_PRERELEASE

This file is a development version

Declaration

Source position: versionconsts.pp line 25

const VS_FF_PRERELEASE = $00000002;

Description

This constant is used for TVersionFixedInfo.FileFlags.

See also

TVersionFixedInfo.FileFlags

The file flags


VS_FF_PRIVATEBUILD

This file is a private build

Declaration

Source position: versionconsts.pp line 27

const VS_FF_PRIVATEBUILD = $00000008;

Description

This constant is used for TVersionFixedInfo.FileFlags.

When this flag is set, a TVersionStringTable in TVersionResource.StringFileInfo should contain an item with PrivateBuild as key.

See also

TVersionFixedInfo.FileFlags | The file flags
TVersionStringTable | Version information for a specific language-codepage combination


VS_FF_SPECIALBUILD

This file is a special build of the standard one

Declaration

Source position: versionconsts.pp line 29

const VS_FF_SPECIALBUILD = $00000020;

Description

This constant is used for TVersionFixedInfo.FileFlags.

When this flag is set, a TVersionStringTable in TVersionResource.StringFileInfo should contain an item with SpecialBuild as key.

See also

TVersionFixedInfo.FileFlags | The file flags
TVersionStringTable | Version information for a specific language-codepage combination


VS_FFI_FILEFLAGSMASK

The valid bits for file flags

Declaration

Source position: versionconsts.pp line 30

const VS_FFI_FILEFLAGSMASK = $0000003F;

Description

This constant is used mainly for TVersionFixedInfo.FileFlagsMask to signal which bits are used in TVersionFixedInfo.FileFlags field.

See also

TVersionFixedInfo.FileFlagsMask | Mask for FileFlags
TVersionFixedInfo.FileFlags | The file flags


Reference for unit 'versionresource'

Contains a version information resource type

uses
sysutils,
Classes,
resource, | Contains base classes for resource handling
versiontypes; | Contains classes used by version information resource

Overview

This unit contains TVersionResource, a TAbstractResource descendant specialized in handling resource of type RT_VERSION.

Adding this unit to a program's uses clause registers class TVersionResource for type RT_VERSION with TResourceFactory.


Reference for unit 'versionresource': Types

TVerBlockHeader

This type is internally used


Reference for unit 'versionresource': Classes

TVersionResource

Version information resource type


Index of all identifiers in unit 'versionresource'

T

T

TVerBlockHeader TVersionResource


TVerBlockHeader

This type is internally used

Declaration

Source position: versionresource.pp line 26

type TVerBlockHeader = packed record

  length: Word;

  vallength: Word;

  valtype: Word;

  key: string;

end;

Description

This type is internally used by TVersionResource


Reference for unit 'versiontypes'

Contains classes used by version information resource

uses

  Classes,

  sysutils,

  resource;

Contains base classes for resource handling

Overview

This unit contains classes used by TVersionResource.


Reference for unit 'versiontypes': Resource strings

SVerStrTableNameNotAllowed
'Name ''%s'' is not a valid 8-cipher hex sequence'

SVerStrTableKeyNotFound
'Key ''%s'' not found'

SVerStrTableDuplicateKey
'Duplicate key ''%s'''


Reference for unit 'versiontypes': Types

PVerTranslationInfo | Pointer to a TVerTranslationInfo
TFileProductVersion | File or Product version type
TVerTranslationInfo | A language - codepage pair


Reference for unit 'versiontypes': Classes

EDuplicateKeyException | Duplicate key error
EKeyNotFoundException | Key not found error
ENameNotAllowedException | String table name not allowed error
EVersionStringTableException | Base class for version string table - related exceptions
TVersionFixedInfo | Language independent part of version information
TVersionStringFileInfo | Language dependent part of version information
TVersionStringTable | Version information for a specific language-codepage combination
TVersionVarFileInfo | List of supported languages


Index of all identifiers in unit 'versiontypes'

E P S T

E

EDuplicateKeyException | ENameNotAllowedException
EKeyNotFoundException | EVersionStringTableException

P

PVerTranslationInfo

S

SVerStrTableDuplicateKey SVerStrTableKeyNotFound SVerStrTableNameNotAllowed

T

TFileProductVersion | TVersionStringFileInfo | TVersionVarFileInfo
TVersionFixedInfo | TVersionStringTable | TVerTranslationInfo


PVerTranslationInfo

Pointer to a TVerTranslationInfo

Declaration

Source position: versiontypes.pp line 43

type PVerTranslationInfo = ^TVerTranslationInfo;

See also

TVerTranslationInfo

A language - codepage pair


TFileProductVersion

File or Product version type

Declaration

Source position: versiontypes.pp line 37

type TFileProductVersion = array [0..3] of Word;

Description

This type is a 4-element array of words that is used to represent a file or product version.

Major version number is stored in the lowest word

Example

Product version 4.2.1.1200 can be represented this way

const
  myver : TFileProductVersion = (4,2,1,1200);


TVerTranslationInfo

A language - codepage pair

Declaration

Source position: versiontypes.pp line 39

type TVerTranslationInfo = packed record
language: Word; | The language id
codepage: Word; | The codepage
end;

Description

This record represents a language id - codepage pair that is used by TVersionVarFileInfo.

See also

TVersionVarFileInfo

List of supported languages


Reference for unit 'winpeimagereader'

Contains a resource reader for PE image files

uses
Classes,
sysutils,
resource, | Contains base classes for resource handling
coffreader; | Contains a resource reader for COFF files

Overview

This unit contains TWinPEImageResourceReader, a TAbstractResourceReader descendant that is able to read Microsoft Windows PE image files (executables, dynamic link libraries and so on).

Adding this unit to a program's uses clause registers class TWinPEImageResourceReader with TResources.


Reference for unit 'winpeimagereader': Classes

TWinPEImageResourceReader

PE image file resource reader


Index of all identifiers in unit 'winpeimagereader'

T

T

TWinPEImageResourceReader