



Free  Pascal  Resource  support  (FCL-res):

Reference  guide.

==============================================================================================================================

                                                                     Reference guide for FCL-res units.

                                                                                         Document version 2.6

                                                                                                   November 2015



Giulio Bernardi
______________________________________________________________________________________________________________________________




Contents



     0.1    Introduction       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  .    20

     0.2    Basic Usage        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  .    20

     0.3    How to implement a new resource class                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    26

     0.4    How to implement a new resource reader                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    30

     0.5    How to implement a new resource writer                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    36

     0.6    Format of resources in object files             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    39


1    Reference for unit 'acceleratorsresource'                                                                            43

     1.1    Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  .    43

     1.2    Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  .    43

     1.3    Constants, types and variables               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    43

            1.3.1     Constants       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  .    43

            1.3.2     Types      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    44

     1.4    TAcceleratorsResource            .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .    44

            1.4.1     Description       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    44

            1.4.2     Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .    45

            1.4.3     Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    45

            1.4.4     TAcceleratorsResource.GetType                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    45

            1.4.5     TAcceleratorsResource.GetName                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    45

            1.4.6     TAcceleratorsResource.ChangeDescTypeAllowed                           .  .  .  .  .  .  .  .  .  .  .  .    45

            1.4.7     TAcceleratorsResource.ChangeDescValueAllowed                          .  .  .  .  .  .  .  .  .  .  .  .    45

            1.4.8     TAcceleratorsResource.NotifyResourcesLoaded                        .  .  .  .  .  .  .  .  .  .  .  .  .    46

            1.4.9     TAcceleratorsResource.Create               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    46

            1.4.10    TAcceleratorsResource.Destroy                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    46

            1.4.11    TAcceleratorsResource.UpdateRawData                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 46

            1.4.12    TAcceleratorsResource.Add               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    46

            1.4.13    TAcceleratorsResource.Clear                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    46

            1.4.14    TAcceleratorsResource.Delete               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    46

            1.4.15    TAcceleratorsResource.Count                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    47

            1.4.16    TAcceleratorsResource.Items                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    47


2    Reference for unit 'bitmapresource'                                                                                  48



                                                              1

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



    2.1    Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    48

    2.2    Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    48

    2.3    TBitmapResource              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    48

           2.3.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    48

           2.3.2     Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    49

           2.3.3     Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    49

           2.3.4     TBitmapResource.GetType                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    49

           2.3.5     TBitmapResource.GetName                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    49

           2.3.6     TBitmapResource.ChangeDescTypeAllowed                          .  .  .  .  .  .  .  .  .  .  .  .  .  .  .    *
 *49

           2.3.7     TBitmapResource.ChangeDescValueAllowed                         .  .  .  .  .  .  .  .  .  .  .  .  .  .  .    *
 *49

           2.3.8     TBitmapResource.NotifyResourcesLoaded                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .    *
 *49

           2.3.9     TBitmapResource.Create                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    50

           2.3.10    TBitmapResource.Destroy               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    50

           2.3.11    TBitmapResource.UpdateRawData                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  50

           2.3.12    TBitmapResource.SetCustomBitmapDataStream                             .  .  .  .  .  .  .  .  .  .  .  .    50

           2.3.13    TBitmapResource.BitmapData                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   51


3    Reference for unit 'coffreader'                                                                                      52

    3.1    Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    52

    3.2    Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    52

    3.3    TCoffResourceReader              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    52

           3.3.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    52

           3.3.2     Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    53

           3.3.3     Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    53

           3.3.4     TCoffResourceReader.GetExtensions                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  53

           3.3.5     TCoffResourceReader.GetDescription                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 53

           3.3.6     TCoffResourceReader.Load                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    53

           3.3.7     TCoffResourceReader.CheckMagic                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  53

           3.3.8     TCoffResourceReader.Create                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    53

           3.3.9     TCoffResourceReader.Destroy                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    53

           3.3.10    TCoffResourceReader.MachineType                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  54


4    Reference for unit 'cofftypes'                                                                                       55

    4.1    Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    55

    4.2    Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    55

           4.2.1     Constants       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    55

           4.2.2     Types      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  .    55


5    Reference for unit 'coffwriter'                                                                                      58

    5.1    Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    58

    5.2    Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    58



                                                                  2

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



    5.3    Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    58

           5.3.1     Types      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  .    58

    5.4    TCoffRelocations          .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    59

           5.4.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    59

           5.4.2     Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    59

           5.4.3     Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    59

           5.4.4     TCoffRelocations.GetCount                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    59

           5.4.5     TCoffRelocations.GetRelocation                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   59

           5.4.6     TCoffRelocations.Create             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    59

           5.4.7     TCoffRelocations.Destroy              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    59

           5.4.8     TCoffRelocations.Add             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    60

           5.4.9     TCoffRelocations.AddRelativeToSection                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 60

           5.4.10    TCoffRelocations.Clear              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    60

           5.4.11    TCoffRelocations.Count              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    60

           5.4.12    TCoffRelocations.Items              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    60

           5.4.13    TCoffRelocations.StartAddress                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   60

           5.4.14    TCoffRelocations.MachineType                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   60

    5.5    TCoffResourceWriter            .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .    61

           5.5.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    61

           5.5.2     Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    61

           5.5.3     Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    61

           5.5.4     TCoffResourceWriter.WriteEmptyCoffHeader                         .  .  .  .  .  .  .  .  .  .  .  .  .  .    61

           5.5.5     TCoffResourceWriter.WriteEmptySectionHeader                           .  .  .  .  .  .  .  .  .  .  .  .    61

           5.5.6     TCoffResourceWriter.WriteResStringTable                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .    *
 *62

           5.5.7     TCoffResourceWriter.WriteRawData                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  62

           5.5.8     TCoffResourceWriter.WriteRelocations                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 62

           5.5.9     TCoffResourceWriter.WriteCoffStringTable                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .    *
 *62

           5.5.10    TCoffResourceWriter.GetFixedCoffHeader                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .    *
 *62

           5.5.11    TCoffResourceWriter.FixCoffHeader                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  62

           5.5.12    TCoffResourceWriter.FixSectionHeader                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 62

           5.5.13    TCoffResourceWriter.GetExtensions                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  62

           5.5.14    TCoffResourceWriter.GetDescription                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  62

           5.5.15    TCoffResourceWriter.PrescanNode                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  63

           5.5.16    TCoffResourceWriter.PrescanResourceTree                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .    *
 *63

           5.5.17    TCoffResourceWriter.Write                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    63

           5.5.18    TCoffResourceWriter.WriteSymbolTable                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 63

           5.5.19    TCoffResourceWriter.Create                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    63

           5.5.20    TCoffResourceWriter.Destroy                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    63

           5.5.21    TCoffResourceWriter.MachineType                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  63

           5.5.22    TCoffResourceWriter.OppositeEndianess                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 64



                                                                  3

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



    5.6    TCoffStringTable          .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    64

           5.6.1     Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    64

           5.6.2     Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    64

           5.6.3     TCoffStringTable.Create             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    64

           5.6.4     TCoffStringTable.Add             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    64

           5.6.5     TCoffStringTable.Delete             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    64

           5.6.6     TCoffStringTable.Size            .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    64

    5.7    TResourceStringTable             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    64

           5.7.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    64

           5.7.2     Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    65

           5.7.3     Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    65

           5.7.4     TResourceStringTable.Create                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    65

           5.7.5     TResourceStringTable.Destroy                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   65

           5.7.6     TResourceStringTable.Add                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    65

           5.7.7     TResourceStringTable.Clear               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    65

           5.7.8     TResourceStringTable.Count                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    65

           5.7.9     TResourceStringTable.Items               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    65

           5.7.10    TResourceStringTable.StartRVA                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   66

           5.7.11    TResourceStringTable.CurrRVA                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   66

           5.7.12    TResourceStringTable.EndRVA                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   66


6    Reference for unit 'dfmreader'                                                                                       67

    6.1    Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    67

    6.2    Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    67

    6.3    TDfmResourceReader               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    67

           6.3.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    67

           6.3.2     Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    68

           6.3.3     TDfmResourceReader.GetExtensions                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  68

           6.3.4     TDfmResourceReader.GetDescription                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 68

           6.3.5     TDfmResourceReader.Load                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    68

           6.3.6     TDfmResourceReader.CheckMagic                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  68

           6.3.7     TDfmResourceReader.Create                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    68

           6.3.8     TDfmResourceReader.Destroy                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   68


7    Reference for unit 'elfconsts'                                                                                       69

    7.1    Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    69

    7.2    Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    69

           7.2.1     Constants       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    69

           7.2.2     Types      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  .    74


8    Reference for unit 'elfreader'                                                                                       75



                                                                  4

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



    8.1    Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    75

    8.2    Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    75

    8.3    EElfResourceReaderException                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    75

           8.3.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    75

    8.4    EElfResourceReaderNoSectionsException                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  75

           8.4.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    75

    8.5    EElfResourceReaderNoStringTableException                         .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 76

           8.5.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    76

    8.6    EElfResourceReaderUnknownClassException                          .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 76

           8.6.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    76

    8.7    EElfResourceReaderUnknownVersionException                           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 76

           8.7.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    76

    8.8    TElfResourceReader             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .    76

           8.8.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    76

           8.8.2     Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    76

           8.8.3     Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    76

           8.8.4     TElfResourceReader.GetExtensions                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  77

           8.8.5     TElfResourceReader.GetDescription                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  77

           8.8.6     TElfResourceReader.Load               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    77

           8.8.7     TElfResourceReader.CheckMagic                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   77

           8.8.8     TElfResourceReader.Create                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    77

           8.8.9     TElfResourceReader.Destroy                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    77

           8.8.10    TElfResourceReader.MachineType                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  77


9    Reference for unit 'elfwriter'                                                                                       78

    9.1    Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    78

    9.2    Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    78

    9.3    EElfResourceWriterException                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    78

           9.3.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    78

    9.4    EElfResourceWriterUnknownClassException                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  78

           9.4.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    78

    9.5    EElfResourceWriterUnknownMachineException                           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 79

           9.5.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    79

    9.6    EElfResourceWriterUnknownSectionException                           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 79

           9.6.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    79

    9.7    TElfResourceWriter             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .    79

           9.7.1     Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    79

           9.7.2     Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    79

           9.7.3     Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    79

           9.7.4     TElfResourceWriter.GetExtensions                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  79



                                                                  5

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



           9.7.5     TElfResourceWriter.GetDescription                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  80

           9.7.6     TElfResourceWriter.Write              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    80

           9.7.7     TElfResourceWriter.Create                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    80

           9.7.8     TElfResourceWriter.Destroy               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    80

           9.7.9     TElfResourceWriter.MachineType                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  80


10   Reference for unit 'externalreader'                                                                                  81

    10.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    81

    10.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    81

    10.3   TExternalResourceReader               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    81

           10.3.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    81

           10.3.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    82

           10.3.3    Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    82

           10.3.4    TExternalResourceReader.GetExtensions                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .    *
 *82

           10.3.5    TExternalResourceReader.GetDescription                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .    *
 *82

           10.3.6    TExternalResourceReader.Load                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   82

           10.3.7    TExternalResourceReader.CheckMagic                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 82

           10.3.8    TExternalResourceReader.Create                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   82

           10.3.9    TExternalResourceReader.Destroy                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  83

           10.3.10   TExternalResourceReader.Endianess                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  83


11   Reference for unit 'externaltypes'                                                                                   84

    11.1   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    84

    11.2   Description of external resource file format                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  84

    11.3   Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .    87

           11.3.1    Constants       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    87

           11.3.2    Types      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  .    87


12   Reference for unit 'externalwriter'                                                                                  88

    12.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    88

    12.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    88

    12.3   EExternalResInvalidEndianessException                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   88

           12.3.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    88

    12.4   EExternalResourceWriterException                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.    89

           12.4.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    89

    12.5   TExternalResourceWriter               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    89

           12.5.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    89

           12.5.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    89

           12.5.3    Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    89

           12.5.4    TExternalResourceWriter.GetExtensions                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 89

           12.5.5    TExternalResourceWriter.GetDescription                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .    *
 *89



                                                                  6

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



           12.5.6    TExternalResourceWriter.Write                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   90

           12.5.7    TExternalResourceWriter.Create                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   90

           12.5.8    TExternalResourceWriter.Destroy                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  90

           12.5.9    TExternalResourceWriter.Endianess                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  90


13   Reference for unit 'groupcursorresource'                                                                             91

    13.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    91

    13.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    91

    13.3   TGroupCursorResource                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    91

           13.3.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    91

           13.3.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    92

           13.3.3    TGroupCursorResource.ReadResourceItemHeader                             .  .  .  .  .  .  .  .  .  .  .    92

           13.3.4    TGroupCursorResource.WriteHeader                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  92

           13.3.5    TGroupCursorResource.CreateSubItem                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 92

           13.3.6    TGroupCursorResource.UpdateItemOwner                           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .    *
 *92

           13.3.7    TGroupCursorResource.ClearItemList                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 93

           13.3.8    TGroupCursorResource.DeleteSubItems                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 93

           13.3.9    TGroupCursorResource.GetSubStream                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 93

           13.3.10   TGroupCursorResource.GetType                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   93

           13.3.11   TGroupCursorResource.GetName                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  93

           13.3.12   TGroupCursorResource.ChangeDescTypeAllowed                            .  .  .  .  .  .  .  .  .  .  .  .    93

           13.3.13   TGroupCursorResource.ChangeDescValueAllowed                             .  .  .  .  .  .  .  .  .  .  .    93

           13.3.14   TGroupCursorResource.Create                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   93


14   Reference for unit 'groupiconresource'                                                                               94

    14.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    94

    14.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    94

    14.3   TGroupIconResource             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .    94

           14.3.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    94

           14.3.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    95

           14.3.3    TGroupIconResource.ReadResourceItemHeader                          .  .  .  .  .  .  .  .  .  .  .  .  .    95

           14.3.4    TGroupIconResource.WriteHeader                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  95

           14.3.5    TGroupIconResource.CreateSubItem                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  95

           14.3.6    TGroupIconResource.UpdateItemOwner                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 95

           14.3.7    TGroupIconResource.ClearItemList                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  96

           14.3.8    TGroupIconResource.DeleteSubItems                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 96

           14.3.9    TGroupIconResource.GetSubStream                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  96

           14.3.10   TGroupIconResource.GetType                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   96

           14.3.11   TGroupIconResource.GetName                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   96

           14.3.12   TGroupIconResource.ChangeDescTypeAllowed                           .  .  .  .  .  .  .  .  .  .  .  .  .    96

           14.3.13   TGroupIconResource.ChangeDescValueAllowed                          .  .  .  .  .  .  .  .  .  .  .  .  .    96



                                                                  7

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



           14.3.14   TGroupIconResource.Create                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *    96


15   Reference for unit 'groupresource'                                                                                   97

    15.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    97

    15.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .    97

    15.3   TGroupCachedDataStream                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    97

           15.3.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    97

           15.3.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    98

           15.3.3    TGroupCachedDataStream.Create                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  98

           15.3.4    TGroupCachedDataStream.Destroy                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  98

           15.3.5    TGroupCachedDataStream.Read                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   98

    15.4   TGroupResource            .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    98

           15.4.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .    98

           15.4.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .    99

           15.4.3    Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .    99

           15.4.4    TGroupResource.FindSubResources                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *  99

           15.4.5    TGroupResource.ReadResourceItemHeader                          .  .  .  .  .  .  .  .  .  .  .  .  .  .  .    *
 *99

           15.4.6    TGroupResource.CheckBuildItemStream                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .   *
 * 99

           15.4.7    TGroupResource.GetItemData                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 *   99

           15.4.8    TGroupResource.WriteHeader                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 100

           15.4.9    TGroupResource.WriteResHeader                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *100

           15.4.10   TGroupResource.CreateSubItems                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 100

           15.4.11   TGroupResource.CreateSubItem                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 100

           15.4.12   TGroupResource.UpdateItemOwner                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *100

           15.4.13   TGroupResource.ClearItemList                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 100

           15.4.14   TGroupResource.DeleteSubItems                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 100

           15.4.15   TGroupResource.GetSubStreamCount                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *00

           15.4.16   TGroupResource.GetSubStream                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 100

           15.4.17   TGroupResource.SetOwnerList                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 101

           15.4.18   TGroupResource.NotifyResourcesLoaded                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  101

           15.4.19   TGroupResource.Destroy                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  101

           15.4.20   TGroupResource.CompareContents                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *101

           15.4.21   TGroupResource.SetCustomItemDataStream                           .  .  .  .  .  .  .  .  .  .  .  .  .  .  101

           15.4.22   TGroupResource.UpdateRawData                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *102

           15.4.23   TGroupResource.ItemData                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  102


16   Reference for unit 'machoreader'                                                                                   103

    16.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  103

    16.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  103

    16.3   TMachOResourceReader                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  103

           16.3.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  103



                                                                  8

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



           16.3.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  104

           16.3.3    Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  104

           16.3.4    TMachOResourceReader.GetExtensions                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *04

           16.3.5    TMachOResourceReader.GetDescription                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *04

           16.3.6    TMachOResourceReader.Load                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 104

           16.3.7    TMachOResourceReader.CheckMagic                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *04

           16.3.8    TMachOResourceReader.Create                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 104

           16.3.9    TMachOResourceReader.Destroy                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 104

           16.3.10   TMachOResourceReader.MachineType                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *05


17   Reference for unit 'machotypes'                                                                                    106

    17.1   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  106

    17.2   Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  106

           17.2.1    Types      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  .  106


18   Reference for unit 'machowriter'                                                                                   111

    18.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  111

    18.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  111

    18.3   Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  111

           18.3.1    Types      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  .  111

    18.4   EMachOResourceWriterException                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  112

           18.4.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  112

    18.5   EMachOResourceWriterUnknownBitSizeException                              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  112

           18.5.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  112

    18.6   TMachOResourceWriter                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  112

           18.6.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  112

           18.6.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  112

           18.6.3    Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  112

           18.6.4    TMachOResourceWriter.GetExtensions                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *13

           18.6.5    TMachOResourceWriter.GetDescription                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *13

           18.6.6    TMachOResourceWriter.Write                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 113

           18.6.7    TMachOResourceWriter.Create                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 113

           18.6.8    TMachOResourceWriter.Destroy                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 113

           18.6.9    TMachOResourceWriter.MachineType                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *13

           18.6.10   TMachOResourceWriter.SubMachineType                         .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  113


19   Reference for unit 'resdatastream'                                                                                 114

    19.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  114

    19.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  114

    19.3   Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  114

           19.3.1    Types      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  .  114



                                                                  9

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



    19.4   TCachedDataStream              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  115

           19.4.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  115

           19.4.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  115

           19.4.3    TCachedDataStream.GetPosition                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 115

           19.4.4    TCachedDataStream.SetPosition                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 115

           19.4.5    TCachedDataStream.GetSize                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  116

           19.4.6    TCachedDataStream.SetSize64                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 116

           19.4.7    TCachedDataStream.Create                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  116

           19.4.8    TCachedDataStream.Write                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  116

           19.4.9    TCachedDataStream.Seek                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  116

    19.5   TCachedResourceDataStream                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  116

           19.5.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  116

           19.5.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  116

           19.5.3    TCachedResourceDataStream.Create                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *117

           19.5.4    TCachedResourceDataStream.Read                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *117

    19.6   TResourceDataStream              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  117

           19.6.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  117

           19.6.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  118

           19.6.3    Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  118

           19.6.4    TResourceDataStream.GetPosition                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *118

           19.6.5    TResourceDataStream.SetPosition                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *118

           19.6.6    TResourceDataStream.GetSize                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 118

           19.6.7    TResourceDataStream.SetSize64                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 118

           19.6.8    TResourceDataStream.Create                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  118

           19.6.9    TResourceDataStream.Destroy                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 119

           19.6.10   TResourceDataStream.Compare                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 119

           19.6.11   TResourceDataStream.SetCustomStream                         .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  119

           19.6.12   TResourceDataStream.Read                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  119

           19.6.13   TResourceDataStream.Write                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  119

           19.6.14   TResourceDataStream.Seek                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  120

           19.6.15   TResourceDataStream.Cached                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 120


20   Reference for unit 'resfactory'                                                                                    121

    20.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  121

    20.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  121

    20.3   Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  121

           20.3.1    Resource strings          .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  121

    20.4   EResourceClassAlreadyRegisteredException                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *121

           20.4.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  121

    20.5   EResourceFactoryException                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  122



                                                                 10

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



           20.5.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  122

    20.6   TResourceFactory             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  122

           20.6.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  122

           20.6.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  122

           20.6.3    TResourceFactory.RegisterResourceClass                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  122

           20.6.4    TResourceFactory.CreateResource                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *123


21   Reference for unit 'resource'                                                                                      124

    21.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  124

    21.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  124

    21.3   Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  124

           21.3.1    Resource strings          .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  124

           21.3.2    Constants       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  125

           21.3.3    Types      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  .  127

    21.4   ENoMoreFreeIDsException                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  128

           21.4.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  128

    21.5   EResourceDescChangeNotAllowedException                         .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *128

           21.5.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  128

    21.6   EResourceDescTypeException                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  128

           21.6.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  128

    21.7   EResourceDuplicateException                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  129

           21.7.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  129

    21.8   EResourceException             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  129

           21.8.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  129

    21.9   EResourceLangIDChangeNotAllowedException                            .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *29

           21.9.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  129

    21.10  EResourceNotFoundException                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  129

           21.10.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  129

    21.11  EResourceReaderException                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  129

           21.11.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  129

    21.12  EResourceReaderNotFoundException                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  129

           21.12.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  129

    21.13  EResourceReaderUnexpectedEndOfStreamException                              .  .  .  .  .  .  .  .  .  .  .  .  .  .  130

           21.13.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  130

    21.14  EResourceReaderWrongFormatException                         .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *130

           21.14.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  130

    21.15  EResourceWriterException                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  130

           21.15.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  130

    21.16  EResourceWriterNotFoundException                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  130

           21.16.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  130



                                                                 11

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



    21.17  TAbstractResource            .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  130

           21.17.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  130

           21.17.2   Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  131

           21.17.3   Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  132

           21.17.4   TAbstractResource.SetDescOwner                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *132

           21.17.5   TAbstractResource.SetOwnerList                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 132

           21.17.6   TAbstractResource.SetChildOwner                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *132

           21.17.7   TAbstractResource.GetType                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  132

           21.17.8   TAbstractResource.GetName                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  133

           21.17.9   TAbstractResource.ChangeDescTypeAllowed                          .  .  .  .  .  .  .  .  .  .  .  .  .  .  133

           21.17.10  TAbstractResource.ChangeDescValueAllowed                         .  .  .  .  .  .  .  .  .  .  .  .  .  .  133

           21.17.11  TAbstractResource.NotifyResourcesLoaded                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  134

           21.17.12  TAbstractResource.Create              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  134

           21.17.13  TAbstractResource.Destroy                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  134

           21.17.14  TAbstractResource.CompareContents                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *34

           21.17.15  TAbstractResource.UpdateRawData                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *135

           21.17.16  TAbstractResource.SetCustomRawDataStream                           .  .  .  .  .  .  .  .  .  .  .  .  .  135

           21.17.17  TAbstractResource._Type               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  136

           21.17.18  TAbstractResource.Name                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  136

           21.17.19  TAbstractResource.LangID                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  136

           21.17.20  TAbstractResource.DataSize                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  137

           21.17.21  TAbstractResource.HeaderSize                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 137

           21.17.22  TAbstractResource.DataVersion                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 137

           21.17.23  TAbstractResource.MemoryFlags                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 137

           21.17.24  TAbstractResource.Version                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  138

           21.17.25  TAbstractResource.Characteristics                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *138

           21.17.26  TAbstractResource.DataOffset                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 138

           21.17.27  TAbstractResource.CodePage                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  139

           21.17.28  TAbstractResource.RawData                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  139

           21.17.29  TAbstractResource.CacheData                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 139

           21.17.30  TAbstractResource.OwnerList                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  140

           21.17.31  TAbstractResource.Owner               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  140

    21.18  TAbstractResourceReader               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  140

           21.18.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  140

           21.18.2   Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  141

           21.18.3   Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  141

           21.18.4   TAbstractResourceReader.SetDataSize                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *41

           21.18.5   TAbstractResourceReader.SetHeaderSize                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  141

           21.18.6   TAbstractResourceReader.SetDataOffset                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *42

           21.18.7   TAbstractResourceReader.SetRawData                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *42



                                                                 12

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



           21.18.8   TAbstractResourceReader.CallSubReaderLoad                          .  .  .  .  .  .  .  .  .  .  .  .  .  142

           21.18.9   TAbstractResourceReader.AddNoTree                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *42

           21.18.10  TAbstractResourceReader.GetTree                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *143

           21.18.11  TAbstractResourceReader.GetExtensions                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  143

           21.18.12  TAbstractResourceReader.GetDescription                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  143

           21.18.13  TAbstractResourceReader.Load                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 143

           21.18.14  TAbstractResourceReader.CheckMagic                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *44

           21.18.15  TAbstractResourceReader.Create                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 144

           21.18.16  TAbstractResourceReader.Extensions                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *45

           21.18.17  TAbstractResourceReader.Description                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *45

    21.19  TAbstractResourceWriter               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  145

           21.19.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  145

           21.19.2   Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  145

           21.19.3   Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  146

           21.19.4   TAbstractResourceWriter.GetTree                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *146

           21.19.5   TAbstractResourceWriter.GetExtensions                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *46

           21.19.6   TAbstractResourceWriter.GetDescription                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  146

           21.19.7   TAbstractResourceWriter.Write                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 146

           21.19.8   TAbstractResourceWriter.Create                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 147

           21.19.9   TAbstractResourceWriter.Extensions                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *147

           21.19.10  TAbstractResourceWriter.Description                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *47

    21.20  TGenericResource             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  147

           21.20.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  147

           21.20.2   Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  148

           21.20.3   TGenericResource.GetType                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  148

           21.20.4   TGenericResource.GetName                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  148

           21.20.5   TGenericResource.ChangeDescTypeAllowed                         .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  148

           21.20.6   TGenericResource.ChangeDescValueAllowed                          .  .  .  .  .  .  .  .  .  .  .  .  .  .  148

           21.20.7   TGenericResource.NotifyResourcesLoaded                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  148

           21.20.8   TGenericResource.Create               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  148

           21.20.9   TGenericResource.Destroy              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  149

           21.20.10  TGenericResource.UpdateRawData                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *149

    21.21  TResourceDesc           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  .  149

           21.21.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  149

           21.21.2   Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  149

           21.21.3   Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  149

           21.21.4   TResourceDesc.SetOwner                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  149

           21.21.5   TResourceDesc.Create             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  150

           21.21.6   TResourceDesc.Assign             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  150

           21.21.7   TResourceDesc.Equals             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  150



                                                                 13

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



           21.21.8   TResourceDesc.Name               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  150

           21.21.9   TResourceDesc.ID            .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  151

           21.21.10  TResourceDesc.DescType                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  151

    21.22  TResources         .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  151

           21.22.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  151

           21.22.2   Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  152

           21.22.3   Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  152

           21.22.4   TResources.Create           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  152

           21.22.5   TResources.Destroy             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  152

           21.22.6   TResources.Add            .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  152

           21.22.7   TResources.AddAutoID                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  153

           21.22.8   TResources.Clear          .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  153

           21.22.9   TResources.Find           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  153

           21.22.10  TResources.FindReader               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  154

           21.22.11  TResources.MoveFrom              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  154

           21.22.12  TResources.Remove              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  154

           21.22.13  TResources.LoadFromStream                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  155

           21.22.14  TResources.LoadFromFile               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  155

           21.22.15  TResources.RegisterReader                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  156

           21.22.16  TResources.RegisterWriter                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  156

           21.22.17  TResources.WriteToStream                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  157

           21.22.18  TResources.WriteToFile              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  157

           21.22.19  TResources.Count            .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  157

           21.22.20  TResources.Items          .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  158

           21.22.21  TResources.CacheData             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  158


22   Reference for unit 'resourcetree'                                                                                  159

    22.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  159

    22.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  159

    22.3   TResourceTreeNode              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  159

           22.3.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  159

           22.3.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  160

           22.3.3    Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  160

           22.3.4    TResourceTreeNode.GetNamedCount                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *60

           22.3.5    TResourceTreeNode.GetNamedEntry                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *160

           22.3.6    TResourceTreeNode.GetIDCount                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 160

           22.3.7    TResourceTreeNode.GetIDEntry                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 161

           22.3.8    TResourceTreeNode.GetData                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  161

           22.3.9    TResourceTreeNode.InternalFind                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 161

           22.3.10   TResourceTreeNode.Create                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  161



                                                                 14

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



           22.3.11   TResourceTreeNode.Destroy                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  161

           22.3.12   TResourceTreeNode.Add                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  161

           22.3.13   TResourceTreeNode.CreateSubNode                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *162

           22.3.14   TResourceTreeNode.CreateResource                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *162

           22.3.15   TResourceTreeNode.Clear               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  162

           22.3.16   TResourceTreeNode.Remove                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  162

           22.3.17   TResourceTreeNode.Find                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  163

           22.3.18   TResourceTreeNode.FindFreeID                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 163

           22.3.19   TResourceTreeNode.IsLeaf                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  163

           22.3.20   TResourceTreeNode.Parent                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  163

           22.3.21   TResourceTreeNode.Desc                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  164

           22.3.22   TResourceTreeNode.NamedCount                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *164

           22.3.23   TResourceTreeNode.NamedEntries                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *164

           22.3.24   TResourceTreeNode.IDCount                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  164

           22.3.25   TResourceTreeNode.IDEntries                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 165

           22.3.26   TResourceTreeNode.NameRVA                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 165

           22.3.27   TResourceTreeNode.SubDirRVA                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 165

           22.3.28   TResourceTreeNode.DataRVA                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 166

           22.3.29   TResourceTreeNode.Data                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  166

    22.4   TRootResTreeNode               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  166

           22.4.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  166

           22.4.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  166

           22.4.3    TRootResTreeNode.InternalFind                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 167

           22.4.4    TRootResTreeNode.Create                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  167

           22.4.5    TRootResTreeNode.CreateSubNode                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *167

           22.4.6    TRootResTreeNode.Add                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  167

           22.4.7    TRootResTreeNode.FindFreeID                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 167


23   Reference for unit 'resreader'                                                                                     168

    23.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  168

    23.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  168

    23.3   TResResourceReader             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  168

           23.3.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  168

           23.3.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  169

           23.3.3    TResResourceReader.GetExtensions                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *169

           23.3.4    TResResourceReader.GetDescription                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *169

           23.3.5    TResResourceReader.Load                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  169

           23.3.6    TResResourceReader.CheckMagic                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *169

           23.3.7    TResResourceReader.Create                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  169

           23.3.8    TResResourceReader.Destroy                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  169



                                                                 15

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



24   Reference for unit 'reswriter'                                                                                     170

    24.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  170

    24.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  170

    24.3   TResResourceWriter             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  170

           24.3.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  170

           24.3.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  171

           24.3.3    TResResourceWriter.GetExtensions                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *171

           24.3.4    TResResourceWriter.GetDescription                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *171

           24.3.5    TResResourceWriter.Write                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  171

           24.3.6    TResResourceWriter.Create                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  171


25   Reference for unit 'stringtableresource'                                                                           172

    25.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  172

    25.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  172

    25.3   Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  172

           25.3.1    Resource strings          .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  172

    25.4   EStringTableIndexOutOfBoundsException                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *173

           25.4.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  173

    25.5   EStringTableNameNotAllowedException                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 173

           25.5.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  173

    25.6   EStringTableResourceException                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  173

           25.6.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  173

    25.7   TStringTableResource             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  173

           25.7.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  173

           25.7.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  174

           25.7.3    Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  174

           25.7.4    TStringTableResource.GetType                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 174

           25.7.5    TStringTableResource.GetName                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 174

           25.7.6    TStringTableResource.ChangeDescTypeAllowed                            .  .  .  .  .  .  .  .  .  .  .  .  174

           25.7.7    TStringTableResource.ChangeDescValueAllowed                           .  .  .  .  .  .  .  .  .  .  .  .  174

           25.7.8    TStringTableResource.NotifyResourcesLoaded                         .  .  .  .  .  .  .  .  .  .  .  .  .  174

           25.7.9    TStringTableResource.Create                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  175

           25.7.10   TStringTableResource.Destroy                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 175

           25.7.11   TStringTableResource.UpdateRawData                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  1*
 *75

           25.7.12   TStringTableResource.FirstID                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 175

           25.7.13   TStringTableResource.LastID                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  176

           25.7.14   TStringTableResource.Count                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  176

           25.7.15   TStringTableResource.Strings               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  176


26   Reference for unit 'versionconsts'                                                                                 177

    26.1   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  177



                                                                 16

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



    26.2   Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  179

           26.2.1    Constants       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  179


27   Reference for unit 'versionresource'                                                                               183

    27.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  183

    27.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  183

    27.3   Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  183

           27.3.1    Types      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  .  183

    27.4   TVersionResource          .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  184

           27.4.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  184

           27.4.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  185

           27.4.3    Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  185

           27.4.4    TVersionResource.GetType                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  185

           27.4.5    TVersionResource.GetName                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  185

           27.4.6    TVersionResource.ChangeDescTypeAllowed                         .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  185

           27.4.7    TVersionResource.ChangeDescValueAllowed                        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  185

           27.4.8    TVersionResource.NotifyResourcesLoaded                      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  186

           27.4.9    TVersionResource.Create               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  186

           27.4.10   TVersionResource.Destroy              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  186

           27.4.11   TVersionResource.UpdateRawData                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *186

           27.4.12   TVersionResource.FixedInfo               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  186

           27.4.13   TVersionResource.StringFileInfo                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 186

           27.4.14   TVersionResource.VarFileInfo               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  187


28   Reference for unit 'versiontypes'                                                                                  188

    28.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  188

    28.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  188

    28.3   Constants, types and variables                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  188

           28.3.1    Resource strings          .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  188

           28.3.2    Types      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  .  188

    28.4   EDuplicateKeyException                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  189

           28.4.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  189

    28.5   EKeyNotFoundException                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  189

           28.5.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  189

    28.6   ENameNotAllowedException                   .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  189

           28.6.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  189

    28.7   EVersionStringTableException                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  189

           28.7.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  189

    28.8   TVersionFixedInfo            .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  190

           28.8.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  190

           28.8.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  190



                                                                 17

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



           28.8.3    Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  190

           28.8.4    TVersionFixedInfo.Create              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  190

           28.8.5    TVersionFixedInfo.FileVersion                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 190

           28.8.6    TVersionFixedInfo.ProductVersion                  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *190

           28.8.7    TVersionFixedInfo.FileFlagsMask                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 191

           28.8.8    TVersionFixedInfo.FileFlags              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  191

           28.8.9    TVersionFixedInfo.FileOS              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  191

           28.8.10   TVersionFixedInfo.FileType               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  192

           28.8.11   TVersionFixedInfo.FileSubType                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 192

           28.8.12   TVersionFixedInfo.FileDate               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  193

    28.9   TVersionStringFileInfo           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  193

           28.9.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  193

           28.9.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  193

           28.9.3    Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  194

           28.9.4    TVersionStringFileInfo.GetCount                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 194

           28.9.5    TVersionStringFileInfo.GetItem               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 194

           28.9.6    TVersionStringFileInfo.SetItem               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 194

           28.9.7    TVersionStringFileInfo.Create              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  194

           28.9.8    TVersionStringFileInfo.Destroy               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 194

           28.9.9    TVersionStringFileInfo.Add               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  194

           28.9.10   TVersionStringFileInfo.Clear               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  195

           28.9.11   TVersionStringFileInfo.Delete              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  195

           28.9.12   TVersionStringFileInfo.Count               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  195

           28.9.13   TVersionStringFileInfo.Items               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  195

    28.10  TVersionStringTable            .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  196

           28.10.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  196

           28.10.2   Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  196

           28.10.3   Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  196

           28.10.4   TVersionStringTable.Create               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  197

           28.10.5   TVersionStringTable.Destroy                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  197

           28.10.6   TVersionStringTable.Add               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  197

           28.10.7   TVersionStringTable.Clear             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  198

           28.10.8   TVersionStringTable.Delete               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  198

           28.10.9   TVersionStringTable.Name                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  198

           28.10.10  TVersionStringTable.Count                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  198

           28.10.11  TVersionStringTable.Keys              .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  199

           28.10.12  TVersionStringTable.ValuesByIndex                    .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *199

           28.10.13  TVersionStringTable.Values               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  199

    28.11  TVersionVarFileInfo            .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  200

           28.11.1   Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  200



                                                                 18

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



           28.11.2   Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  200

           28.11.3   Property overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  200

           28.11.4   TVersionVarFileInfo.GetCount                 .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * 200

           28.11.5   TVersionVarFileInfo.GetItem                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  200

           28.11.6   TVersionVarFileInfo.SetItem                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  200

           28.11.7   TVersionVarFileInfo.Create               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  200

           28.11.8   TVersionVarFileInfo.Destroy                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  201

           28.11.9   TVersionVarFileInfo.Add               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  201

           28.11.10  TVersionVarFileInfo.Clear             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  201

           28.11.11  TVersionVarFileInfo.Delete               .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  201

           28.11.12  TVersionVarFileInfo.Count                .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  201

           28.11.13  TVersionVarFileInfo.Items             .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  202


29   Reference for unit 'winpeimagereader'                                                                              203

    29.1   Used units      .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  203

    29.2   Overview        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  .  .  203

    29.3   TWinPEImageResourceReader                     .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  . *
 * .  203

           29.3.1    Description        .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .*
 *  .  .  203

           29.3.2    Method overview           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *.  .  204

           29.3.3    TWinPEImageResourceReader.CheckDosStub                             .  .  .  .  .  .  .  .  .  .  .  .  .  204

           29.3.4    TWinPEImageResourceReader.CheckPESignature                              .  .  .  .  .  .  .  .  .  .  .  204

           29.3.5    TWinPEImageResourceReader.GetExtensions                          .  .  .  .  .  .  .  .  .  .  .  .  .  .  204

           29.3.6    TWinPEImageResourceReader.GetDescription                           .  .  .  .  .  .  .  .  .  .  .  .  .  204

           29.3.7    TWinPEImageResourceReader.Load                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  *
 *204

           29.3.8    TWinPEImageResourceReader.CheckMagic                           .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  204

           29.3.9    TWinPEImageResourceReader.Create                       .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  2*
 *04

           29.3.10   TWinPEImageResourceReader.Destroy                         .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  2*
 *05



                                                                 19

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



About  this  guide


This document describes all constants, types, variables, functions and procedures as they are
declared in the units that come standard with the FCL-res (Free Pascal Resource support).

Throughout this document, we will refer to functions, types and variables with typewriter
font.  Functions and procedures gave their own subsections, and for each function or proce-
dure we have the following topics:


Declaration        The exact declaration of the function.

Description        What does the procedure exactly do ?

Errors     What errors can occur.

See Also       Cross references to other related functions/commands.



0.1         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.



0.2         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 TAbstractRe-
sourceWriter (??  ).

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.



                                                                 20

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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);



                                                                 21

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



   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  (win-
peimagereader (??  ), 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.



                                                                 22

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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;



                                                                 23

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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.



                                                                 24

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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 SetCustom-
RawDataStream (??  ) 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 TGroupRe-
source.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.  TVersion-
Resource (??  ) 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



                                                                 25

               ____________________________________________________________________________________________________________________*
 *CONTENTS__________



               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
               (??  ).



               0.3         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 re-
               source  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 Ex-
               plorer, respectively.

               Using this kind of resources in a cross-platform perspective doesn't make much sense how-
               ever, 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  run-
               time  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



                                                                                26

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



   TAccelerator  =  packed  record
      Flags  :  word;
      Ansi  :  word;
      Id  :  word;
      padding  :  word;
   end;


The resource simply contains accelerators, one immediately following the other.  Last accel-
erator 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 TAbstractRe-
source (??  ):


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 TRe-
sourceDesc  (??  ).  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  con-
structor 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;



                                                                 27

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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  re-
sources.  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



                                                                 28

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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 what-
ever  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



                                                                 29

               ____________________________________________________________________________________________________________________*
 *CONTENTS__________



                     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.



               0.4         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.



                                                                                30

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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.



                                                                 31

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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



                                                                 32

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



(??  ):  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 EResourceReaderUnexpectedEndOfStreamExcep-
tion (??  ) exception is raised.

So, let's implement the private method which will load resources.

Suppose that our foo format is very simple:


     o 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.

     o 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


     o after  the  resource  header  immediately  comes  the  resource  data,  possibly  padded  so
       that it ends on a 4 byte boundary.

     o 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.



                                                                 33

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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;



                                                                 34

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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 (??  ) ob-
ject 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;



                                                                 35

               ____________________________________________________________________________________________________________________*
 *CONTENTS__________



                     //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  inter-
               nal tree used by the TResources (??  ) object (see TAbstractResourceReader.GetTree (??  )),
               populate it and notify the TResources (??  ) object about the added resources (see TAbstrac-
               tResourceReader.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.



               0.5         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



                                                                                36

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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:


     o 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.

     o 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


     o after  the  resource  header  immediately  comes  the  resource  data,  possibly  padded  so
       that it ends on a 4 byte boundary.



                                                                 37

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



     o 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));



                                                                 38

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



   //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.



0.6         Format  of  resources  in  ob ject  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 docu-
mentation 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:



                                                         Table 1:

                         __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).



                                                                 39

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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:


     o fpc.resources.  This is a data section that contains all required structures.  It must
       be writable.

     o 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:


     o The initial header

     o The resource tree, in the form of nodes

     o The string table, which can be optional

     o The resource data


The initial header

The fpc.resources section starts with this header:



                                                         Table 2:

 __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:


     o First the "named" nodes (nodes that use a string as identifier) come, then the id ones
       (nodes that use an integer as identifier).

     o Named nodes are alphabetically sorted, in ascending order.

     o Id nodes are sorted in ascending order.



                                                                 40

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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



                                                         Table 3:

           __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.



                                                                 41

____________________________________________________________________________________________________________________CONTENTS_______*
 *___



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.



                                                                 42




Chapter   1



Reference   for   unit



'acceleratorsresource'



1.1         Used  units



                            Table 1.1:  Used units by unit 'acceleratorsresource'


                                                  __Name___________Page_____
                                                    Classes           ??
                                                    resource         124
                                                    System            ??
                                                    sysutils          ??



1.2         Overview


This unit contains TAcceleratorsResource (44 ),  a TAbstractResource (43 ) descendant spe-
cialized in handling resource of type RT_ACCELERATOR (43 ).

Adding this unit to a program's uses clause registers class TAcceleratorsResource (44 ) for
type RT_ACCELERATOR (43 ) with TResourceFactory (43 ).



1.3         Constants,  types  and  variables



1.3.1        Constants

FAlt  =  16


This flag is valid only if the key is a virtual key.


FControl  =  8


This flag is valid only if the key is a virtual key.


FNoInvert  =  2



                                                              43

____________________________CHAPTER_1.___REFERENCE_FOR_UNIT_'ACCELERATORSRESOURCE'_________________________________________________*
 *___



This flag is obsolete and is provided only for compatibility with 16 bit Windows.


FShift  =  4


This flag is valid only if the key is a virtual key.


FVirtKey  =  1


When  this  flag  is  set,  the  accelerator  key  is  a  virtual  key  code.  Otherwise,  it  is  a  ASCII
character



1.3.2        Types

PAccelerator  =  ^TAccelerator


A pointer to a TAccelerator record


TAccelerator  =  packed  record
    Flags  :  Word;
    Ansi  :  Word;
    Id  :  Word;
    padding  :  Word;
end



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 (44 ) flag must be active).

The accelerator is identified by the value of  id field.

Flags is a combination of the following values:


     o  FVirtKey (44 )

     o  FShift (44 )

     o  FNoInvert (44 )

     o  FControl (43 )

     o  FAlt (43 )



1.4         TAcceleratorsResource



1.4.1        Description

This class represents a resource of type RT_ACCELERATOR (43 ).

An accelerator table resource is a collection of accelerators (represented by TAccelerator (44 )
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.



                                                                 44

                ____________________________CHAPTER_1.___REFERENCE_FOR_UNIT_'ACCELERATORSRESOURCE'_________________________________*
 *___________________



                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
                (43 ).  Attempts to do so result in a EResourceDescChangeNotAllowedException (43 ).



                1.4.2        Method  overview

                __Page______Method__________________________________Description____________________________________________________*
 *___________
                  46        Add                                     Adds a new accelerator to the table
                  45        ChangeDescTypeAllowed
                  45        ChangeDescValueAllowed
                  46        Clear                                   Empties the accelerator table
                  46        Create                                  Creates a new accelerator table resource
                  46        Delete                                  Deletes an accelerator from the table
                  46        Destroy
                  45        GetName
                  45        GetType
                  46        NotifyResourcesLoaded
                __46________UpdateRawData__________________________________________________________________________________________*
 *___________



                1.4.3        Property  overview

                __Page______Properties________Access_______Description_____________________________________________________________*
 *___________
                  47        Count             r            The number of accelerators in the table
                __47________Items_____________rw___________Indexed_array_of_accelerators_in_the_table______________________________*
 *___________



                1.4.4        TAcceleratorsResource.GetType

Declaration:     function  GetType  :  TResourceDesc;    Override

    Visibility:   protected



                1.4.5        TAcceleratorsResource.GetName

Declaration:     function  GetName  :  TResourceDesc;    Override

    Visibility:   protected



                1.4.6        TAcceleratorsResource.ChangeDescTypeAllowed

Declaration:     function  ChangeDescTypeAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                  ;    Override

    Visibility:   protected



                1.4.7        TAcceleratorsResource.ChangeDescValueAllowed

Declaration:     function  ChangeDescValueAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                   ;    Override

    Visibility:   protected



                                                                                 45

                ____________________________CHAPTER_1.___REFERENCE_FOR_UNIT_'ACCELERATORSRESOURCE'_________________________________*
 *___________________



                1.4.8        TAcceleratorsResource.NotifyResourcesLoaded

Declaration:     procedure  NotifyResourcesLoaded;    Override

    Visibility:   protected



                1.4.9        TAcceleratorsResource.Create

    Synopsis:    Creates a new accelerator table resource

Declaration:     constructor  Create;    Override
                constructor  Create(aType:  TResourceDesc;aName:  TResourceDesc);    Override

    Visibility:   public

Description:     Please note that aType parameter is not used, since this class always uses RT_ACCELERATOR
                (43 ) as type.



                1.4.10         TAcceleratorsResource.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                1.4.11         TAcceleratorsResource.UpdateRawData

Declaration:     procedure  UpdateRawData;    Override

    Visibility:   public



                1.4.12         TAcceleratorsResource.Add

    Synopsis:    Adds a new accelerator to the table

Declaration:     procedure  Add(aItem:  TAccelerator)

    Visibility:   public

    See also:    TAcceleratorsResource.Items (47 )



                1.4.13         TAcceleratorsResource.Clear

    Synopsis:    Empties the accelerator table

Declaration:     procedure  Clear

    Visibility:   public

    See also:    TAcceleratorsResource.Items (47 ), TAcceleratorsResource.Delete (46 )



                1.4.14         TAcceleratorsResource.Delete

    Synopsis:    Deletes an accelerator from the table

Declaration:     procedure  Delete(aIndex:  Integer)

    Visibility:   public

    See also:    TAcceleratorsResource.Items (47 ), TAcceleratorsResource.Clear (46 )



                                                                                 46

                ____________________________CHAPTER_1.___REFERENCE_FOR_UNIT_'ACCELERATORSRESOURCE'_________________________________*
 *___________________



                1.4.15         TAcceleratorsResource.Count

    Synopsis:    The number of accelerators in the table

Declaration:     Property  Count  :  Integer

    Visibility:   public

      Access:    Read

    See also:    TAcceleratorsResource.Items (47 )



                1.4.16         TAcceleratorsResource.Items

    Synopsis:    Indexed array of accelerators in the table

Declaration:     Property  Items[index:  Integer]:  TAccelerator;  default

    Visibility:   public

      Access:    Read,Write

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 (47 )-1.

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

    See also:    TAcceleratorsResource.Count (47 ), TAccelerator (44 )



                                                                                 47




               Chapter   2



               Reference   for   unit



               'bitmapresource'



               2.1         Used  units



                                              Table 2.1:  Used units by unit 'bitmapresource'


                                                                 __Name___________Page_____
                                                                   Classes           ??
                                                                   resource         124
                                                                   System            ??
                                                                   sysutils          ??



               2.2         Overview


               This unit contains TBitmapResource (48 ), a TAbstractResource (48 ) descendant specialized
               in handling resource of type RT_BITMAP (48 ).

               Adding this unit to a program's uses clause registers class TBitmapResource (48 ) for type
               RT_BITMAP (48 ) with TResourceFactory (48 ).



               2.3         TBitmapResource



               2.3.1        Description

               This class represents a resource of type RT_BITMAP (48 ).

               A bitmap resource contents is very similar to a BMP file.  However some differences exists,
               so  RawData  (48 )  is  not  appropriate  if  you  need  to  read  and  write  BMP  data.   Instead,
               BitmapData (51 ) 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  (48 ).
               Attempts to do so result in a EResourceDescChangeNotAllowedException (48 ).


   See also:    BitmapData (51 ), TAbstractResource.RawData (48 )



                                                                             48

                __________________________________________CHAPTER_2.___REFERENCE_FOR_UNIT_'BITMAPRESOURCE'_________________________*
 *___________________



                2.3.2        Method  overview

                __Page______Method________________________________________Description______________________________________________*
 *___________
                  49        ChangeDescTypeAllowed
                  49        ChangeDescValueAllowed
                  50        Create                                        Creates a new bitmap resource
                  50        Destroy
                  49        GetName
                  49        GetType
                  49        NotifyResourcesLoaded
                  50        SetCustomBitmapDataStream                     Sets  a  custom  stream  as  the  underlying  stream
                                                                          for BitmapData
                __50________UpdateRawData__________________________________________________________________________________________*
 *___________



                2.3.3        Property  overview

                __Page______Properties___________Access_______Description__________________________________________________________*
 *___________
                __51________BitmapData___________r____________Resource_data_as_a_BMP_stream________________________________________*
 *___________



                2.3.4        TBitmapResource.GetType

Declaration:     function  GetType  :  TResourceDesc;    Override

    Visibility:   protected



                2.3.5        TBitmapResource.GetName

Declaration:     function  GetName  :  TResourceDesc;    Override

    Visibility:   protected



                2.3.6        TBitmapResource.ChangeDescTypeAllowed

Declaration:     function  ChangeDescTypeAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                  ;    Override

    Visibility:   protected



                2.3.7        TBitmapResource.ChangeDescValueAllowed

Declaration:     function  ChangeDescValueAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                   ;    Override

    Visibility:   protected



                2.3.8        TBitmapResource.NotifyResourcesLoaded

Declaration:     procedure  NotifyResourcesLoaded;    Override

    Visibility:   protected



                                                                                 49

                __________________________________________CHAPTER_2.___REFERENCE_FOR_UNIT_'BITMAPRESOURCE'_________________________*
 *___________________



                2.3.9        TBitmapResource.Create

    Synopsis:    Creates a new bitmap resource

Declaration:     constructor  Create;    Override
                constructor  Create(aType:  TResourceDesc;aName:  TResourceDesc);    Override

    Visibility:   public

Description:     Please  note  that  aType  parameter  is  not  used,  since  this  class  always  uses  RT_BITMAP
                (48 ) as type.



                2.3.10         TBitmapResource.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                2.3.11         TBitmapResource.UpdateRawData

Declaration:     procedure  UpdateRawData;    Override

    Visibility:   public



                2.3.12         TBitmapResource.SetCustomBitmapDataStream

    Synopsis:    Sets a custom stream as the underlying stream for BitmapData

Declaration:     procedure  SetCustomBitmapDataStream(aStream:  TStream)

    Visibility:   public

Description:     This method allows the user to use a custom stream as the underlying stream for Bitmap-
                Data (51 ).  This is useful when you want a TBitmapResource (48 ) 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;



                                                                                 50

                __________________________________________CHAPTER_2.___REFERENCE_FOR_UNIT_'BITMAPRESOURCE'_________________________*
 *___________________



    See also:    TBitmapResource.BitmapData (51 ), TAbstractResource.UpdateRawData (48 )



                2.3.13         TBitmapResource.BitmapData

    Synopsis:    Resource data as a BMP stream

Declaration:     Property  BitmapData  :  TStream

    Visibility:   public

      Access:    Read

Description:     BitmapData (51 ) property gives access to resource data in a BMP file-like stream,  unlike
                RawData (48 ).

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

                You can also set a custom stream as the underlying stream for BitmapData (51 ) via SetCus-
                tomBitmapDataStream (50 ), much like SetCustomRawDataStream (48 ) does for RawData
                (48 ).  This is useful when you want a TBitmapResource (48 ) to be created from a bmp file
                for which you have a stream.

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

    See also:    TBitmapResource.SetCustomBitmapDataStream  (50 ),  TAbstractResource.RawData  (48 ),
                TAbstractResource.UpdateRawData (48 )



                                                                                 51




               Chapter   3



               Reference   for   unit   'coffreader'



               3.1         Used  units



                                                  Table 3.1:  Used units by unit 'coffreader'


                                                               __Name________________Page_____
                                                                 Classes                 ??
                                                                 cofftypes               55
                                                                 resource              124
                                                                 resourcetree          159
                                                                 System                  ??
                                                                 sysutils                ??



               3.2         Overview


               This unit contains TCoffResourceReader (52 ), a TAbstractResourceReader (52 ) descendant
               that is able to read COFF object files containing resources.

               Adding this unit to a program's uses clause registers class TCoffResourceReader (52 ) with
               TResources (52 ).



               3.3         TCoffResourceReader



               3.3.1        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 (54 ) property holds the machine type the
               object file was built for.

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


   See also:    TCoffResourceReader.MachineType (54 ), TAbstractResourceReader (52 ), TWinPEImageRe-



                                                                             52

                __________________________________________________CHAPTER_3.___REFERENCE_FOR_UNIT_'COFFREADER'_____________________*
 *___________________



                sourceReader (52 ), TCoffResourceWriter (52 )



                3.3.2        Method  overview

                __Page______Method___________________Description___________________________________________________________________*
 *___________
                  53        CheckMagic
                  53        Create
                  53        Destroy
                  53        GetDescription
                  53        GetExtensions
                __53________Load___________________________________________________________________________________________________*
 *___________



                3.3.3        Property  overview

                __Page______Properties_____________Access_______Description________________________________________________________*
 *___________
                __54________MachineType____________r____________The_machine_type_of_the_object_file________________________________*
 *___________



                3.3.4        TCoffResourceReader.GetExtensions

Declaration:     function  GetExtensions  :  string;    Override

    Visibility:   protected



                3.3.5        TCoffResourceReader.GetDescription

Declaration:     function  GetDescription  :  string;    Override

    Visibility:   protected



                3.3.6        TCoffResourceReader.Load

Declaration:     procedure  Load(aResources:  TResources;aStream:  TStream);    Override

    Visibility:   protected



                3.3.7        TCoffResourceReader.CheckMagic

Declaration:     function  CheckMagic(aStream:  TStream)  :  Boolean;    Override

    Visibility:   protected



                3.3.8        TCoffResourceReader.Create

Declaration:     constructor  Create;    Override

    Visibility:   public



                3.3.9        TCoffResourceReader.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                                                                                 53

                __________________________________________________CHAPTER_3.___REFERENCE_FOR_UNIT_'COFFREADER'_____________________*
 *___________________



                3.3.10         TCoffResourceReader.MachineType

    Synopsis:    The machine type of the object file

Declaration:     Property  MachineType  :  TCoffMachineType

    Visibility:   public

      Access:    Read

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 (52 )



                                                                                 54




Chapter   4



Reference   for   unit   'cofftypes'



4.1         Overview


These types are used internally by TCoffResourceWriter (55 ) and TCoffResourceReader (55 ).

The only type of interest for the user is TCoffMachineType (55 ).



4.2         Constants,  types  and  variables



4.2.1        Constants

RSRCSectName  :  TSectionName  =  '.rsrc'  +  #0  +  #0  +  #0



4.2.2        Types

TCoffHeader  =  packed  record
    Machine  :  Word;
    NumSects  :  Word;
    TimeStamp  :  LongWord;
    SymTablePtr  :  LongWord;
    SymNum  :  LongWord;
    OptHdrSize  :  Word;
    Characteristics  :  Word;
end



TCoffMachineType  =  (cmti386,cmtarm,cmtx8664,cmtppc32aix,cmtppc64aix)



                                                              55

_____________________________________________________CHAPTER_4.___REFERENCE_FOR_UNIT_'COFFTYPES'___________________________________*
 *___



                      Table 4.1:  Enumeration values for type TCoffMachineType


                                          __Value________________Explanation_________
                                            cmtarm               ARM
                                            cmti386              Intel i386
                                            cmtppc32aix
                                            cmtppc64aix
                                            cmtx8664             AMD x86_64



This enumeration specifies the COFF machine type.

It is used by TCoffResourceWriter (55 ) to specify the machine type of the generated object
file and by TCoffResourceReader (55 ) to read the machine type of the object file that has
been read.


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  =  TCoffSymtableEntry



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



                                                                 56

_____________________________________________________CHAPTER_4.___REFERENCE_FOR_UNIT_'COFFTYPES'___________________________________*
 *___



TResDataEntry  =  packed  record
   DataRVA  :  LongWord;
   Size  :  LongWord;
   Codepage  :  LongWord;
   Reserved  :  LongWord;
end



TResDirEntry  =  packed  record
   NameID  :  LongWord;
   DataSubDirRVA  :  LongWord;
end



TResDirTable  =  packed  record
   Characteristics  :  LongWord;
   TimeStamp  :  LongWord;
   VerMajor  :  Word;
   VerMinor  :  Word;
   NamedEntriesCount  :  Word;
   IDEntriesCount  :  Word;
end



TSectionName  =  Array[0..7]  of  Char



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  =  packed  record
   x_scnlen  :  LongWord;
   x_parmhash  :  LongWord;
   x_snhash  :  Word;
   x_smtyp  :  Byte;
   x_smclas  :  Byte;
   x_stab  :  LongWord;
   x_snstab  :  Word;
end



                                                                 57




Chapter   5



Reference   for   unit   'coffwriter'



5.1         Used  units



                                   Table 5.1:  Used units by unit 'coffwriter'


                                                __Name________________Page_____
                                                  Classes                 ??
                                                  cofftypes               55
                                                  resource              124
                                                  resourcetree          159
                                                  System                  ??
                                                  sysutils                ??



5.2         Overview


This unit contains TCoffResourceWriter (61 ), a TAbstractResourceWriter (58 ) descendant
that is able to write COFF object files containing resources.

Adding this unit to a program's uses clause registers class TCoffResourceWriter (61 ) with
TResources (58 ).



5.3         Constants,  types  and  variables



5.3.1        Types

PCoffRelocation  =  ^TCoffRelocation


This type is used internally by TCoffResourceWriter (61 ).


TCoffRelocation  =  packed  record
    VirtualAddress  :  LongWord;
    SymTableIndex  :  LongWord;
    _type  :  Word;
end



                                                              58

                __________________________________________________CHAPTER_5.___REFERENCE_FOR_UNIT_'COFFWRITER'_____________________*
 *___________________



                This record is used internally by TCoffResourceWriter (61 ).



                5.4         TCoffRelocations



                5.4.1        Description

                This class is used internally by TCoffResourceWriter (61 ).



                5.4.2        Method  overview

                __Page______Method_____________________________Description_________________________________________________________*
 *___________
                  60        Add
                  60        AddRelativeToSection
                  60        Clear
                  59        Create
                  59        Destroy
                  59        GetCount
                __59________GetRelocation__________________________________________________________________________________________*
 *___________



                5.4.3        Property  overview

                __Page______Properties_____________Access_______Description________________________________________________________*
 *___________
                  60        Count                  r
                  60        Items                  r
                  60        MachineType            rw
                __60________StartAddress___________rw______________________________________________________________________________*
 *___________



                5.4.4        TCoffRelocations.GetCount

Declaration:     function  GetCount  :  Integer

    Visibility:   protected



                5.4.5        TCoffRelocations.GetRelocation

Declaration:     function  GetRelocation(index:  Integer)  :  PCoffRelocation

    Visibility:   protected



                5.4.6        TCoffRelocations.Create

Declaration:     constructor  Create(aMachineType:  TCoffMachineType)

    Visibility:   public



                5.4.7        TCoffRelocations.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                                                                                 59

                __________________________________________________CHAPTER_5.___REFERENCE_FOR_UNIT_'COFFWRITER'_____________________*
 *___________________



                5.4.8        TCoffRelocations.Add

Declaration:     procedure  Add(aAddress:  LongWord;aType:  Word;aSymTableIndex:  LongWord)

    Visibility:   public



                5.4.9        TCoffRelocations.AddRelativeToSection

Declaration:     procedure  AddRelativeToSection(aAddress:  LongWord;
                                                                  aSectSymTableIndex:  LongWord)

    Visibility:   public



                5.4.10         TCoffRelocations.Clear

Declaration:     procedure  Clear

    Visibility:   public



                5.4.11         TCoffRelocations.Count

Declaration:     Property  Count  :  Integer

    Visibility:   public

      Access:    Read



                5.4.12         TCoffRelocations.Items

Declaration:     Property  Items[index:  Integer]:  PCoffRelocation;  default

    Visibility:   public

      Access:    Read



                5.4.13         TCoffRelocations.StartAddress

Declaration:     Property  StartAddress  :  LongWord

    Visibility:   public

      Access:    Read,Write



                5.4.14         TCoffRelocations.MachineType

Declaration:     Property  MachineType  :  TCoffMachineType

    Visibility:   public

      Access:    Read,Write



                                                                                 60

                __________________________________________________CHAPTER_5.___REFERENCE_FOR_UNIT_'COFFWRITER'_____________________*
 *___________________



                5.5         TCoffResourceWriter



                5.5.1        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 (63 ) property can be used to set the machine type of the object file to generate.


    See also:    TCoffResourceWriter.MachineType (63 ), TAbstractResourceWriter (58 ), TCoffResourceWriter
                (58 )



                5.5.2        Method  overview

                __Page______Method___________________________________Description___________________________________________________*
 *___________
                  63        Create
                  63        Destroy
                  62        FixCoffHeader
                  62        FixSectionHeader
                  62        GetDescription
                  62        GetExtensions
                  62        GetFixedCoffHeader
                  63        PrescanNode
                  63        PrescanResourceTree
                  63        Write
                  62        WriteCoffStringTable
                  61        WriteEmptyCoffHeader
                  61        WriteEmptySectionHeader
                  62        WriteRawData
                  62        WriteRelocations
                  62        WriteResStringTable
                __63________WriteSymbolTable_______________________________________________________________________________________*
 *___________



                5.5.3        Property  overview

                __Page______Properties____________________Access_______Description_________________________________________________*
 *___________
                  63        MachineType                   rw           The machine type of the object file
                __64________OppositeEndianess_____________rw_______________________________________________________________________*
 *___________



                5.5.4        TCoffResourceWriter.WriteEmptyCoffHeader

Declaration:     procedure  WriteEmptyCoffHeader(aStream:  TStream)

    Visibility:   protected



                5.5.5        TCoffResourceWriter.WriteEmptySectionHeader

Declaration:     procedure  WriteEmptySectionHeader(aStream:  TStream);    Virtual

    Visibility:   protected



                                                                                 61

                __________________________________________________CHAPTER_5.___REFERENCE_FOR_UNIT_'COFFWRITER'_____________________*
 *___________________



                5.5.6        TCoffResourceWriter.WriteResStringTable

Declaration:     procedure  WriteResStringTable(aStream:  TStream);    Virtual

    Visibility:   protected



                5.5.7        TCoffResourceWriter.WriteRawData

Declaration:     procedure  WriteRawData(aStream:  TStream)

    Visibility:   protected



                5.5.8        TCoffResourceWriter.WriteRelocations

Declaration:     procedure  WriteRelocations(aStream:  TStream)

    Visibility:   protected



                5.5.9        TCoffResourceWriter.WriteCoffStringTable

Declaration:     procedure  WriteCoffStringTable(aStream:  TStream)

    Visibility:   protected



                5.5.10         TCoffResourceWriter.GetFixedCoffHeader

Declaration:     function  GetFixedCoffHeader  :  TCoffHeader;    Virtual

    Visibility:   protected



                5.5.11         TCoffResourceWriter.FixCoffHeader

Declaration:     procedure  FixCoffHeader(aStream:  TStream)

    Visibility:   protected



                5.5.12         TCoffResourceWriter.FixSectionHeader

Declaration:     procedure  FixSectionHeader(aStream:  TStream;aResources:  TResources)
                                                           ;    Virtual

    Visibility:   protected



                5.5.13         TCoffResourceWriter.GetExtensions

Declaration:     function  GetExtensions  :  string;    Override

    Visibility:   protected



                5.5.14         TCoffResourceWriter.GetDescription

Declaration:     function  GetDescription  :  string;    Override

    Visibility:   protected



                                                                                 62

                __________________________________________________CHAPTER_5.___REFERENCE_FOR_UNIT_'COFFWRITER'_____________________*
 *___________________



                5.5.15         TCoffResourceWriter.PrescanNode

Declaration:     function  PrescanNode(aNode:  TResourceTreeNode;aNodeSize:  LongWord)
                                                   :  LongWord;    Virtual

    Visibility:   protected



                5.5.16         TCoffResourceWriter.PrescanResourceTree

Declaration:     procedure  PrescanResourceTree;    Virtual

    Visibility:   protected



                5.5.17         TCoffResourceWriter.Write

Declaration:     procedure  Write(aResources:  TResources;aStream:  TStream);    Override

    Visibility:   protected



                5.5.18         TCoffResourceWriter.WriteSymbolTable

Declaration:     procedure  WriteSymbolTable(aStream:  TStream;aResources:  TResources)
                                                           ;    Virtual

    Visibility:   protected



                5.5.19         TCoffResourceWriter.Create

Declaration:     constructor  Create;    Override

    Visibility:   public



                5.5.20         TCoffResourceWriter.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                5.5.21         TCoffResourceWriter.MachineType

    Synopsis:    The machine type of the object file

Declaration:     Property  MachineType  :  TCoffMachineType

    Visibility:   public

      Access:    Read,Write

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

    See also:    TCoffMachineType (58 )



                                                                                 63

                __________________________________________________CHAPTER_5.___REFERENCE_FOR_UNIT_'COFFWRITER'_____________________*
 *___________________



                5.5.22         TCoffResourceWriter.OppositeEndianess

Declaration:     Property  OppositeEndianess  :  Boolean

    Visibility:   public

      Access:    Read,Write



                5.6         TCoffStringTable



                5.6.1        Method  overview

                __Page______Method_________Description_____________________________________________________________________________*
 *___________
                  64        Add
                  64        Create
                __64________Delete_________________________________________________________________________________________________*
 *___________



                5.6.2        Property  overview

                __Page______Properties________Access_______Description_____________________________________________________________*
 *___________
                __64________Size______________r____________________________________________________________________________________*
 *___________



                5.6.3        TCoffStringTable.Create

Declaration:     constructor  Create

    Visibility:   public



                5.6.4        TCoffStringTable.Add

Declaration:     function  Add(const  S:  string)  :  Integer;    Override

    Visibility:   public



                5.6.5        TCoffStringTable.Delete

Declaration:     procedure  Delete(Index:  Integer);    Override

    Visibility:   public



                5.6.6        TCoffStringTable.Size

Declaration:     Property  Size  :  ptruint

    Visibility:   public

      Access:    Read



                5.7         TResourceStringTable



                5.7.1        Description

                This class is used internally by TCoffResourceWriter (61 ).



                                                                                 64

                __________________________________________________CHAPTER_5.___REFERENCE_FOR_UNIT_'COFFWRITER'_____________________*
 *___________________



                5.7.2        Method  overview

                __Page______Method_________Description_____________________________________________________________________________*
 *___________
                  65        Add
                  65        Clear
                  65        Create
                __65________Destroy________________________________________________________________________________________________*
 *___________



                5.7.3        Property  overview

                __Page______Properties________Access_______Description_____________________________________________________________*
 *___________
                  65        Count             r
                  66        CurrRVA           r
                  66        EndRVA            r
                  65        Items             r
                __66________StartRVA__________rw___________________________________________________________________________________*
 *___________



                5.7.4        TResourceStringTable.Create

Declaration:     constructor  Create

    Visibility:   public



                5.7.5        TResourceStringTable.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                5.7.6        TResourceStringTable.Add

Declaration:     procedure  Add(s:  string)

    Visibility:   public



                5.7.7        TResourceStringTable.Clear

Declaration:     procedure  Clear

    Visibility:   public



                5.7.8        TResourceStringTable.Count

Declaration:     Property  Count  :  Integer

    Visibility:   public

      Access:    Read



                5.7.9        TResourceStringTable.Items

Declaration:     Property  Items[index:  Integer]:  string;  default

    Visibility:   public

      Access:    Read



                                                                                 65

                __________________________________________________CHAPTER_5.___REFERENCE_FOR_UNIT_'COFFWRITER'_____________________*
 *___________________



                5.7.10         TResourceStringTable.StartRVA

Declaration:     Property  StartRVA  :  LongWord

    Visibility:   public

      Access:    Read,Write



                5.7.11         TResourceStringTable.CurrRVA

Declaration:     Property  CurrRVA  :  LongWord

    Visibility:   public

      Access:    Read



                5.7.12         TResourceStringTable.EndRVA

Declaration:     Property  EndRVA  :  LongWord

    Visibility:   public

      Access:    Read



                                                                                 66




Chapter   6



Reference   for   unit   'dfmreader'



6.1         Used  units



                                   Table 6.1:  Used units by unit 'dfmreader'


                                                  __Name___________Page_____
                                                    Classes           ??
                                                    resource         124
                                                    System            ??
                                                    sysutils          ??



6.2         Overview


This unit contains TDfmResourceReader (67 ), a TAbstractResourceReader (67 ) descendant
used to compile DFM files to resources.

Adding this unit to a program's uses clause registers class TDfmResourceReader (67 ) with
TResources (67 ).



6.3         TDfmResourceReader



6.3.1        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 (67 ) with the name of the form specified in the DFM
file.



                                                              67

                ___________________________________________________CHAPTER_6.___REFERENCE_FOR_UNIT_'DFMREADER'_____________________*
 *___________________



                6.3.2        Method  overview

                __Page______Method___________________Description___________________________________________________________________*
 *___________
                  68        CheckMagic
                  68        Create
                  68        Destroy
                  68        GetDescription
                  68        GetExtensions
                __68________Load___________________________________________________________________________________________________*
 *___________



                6.3.3        TDfmResourceReader.GetExtensions

Declaration:     function  GetExtensions  :  string;    Override

    Visibility:   protected



                6.3.4        TDfmResourceReader.GetDescription

Declaration:     function  GetDescription  :  string;    Override

    Visibility:   protected



                6.3.5        TDfmResourceReader.Load

Declaration:     procedure  Load(aResources:  TResources;aStream:  TStream);    Override

    Visibility:   protected



                6.3.6        TDfmResourceReader.CheckMagic

Declaration:     function  CheckMagic(aStream:  TStream)  :  Boolean;    Override

    Visibility:   protected



                6.3.7        TDfmResourceReader.Create

Declaration:     constructor  Create;    Override

    Visibility:   public



                6.3.8        TDfmResourceReader.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                                                                                 68




Chapter   7



Reference   for   unit   'elfconsts'



7.1         Overview


These  constants  are  used  internally  by  TElfResourceWriter  (69 )  and  TElfResourceReader
(69 ).

The only type of interest for the user is TElfMachineType (74 ).



7.2         Constants,  types  and  variables



7.2.1        Constants

EF_IA_64_ABI64  =  $10



ELFCLASS32  =  1



ELFCLASS64  =  2



ELFCLASSNONE  =  0



ELFDATA2LSB  =  1



ELFDATA2MSB  =  2



ELFDATANONE  =  0



ELFMAGIC  =  ($7f)  +  'ELF'



ELFOSABI_ARM  =  97



                                                              69

_____________________________________________________CHAPTER_7.___REFERENCE_FOR_UNIT_'ELFCONSTS'___________________________________*
 *___



ELFOSABI_FREEBSD  =  9



ELFOSABI_LINUX  =  3



ELFOSABI_NONE  =  0



EM_386  =  3



EM_68K  =  4



EM_ALPHA  =  $9026



EM_ARM  =  40



EM_IA_64  =  50



EM_MIPS  =  8



EM_MIPS_RS3_LE  =  10



EM_MIPS_X  =  51



EM_NONE  =  0



EM_PPC  =  20



EM_PPC64  =  21



EM_SPARC  =  2



EM_X86_64  =  62



ET_CORE  =  4



ET_DYN  =  3



ET_EXEC  =  2



                                                                 70

_____________________________________________________CHAPTER_7.___REFERENCE_FOR_UNIT_'ELFCONSTS'___________________________________*
 *___



ET_HIOS  =  $feff



ET_HIPROC  =  $ffff



ET_LOOS  =  $fe00



ET_LOPROC  =  $ff00



ET_NONE  =  0



ET_REL  =  1



EV_CURRENT  =  1



EV_NONE  =  0



HANDLESECT_IDX  =  2



HandlesSectName  =  'fpc.reshandles'



RsrcSectName  =  'fpc.resources'



RSRCSECT_IDX  =  1



R_386_32  =  1



R_68K_32  =  1



R_ALPHA_REFQUAD  =  2



R_ARM_ABS32  =  2



R_IA64_DIR64LSB  =  $27



R_MIPS_32  =  2



R_PPC64_ADDR64  =  38



                                                                 71

_____________________________________________________CHAPTER_7.___REFERENCE_FOR_UNIT_'ELFCONSTS'___________________________________*
 *___



R_PPC_ADDR32  =  1



R_SPARC_32  =  3



R_x86_64_64  =  1



SHF_ALLOC  =  2



SHF_EXECINSTR  =  4



SHF_MASKOS  =  $0f000000



SHF_MASKPROC  =  $f0000000



SHF_WRITE  =  1



SHT_DYNAMIC  =  6



SHT_DYNSYM  =  11



SHT_HASH  =  5



SHT_HIOS  =  $ffffffff



SHT_HIPROC  =  $7fffffff



SHT_LOOS  =  $80000000



SHT_LOPROC  =  $70000000



SHT_NOBITS  =  8



SHT_NOTE  =  7



SHT_NULL  =  0



SHT_PROGBITS  =  1



                                                                 72

_____________________________________________________CHAPTER_7.___REFERENCE_FOR_UNIT_'ELFCONSTS'___________________________________*
 *___



SHT_REL  =  9


SHT_RELA  =  4


SHT_SHLIB  =  10


SHT_STRTAB  =  3


SHT_SYMTAB  =  2


STB_GLOBAL  =  1


STB_HIOS  =  12


STB_HIPROC  =  15


STB_LOCAL  =  0


STB_LOOS  =  10


STB_LOPROC  =  13


STB_WEAK  =  2


STT_COMMON  =  5


STT_FILE  =  4


STT_FUNC  =  2


STT_HIOS  =  12


STT_HIPROC  =  15


STT_LOOS  =  10


STT_LOPROC  =  13


STT_NOTYPE  =  0


STT_OBJECT  =  1


STT_SECTION  =  3


STT_SPARC_REGISTER  =  13


STT_TLS  =  6



                                                                 73

_____________________________________________________CHAPTER_7.___REFERENCE_FOR_UNIT_'ELFCONSTS'___________________________________*
 *___



7.2.2        Types

TElfMachineType  =  (emtnone,emtsparc,emti386,emtm68k,emtppc,emtppc64,
                                emtarm,emtarmeb,emtia64,emtx86_64,emtalpha,emtmips,
                                emtmipsel)



                       Table 7.1:  Enumeration values for type TElfMachineType


                              __Value_____________Explanation___________________________________
                                emtalpha          DEC Alpha machine type
                                emtarm            ARM machine type
                                emtarmeb          ARM Big Endian machine type
                                emti386           Intel 386 machine type
                                emtia64           Intel IA-64 machine type
                                emtm68k           Motorola 68000 machine type
                                emtmips
                                emtmipsel
                                emtnone           Invalid machine type
                                emtppc            PowerPC machine type
                                emtppc64          PowerPC 64 machine type
                                emtsparc          Sparc machine type
                                emtx86_64         AMD x86_64 machine type



This enumeration specifies the ELF machine type.

It is used by TElfResourceWriter (69 ) to specify the machine type of the generated object
file  and  by  TElfResourceReader  (69 )  to  read  the  machine  type  of  the  object  file  that  has
been read.



                                                                 74




Chapter   8



Reference   for   unit   'elfreader'



8.1         Used  units



                                    Table 8.1:  Used units by unit 'elfreader'


                                                  __Name____________Page____
                                                    Classes            ??
                                                    elfconsts          69
                                                    elftypes           ??
                                                    resource         124
                                                    System             ??
                                                    sysutils           ??



8.2         Overview


This unit contains TElfResourceReader (76 ),  a TAbstractResourceReader (75 ) descendant
that is able to read ELF object files containing resources.

Adding this unit to a program's uses clause registers class TElfResourceReader (76 ) with
TResources (75 ).



8.3         EElfResourceReaderException



8.3.1        Description

Base class for elf resource reader-related exceptions



8.4         EElfResourceReaderNoSectionsException



8.4.1        Description

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



                                                              75

               ____________________________________________________CHAPTER_8.___REFERENCE_FOR_UNIT_'ELFREADER'_____________________*
 *__________________



               8.5         EElfResourceReaderNoStringTableException



               8.5.1        Description

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



               8.6         EElfResourceReaderUnknownClassException



               8.6.1        Description

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



               8.7         EElfResourceReaderUnknownVersionException



               8.7.1        Description

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



               8.8         TElfResourceReader



               8.8.1        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 (77 ) 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 (77 ), TAbstractResourceReader (75 ), TElfResourceWriter
               (75 ), Format of resources in object files (75 )



               8.8.2        Method  overview

               __Page______Method___________________Description____________________________________________________________________*
 *__________
                 77        CheckMagic
                 77        Create
                 77        Destroy
                 77        GetDescription
                 77        GetExtensions
               __77________Load____________________________________________________________________________________________________*
 *__________



               8.8.3        Property  overview

               __Page______Properties_____________Access_______Description_________________________________________________________*
 *__________
               __77________MachineType____________r____________The_machine_type_of_the_object_file_________________________________*
 *__________



                                                                                76

                ____________________________________________________CHAPTER_8.___REFERENCE_FOR_UNIT_'ELFREADER'____________________*
 *___________________



                8.8.4        TElfResourceReader.GetExtensions

Declaration:     function  GetExtensions  :  string;    Override

    Visibility:   protected



                8.8.5        TElfResourceReader.GetDescription

Declaration:     function  GetDescription  :  string;    Override

    Visibility:   protected



                8.8.6        TElfResourceReader.Load

Declaration:     procedure  Load(aResources:  TResources;aStream:  TStream);    Override

    Visibility:   protected



                8.8.7        TElfResourceReader.CheckMagic

Declaration:     function  CheckMagic(aStream:  TStream)  :  Boolean;    Override

    Visibility:   protected



                8.8.8        TElfResourceReader.Create

Declaration:     constructor  Create;    Override

    Visibility:   public



                8.8.9        TElfResourceReader.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                8.8.10         TElfResourceReader.MachineType

    Synopsis:    The machine type of the object file

Declaration:     Property  MachineType  :  TElfMachineType

    Visibility:   public

      Access:    Read

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 (75 )



                                                                                 77




Chapter   9



Reference   for   unit   'elfwriter'



9.1         Used  units



                                    Table 9.1:  Used units by unit 'elfwriter'


                                                  __Name____________Page____
                                                    Classes            ??
                                                    elfconsts          69
                                                    elftypes           ??
                                                    resource         124
                                                    System             ??
                                                    sysutils           ??



9.2         Overview


This  unit  contains  TElfResourceWriter  (79 ),  a  TAbstractResourceWriter  (78 )  descendant
that is able to write ELF object files containing resources.

Adding  this  unit  to  a  program's  uses  clause  registers  class  TElfResourceWriter  (79 )  with
TResources (78 ).



9.3         EElfResourceWriterException



9.3.1        Description

Base class for elf resource writer-related exceptions



9.4         EElfResourceWriterUnknownClassException



9.4.1        Description

If this exception is raised, an internal error occurred.



                                                              78

                _____________________________________________________CHAPTER_9.___REFERENCE_FOR_UNIT_'ELFWRITER'___________________*
 *___________________



                9.5         EElfResourceWriterUnknownMachineException



                9.5.1        Description

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


    See also:    TElfResourceWriter.MachineType (80 )



                9.6         EElfResourceWriterUnknownSectionException



                9.6.1        Description

                If this exception is raised, an internal error occurred.



                9.7         TElfResourceWriter



                9.7.1        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 (80 ) property can be used to set the machine type of the object file to generate.


    See also:    TElfResourceWriter.MachineType (80 ), TAbstractResourceWriter (78 ), TElfResourceReader
                (78 ), Format of resources in object files (78 )



                9.7.2        Method  overview

                __Page______Method___________________Description___________________________________________________________________*
 *___________
                  80        Create
                  80        Destroy
                  80        GetDescription
                  79        GetExtensions
                __80________Write__________________________________________________________________________________________________*
 *___________



                9.7.3        Property  overview

                __Page______Properties_____________Access_______Description________________________________________________________*
 *___________
                __80________MachineType____________rw___________The_machine_type_of_the_object_file________________________________*
 *___________



                9.7.4        TElfResourceWriter.GetExtensions

Declaration:     function  GetExtensions  :  string;    Override

    Visibility:   protected



                                                                                 79

                _____________________________________________________CHAPTER_9.___REFERENCE_FOR_UNIT_'ELFWRITER'___________________*
 *___________________



                9.7.5        TElfResourceWriter.GetDescription

Declaration:     function  GetDescription  :  string;    Override

    Visibility:   protected



                9.7.6        TElfResourceWriter.Write

Declaration:     procedure  Write(aResources:  TResources;aStream:  TStream);    Override

    Visibility:   protected



                9.7.7        TElfResourceWriter.Create

Declaration:     constructor  Create;    Override

    Visibility:   public



                9.7.8        TElfResourceWriter.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                9.7.9        TElfResourceWriter.MachineType

    Synopsis:    The machine type of the object file

Declaration:     Property  MachineType  :  TElfMachineType

    Visibility:   public

      Access:    Read,Write

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 EElfResourceWriterUn-
                knownMachineException (79 ) exception is raised.

    See also:    TElfMachineType (78 ), EElfResourceWriterUnknownMachineException (79 )



                                                                                 80




Chapter   10



Reference   for   unit



'externalreader'



10.1          Used  units



                               Table 10.1:  Used units by unit 'externalreader'


                                               __Name__________________Page_____
                                                 Classes                  ??
                                                 externaltypes             84
                                                 resource                124
                                                 resourcetree            159
                                                 System                   ??
                                                 sysutils                 ??



10.2          Overview


This unit contains TExternalResourceReader (81 ), a TAbstractResourceReader (81 ) descen-
dant 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 (81 )
with TResources (81 ).

See also

Free Pascal external resource file format description (81 )



10.3          TExternalResourceReader



10.3.1         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



                                                              81

                _______________________________________CHAPTER_10.___REFERENCE_FOR_UNIT_'EXTERNALREADER'___________________________*
 *___________________



                application.

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


    See also:    TExternalResourceReader.Endianess  (83 ),  TAbstractResourceReader  (81 ),  TExternalRe-
                sourceWriter (81 )



                10.3.2         Method  overview

                __Page______Method___________________Description___________________________________________________________________*
 *___________
                  82        CheckMagic
                  82        Create
                  83        Destroy
                  82        GetDescription
                  82        GetExtensions
                __82________Load___________________________________________________________________________________________________*
 *___________



                10.3.3         Property  overview

                __Page______Properties________Access_______Description_____________________________________________________________*
 *___________
                __83________Endianess_________r____________The_byte_order_used_in_the_file_________________________________________*
 *___________



                10.3.4         TExternalResourceReader.GetExtensions

Declaration:     function  GetExtensions  :  string;    Override

    Visibility:   protected



                10.3.5         TExternalResourceReader.GetDescription

Declaration:     function  GetDescription  :  string;    Override

    Visibility:   protected



                10.3.6         TExternalResourceReader.Load

Declaration:     procedure  Load(aResources:  TResources;aStream:  TStream);    Override

    Visibility:   protected



                10.3.7         TExternalResourceReader.CheckMagic

Declaration:     function  CheckMagic(aStream:  TStream)  :  Boolean;    Override

    Visibility:   protected



                10.3.8         TExternalResourceReader.Create

Declaration:     constructor  Create;    Override

    Visibility:   public



                                                                                 82

                _______________________________________CHAPTER_10.___REFERENCE_FOR_UNIT_'EXTERNALREADER'___________________________*
 *___________________



                10.3.9         TExternalResourceReader.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                10.3.10          TExternalResourceReader.Endianess

    Synopsis:    The byte order used in the file

Declaration:     Property  Endianess  :  Byte

    Visibility:   public

      Access:    Read

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 (81 ), EXT_ENDIAN_LITTLE (81 )



                                                                                 83




Chapter   11



Reference   for   unit



'externaltypes'



11.1          Overview


These types are used internally by TExternalResourceReader (84 ) and TExternalResourceWriter
(84 ).

Two constants are of interest:  EXT_ENDIAN_BIG (87 ) and EXT_ENDIAN_LITTLE (87 ).



11.2          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 (84 )

File layout

An external resource file consists of these parts:


     o  The initial header, containing various file information

     o  The resource tree, in the form of nodes

     o  The string table, which can be optional

     o  The resource data


The header is made up by initial header, resource tree and string table (if present).

Conventions



                                                              84

__________________________________________CHAPTER_11.___REFERENCE_FOR_UNIT_'EXTERNALTYPES'_________________________________________*
 *___



In this document, data sizes are specified with pascal-style data types.  They are the following:



                                                       Table 11.1:

                                    __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:



                                                       Table 11.2:

   __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:


     o First the "named" nodes (nodes that use a string as identifier) come, then the id ones
       (nodes that use an integer as identifier).

     o Named nodes are alphabetically sorted, in ascending order.

     o 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:



                                                                 85

__________________________________________CHAPTER_11.___REFERENCE_FOR_UNIT_'EXTERNALTYPES'_________________________________________*
 *___



    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



                                                       Table 11.3:

            __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.



                                                                 86

__________________________________________CHAPTER_11.___REFERENCE_FOR_UNIT_'EXTERNALTYPES'_________________________________________*
 *___



11.3          Constants,  types  and  variables



11.3.1         Constants

EXTERNAL_RESMAGIC  :  TExternalResMagic  =  'FPCRES'


This value is used for TExtHeader.magic (87 ).


EXT_CURRENT_VERSION  =  1


This value is used for TExtHeader.version (87 ).


EXT_ENDIAN_BIG  =  1


This value is used for TExtHeader.endianess (87 ).


EXT_ENDIAN_LITTLE  =  2


This value is used for TExtHeader.endianess (87 ).



11.3.2         Types

TExternalResMagic  =  Array[1..6]  of  Char


Type used for the magic identifier in external resource files


TExtHeader  =  packed  record
    magic  :  TExternalResMagic;
    version  :  Byte;
    endianess  :  Byte;
    count  :  LongWord;
    nodesize  :  LongWord;
    hdrsize  :  LongWord;
    reserved1  :  LongWord;
    reserved2  :  LongWord;
    reserved3  :  LongWord;
end



This  header  describes  the  data  structure  present  at  the  beginning  of  an  external  resource
file.


TResInfoNode  =  packed  record
    nameid  :  LongWord;
    ncount  :  LongWord;
    idcountsize  :  LongWord;
    subptr  :  LongWord;
end



This record represents a node used in a resource tree.  A node contains information about a
certain resource type, name or language id.



                                                                 87




Chapter   12



Reference   for   unit



'externalwriter'



12.1          Used  units



                               Table 12.1:  Used units by unit 'externalwriter'


                                               __Name__________________Page_____
                                                 Classes                  ??
                                                 externaltypes             84
                                                 resource                124
                                                 resourcetree            159
                                                 strtable                 ??
                                                 System                   ??
                                                 sysutils                 ??



12.2          Overview


This unit contains TExternalResourceWriter (89 ), a TAbstractResourceWriter (88 ) descen-
dant 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 (89 )
with TResources (88 ).

See also

Free Pascal external resource file format description (88 )



12.3          EExternalResInvalidEndianessException



12.3.1         Description

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



                                                              88

                ________________________________________CHAPTER_12.___REFERENCE_FOR_UNIT_'EXTERNALWRITER'__________________________*
 *___________________



    See also:    TExternalResourceWriter.Endianess (90 )



                12.4          EExternalResourceWriterException



                12.4.1         Description

                Base class for external resource writer-related exceptions



                12.5          TExternalResourceWriter



                12.5.1         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 (90 ) property can be used to set the byte order to use in the file to generate.


    See also:    TExternalResourceWriter.Endianess (90 ), TAbstractResourceWriter (88 ), TExternalResourceReader
                (88 )



                12.5.2         Method  overview

                __Page______Method___________________Description___________________________________________________________________*
 *___________
                  90        Create
                  90        Destroy
                  89        GetDescription
                  89        GetExtensions
                __90________Write__________________________________________________________________________________________________*
 *___________



                12.5.3         Property  overview

                __Page______Properties________Access_______Description_____________________________________________________________*
 *___________
                __90________Endianess_________rw___________The_byte_order_to_use_in_the_file_______________________________________*
 *___________



                12.5.4         TExternalResourceWriter.GetExtensions

Declaration:     function  GetExtensions  :  string;    Override

    Visibility:   protected



                12.5.5         TExternalResourceWriter.GetDescription

Declaration:     function  GetDescription  :  string;    Override

    Visibility:   protected



                                                                                 89

                ________________________________________CHAPTER_12.___REFERENCE_FOR_UNIT_'EXTERNALWRITER'__________________________*
 *___________________



                12.5.6         TExternalResourceWriter.Write

Declaration:     procedure  Write(aResources:  TResources;aStream:  TStream);    Override

    Visibility:   protected



                12.5.7         TExternalResourceWriter.Create

Declaration:     constructor  Create;    Override

    Visibility:   public



                12.5.8         TExternalResourceWriter.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                12.5.9         TExternalResourceWriter.Endianess

    Synopsis:    The byte order to use in the file

Declaration:     Property  Endianess  :  Byte

    Visibility:   public

      Access:    Read,Write

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 (88 ) or EXT_ENDIAN_LITTLE (88 ) is used, an
                EExternalResInvalidEndianessException (88 ) exception is raised.

    See also:    EXT_ENDIAN_BIG (88 ), EXT_ENDIAN_LITTLE (88 )



                                                                                 90




Chapter   13



Reference   for   unit



'groupcursorresource'



13.1          Used  units



                           Table 13.1:  Used units by unit 'groupcursorresource'


                                               _Name___________________Page______
                                                 Classes                   ??
                                                 groupresource             97
                                                 resource                 124
                                                 System                    ??
                                                 sysutils                  ??



13.2          Overview


This unit contains TGroupCursorResource (91 ), a TAbstractResource (91 ) descendant spe-
cialized in handling resource of type RT_GROUP_CURSOR (91 ).

Adding this unit to a program's uses clause registers class TGroupCursorResource (91 ) for
type RT_GROUP_CURSOR (91 ) with TResourceFactory (91 ).



13.3          TGroupCursorResource



13.3.1         Description

This class represents a resource of type RT_GROUP_CURSOR (91 ).

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 (91 ) resource only contains information about
the single images, which are contained each in a different resource of type RT_CURSOR (91 ).



                                                              91

                ____________________________CHAPTER_13.___REFERENCE_FOR_UNIT_'GROUPCURSORRESOURCE'_________________________________*
 *___________________



                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  (91 )  resource,  which
                provides information about them.

                TGroupCursorResource (91 ) provides a way to handle a cursor as if it was a .cur file,  via
                ItemData (91 ) 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
                (91 ).  Attempts to do so result in a EResourceDescChangeNotAllowedException (91 ).


    See also:    TGroupResource.ItemData (91 ), TGroupIconResource (91 )



                13.3.2         Method  overview

                __Page______Method__________________________________Description____________________________________________________*
 *___________
                  93        ChangeDescTypeAllowed
                  93        ChangeDescValueAllowed
                  93        ClearItemList
                  93        Create                                  Creates a new group cursor resource
                  92        CreateSubItem
                  93        DeleteSubItems
                  93        GetName
                  93        GetSubStream
                  93        GetType
                  92        ReadResourceItemHeader
                  92        UpdateItemOwner
                __92________WriteHeader____________________________________________________________________________________________*
 *___________



                13.3.3         TGroupCursorResource.ReadResourceItemHeader

Declaration:     procedure  ReadResourceItemHeader;    Override

    Visibility:   protected



                13.3.4         TGroupCursorResource.WriteHeader

Declaration:     procedure  WriteHeader(aStream:  TStream);    Override

    Visibility:   protected



                13.3.5         TGroupCursorResource.CreateSubItem

Declaration:     procedure  CreateSubItem;    Override

    Visibility:   protected



                13.3.6         TGroupCursorResource.UpdateItemOwner

Declaration:     procedure  UpdateItemOwner(index:  Integer);    Override

    Visibility:   protected



                                                                                 92

                ____________________________CHAPTER_13.___REFERENCE_FOR_UNIT_'GROUPCURSORRESOURCE'_________________________________*
 *___________________



                13.3.7         TGroupCursorResource.ClearItemList

Declaration:     procedure  ClearItemList;    Override

    Visibility:   protected



                13.3.8         TGroupCursorResource.DeleteSubItems

Declaration:     procedure  DeleteSubItems;    Override

    Visibility:   protected



                13.3.9         TGroupCursorResource.GetSubStream

Declaration:     function  GetSubStream(const  index:  Integer;out  aSize:  Int64)  :  TStream
                                                   ;    Override

    Visibility:   protected



                13.3.10          TGroupCursorResource.GetType

Declaration:     function  GetType  :  TResourceDesc;    Override

    Visibility:   protected



                13.3.11          TGroupCursorResource.GetName

Declaration:     function  GetName  :  TResourceDesc;    Override

    Visibility:   protected



                13.3.12          TGroupCursorResource.ChangeDescTypeAllowed

Declaration:     function  ChangeDescTypeAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                  ;    Override

    Visibility:   protected



                13.3.13          TGroupCursorResource.ChangeDescValueAllowed

Declaration:     function  ChangeDescValueAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                   ;    Override

    Visibility:   protected



                13.3.14          TGroupCursorResource.Create

    Synopsis:    Creates a new group cursor resource

Declaration:     constructor  Create;    Override
                constructor  Create(aType:  TResourceDesc;aName:  TResourceDesc);    Override

    Visibility:   public

Description:     Please note that aType parameter is not used, since this class always uses RT_GROUP_CURSOR
                (91 ) as type.



                                                                                 93




Chapter   14



Reference   for   unit



'groupiconresource'



14.1          Used  units



                            Table 14.1:  Used units by unit 'groupiconresource'


                                               _Name___________________Page______
                                                 Classes                   ??
                                                 groupresource             97
                                                 resource                 124
                                                 System                    ??
                                                 sysutils                  ??



14.2          Overview


This unit contains TGroupIconResource (94 ), a TAbstractResource (94 ) descendant special-
ized in handling resource of type RT_GROUP_ICON (94 ).

Adding  this  unit  to  a  program's  uses  clause  registers  class  TGroupIconResource  (94 )  for
type RT_GROUP_ICON (94 ) with TResourceFactory (94 ).



14.3          TGroupIconResource



14.3.1         Description

This class represents a resource of type RT_GROUP_ICON (94 ).

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  (94 )  resource  only  contains  information
about the single images, which are contained each in a different resource of type RT_ICON



                                                              94

                _________________________________CHAPTER_14.___REFERENCE_FOR_UNIT_'GROUPICONRESOURCE'______________________________*
 *___________________



                (94 ).  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 (94 ) resource, which
                provides information about them.

                TGroupIconResource  (94 )  provides  a  way  to  handle  an  icon  as  if  it  was  a  .ico  file,  via
                ItemData  (94 )  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
                (94 ).  Attempts to do so result in a EResourceDescChangeNotAllowedException (94 ).


    See also:    TGroupResource.ItemData (94 ), TGroupCursorResource (94 )



                14.3.2         Method  overview

                __Page______Method__________________________________Description____________________________________________________*
 *___________
                  96        ChangeDescTypeAllowed
                  96        ChangeDescValueAllowed
                  96        ClearItemList
                  96        Create                                  Creates a new group icon resource
                  95        CreateSubItem
                  96        DeleteSubItems
                  96        GetName
                  96        GetSubStream
                  96        GetType
                  95        ReadResourceItemHeader
                  95        UpdateItemOwner
                __95________WriteHeader____________________________________________________________________________________________*
 *___________



                14.3.3         TGroupIconResource.ReadResourceItemHeader

Declaration:     procedure  ReadResourceItemHeader;    Override

    Visibility:   protected



                14.3.4         TGroupIconResource.WriteHeader

Declaration:     procedure  WriteHeader(aStream:  TStream);    Override

    Visibility:   protected



                14.3.5         TGroupIconResource.CreateSubItem

Declaration:     procedure  CreateSubItem;    Override

    Visibility:   protected



                14.3.6         TGroupIconResource.UpdateItemOwner

Declaration:     procedure  UpdateItemOwner(index:  Integer);    Override

    Visibility:   protected



                                                                                 95

                _________________________________CHAPTER_14.___REFERENCE_FOR_UNIT_'GROUPICONRESOURCE'______________________________*
 *___________________



                14.3.7         TGroupIconResource.ClearItemList

Declaration:     procedure  ClearItemList;    Override

    Visibility:   protected



                14.3.8         TGroupIconResource.DeleteSubItems

Declaration:     procedure  DeleteSubItems;    Override

    Visibility:   protected



                14.3.9         TGroupIconResource.GetSubStream

Declaration:     function  GetSubStream(const  index:  Integer;out  aSize:  Int64)  :  TStream
                                                   ;    Override

    Visibility:   protected



                14.3.10          TGroupIconResource.GetType

Declaration:     function  GetType  :  TResourceDesc;    Override

    Visibility:   protected



                14.3.11          TGroupIconResource.GetName

Declaration:     function  GetName  :  TResourceDesc;    Override

    Visibility:   protected



                14.3.12          TGroupIconResource.ChangeDescTypeAllowed

Declaration:     function  ChangeDescTypeAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                  ;    Override

    Visibility:   protected



                14.3.13          TGroupIconResource.ChangeDescValueAllowed

Declaration:     function  ChangeDescValueAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                   ;    Override

    Visibility:   protected



                14.3.14          TGroupIconResource.Create

    Synopsis:    Creates a new group icon resource

Declaration:     constructor  Create;    Override
                constructor  Create(aType:  TResourceDesc;aName:  TResourceDesc);    Override

    Visibility:   public

Description:     Please note that aType parameter is not used, since this class always uses RT_GROUP_ICON
                (94 ) as type.



                                                                                 96




Chapter   15



Reference   for   unit



'groupresource'



15.1          Used  units



                               Table 15.1:  Used units by unit 'groupresource'


                                              __Name___________________Page_____
                                                Classes                   ??
                                                resdatastream            114
                                                resource                 124
                                                System                    ??
                                                sysutils                  ??



15.2          Overview


This unit contains TGroupResource (98 ) and TGroupCachedDataStream (97 ), two classes
used for resources of type RT_GROUP_ICON (97 ) and RT_GROUP_CURSOR (97 ).

The former is an abstract resource class which is implemented by TGroupIconResource (97 )
and TGroupCursorResource (97 ), and the latter is a TCachedDataStream (97 ) 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 groupi-
conresource (97 ) and groupcursorresource (97 ) units instead.



15.3          TGroupCachedDataStream



15.3.1         Description

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

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



                                                              97

                _________________________________________CHAPTER_15.___REFERENCE_FOR_UNIT_'GROUPRESOURCE'__________________________*
 *___________________



    See also:    TGroupResource (98 ), TGroupIconResource (97 ), TGroupCursorResource (97 ), TCached-
                DataStream (97 ), TCachedResourceDataStream (97 )



                15.3.2         Method  overview

                __Page______Method_________Description_____________________________________________________________________________*
 *___________
                  98        Create
                  98        Destroy
                __98________Read___________________________________________________________________________________________________*
 *___________



                15.3.3         TGroupCachedDataStream.Create

Declaration:     constructor  Create(aStream:  TStream;aResource:  TAbstractResource;
                                              aSize:  Int64);    Override

    Visibility:   public



                15.3.4         TGroupCachedDataStream.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                15.3.5         TGroupCachedDataStream.Read

Declaration:     function  Read(var  Buffer;Count:  LongInt)  :  LongInt;    Override

    Visibility:   public



                15.4          TGroupResource



                15.4.1         Description

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

                Resources of type RT_GROUP_ICON (97 ) and RT_GROUP_CURSOR (97 ) 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  (97 )  resource  only  contains  information  about  the  single
                images, which are contained each in a different resource of type RT_ICON (97 ).  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 (97 ) resource, which provides information
                about them.

                TGroupIconResource  (97 )  and  TGroupCursorResource  (97 )  provide  a  way  to  handle  re-
                sources  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 (97 ), TGroupCursorResource (97 )



                                                                                 98

                _________________________________________CHAPTER_15.___REFERENCE_FOR_UNIT_'GROUPRESOURCE'__________________________*
 *___________________



                15.4.2         Method  overview

                __Page______Method____________________________________Description__________________________________________________*
 *___________
                  99        CheckBuildItemStream
                  100       ClearItemList
                  101       CompareContents
                  100       CreateSubItem
                  100       CreateSubItems
                  100       DeleteSubItems
                  101       Destroy
                  99        FindSubResources
                  99        GetItemData
                  100       GetSubStream
                  100       GetSubStreamCount
                  101       NotifyResourcesLoaded
                  99        ReadResourceItemHeader
                  101       SetCustomItemDataStream                   Sets a custom stream as the underlying stream for
                                                                      ItemData
                  101       SetOwnerList
                  100       UpdateItemOwner
                  102       UpdateRawData
                  100       WriteHeader
                __100_______WriteResHeader_________________________________________________________________________________________*
 *___________



                15.4.3         Property  overview

                __Page______Properties________Access_______Description_____________________________________________________________*
 *___________
                __102_______ItemData__________r____________Resource_data_as_an_ICO/CUR_stream______________________________________*
 *___________



                15.4.4         TGroupResource.FindSubResources

Declaration:     procedure  FindSubResources

    Visibility:   protected



                15.4.5         TGroupResource.ReadResourceItemHeader

Declaration:     procedure  ReadResourceItemHeader;    Virtual;    Abstract

    Visibility:   protected



                15.4.6         TGroupResource.CheckBuildItemStream

Declaration:     procedure  CheckBuildItemStream

    Visibility:   protected



                15.4.7         TGroupResource.GetItemData

Declaration:     function  GetItemData  :  TStream

    Visibility:   protected



                                                                                 99

                _________________________________________CHAPTER_15.___REFERENCE_FOR_UNIT_'GROUPRESOURCE'__________________________*
 *___________________



                15.4.8         TGroupResource.WriteHeader

Declaration:     procedure  WriteHeader(aStream:  TStream);    Virtual;    Abstract

    Visibility:   protected



                15.4.9         TGroupResource.WriteResHeader

Declaration:     function  WriteResHeader  :  Word

    Visibility:   protected



                15.4.10          TGroupResource.CreateSubItems

Declaration:     procedure  CreateSubItems

    Visibility:   protected



                15.4.11          TGroupResource.CreateSubItem

Declaration:     procedure  CreateSubItem;    Virtual;    Abstract

    Visibility:   protected



                15.4.12          TGroupResource.UpdateItemOwner

Declaration:     procedure  UpdateItemOwner(index:  Integer);    Virtual;    Abstract

    Visibility:   protected



                15.4.13          TGroupResource.ClearItemList

Declaration:     procedure  ClearItemList;    Virtual;    Abstract

    Visibility:   protected



                15.4.14          TGroupResource.DeleteSubItems

Declaration:     procedure  DeleteSubItems;    Virtual;    Abstract

    Visibility:   protected



                15.4.15          TGroupResource.GetSubStreamCount

Declaration:     function  GetSubStreamCount  :  Integer

    Visibility:   protected



                15.4.16          TGroupResource.GetSubStream

Declaration:     function  GetSubStream(const  index:  Integer;out  aSize:  Int64)  :  TStream
                                                   ;    Virtual;    Abstract

    Visibility:   protected



                                                                                 100

                _________________________________________CHAPTER_15.___REFERENCE_FOR_UNIT_'GROUPRESOURCE'__________________________*
 *___________________



                15.4.17          TGroupResource.SetOwnerList

Declaration:     procedure  SetOwnerList(aResources:  TResources);    Override

    Visibility:   protected



                15.4.18          TGroupResource.NotifyResourcesLoaded

Declaration:     procedure  NotifyResourcesLoaded;    Override

    Visibility:   protected



                15.4.19          TGroupResource.Destroy

    Synopsis:

Declaration:     destructor  Destroy;    Override

    Visibility:   public

Description:



                15.4.20          TGroupResource.CompareContents

Declaration:     function  CompareContents(aResource:  TAbstractResource)  :  Boolean
                                                        ;    Override

    Visibility:   public



                15.4.21          TGroupResource.SetCustomItemDataStream

    Synopsis:    Sets a custom stream as the underlying stream for ItemData

Declaration:     procedure  SetCustomItemDataStream(aStream:  TStream)

    Visibility:   public

Description:     This method allows the user to use a custom stream as the underlying stream for ItemData
                (102  ).  This is useful when you want a TGroupIconResource (97 ) or TGroupCursorResource
                (97 ) 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);



                                                                                 101

                _________________________________________CHAPTER_15.___REFERENCE_FOR_UNIT_'GROUPRESOURCE'__________________________*
 *___________________



                   Resources.Add(aRes);
                   Resources.WriteToFile('myresource.res');


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


    See also:    TGroupResource.ItemData (102  ), TGroupIconResource (97 ), TGroupCursorResource (97 ),
                TAbstractResource.UpdateRawData (97 )



                15.4.22          TGroupResource.UpdateRawData

Declaration:     procedure  UpdateRawData;    Override

    Visibility:   public



                15.4.23          TGroupResource.ItemData

    Synopsis:    Resource data as an ICO/CUR stream

Declaration:     Property  ItemData  :  TStream

    Visibility:   public

      Access:    Read

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

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

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

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

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

    See also:    TGroupResource.SetCustomItemDataStream (101  ), TGroupIconResource (97 ), TGroupCur-
                sorResource  (97 ),  TAbstractResource.RawData  (97 ),  TAbstractResource.UpdateRawData
                (97 )



                                                                                 102




               Chapter   16



               Reference   for   unit   'machoreader'



               16.1          Used  units



                                               Table 16.1:  Used units by unit 'machoreader'


                                                               __Name________________Page_____
                                                                 Classes                ??
                                                                 machotypes            106
                                                                 resource              124
                                                                 System                 ??
                                                                 sysutils               ??



               16.2          Overview


               This  unit  contains  TMachOResourceReader  (103  ),  a  TAbstractResourceReader  (103  )  de-
               scendant that is able to read Mach-O object files containing resources.

               Adding this unit to a program's uses clause registers class TMachOResourceReader (103  )
               with TResources (103  ).



               16.3          TMachOResourceReader



               16.3.1         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 (105  ) 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 (105  ), TAbstractResourceReader (103  ), TMachORe-



                                                                            103

                _____________________________________________CHAPTER_16.___REFERENCE_FOR_UNIT_'MACHOREADER'________________________*
 *___________________



                sourceWriter (103  ), Format of resources in object files (103  )



                16.3.2         Method  overview

                __Page______Method___________________Description___________________________________________________________________*
 *___________
                  104       CheckMagic
                  104       Create
                  104       Destroy
                  104       GetDescription
                  104       GetExtensions
                __104_______Load___________________________________________________________________________________________________*
 *___________



                16.3.3         Property  overview

                __Page______Properties_____________Access_______Description________________________________________________________*
 *___________
                __105_______MachineType____________r____________The_machine_type_of_the_object_file________________________________*
 *___________



                16.3.4         TMachOResourceReader.GetExtensions

Declaration:     function  GetExtensions  :  string;    Override

    Visibility:   protected



                16.3.5         TMachOResourceReader.GetDescription

Declaration:     function  GetDescription  :  string;    Override

    Visibility:   protected



                16.3.6         TMachOResourceReader.Load

Declaration:     procedure  Load(aResources:  TResources;aStream:  TStream);    Override

    Visibility:   protected



                16.3.7         TMachOResourceReader.CheckMagic

Declaration:     function  CheckMagic(aStream:  TStream)  :  Boolean;    Override

    Visibility:   protected



                16.3.8         TMachOResourceReader.Create

Declaration:     constructor  Create;    Override

    Visibility:   public



                16.3.9         TMachOResourceReader.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                                                                                 104

                _____________________________________________CHAPTER_16.___REFERENCE_FOR_UNIT_'MACHOREADER'________________________*
 *___________________



                16.3.10          TMachOResourceReader.MachineType

    Synopsis:    The machine type of the object file

Declaration:     Property  MachineType  :  TMachOMachineType

    Visibility:   public

      Access:    Read

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 (103  )



                                                                                 105




Chapter   17



Reference   for   unit   'machotypes'



17.1          Overview


These constants are used internally by TMachOResourceWriter (106  ) and TMachOResourceReader
(106  ).

The only type of interest for the user is TMachOMachineType (107  ).



17.2          Constants,  types  and  variables



17.2.1         Types

PNList32  =  ^TNList32



PNList64  =  ^TNList64



PRelocationInfo  =  ^TRelocationInfo



TDySymtabCommand  =  packed  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;



                                                             106

________________________________________________CHAPTER_17.___REFERENCE_FOR_UNIT_'MACHOTYPES'______________________________________*
 *___



   locreloff  :  LongWord;
   nlocrel  :  LongWord;
end



TLoadCommand  =  packed  record
   cmd  :  LongWord;
   cmdsize  :  LongWord;
end



TMachHdr  =  packed  record
   magic  :  LongWord;
   cputype  :  LongInt;
   cpusubtype  :  LongInt;
   filetype  :  LongWord;
   ncmds  :  LongWord;
   sizeofcmds  :  LongWord;
   flags  :  LongWord;
end



TMachOMachineType  =  (mmtpowerpc,mmtpowerpc64,mmti386,mmtx86_64,mmtarm)



                   Table 17.1:  Enumeration values for type TMachOMachineType


                              __Value____________________Explanation____________________________
                                mmtarm
                                mmti386                  Intel 386 machine type
                                mmtpowerpc               PowerPC machine type
                                mmtpowerpc64             PowerPC 64 machine type
                                mmtx86_64                AMD x86_64 machine type



This enumeration specifies the Mach-O machine type.

It  is  used  by  TMachOResourceWriter  (106  )  to  specify  the  machine  type  of  the  generated
object file and by TMachOResourceReader (106  ) to read the machine type of the object file
that has been read.


TMachOSubMachineType386  =  (msm386_all)



              Table 17.2:  Enumeration values for type TMachOSubMachineType386


                                           __Value______________Explanation________
                                             msm386_all



                                                                 107

________________________________________________CHAPTER_17.___REFERENCE_FOR_UNIT_'MACHOTYPES'______________________________________*
 *___



TMachOSubMachineTypeArm  =  (msmarm_all,msmarm_v4t,msmarm_v6,msmarm_v5tej,
                                            msmarm_xscale,msmarm_v7)



             Table 17.3:  Enumeration values for type TMachOSubMachineTypeArm


                                        __Value____________________Explanation________
                                          msmarm_all
                                          msmarm_v4t
                                          msmarm_v5tej
                                          msmarm_v6
                                          msmarm_v7
                                          msmarm_xscale



TMachOSubMachineTypePowerPC  =  (msmppc_all)



          Table 17.4:  Enumeration values for type TMachOSubMachineTypePowerPC


                                           __Value_______________Explanation________
                                             msmppc_all



TMachOSubMachineTypePowerPC64  =  (msmppc64_all)



        Table 17.5:  Enumeration values for type TMachOSubMachineTypePowerPC64


                                         __Value__________________Explanation________
                                           msmppc64_all



TMachOSubMachineTypex64  =  (msmx64_all)



              Table 17.6:  Enumeration values for type TMachOSubMachineTypex64


                                           __Value______________Explanation________
                                             msmx64_all



TNList32  =  packed  record
   strx  :  LongWord;
   _type  :  Byte;
   sect  :  Byte;
   desc  :  Word;
   value  :  LongWord;
end



                                                                 108

________________________________________________CHAPTER_17.___REFERENCE_FOR_UNIT_'MACHOTYPES'______________________________________*
 *___



TNList64  =  packed  record
   strx  :  LongWord;
   _type  :  Byte;
   sect  :  Byte;
   desc  :  Word;
   value  :  QWord;
end



TRelocationInfo  =  packed  record
   address  :  LongWord;
   flags  :  LongWord;
end



TSection32  =  packed  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  =  packed  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  =  packed  record
   name  :  TSegSectName;
   vmaddr  :  LongWord;
   vmsize  :  LongWord;



                                                                 109

________________________________________________CHAPTER_17.___REFERENCE_FOR_UNIT_'MACHOTYPES'______________________________________*
 *___



   fileoff  :  LongWord;
   filesize  :  LongWord;
   maxprot  :  LongInt;
   initprot  :  LongInt;
   nsects  :  LongWord;
   flags  :  LongWord;
end



TSegmentCommand64  =  packed  record
   name  :  TSegSectName;
   vmaddr  :  QWord;
   vmsize  :  QWord;
   fileoff  :  QWord;
   filesize  :  QWord;
   maxprot  :  LongInt;
   initprot  :  LongInt;
   nsects  :  LongWord;
   flags  :  LongWord;
end



TSegSectName  =  Array[0..15]  of  Char



TSymtabCommand  =  packed  record
   symoff  :  LongWord;
   nsyms  :  LongWord;
   stroff  :  LongWord;
   strsize  :  LongWord;
end



                                                                 110




Chapter   18



Reference   for   unit   'machowriter'



18.1          Used  units



                                Table 18.1:  Used units by unit 'machowriter'


                                                __Name________________Page_____
                                                  Classes                ??
                                                  machotypes            106
                                                  resource              124
                                                  System                 ??
                                                  sysutils               ??



18.2          Overview


This unit contains TMachOResourceWriter (112  ), a TAbstractResourceWriter (111  ) descen-
dant that is able to write Mach-O object files containing resources.

Adding  this  unit  to  a  program's  uses  clause  registers  class  TMachOResourceWriter  (112  )
with TResources (111  ).



18.3          Constants,  types  and  variables



18.3.1         Types

TMachoSubMachineType  =  record
case  TMachOMachineType  of
msmppc_all:  (
    fPpcSubType  :  TMachOSubMachineTypePowerPC;
);
msmppc64_all:  (
    fPpc64SubType  :  TMachOSubMachineTypePowerPC64;
);
msm386_all:  (
    f386SubType  :  TMachOSubMachineType386;
);



                                                             111

            _____________________________________________CHAPTER_18.___REFERENCE_FOR_UNIT_'MACHOWRITER'____________________________*
 *_______________



            msmx64_all:  (
               fX64SubType  :  TMachOSubMachineTypex64;
            );
            mmtarm:  (
               fArmSubType  :  TMachOSubMachineTypeArm;
            );
            end



            18.4          EMachOResourceWriterException



            18.4.1         Description

            Base class for Mach-O resource writer-related exceptions



            18.5          EMachOResourceWriterUnknownBitSizeException



            18.5.1         Description

            If this exception is raised, an internal error occurred.



            18.6          TMachOResourceWriter



            18.6.1         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 (113  ) property can be used to set the machine type of the object file to generate.


See also:    TMachOResourceWriter.MachineType (113  ), TAbstractResourceWriter (111  ), TMachORe-
            sourceReader (111  ), Format of resources in object files (111  )



            18.6.2         Method  overview

            __Page______Method___________________Description_______________________________________________________________________*
 *_______
              113       Create
              113       Destroy
              113       GetDescription
              113       GetExtensions
            __113_______Write______________________________________________________________________________________________________*
 *_______



            18.6.3         Property  overview

            __Page______Properties__________________Access_______Description_______________________________________________________*
 *_______
              113       MachineType                 rw           The machine type of the object file
            __113_______SubMachineType______________rw_____________________________________________________________________________*
 *_______



                                                                             112

                _____________________________________________CHAPTER_18.___REFERENCE_FOR_UNIT_'MACHOWRITER'________________________*
 *___________________



                18.6.4         TMachOResourceWriter.GetExtensions

Declaration:     function  GetExtensions  :  string;    Override

    Visibility:   protected



                18.6.5         TMachOResourceWriter.GetDescription

Declaration:     function  GetDescription  :  string;    Override

    Visibility:   protected



                18.6.6         TMachOResourceWriter.Write

Declaration:     procedure  Write(aResources:  TResources;aStream:  TStream);    Override

    Visibility:   protected



                18.6.7         TMachOResourceWriter.Create

Declaration:     constructor  Create;    Override

    Visibility:   public



                18.6.8         TMachOResourceWriter.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                18.6.9         TMachOResourceWriter.MachineType

    Synopsis:    The machine type of the object file

Declaration:     Property  MachineType  :  TMachOMachineType

    Visibility:   public

      Access:    Read,Write

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

    See also:    TMachOMachineType (111  )



                18.6.10          TMachOResourceWriter.SubMachineType

Declaration:     Property  SubMachineType  :  TMachoSubMachineType

    Visibility:   public

      Access:    Read,Write



                                                                                 113




Chapter   19



Reference   for   unit



'resdatastream'



19.1          Used  units



                               Table 19.1:  Used units by unit 'resdatastream'


                                                  __Name___________Page_____
                                                    Classes           ??
                                                    resource         124
                                                    System            ??
                                                    sysutils          ??



19.2          Overview


This  unit  contains  various  streams  that  are  used  to  provide  copy-on-write  mechanism  for
TAbstractResource.RawData (114  ), via more levels of indirection.

Main  class  is  TResourceDataStream  (117  ),  which  is  the  stream  used  for  TAbstractRe-
source.RawData  (114  ).   This  class  uses  an  underlying  stream,  to  which  it  redirects  oper-
ations.

At  a  lower  level,  a  TCachedDataStream  (115  )  descendant  provides  a  layer  between  the
original stream and the TResourceDataStream (117  ).



19.3          Constants,  types  and  variables



19.3.1         Types

TCachedStreamClass  =  Class  of  TCachedDataStream


Cached stream metaclass


TUnderlyingStreamType  =  (usCached,usMemory,usCustom)



                                                             114

                __________________________________________CHAPTER_19.___REFERENCE_FOR_UNIT_'RESDATASTREAM'_________________________*
 *___________________



                                 Table 19.2:  Enumeration values for type TUnderlyingStreamType


                    __Value_____________Explanation________________________________________________________________________________*
 *_______
                      usCached          The underlying stream is a TCachedResourceDataStream descendant
                      usCustom          The underlying stream is a custom stream
                      usMemory          The underlying stream is a memory stream



                The type of the underlying stream of TResourceDataStream



                19.4          TCachedDataStream



                19.4.1         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 (117  ) to access the raw data of a resource.  When
                an attempt to write to the stream is detected, TResourceDataStream (117  ) 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 (117  ), TCachedResourceDataStream (116  )



                19.4.2         Method  overview

                __Page______Method______________Description________________________________________________________________________*
 *___________
                  116       Create              Creates a new object
                  115       GetPosition
                  116       GetSize
                  116       Seek
                  115       SetPosition
                  116       SetSize64
                __116_______Write__________________________________________________________________________________________________*
 *___________



                19.4.3         TCachedDataStream.GetPosition

Declaration:     function  GetPosition  :  Int64;    Override

    Visibility:   protected



                19.4.4         TCachedDataStream.SetPosition

Declaration:     procedure  SetPosition(const  Pos:  Int64);    Override

    Visibility:   protected



                                                                                 115

                __________________________________________CHAPTER_19.___REFERENCE_FOR_UNIT_'RESDATASTREAM'_________________________*
 *___________________



                19.4.5         TCachedDataStream.GetSize

Declaration:     function  GetSize  :  Int64;    Override

    Visibility:   protected



                19.4.6         TCachedDataStream.SetSize64

Declaration:     procedure  SetSize64(const  NewSize:  Int64);    Override

    Visibility:   protected



                19.4.7         TCachedDataStream.Create

    Synopsis:    Creates a new object

Declaration:     constructor  Create(aStream:  TStream;aResource:  TAbstractResource;
                                              aSize:  Int64);    Virtual

    Visibility:   public

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

    See also:    TCachedDataStream (115  ), TResourceDataStream (117  ), TResourceDataStream.Create (118  )



                19.4.8         TCachedDataStream.Write

Declaration:     function  Write(const  Buffer;Count:  LongInt)  :  LongInt;    Override

    Visibility:   public



                19.4.9         TCachedDataStream.Seek

Declaration:     function  Seek(const  Offset:  Int64;Origin:  TSeekOrigin)  :  Int64
                                      ;    Override

    Visibility:   public



                19.5          TCachedResourceDataStream



                19.5.1         Description

                This class provides an implementation of TCachedDataStream (115  ).

                Usually  resource  readers  create  a  TResourceDataStream  (117  )  with  a  TCachedResource-
                DataStream as the underlying stream.


    See also:    TCachedDataStream (115  ), TResourceDataStream (117  )



                19.5.2         Method  overview

                __Page______Method_________Description_____________________________________________________________________________*
 *___________
                  117       Create
                __117_______Read___________________________________________________________________________________________________*
 *___________



                                                                                 116

                __________________________________________CHAPTER_19.___REFERENCE_FOR_UNIT_'RESDATASTREAM'_________________________*
 *___________________



                19.5.3         TCachedResourceDataStream.Create

Declaration:     constructor  Create(aStream:  TStream;aResource:  TAbstractResource;
                                              aSize:  Int64);    Override

    Visibility:   public



                19.5.4         TCachedResourceDataStream.Read

Declaration:     function  Read(var  Buffer;Count:  LongInt)  :  LongInt;    Override

    Visibility:   public



                19.6          TResourceDataStream



                19.6.1         Description

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

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

                The underlying stream can be a TCachedDataStream (115  ) descendant, a memory stream
                or a custom stream.  Usually when a resource is loaded from a stream, the underlying stream
                is a TCachedDataStream (115  ) 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  (117  )  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 (114  ) method, which
                in turn calls TResourceDataStream.SetCustomStream (119  )

                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 (115  ), TResourceDataStream.Create (118  ), TResourceDataStream.SetCustomStream
                (119  )



                                                                                 117

                __________________________________________CHAPTER_19.___REFERENCE_FOR_UNIT_'RESDATASTREAM'_________________________*
 *___________________



                19.6.2         Method  overview

                __Page______Method_______________________Description_______________________________________________________________*
 *___________
                  119       Compare                      Compares the stream to another one
                  118       Create                       Creates a new object
                  119       Destroy
                  118       GetPosition
                  118       GetSize
                  119       Read
                  120       Seek
                  119       SetCustomStream              Sets a custom stream as the underlying stream
                  118       SetPosition
                  118       SetSize64
                __119_______Write__________________________________________________________________________________________________*
 *___________



                19.6.3         Property  overview

                __Page______Properties________Access_______Description_____________________________________________________________*
 *___________
                __120_______Cached____________rw___________Controls_the_copy-on-write_behaviour_of_the_stream______________________*
 *___________



                19.6.4         TResourceDataStream.GetPosition

Declaration:     function  GetPosition  :  Int64;    Override

    Visibility:   protected



                19.6.5         TResourceDataStream.SetPosition

Declaration:     procedure  SetPosition(const  Pos:  Int64);    Override

    Visibility:   protected



                19.6.6         TResourceDataStream.GetSize

Declaration:     function  GetSize  :  Int64;    Override

    Visibility:   protected



                19.6.7         TResourceDataStream.SetSize64

Declaration:     procedure  SetSize64(const  NewSize:  Int64);    Override

    Visibility:   protected



                19.6.8         TResourceDataStream.Create

    Synopsis:    Creates a new object

Declaration:     constructor  Create(aStream:  TStream;aResource:  TAbstractResource;
                                              aSize:  Int64;aClass:  TCachedStreamClass)

    Visibility:   public



                                                                                 118

                __________________________________________CHAPTER_19.___REFERENCE_FOR_UNIT_'RESDATASTREAM'_________________________*
 *___________________



Description:     A new TResourceDataStream (117  ) 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 (117  ), TCachedDataStream (115  ), TResourceDataStream.SetCustomStream
                (119  )



                19.6.9         TResourceDataStream.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                19.6.10          TResourceDataStream.Compare

    Synopsis:    Compares the stream to another one

Declaration:     function  Compare(aStream:  TStream)  :  Boolean

    Visibility:   public

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 (114  )



                19.6.11          TResourceDataStream.SetCustomStream

    Synopsis:    Sets a custom stream as the underlying stream

Declaration:     procedure  SetCustomStream(aStream:  TStream)

    Visibility:   public

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 (114  ).

    See also:    TResourceDataStream (117  ), TAbstractResource.SetCustomRawDataStream (114  )



                19.6.12          TResourceDataStream.Read

Declaration:     function  Read(var  Buffer;Count:  LongInt)  :  LongInt;    Override

    Visibility:   public



                19.6.13          TResourceDataStream.Write

Declaration:     function  Write(const  Buffer;Count:  LongInt)  :  LongInt;    Override

    Visibility:   public



                                                                                 119

                __________________________________________CHAPTER_19.___REFERENCE_FOR_UNIT_'RESDATASTREAM'_________________________*
 *___________________



                19.6.14          TResourceDataStream.Seek

Declaration:     function  Seek(const  Offset:  Int64;Origin:  TSeekOrigin)  :  Int64
                                      ;    Override

    Visibility:   public



                19.6.15          TResourceDataStream.Cached

    Synopsis:    Controls the copy-on-write behaviour of the stream

Declaration:     Property  Cached  :  Boolean

    Visibility:   public

      Access:    Read,Write

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 (117  ), TAbstractResource.CacheData (114  )



                                                                                 120




            Chapter   20



            Reference   for   unit   'resfactory'



            20.1          Used  units



                                              Table 20.1:  Used units by unit 'resfactory'


                                                              __Name___________Page_____
                                                                Classes           ??
                                                                resource         124
                                                                System            ??
                                                                sysutils          ??



            20.2          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 (122  ) so that the class knows how
            to create a resource of a specific type.



            20.3          Constants,  types  and  variables



            20.3.1         Resource  strings

            SAlreadyRegistered  =  'A  resource  class  for  the  type  %s  is  already  registered.'



            20.4          EResourceClassAlreadyRegisteredException



            20.4.1         Description

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


See also:    TResourceFactory.RegisterResourceClass (122  )



                                                                         121

                _________________________________________________CHAPTER_20.___REFERENCE_FOR_UNIT_'RESFACTORY'_____________________*
 *___________________



                20.5          EResourceFactoryException



                20.5.1         Description

                Base class for resource factory-related exceptions



                20.6          TResourceFactory



                20.6.1         Description

                Resources  are  represented  by  descendants  of  TAbstractResource  (121  ).  Some  applications
                don't need specialized resource classes, and a TGenericResource (121  ) 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 (122  ) 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 (121  )
                is used.

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


    See also:    TResourceFactory.RegisterResourceClass (122  ), TResourceFactory.CreateResource (123  ), TAb-
                stractResource (121  ), TGenericResource (121  )



                20.6.2         Method  overview

                __Page______Method_____________________________Description_________________________________________________________*
 *___________
                  123       CreateResource                     Creates a new resource
                __122_______RegisterResourceClass______________Registers_a_resource_class__________________________________________*
 *___________



                20.6.3         TResourceFactory.RegisterResourceClass

    Synopsis:    Registers a resource class

Declaration:     class  procedure  RegisterResourceClass(aType:  TResID;
                                                                             aClass:  TResourceClass);    Overload
                class  procedure  RegisterResourceClass(aType:  TResName;
                                                                             aClass:  TResourceClass);    Overload
                class  procedure  RegisterResourceClass(aType:  TResourceDesc;
                                                                             aClass:  TResourceClass);    Overload

    Visibility:   public

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  EResourceClassAl-
                readyRegisteredException (121  ) exception is raised.

    See also:    TResourceFactory (122  )



                                                                                 122

                _________________________________________________CHAPTER_20.___REFERENCE_FOR_UNIT_'RESFACTORY'_____________________*
 *___________________



                20.6.4         TResourceFactory.CreateResource

    Synopsis:    Creates a new resource

Declaration:     class  function  CreateResource(aType:  TResourceDesc;aName:  TResourceDesc)

    Visibility:   public

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
                (121  ) class.

    See also:    TResourceFactory (122  ), TResourceFactory.RegisterResourceClass (122  ), TGenericResource
                (121  )



                                                                                 123




Chapter   21



Reference   for   unit   'resource'



21.1          Used  units



                                   Table 21.1:  Used units by unit 'resource'


                                                   __Name__________Page_____
                                                     Classes          ??
                                                     System           ??
                                                     sysutils         ??



21.2          Overview


This unit contains base classes needed to work with resources.

Single  resources  are  represented  by  an  instance  of  a  TAbstractResource  (130  )  descendant.
They are grouped in a TResources (151  ) instance which can be read (written) to (from) a
stream via a TAbstractResourceReader (140  ) (TAbstractResourceWriter (145  )) descendant.

TGenericResource (147  ) provides a basic implementation of TAbstractResource (130  ).



21.3          Constants,  types  and  variables



21.3.1         Resource  strings

SDescChangeNotAllowed  =  'Cannot  modify  %s  resource  description'



SLangIDChangeNotAllowed  =  'Cannot  modify  %s  resource  language  ID'



SReaderNotFoundExt  =  'Cannot  find  resource  reader  for  extension  ''%s'''



SReaderNotFoundProbe  =  'Cannot  find  a  resource  reader:  unknown  format.'



SResDuplicate  =  'Duplicate  resource:  Type  =  %s,  Name  =  %s,  Lang  ID  =  %.4x'



                                                             124

_____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________________________*
 *___



SResourceNotFound  =  'Cannot  find  resource:  Type  =  %s,  Name  =  %s'



SResourceNotFoundLang  =  'Cannot  find  resource:  Type  =  %s,  Name  =  %s,  Lang  ID  =  %.4x'



SWriterNotFoundExt  =  'Cannot  find  resource  writer  for  extension  ''%s'''



21.3.2         Constants

CREATEPROCESS_MANIFEST_RESOURCE_ID  =  1



ISOLATIONAWARE_MANIFEST_RESOURCE_ID  =  2



ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID  =  3



MAXIMUM_RESERVED_MANIFEST_RESOURCE_ID  =  16



MF_DISCARDABLE  =  $1000


This flag is ignored by Windows and Free Pascal RTL. It's provided for compatibility with
16-bit Windows.


MF_MOVEABLE  =  $0010


This flag is ignored by Windows and Free Pascal RTL. It's provided for compatibility with
16-bit Windows.


MF_PRELOAD  =  $0040


This flag is ignored by Windows and Free Pascal RTL. It's provided for compatibility with
16-bit Windows.


MF_PURE  =  $0020


This flag is ignored by Windows and Free Pascal RTL. It's provided for compatibility with
16-bit Windows.


MINIMUM_RESERVED_MANIFEST_RESOURCE_ID  =  1



RT_ACCELERATOR  =  9


Accelerator table resource


RT_ANICURSOR  =  21


This resource type contains raw binary data taken from a .ani file



                                                                 125

               _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'____________________*
 *__________________



               RT_ANIICON  =  22


               This resource type contains raw binary data taken from a .ani file


               RT_BITMAP  =  2


               Bitmap resource


               RT_CURSOR  =  1


               A single image in a cursor.  Don't use it directly.


               RT_DIALOG  =  5


               Dialog resource


               RT_DLGINCLUDE  =  17


               This resource is used internally by resource compilers but will never appear in compiled form


               RT_FONT  =  8


               This resource type is obsolete and never appears in 32 bit resources.


               RT_FONTDIR  =  7


               This resource type is obsolete and never appears in 32 bit resources.


               RT_GROUP_CURSOR  =  12


               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 (126  ) resources (the single cursor
               images) that shouldn't be accessed singularly.


               RT_GROUP_ICON  =  14


               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 (126  ) resources (the single icon images)
               that shouldn't be accessed singularly.


               RT_HTML  =  23


               This resource type contains an HTML file.


               RT_ICON  =  3


               A single image in a icon.  Don't use it directly.


               RT_MANIFEST  =  24



                                                                                126

               _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'____________________*
 *__________________



               This resource contains data taken from a .manifest file

Remark:         Resource  name  must  be  one  of  CREATEPROCESS_MANIFEST_RESOURCE_ID  (125  )
               (mainly used for executables), ISOLATIONAWARE_MANIFEST_RESOURCE_ID (125  ) or
               ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID (125  ) (mainly used
               for DLLs)


               RT_MENU  =  4


               Menu resource


               RT_MESSAGETABLE  =  11


               Message table resource


               RT_PLUGPLAY  =  19


               Plug and Play resource


               RT_RCDATA  =  10


               This resource type contains arbitrary binary data

               Note that Delphi dfm files are stored in compiled form as a RCDATA resource


               RT_STRING  =  6


               String table resource


               RT_VERSION  =  16


               This resource defines version information which is visible when viewing properties of a Win-
               dows executable or DLL.


               RT_VXD  =  20


               VXD resource



               21.3.3         Types

               TDescType  =  (dtName,dtID)



                                         Table 21.2:  Enumeration values for type TDescType


                                           __Value__________Explanation___________________________________________
                                             dtID           The resource type or name is an ID
                                             dtName         The resource type or name is a string



               The type of a resource type or name



                                                                                127

            _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'_______________________*
 *_______________



            TLangID  =  Word


            A resource language ID


            TResID  =  LongWord


            A resource type or name in ID form


            TResName  =  String


            A resource type or name in string form


            TResourceClass  =  Class  of  TAbstractResource


            Resource metaclass


            TResourceReaderClass  =  Class  of  TAbstractResourceReader


            Resource reader metaclass


            TResourceWriterClass  =  Class  of  TAbstractResourceWriter


            Resource writer metaclass



            21.4          ENoMoreFreeIDsException



            21.4.1         Description

            This exception is raised by TResources.AddAutoID (153  ) 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 (153  )



            21.5          EResourceDescChangeNotAllowedException



            21.5.1         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 (136  ), TAbstractResource.Name (136  )



            21.6          EResourceDescTypeException



            21.6.1         Description

            This  exception  is  raised  when  a  resource  description  is  of  type  dtName  (127  )  and  TRe-
            sourceDesc.ID (151  ) property is read.


See also:    TResourceDesc.ID (151  )



                                                                             128

            _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'_______________________*
 *_______________



            21.7          EResourceDuplicateException



            21.7.1         Description

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


See also:    TResources.Add (152  ), TResources.MoveFrom (154  )



            21.8          EResourceException



            21.8.1         Description

            Base class for resource-related exceptions



            21.9          EResourceLangIDChangeNotAllowedException



            21.9.1         Description

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


See also:    TAbstractResource.LangID (136  )



            21.10            EResourceNotFoundException



            21.10.1          Description

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


See also:    TResources.Find (153  ), TResources.Remove (154  )



            21.11            EResourceReaderException



            21.11.1          Description

            Base class for resource reader-related exceptions



            21.12            EResourceReaderNotFoundException



            21.12.1          Description

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


See also:    TResources.FindReader (154  ), TResources.LoadFromStream (155  ), TResources.LoadFromFile
            (155  )



                                                                             129

            _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'_______________________*
 *_______________



            21.13            EResourceReaderUnexpectedEndOfStreamException



            21.13.1          Description

            This exception is raised by Load (143  ) method of a TAbstractResourceReader (140  ) descen-
            dant when the stream it was asked to read resources from ended prematurely.


See also:    TAbstractResourceReader.Load (143  )



            21.14            EResourceReaderWrongFormatException



            21.14.1          Description

            This exception is raised by Load (143  ) method of a TAbstractResourceReader (140  ) descen-
            dant when the stream it was asked to read resources from is not in the format it supports.


See also:    TAbstractResourceReader.Load (143  )



            21.15            EResourceWriterException



            21.15.1          Description

            Base class for resource writer-related exceptions



            21.16            EResourceWriterNotFoundException



            21.16.1          Description

            This exception is raised by WriteToFile (157  ) method of TResources (151  ) when no TAb-
            stractResourceWriter (145  ) descendant matching filename extension was found.


See also:    TResources.WriteToFile (157  )



            21.17            TAbstractResource



            21.17.1          Description

            This is the base class that represents a resource.

            A resource is identified by its type (136  ),  name (136  ) and language ID (136  ) 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  (139  )  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
            (139  )  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.



                                                                             130

               _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'____________________*
 *__________________



               When resource data is encoded in a resource-specific format, RawData (139  ) can be uncom-
               fortable:  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 (151  ) object, which represents an abstract view of a resource file.

               Usually each descendant registers itself with TResourceFactory (124  ) class in the initialization
               section of the unit in which it is implemented:  this way TResourceFactory (124  ) 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 (147  ), TAcceleratorsResource (124  ), TBitmapResource (124  ), TGroupCur-
               sorResource  (124  ),  TGroupIconResource  (124  ),  TStringTableResource  (124  ),  TVersionRe-
               source (124  ), TResources (151  ), TResourceFactory (124  )



               21.17.2          Method  overview

               __Page______Method____________________________________Description___________________________________________________*
 *__________
                 133       ChangeDescTypeAllowed                     Reports whether changing the type of resource type
                                                                     or name is allowed
                 133       ChangeDescValueAllowed                    Reports whether changing the value of resource type
                                                                     or name is allowed
                 134       CompareContents                           Compares the contents of the resource to the con-
                                                                     tents of another one
                 134       Create                                    Creates a new resource
                 134       Destroy                                   Destroys the object
                 133       GetName                                   Returns the name of the resource
                 132       GetType                                   Returns the type of the resource
                 134       NotifyResourcesLoaded                     Tells  the  resource  that  all  resources  have  been
                                                                     loaded
                 132       SetChildOwner                             Protected method to let a resource set itself as the
                                                                     owner of a sub-resource
                 135       SetCustomRawDataStream                    Sets a custom stream as the underlying stream for
                                                                     RawData
                 132       SetDescOwner                              Sets  this  resource  as  the  owner  of  the  given  TRe-
                                                                     sourceDesc
                 132       SetOwnerList                              Protected method to let a resource list set itself as
                                                                     the owner of the resource
               __135_______UpdateRawData_____________________________Updates_RawData_stream._______________________________________*
 *__________



                                                                                131

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.17.3          Property  overview

                __Page______Properties_______________Access_______Description______________________________________________________*
 *___________
                  139       CacheData                rw           Controls the copy-on-write behaviour of the resource
                  138       Characteristics          rw           A user defined piece of data
                  139       CodePage                 rw           The code page of the resource
                  138       DataOffset               r            The offset of resource data from the beginning of the
                                                                  stream
                  137       DataSize                 r            The size of resource raw data
                  137       DataVersion              rw           The version of the resource data
                  137       HeaderSize               r            The size of resource header
                  136       LangID                   rw           The language ID of the resource
                  137       MemoryFlags              rw           The memory flags of the resource
                  136       Name                     r            The name of the resource
                  140       Owner                    r            The owner of this resource
                  140       OwnerList                r            The resource list that owns this resource
                  139       RawData                  r            The raw resource data stream
                  136       \_Type                   r            The type of the resource
                __138_______Version__________________rw___________A_user_defined_version_number____________________________________*
 *___________



                21.17.4          TAbstractResource.SetDescOwner

    Synopsis:    Sets this resource as the owner of the given TResourceDesc

Declaration:     procedure  SetDescOwner(aDesc:  TResourceDesc)

    Visibility:   protected

Description:     This method is provided so that descendants of TAbstractResource (130  ) can set themselves
                as the owners of the given TResourceDesc



                21.17.5          TAbstractResource.SetOwnerList

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

Declaration:     procedure  SetOwnerList(aResources:  TResources);    Virtual

    Visibility:   protected



                21.17.6          TAbstractResource.SetChildOwner

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

Declaration:     procedure  SetChildOwner(aChild:  TAbstractResource)

    Visibility:   protected



                21.17.7          TAbstractResource.GetType

    Synopsis:    Returns the type of the resource

Declaration:     function  GetType  :  TResourceDesc;    Virtual;    Abstract

    Visibility:   protected

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



                                                                                 132

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.17.8          TAbstractResource.GetName

    Synopsis:    Returns the name of the resource

Declaration:     function  GetName  :  TResourceDesc;    Virtual;    Abstract

    Visibility:   protected

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



                21.17.9          TAbstractResource.ChangeDescTypeAllowed

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

Declaration:     function  ChangeDescTypeAllowed(aDesc:  TResourceDesc)  :  Boolean;    Virtual
                                                                  ;    Abstract

    Visibility:   protected

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 (127  ) to dtID (127  ) or vice versa.

                Example:

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


                Result:=aDesc=fName;


    See also:    TAbstractResource.ChangDescValueAllowed (130  )



                21.17.10           TAbstractResource.ChangeDescValueAllowed

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

Declaration:     function  ChangeDescValueAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                   ;    Virtual;    Abstract

    Visibility:   protected

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 (124  )
                doesn't want its type to be anything else than RT_BITMAP (126  ).  It then allows changing
                the value of the description only if the description is the resource name:


                Result:=aDesc=fName;


    See also:    TAbstractResource.ChangDescTypeAllowed (130  )



                                                                                 133

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.17.11           TAbstractResource.NotifyResourcesLoaded

    Synopsis:    Tells the resource that all resources have been loaded

Declaration:     procedure  NotifyResourcesLoaded;    Virtual;    Abstract

    Visibility:   protected

Description:     This method is called by a TResources (151  ) object when the loading of all resources from
                a stream has completed.

                Example:

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



                21.17.12           TAbstractResource.Create

    Synopsis:    Creates a new resource

Declaration:     constructor  Create;    Virtual;    Overload
                constructor  Create(aType:  TResourceDesc;aName:  TResourceDesc);    Virtual
                                              ;    Abstract;    Overload

    Visibility:   protected

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 (149  ) objects
                passed as parameters, it simply copies them:  it's user responsibility to free them when no
                longer needed.



                21.17.13           TAbstractResource.Destroy

    Synopsis:    Destroys the object

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                21.17.14           TAbstractResource.CompareContents

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

Declaration:     function  CompareContents(aResource:  TAbstractResource)  :  Boolean
                                                        ;    Virtual

    Visibility:   public

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  (139  )  streams,  calling
                TResourceDataStream.Compare (124  ), but descendent classes can implement a different al-
                gorithm.

    See also:    TResourceDataStream.Compare (124  )



                                                                                 134

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.17.15           TAbstractResource.UpdateRawData

    Synopsis:    Updates RawData stream.

Declaration:     procedure  UpdateRawData;    Virtual;    Abstract

    Visibility:   public

Description:     When operating on resource data with more high-level streams than RawData (139  ) (e.g:
                TBitmapResource.BitmapData (124  )) RawData contents are no longer valid.  This method
                ensures that RawData (139  ) 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 (151  ) class takes care of this before telling the
                resource writer to write resources to a stream.

    See also:    TAbstractResource.RawData (139  )



                21.17.16           TAbstractResource.SetCustomRawDataStream

    Synopsis:    Sets a custom stream as the underlying stream for RawData

Declaration:     procedure  SetCustomRawDataStream(aStream:  TStream)

    Visibility:   public

Description:     Normally, RawData (139  ) 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 (139  )



                                                                                 135

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.17.17           TAbstractResource.__Type

    Synopsis:    The type of the resource

Declaration:     Property  _Type  :  TResourceDesc

    Visibility:   public

      Access:    Read

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

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

    See also:    TAbstractResource.ChangeDescTypeAllowed (133  ), TAbstractResource.ChangeDescValueAllowed
                (133  )



                21.17.18           TAbstractResource.Name

    Synopsis:    The name of the resource

Declaration:     Property  Name  :  TResourceDesc

    Visibility:   public

      Access:    Read

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

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

    See also:    TAbstractResource.ChangeDescTypeAllowed (133  ), TAbstractResource.ChangeDescValueAllowed
                (133  )



                21.17.19           TAbstractResource.LangID

    Synopsis:    The language ID of the resource

Declaration:     Property  LangID  :  TLangID

    Visibility:   public

      Access:    Read,Write

Description:Remark:Please  note  that  if  the  resource  is  contained  in  a  TResources  (151  )  object,  language  ID
                change is not allowed:  trying to do so results in an EResourceLangIDChangeNotAllowedEx-
                ception (129  ) exception being raised.



                                                                                 136

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.17.20           TAbstractResource.DataSize

    Synopsis:    The size of resource raw data

Declaration:     Property  DataSize  :  LongWord

    Visibility:   public

      Access:    Read

Description:     DataSize is the length, in bytes, of the resource data, accessible via RawData (139  ) property.

    See also:    TAbstractResource.RawData (139  ), TAbstractResource.DataOffset (138  )



                21.17.21           TAbstractResource.HeaderSize

    Synopsis:    The size of resource header

Declaration:     Property  HeaderSize  :  LongWord

    Visibility:   public

      Access:    Read

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

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



                21.17.22           TAbstractResource.DataVersion

    Synopsis:    The version of the resource data

Declaration:     Property  DataVersion  :  LongWord

    Visibility:   public

      Access:    Read,Write

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

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



                21.17.23           TAbstractResource.MemoryFlags

    Synopsis:    The memory flags of the resource

Declaration:     Property  MemoryFlags  :  Word

    Visibility:   public

      Access:    Read,Write

Description:     This field is a combination of the following flags


                      oMF_MOVEABLE (125  )

                      oMF_PURE (125  )

                      oMF_PRELOAD (125  )

                      oMF_DISCARDABLE (125  )



                                                                                 137

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                By default, a newly created resource has MF_MOVEABLE (125  ) and MF_DISCARDABLE
                (125  ) 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.



                21.17.24           TAbstractResource.Version

    Synopsis:    A user defined version number

Declaration:     Property  Version  :  LongWord

    Visibility:   public

      Access:    Read,Write

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 (138  )



                21.17.25           TAbstractResource.Characteristics

    Synopsis:    A user defined piece of data

Declaration:     Property  Characteristics  :  LongWord

    Visibility:   public

      Access:    Read,Write

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 (138  )



                21.17.26           TAbstractResource.DataOffset

    Synopsis:    The offset of resource data from the beginning of the stream

Declaration:     Property  DataOffset  :  LongWord

    Visibility:   public

      Access:    Read

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

    See also:    TAbstractResource.RawData (139  ), TAbstractResource.DataSize (137  )



                                                                                 138

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.17.27           TAbstractResource.CodePage

    Synopsis:    The code page of the resource

Declaration:     Property  CodePage  :  LongWord

    Visibility:   public

      Access:    Read,Write

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

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



                21.17.28           TAbstractResource.RawData

    Synopsis:    The raw resource data stream

Declaration:     Property  RawData  :  TStream

    Visibility:   public

      Access:    Read

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 (139  ) 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 (126  ), RawData doesn't contain a valid
                BMP file:  in this case it's better to use BitmapData (124  ) stream of TBitmapResource (124  )
                class to work with a BMP-like stream.

 Remark:         When writing to a "specialized" stream in a descendant class (like the TBitmapResource.BitmapData
                (124  ) stream mentioned earlier), RawData contents might not be valid anymore.  If you need
                to access RawData again, be sure to call UpdateRawData (135  ) 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 (124  ) doesn't mean the
                bitmap is allocated two times.

    See also:    TAbstractResource.CacheData (139  ), TAbstractResource.UpdateRawData (135  ), TAbstrac-
                tResource.SetCustomRawDataStream (135  )



                21.17.29           TAbstractResource.CacheData

    Synopsis:    Controls the copy-on-write behaviour of the resource

Declaration:     Property  CacheData  :  Boolean

    Visibility:   public

      Access:    Read,Write



                                                                                 139

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



Description:     When CacheData is true, copy-on-write mechanism of RawData (139  ) 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 (139  ), TResources.CacheData (158  )



                21.17.30           TAbstractResource.OwnerList

    Synopsis:    The resource list that owns this resource

Declaration:     Property  OwnerList  :  TResources

    Visibility:   public

      Access:    Read

Description:     This property identifies the TResources (151  ) object to which this resource belongs to.

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



                21.17.31           TAbstractResource.Owner

    Synopsis:    The owner of this resource

Declaration:     Property  Owner  :  TAbstractResource

    Visibility:   public

      Access:    Read

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  (126  )  resource  and  many  RT_ICON
                (126  ) resources that hold single-image data.  Each RT_ICON (126  ) resource has a pointer to
                the RT_GROUP_ICON (126  ) resource in its Owner property.



                21.18            TAbstractResourceReader



                21.18.1          Description

                This is the base class that represents a resource reader.

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

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

                Usually each resource reader registers itself with TResources (151  ) class in the initialization
                section of the unit in which it is implemented:  this way a TResources (151  ) 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 (151  ), TAbstractResource (130  ), TAbstractResourceWriter (145  ), TResResourceReader
                (124  ), TCoffResourceReader (124  ), TWinPEResourceReader (124  ), TElfResourceReader (124  ),
                TExternalResourceReader (124  ), TDfmResourceReader (124  )



                                                                                 140

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.18.2          Method  overview

                __Page______Method__________________________Description____________________________________________________________*
 *___________
                  142       AddNoTree                       Adds a resource without updating the internal tree
                  142       CallSubReaderLoad               Calls another reader's Load (143  ) method
                  144       CheckMagic                      Checks whether a stream is in a format the reader recog-
                                                            nizes
                  144       Create                          Creates a new reader object
                  143       GetDescription                  Returns the description of the reader
                  143       GetExtensions                   Returns the extensions the reader is registered for
                  143       GetTree                         Gets the internal resource tree of a TResources object
                  143       Load                            Loads resources from a stream
                  142       SetDataOffset                   Protected method to let a reader set a resource DataOffset
                                                            (138  ) property
                  141       SetDataSize                     Protected  method  to  let  a  reader  set  a  resource  DataSize
                                                            (137  ) property
                  141       SetHeaderSize                   Protected method to let a reader set a resource HeaderSize
                                                            (137  ) property
                  142       SetRawData                      Protected method to let a reader set a resource RawData
                ____________________________________________(139__)_property_______________________________________________________*
 *___________



                21.18.3          Property  overview

                __Page______Properties__________Access_______Description___________________________________________________________*
 *___________
                  145       Description         r            The reader description
                __145_______Extensions__________r____________The_extensions_of_file_types_the_reader_is_able_to_read_______________*
 *___________



                21.18.4          TAbstractResourceReader.SetDataSize

    Synopsis:    Protected method to let a reader set a resource DataSize (137  ) property

Declaration:     procedure  SetDataSize(aResource:  TAbstractResource;aValue:  LongWord)

    Visibility:   protected

Description:     This method allows a descendant class to set DataSize (137  ) property of a resource that is
                being loaded.

    See also:    TAbstractResourceReader.SetHeaderSize (141  ), TAbstractResourceReader.SetDataOffset (142  ),
                TAbstractResourceReader.SetRawData (142  )



                21.18.5          TAbstractResourceReader.SetHeaderSize

    Synopsis:    Protected method to let a reader set a resource HeaderSize (137  ) property

Declaration:     procedure  SetHeaderSize(aResource:  TAbstractResource;aValue:  LongWord)

    Visibility:   protected

Description:     This method allows a descendant class to set HeaderSize (137  ) property of a resource that
                is being loaded.

    See also:    TAbstractResourceReader.SetDataSize (141  ), TAbstractResourceReader.SetDataOffset (142  ),
                TAbstractResourceReader.SetRawData (142  )



                                                                                 141

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.18.6          TAbstractResourceReader.SetDataOffset

    Synopsis:    Protected method to let a reader set a resource DataOffset (138  ) property

Declaration:     procedure  SetDataOffset(aResource:  TAbstractResource;aValue:  LongWord)

    Visibility:   protected

Description:     This method allows a descendant class to set DataOffset (138  ) property of a resource that
                is being loaded.

    See also:    TAbstractResourceReader.SetDataSize (141  ), TAbstractResourceReader.SetHeaderSize (141  ),
                TAbstractResourceReader.SetRawData (142  )



                21.18.7          TAbstractResourceReader.SetRawData

    Synopsis:    Protected method to let a reader set a resource RawData (139  ) property

Declaration:     procedure  SetRawData(aResource:  TAbstractResource;aStream:  TStream)

    Visibility:   protected

Description:     This method allows a descendant class to set RawData (139  ) property of a resource that is
                being loaded.

    See also:    TAbstractResourceReader.SetDataSize (141  ), TAbstractResourceReader.SetHeaderSize (141  ),
                TAbstractResourceReader.SetDataOffset (142  )



                21.18.8          TAbstractResourceReader.CallSubReaderLoad

    Synopsis:    Calls another reader's Load (143  ) method

Declaration:     procedure  CallSubReaderLoad(aReader:  TAbstractResourceReader;
                                                             aResources:  TResources;aStream:  TStream)

    Visibility:   protected

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



                21.18.9          TAbstractResourceReader.AddNoTree

    Synopsis:    Adds a resource without updating the internal tree

Declaration:     procedure  AddNoTree(aResources:  TResources;aResource:  TAbstractResource)

    Visibility:   protected

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

    See also:    TAbstractResourceReader.GetTree (143  ), TRootResTreeNode (166  )



                                                                                 142

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.18.10           TAbstractResourceReader.GetTree

    Synopsis:    Gets the internal resource tree of a TResources object

Declaration:     function  GetTree(aResources:  TResources)  :  TObject

    Visibility:   protected

Description:     This protected method can be used by descendents of TAbstractResourceReader (140  ) to
                obtain the internal resource tree used by a TResources (151  ) object.  The internal resource
                tree is an instance of TRootResTreeNode (166  ).

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

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

    See also:    TAbstractResourceReader.AddNoTree (142  ), TRootResTreeNode (166  )



                21.18.11           TAbstractResourceReader.GetExtensions

    Synopsis:    Returns the extensions the reader is registered for

Declaration:     function  GetExtensions  :  string;    Virtual;    Abstract

    Visibility:   protected

Description:     Descendant classes must implement this method to provide access to Extensions (145  ) prop-
                erty.

    See also:    TAbstractResourceReader.Extensions (145  )



                21.18.12           TAbstractResourceReader.GetDescription

    Synopsis:    Returns the description of the reader

Declaration:     function  GetDescription  :  string;    Virtual;    Abstract

    Visibility:   protected

Description:     Descendant  classes  must  implement  this  method  to  provide  access  to  Description  (145  )
                property.

    See also:    TAbstractResourceReader.Description (145  )



                21.18.13           TAbstractResourceReader.Load

    Synopsis:    Loads resources from a stream

Declaration:     procedure  Load(aResources:  TResources;aStream:  TStream);    Virtual
                                       ;    Abstract

    Visibility:   protected

Description:     A TResources (151  ) 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.



                                                                                 143

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



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

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

                When reading a resource, a reader must:


                      oCreate the resource via TResourceFactory.CreateResource (124  ) class method with the
                      correct type and name.

                      oSet at least the following resource properties:

                          - DataSize (137  ), via SetDataSize (141  ) method.

                          - DataOffset (138  ), via SetDataSize (142  ) method.  This is the offset of the resource
                            data from the beginning of the stream.

                          - RawData (139  ).  The reader must create a TResourceDataStream (124  ) object and
                            assign it to the resource via SetRawData (142  ) method.


       Errors:   If the stream is in a format not recognized by the reader, a EResourceReaderWrongForma-
                tException (130  ) exception must be raised.

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

    See also:    TResources  (151  ),  TResources.LoadFromStream  (155  ),  TResources.LoadFromFile  (155  ),
                TAbstractResource (130  ), TAbstractResource.DataSize (137  ), TAbstractResource.DataOffset
                (138  ), TAbstractResource.RawData (139  ), TAbstractResourceReader.SetDataSize (141  ), TAb-
                stractResourceReader.SetDataOffset (142  ), TAbstractResourceReader.SetRawData (142  ), TAb-
                stractResourceReader.CheckMagic (144  ), TResourceDataStream (124  )



                21.18.14           TAbstractResourceReader.CheckMagic

    Synopsis:    Checks whether a stream is in a format the reader recognizes

Declaration:     function  CheckMagic(aStream:  TStream)  :  Boolean;    Virtual;    Abstract

    Visibility:   protected

Description:     A  TResources  (151  )  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 con-
                tents  of  a  stream  as  a  valid  format:  it  usually  means  reading  a  magic  number  or  a  file
                header.

    See also:    TAbstractResourceReader.Load (143  ), TResources.FindReader (154  ), TResources.LoadFromStream
                (155  ), TResources.LoadFromFile (155  )



                21.18.15           TAbstractResourceReader.Create

    Synopsis:    Creates a new reader object

Declaration:     constructor  Create;    Virtual;    Abstract

    Visibility:   public



                                                                                 144

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.18.16           TAbstractResourceReader.Extensions

    Synopsis:    The extensions of file types the reader is able to read

Declaration:     Property  Extensions  :  string

    Visibility:   public

      Access:    Read

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.



                21.18.17           TAbstractResourceReader.Description

    Synopsis:    The reader description

Declaration:     Property  Description  :  string

    Visibility:   public

      Access:    Read

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



                21.19            TAbstractResourceWriter



                21.19.1          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
                (151  ) object to a stream in a specific format.

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

                Usually each resource writer registers itself with TResources (151  ) class in the initialization
                section of the unit in which it is implemented:  this way a TResources (151  ) 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  (151  ),  TAbstractResource  (130  ),  TAbstractResourceReader  (140  ),  TResRe-
                sourceWriter  (124  ),  TCoffResourceWriter  (124  ),  TElfResourceWriter  (124  ),  TExternalRe-
                sourceWriter (124  )



                21.19.2          Method  overview

                __Page______Method___________________Description___________________________________________________________________*
 *___________
                  147       Create                   Creates a new writer object
                  146       GetDescription           Returns the description of the writer
                  146       GetExtensions            Returns the extensions the writer is registered for
                  146       GetTree                  Gets the internal resource tree of a TResources object
                __146_______Write____________________Writes_resources_to_a_stream__________________________________________________*
 *___________



                                                                                 145

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.19.3          Property  overview

                __Page______Properties__________Access_______Description___________________________________________________________*
 *___________
                  147       Description         r            The writer description
                __147_______Extensions__________r____________The_extensions_of_file_types_the_writer_is_able_to_write______________*
 *___________



                21.19.4          TAbstractResourceWriter.GetTree

    Synopsis:    Gets the internal resource tree of a TResources object

Declaration:     function  GetTree(aResources:  TResources)  :  TObject

    Visibility:   protected

Description:     This  protected  method  can  be  used  by  descendents  of  TAbstractResourceWriter  (145  )  to
                obtain the internal resource tree used by a TResources (151  ) object.  The internal resource
                tree is an instance of TRootResTreeNode (166  ).

                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 (151  ) object they must write.

    See also:    TRootResTreeNode (166  )



                21.19.5          TAbstractResourceWriter.GetExtensions

    Synopsis:    Returns the extensions the writer is registered for

Declaration:     function  GetExtensions  :  string;    Virtual;    Abstract

    Visibility:   protected

Description:     Descendant classes must implement this method to provide access to Extensions (147  ) prop-
                erty.

    See also:    TAbstractResourceWriter.Extensions (147  )



                21.19.6          TAbstractResourceWriter.GetDescription

    Synopsis:    Returns the description of the writer

Declaration:     function  GetDescription  :  string;    Virtual;    Abstract

    Visibility:   protected

Description:     Descendant  classes  must  implement  this  method  to  provide  access  to  Description  (147  )
                property.

    See also:    TAbstractResourceWriter.Description (147  )



                21.19.7          TAbstractResourceWriter.Write

    Synopsis:    Writes resources to a stream

Declaration:     procedure  Write(aResources:  TResources;aStream:  TStream);    Virtual
                                         ;    Abstract

    Visibility:   protected



                                                                                 146

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



Description:     A TResources (151  ) 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 (151  ) 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 (139  ) property of the resource.

    See also:    TResources (151  ), TResources.WriteToStream (157  ), TResources.WriteToFile (157  ), TAb-
                stractResource (130  ), TAbstractResource.DataSize (137  ), TAbstractResource.RawData (139  )



                21.19.8          TAbstractResourceWriter.Create

    Synopsis:    Creates a new writer object

Declaration:     constructor  Create;    Virtual;    Abstract

    Visibility:   public



                21.19.9          TAbstractResourceWriter.Extensions

    Synopsis:    The extensions of file types the writer is able to write

Declaration:     Property  Extensions  :  string

    Visibility:   public

      Access:    Read

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.



                21.19.10           TAbstractResourceWriter.Description

    Synopsis:    The writer description

Declaration:     Property  Description  :  string

    Visibility:   public

      Access:    Read

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



                21.20            TGenericResource



                21.20.1          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 (124  ) when it finds no
                class matching the given type.



                                                                                 147

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



    See also:    TResourceFactory.CreateResource (124  )



                21.20.2          Method  overview

                __Page______Method__________________________________Description____________________________________________________*
 *___________
                  148       ChangeDescTypeAllowed
                  148       ChangeDescValueAllowed
                  148       Create
                  149       Destroy
                  148       GetName
                  148       GetType
                  148       NotifyResourcesLoaded
                __149_______UpdateRawData__________________________________________________________________________________________*
 *___________



                21.20.3          TGenericResource.GetType

Declaration:     function  GetType  :  TResourceDesc;    Override

    Visibility:   protected



                21.20.4          TGenericResource.GetName

Declaration:     function  GetName  :  TResourceDesc;    Override

    Visibility:   protected



                21.20.5          TGenericResource.ChangeDescTypeAllowed

Declaration:     function  ChangeDescTypeAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                  ;    Override

    Visibility:   protected



                21.20.6          TGenericResource.ChangeDescValueAllowed

Declaration:     function  ChangeDescValueAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                   ;    Override

    Visibility:   protected



                21.20.7          TGenericResource.NotifyResourcesLoaded

Declaration:     procedure  NotifyResourcesLoaded;    Override

    Visibility:   protected



                21.20.8          TGenericResource.Create

Declaration:     constructor  Create(aType:  TResourceDesc;aName:  TResourceDesc);    Override

    Visibility:   public



                                                                                 148

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.20.9          TGenericResource.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                21.20.10           TGenericResource.UpdateRawData

Declaration:     procedure  UpdateRawData;    Override

    Visibility:   public



                21.21            TResourceDesc



                21.21.1          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
                (126  ) (type is an ID) and name MAINICON (name is a name).


    See also:    TAbstractResource (130  )



                21.21.2          Method  overview

                __Page______Method____________Description__________________________________________________________________________*
 *___________
                  150       Assign            Assigns the contents of another TResourceDesc object to this one
                  150       Create            Creates a new TResourceDesc object
                  150       Equals            Compares the contents of another TResourceDesc object to this one
                  149       SetOwner          Protected  method  to  let  a  resource  set  itself  as  owner  of  the  TRe-
                ______________________________sourceDesc___________________________________________________________________________*
 *___________



                21.21.3          Property  overview

                __Page______Properties________Access_______Description_____________________________________________________________*
 *___________
                  151       DescType          r            The type of the resource description
                  151       ID                rw           The value of the resource description as an ID
                __150_______Name______________rw___________The_value_of_the_resource_description_as_a_name_________________________*
 *___________



                21.21.4          TResourceDesc.SetOwner

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

Declaration:     procedure  SetOwner(aOwner:  TAbstractResource)

    Visibility:   protected



                                                                                 149

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.21.5          TResourceDesc.Create

    Synopsis:    Creates a new TResourceDesc object

Declaration:     constructor  Create;    Overload
                constructor  Create(const  aID:  TResID);    Overload
                constructor  Create(const  aName:  TResName);    Overload

    Visibility:   public

Description:     Creates a new TResourceDesc object.

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

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



                21.21.6          TResourceDesc.Assign

    Synopsis:    Assigns the contents of another TResourceDesc object to this one

Declaration:     procedure  Assign(aResourceDesc:  TResourceDesc)

    Visibility:   public

Description:     Assigns the contents of another TResourceDesc object to this one

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



                21.21.7          TResourceDesc.Equals

    Synopsis:    Compares the contents of another TResourceDesc object to this one

Declaration:     function  Equals(aResDesc:  TResourceDesc)  :  Boolean

    Visibility:   public



                21.21.8          TResourceDesc.Name

    Synopsis:    The value of the resource description as a name

Declaration:     Property  Name  :  TResName

    Visibility:   public

      Access:    Read,Write

Description:     Setting this property causes DescType (151  ) to be dtName (127  )

                When reading, if DescType (151  ) is dtID (127  ), the ID is returned as a string value.

    See also:    TResourceDesc.ID (151  ), TResourceDesc.DescType (151  )



                                                                                 150

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.21.9          TResourceDesc.ID

    Synopsis:    The value of the resource description as an ID

Declaration:     Property  ID  :  TResID

    Visibility:   public

      Access:    Read,Write

Description:     Setting this property causes DescType (151  ) to be dtID (127  )

 Remark:         When reading, if DescType (151  ) is dtName (127  ), an EResourceDescTypeException (128  )
                exception is raised.

    See also:    TResourceDesc.Name (150  ), TResourceDesc.DescType (151  )



                21.21.10           TResourceDesc.DescType

    Synopsis:    The type of the resource description

Declaration:     Property  DescType  :  TDescType

    Visibility:   public

      Access:    Read

Description:     When DescType is dtName (127  ), resource description value is a name and can be accessed
                via Name (150  ) property

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

    See also:    TResourceDesc.Name (150  ), TResourceDesc.ID (151  ), TDescType (127  )



                21.22            TResources



                21.22.1          Description

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

                Typically, a TResource object is loaded from and written to a stream via format-dependent
                readers  and  writers,  which  are  descendants  of  TAbstractResourceReader  (140  )  and  TAb-
                stractResourceWriter (145  ), 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 (130  ), 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 (155  ) and TRe-
                sources.LoadFromFile (155  ).


    See also:    TAbstractResource (130  ), TAbstractResourceReader (140  ), TAbstractResourceWriter (145  )



                                                                                 151

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.22.2          Method  overview

                __Page______Method______________________Description________________________________________________________________*
 *___________
                  152       Add                         Adds a resource
                  153       AddAutoID                   Adds a resource and gives it a new autogenerated name
                  153       Clear                       Deletes all resources
                  152       Create                      Creates a new TResources object
                  152       Destroy                     Destroys the object
                  153       Find                        Searches for a resource
                  154       FindReader                  Searches for a suitable resource reader
                  155       LoadFromFile                Loads the contents of the object from a file
                  155       LoadFromStream              Loads the contents of the object from a stream
                  154       MoveFrom                    Moves all resources of another TResources object to itself
                  156       RegisterReader              Registers a resource reader class
                  156       RegisterWriter              Registers a resource writer class
                  154       Remove                      Removes a resource
                  157       WriteToFile                 Writes the contents of the object to a file
                __157_______WriteToStream_______________Writes_the_contents_of_the_object_to_a_stream______________________________*
 *___________



                21.22.3          Property  overview

                __Page______Properties_________Access_______Description____________________________________________________________*
 *___________
                  158       CacheData          rw           Controls the copy-on-write behaviour of all resources
                  157       Count              r            The number of resources in the object
                __158_______Items______________r____________Indexed_array_of_resources_in_the_object_______________________________*
 *___________



                21.22.4          TResources.Create

    Synopsis:    Creates a new TResources object

Declaration:     constructor  Create

    Visibility:   public



                21.22.5          TResources.Destroy

    Synopsis:    Destroys the object

Declaration:     destructor  Destroy;    Override

    Visibility:   public

Description:Remark:All resources are destroyed as well.



                21.22.6          TResources.Add

    Synopsis:    Adds a resource

Declaration:     procedure  Add(aResource:  TAbstractResource)

    Visibility:   public

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 EResourceDu-
                plicateException (129  ) exception is raised.

    See also:    TResources.AddAutoID (153  )



                                                                                 152

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.22.7          TResources.AddAutoID

    Synopsis:    Adds a resource and gives it a new autogenerated name

Declaration:     function  AddAutoID(aResource:  TAbstractResource)  :  TResID

    Visibility:   public

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 (128  ) exception is raised.

    See also:    TResources.Add (152  )



                21.22.8          TResources.Clear

    Synopsis:    Deletes all resources

Declaration:     procedure  Clear

    Visibility:   public

Description:     This method empties the TResources object destroying all resources.



                21.22.9          TResources.Find

    Synopsis:    Searches for a resource

Declaration:     function  Find(aType:  TResourceDesc;aName:  TResourceDesc;
                                      const  aLangID:  TLangID)  :  TAbstractResource;    Overload
                function  Find(aType:  TResourceDesc;aName:  TResourceDesc)
                                       :  TAbstractResource;    Overload
                function  Find(const  aType:  TResName;const  aName:  TResName;
                                      const  aLangID:  TLangID)  :  TAbstractResource;    Overload
                function  Find(const  aType:  TResName;const  aName:  TResID;
                                      const  aLangID:  TLangID)  :  TAbstractResource;    Overload
                function  Find(const  aType:  TResID;const  aName:  TResName;
                                      const  aLangID:  TLangID)  :  TAbstractResource;    Overload
                function  Find(const  aType:  TResID;const  aName:  TResID;
                                      const  aLangID:  TLangID)  :  TAbstractResource;    Overload
                function  Find(const  aType:  TResName;const  aName:  TResName)
                                       :  TAbstractResource;    Overload
                function  Find(const  aType:  TResName;const  aName:  TResID)
                                       :  TAbstractResource;    Overload
                function  Find(const  aType:  TResID;const  aName:  TResName)
                                       :  TAbstractResource;    Overload
                function  Find(const  aType:  TResID;const  aName:  TResID)
                                       :  TAbstractResource;    Overload

    Visibility:   public



                                                                                 153

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



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 (129  ) exception is raised.



                21.22.10           TResources.FindReader

    Synopsis:    Searches for a suitable resource reader

Declaration:     class  function  FindReader(aStream:  TStream;aExtension:  string)
                class  function  FindReader(aStream:  TStream)

    Visibility:   public

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 (129  ) exception is
                raised.

    See also:    TAbstractResourceReader (140  )



                21.22.11           TResources.MoveFrom

    Synopsis:    Moves all resources of another TResources object to itself

Declaration:     procedure  MoveFrom(aResources:  TResources)

    Visibility:   public

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 EResourceDu-
                plicateException (129  ) exception is raised.

    See also:    TResources.Add (152  )



                21.22.12           TResources.Remove

    Synopsis:    Removes a resource

Declaration:     function  Remove(aType:  TResourceDesc;aName:  TResourceDesc;
                                         const  aLangID:  TLangID)  :  TAbstractResource;    Overload
                function  Remove(aType:  TResourceDesc;aName:  TResourceDesc)
                                           :  TAbstractResource;    Overload
                function  Remove(aResource:  TAbstractResource)  :  TAbstractResource
                                         ;    Overload
                function  Remove(aIndex:  Integer)  :  TAbstractResource;    Overload

    Visibility:   public



                                                                                 154

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



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 (129  ) exception is raised.

    See also:    TResources.Find (153  )



                21.22.13           TResources.LoadFromStream

    Synopsis:    Loads the contents of the object from a stream

Declaration:     procedure  LoadFromStream(aStream:  TStream);    Overload
                procedure  LoadFromStream(aStream:  TStream;
                                                        aReader:  TAbstractResourceReader);    Overload

    Visibility:   public

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  (158  )  is  set  to  true,  the  stream  will  be  used  as  the  underlying  stream  of
                each resource RawData (139  ) 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 (158  )
                property to false.

       Errors:   If  no  reader  is  passed  and  probing  fails,  an  EResourceReaderNotFoundException  (129  )
                exception is raised.

    See also:    TAbstractResourceReader (140  ), TAbstractResource.RawData (139  ), TAbstractResource.CacheData
                (139  ), TResources.CacheData (158  ), TResources.LoadFromFile (155  ), TResources.Clear (153  ),
                TResources.FindReader (154  )



                21.22.14           TResources.LoadFromFile

    Synopsis:    Loads the contents of the object from a file

Declaration:     procedure  LoadFromFile(aFileName:  string);    Overload
                procedure  LoadFromFile(aFileName:  string;
                                                     aReader:  TAbstractResourceReader);    Overload

    Visibility:   public

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  (158  )  is  set  to  true,  the  file  will  be  left  open  and  used  as  the  underlying
                stream of each resource RawData (139  ) 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 (158  ) property to false.



                                                                                 155

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                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  (129  )
                exception is raised.

    See also:    TAbstractResourceReader (140  ), TAbstractResource.RawData (139  ), TAbstractResource.CacheData
                (139  ), TResources.CacheData (158  ), TResources.LoadFromStream (155  ), TResources.Clear
                (153  ), TResources.FindReader (154  )



                21.22.15           TResources.RegisterReader

    Synopsis:    Registers a resource reader class

Declaration:     class  procedure  RegisterReader(const  aExtension:  string;
                                                                  aClass:  TResourceReaderClass)

    Visibility:   public

Description:     This class method registers a resource reader class.

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

                Usually  this  method  is  called  in  the  initialization  section  of  the  unit  implementing  a
                TAbstractResourceReader (140  ) 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 (140  ), TResources.FindReader (154  ), TResources.LoadFromStream
                (155  ), TResources.LoadFromFile (155  )



                21.22.16           TResources.RegisterWriter

    Synopsis:    Registers a resource writer class

Declaration:     class  procedure  RegisterWriter(const  aExtension:  string;
                                                                  aClass:  TResourceWriterClass)

    Visibility:   public

Description:     This class method registers a resource writer class.

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



                                                                                 156

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                Usually  this  method  is  called  in  the  initialization  section  of  the  unit  implementing  a
                TAbstractResourceWriter (145  ) 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 (145  ), TResources.WriteToFile (157  )



                21.22.17           TResources.WriteToStream

    Synopsis:    Writes the contents of the object to a stream

Declaration:     procedure  WriteToStream(aStream:  TStream;
                                                      aWriter:  TAbstractResourceWriter)

    Visibility:   public

Description:     This method writes the contents of the object to a stream via the specified TAbstractRe-
                sourceWriter (145  ) descendant

    See also:    TAbstractResourceWriter (145  ), TResources.WriteToFile (157  )



                21.22.18           TResources.WriteToFile

    Synopsis:    Writes the contents of the object to a file

Declaration:     procedure  WriteToFile(aFileName:  string);    Overload
                procedure  WriteToFile(aFileName:  string;
                                                   aWriter:  TAbstractResourceWriter);    Overload

    Visibility:   public

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 EResourceWriterNotFoundExcep-
                tion (130  ) exception is raised.

    See also:    TAbstractResourceWriter (145  ), TResources.WriteToStream (157  )



                21.22.19           TResources.Count

    Synopsis:    The number of resources in the object

Declaration:     Property  Count  :  LongWord

    Visibility:   public

      Access:    Read

    See also:    TResources.Items (158  )



                                                                                 157

                _____________________________________________________CHAPTER_21.___REFERENCE_FOR_UNIT_'RESOURCE'___________________*
 *___________________



                21.22.20           TResources.Items

    Synopsis:    Indexed array of resources in the object

Declaration:     Property  Items[Index:  Integer]:  TAbstractResource;  default

    Visibility:   public

      Access:    Read

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 (157  )-1.

    See also:    TResources.Count (157  ), TAbstractResource (130  )



                21.22.21           TResources.CacheData

    Synopsis:    Controls the copy-on-write behaviour of all resources

Declaration:     Property  CacheData  :  Boolean

    Visibility:   public

      Access:    Read,Write

Description:     Changing this property changes CacheData (139  ) 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 (139  ), TAbstractResource.RawData (139  )



                                                                                 158




               Chapter   22



               Reference   for   unit   'resourcetree'



               22.1          Used  units



                                               Table 22.1:  Used units by unit 'resourcetree'


                                                                 __Name___________Page_____
                                                                   Classes           ??
                                                                   resource         124
                                                                   System            ??
                                                                   sysutils          ??



               22.2          Overview


               This unit implements classes that represent an ordered tree of resources.

               Such a tree is used internally by TResources (159  ) 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 (166  ).  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.



               22.3          TResourceTreeNode



               22.3.1         Description

               This class represents a node in a resource tree.



                                                                            159

                ____________________________________________CHAPTER_22.___REFERENCE_FOR_UNIT_'RESOURCETREE'________________________*
 *___________________



 Remark:         An object of this class should never be directly instantiated.  To create a node, call Create-
                SubNode (162  ) method of an already existing node.



                22.3.2         Method  overview

                __Page______Method_____________________Description_________________________________________________________________*
 *___________
                  161       Add                        Adds a new resource to the tree
                  162       Clear                      Destroys all sub nodes
                  161       Create
                  162       CreateResource             Creates a new resource
                  162       CreateSubNode              Creates a subnode
                  161       Destroy                    Destroys the object.
                  163       Find                       Searches for a resource
                  163       FindFreeID                 Find a free ID to be used as a resource name
                  161       GetData
                  160       GetIDCount
                  161       GetIDEntry
                  160       GetNamedCount
                  160       GetNamedEntry
                  161       InternalFind
                  163       IsLeaf                     Reports whether the node is a leaf node.
                __162_______Remove_____________________Removes_a_resource_from_the_tree____________________________________________*
 *___________



                22.3.3         Property  overview

                __Page______Properties______________Access______Description________________________________________________________*
 *___________
                  166       Data                    r           The resource contained in this node
                  166       DataRVA                 rw          To be used by readers and writers
                  164       Desc                    r           The description of the node
                  164       IDCount                 r           The number of ID sub nodes of the node
                  165       IDEntries               r           Indexed array of ID sub nodes of the node
                  164       NamedCount              r           The number of named sub nodes of the node
                  164       NamedEntries            r           Indexed array of named sub nodes of the node
                  165       NameRVA                 rw          To be used by readers and writers
                  163       Parent                  r
                __165_______SubDirRVA_______________rw__________To_be_used_by_readers_and_writers__________________________________*
 *___________



                22.3.4         TResourceTreeNode.GetNamedCount

Declaration:     function  GetNamedCount  :  LongWord

    Visibility:   protected



                22.3.5         TResourceTreeNode.GetNamedEntry

Declaration:     function  GetNamedEntry(index:  Integer)  :  TResourceTreeNode

    Visibility:   protected



                22.3.6         TResourceTreeNode.GetIDCount

Declaration:     function  GetIDCount  :  LongWord



                                                                                 160

                ____________________________________________CHAPTER_22.___REFERENCE_FOR_UNIT_'RESOURCETREE'________________________*
 *___________________



    Visibility:  protected



                22.3.7         TResourceTreeNode.GetIDEntry

Declaration:     function  GetIDEntry(index:  Integer)  :  TResourceTreeNode

    Visibility:   protected



                22.3.8         TResourceTreeNode.GetData

Declaration:     function  GetData  :  TAbstractResource;    Virtual

    Visibility:   protected



                22.3.9         TResourceTreeNode.InternalFind

Declaration:     function  InternalFind(aList:  TFPList;aDesc:  TResourceDesc;
                                                   out  index:  Integer)  :  Boolean;    Overload
                function  InternalFind(aList:  TFPList;aLangID:  TLangID;
                                                   out  index:  Integer)  :  Boolean;    Overload
                function  InternalFind(aType:  TResourceDesc;aName:  TResourceDesc;
                                                   const  aLangID:  TLangID;const  noLangID:  Boolean;
                                                   const  toDelete:  Boolean)  :  TAbstractResource
                                                   ;    Virtual;    Abstract;    Overload

    Visibility:   protected



                22.3.10          TResourceTreeNode.Create

Declaration:     constructor  Create;    Virtual;    Overload

    Visibility:   protected



                22.3.11          TResourceTreeNode.Destroy

    Synopsis:    Destroys the object.

Declaration:     destructor  Destroy;    Override

    Visibility:   public

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



                22.3.12          TResourceTreeNode.Add

    Synopsis:    Adds a new resource to the tree

Declaration:     procedure  Add(aResource:  TAbstractResource);    Virtual;    Abstract

    Visibility:   public

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 (166  )).



                                                                                 161

                ____________________________________________CHAPTER_22.___REFERENCE_FOR_UNIT_'RESOURCETREE'________________________*
 *___________________



       Errors:   If a resource with the same type, name and language ID already exists, an EResourceDu-
                plicateException (159  ) exception is raised.

    See also:    TResourceTreeNode.Remove (162  )



                22.3.13          TResourceTreeNode.CreateSubNode

    Synopsis:    Creates a subnode

Declaration:     function  CreateSubNode(aDesc:  TResourceDesc)  :  TResourceTreeNode
                                                     ;    Virtual;    Abstract

    Visibility:   public

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

    See also:    TResourceTreeNode.Desc (164  )



                22.3.14          TResourceTreeNode.CreateResource

    Synopsis:    Creates a new resource

Declaration:     function  CreateResource  :  TAbstractResource;    Virtual

    Visibility:   public

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 (163  )



                22.3.15          TResourceTreeNode.Clear

    Synopsis:    Destroys all sub nodes

Declaration:     procedure  Clear

    Visibility:   public

Description:     This method destroys all sub nodes of the node.



                22.3.16          TResourceTreeNode.Remove

    Synopsis:    Removes a resource from the tree

Declaration:     function  Remove(aType:  TResourceDesc;aName:  TResourceDesc)
                                           :  TAbstractResource;    Overload
                function  Remove(aType:  TResourceDesc;aName:  TResourceDesc;
                                         const  aLangID:  TLangID)  :  TAbstractResource;    Overload

    Visibility:   public



                                                                                 162

                ____________________________________________CHAPTER_22.___REFERENCE_FOR_UNIT_'RESOURCETREE'________________________*
 *___________________



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 (166  )).

    See also:    TResourceTreeNode.Add (161  )



                22.3.17          TResourceTreeNode.Find

    Synopsis:    Searches for a resource

Declaration:     function  Find(aType:  TResourceDesc;aName:  TResourceDesc)
                                       :  TAbstractResource;    Overload
                function  Find(aType:  TResourceDesc;aName:  TResourceDesc;
                                      const  aLangID:  TLangID)  :  TAbstractResource;    Overload

    Visibility:   public

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 (166  )).



                22.3.18          TResourceTreeNode.FindFreeID

    Synopsis:    Find a free ID to be used as a resource name

Declaration:     function  FindFreeID(aType:  TResourceDesc)  :  TResID;    Virtual

    Visibility:   public

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 (159  ) method of TResources (159  ).

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

       Errors:   If there are no free ids left for the given resource type, an ENoMoreFreeIDsException (159  )
                is raised.



                22.3.19          TResourceTreeNode.IsLeaf

    Synopsis:    Reports whether the node is a leaf node.

Declaration:     function  IsLeaf  :  Boolean;    Virtual

    Visibility:   public

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



                22.3.20          TResourceTreeNode.Parent

Declaration:     Property  Parent  :  TResourceTreeNode

    Visibility:   protected

      Access:    Read



                                                                                 163

                ____________________________________________CHAPTER_22.___REFERENCE_FOR_UNIT_'RESOURCETREE'________________________*
 *___________________



                22.3.21          TResourceTreeNode.Desc

    Synopsis:    The description of the node

Declaration:     Property  Desc  :  TResourceDesc

    Visibility:   public

      Access:    Read

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.



                22.3.22          TResourceTreeNode.NamedCount

    Synopsis:    The number of named sub nodes of the node

Declaration:     Property  NamedCount  :  LongWord

    Visibility:   public

      Access:    Read

    See also:    TResourceTreeNode.NamedEntries (164  ), TResourceTreeNode.IDCount (164  )



                22.3.23          TResourceTreeNode.NamedEntries

    Synopsis:    Indexed array of named sub nodes of the node

Declaration:     Property  NamedEntries[index:  Integer]:  TResourceTreeNode

    Visibility:   public

      Access:    Read

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 (164  )-1.

    See also:    TResourceTreeNode.NamedCount (164  ), TResourceTreeNode.IDEntries (165  )



                22.3.24          TResourceTreeNode.IDCount

    Synopsis:    The number of ID sub nodes of the node

Declaration:     Property  IDCount  :  LongWord

    Visibility:   public

      Access:    Read

    See also:    TResourceTreeNode.IDEntries (165  ), TResourceTreeNode.NamedCount (164  )



                                                                                 164

                ____________________________________________CHAPTER_22.___REFERENCE_FOR_UNIT_'RESOURCETREE'________________________*
 *___________________



                22.3.25          TResourceTreeNode.IDEntries

    Synopsis:    Indexed array of ID sub nodes of the node

Declaration:     Property  IDEntries[index:  Integer]:  TResourceTreeNode

    Visibility:   public

      Access:    Read

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 (164  )-1.

    See also:    TResourceTreeNode.IDCount (164  ), TResourceTreeNode.NamedEntries (164  )



                22.3.26          TResourceTreeNode.NameRVA

    Synopsis:    To be used by readers and writers

Declaration:     Property  NameRVA  :  LongWord

    Visibility:   public

      Access:    Read,Write

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 (159  )
                or TResources (159  ).

 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 (165  ), TResourceTreeNode.DataRVA (166  )



                22.3.27          TResourceTreeNode.SubDirRVA

    Synopsis:    To be used by readers and writers

Declaration:     Property  SubDirRVA  :  LongWord

    Visibility:   public

      Access:    Read,Write

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 (159  )
                or TResources (159  ).

 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 (165  ), TResourceTreeNode.DataRVA (166  )



                                                                                 165

                ____________________________________________CHAPTER_22.___REFERENCE_FOR_UNIT_'RESOURCETREE'________________________*
 *___________________



                22.3.28          TResourceTreeNode.DataRVA

    Synopsis:    To be used by readers and writers

Declaration:     Property  DataRVA  :  LongWord

    Visibility:   public

      Access:    Read,Write

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 (159  )
                or TResources (159  ).

 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 (165  ), TResourceTreeNode.SubDirRVA (165  )



                22.3.29          TResourceTreeNode.Data

    Synopsis:    The resource contained in this node

Declaration:     Property  Data  :  TAbstractResource

    Visibility:   public

      Access:    Read

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 (163  )



                22.4          TRootResTreeNode



                22.4.1         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 (162  ) method of
                their parent.

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



                22.4.2         Method  overview

                __Page______Method____________________Description__________________________________________________________________*
 *___________
                  167       Add
                  167       Create                    Creates a new root node
                  167       CreateSubNode
                  167       FindFreeID
                __167_______InternalFind___________________________________________________________________________________________*
 *___________



                                                                                 166

                ____________________________________________CHAPTER_22.___REFERENCE_FOR_UNIT_'RESOURCETREE'________________________*
 *___________________



                22.4.3         TRootResTreeNode.InternalFind

Declaration:     function  InternalFind(aType:  TResourceDesc;aName:  TResourceDesc;
                                                   const  aLangID:  TLangID;const  noLangID:  Boolean;
                                                   const  toDelete:  Boolean)  :  TAbstractResource
                                                   ;    Override

    Visibility:   protected



                22.4.4         TRootResTreeNode.Create

    Synopsis:    Creates a new root node

Declaration:     constructor  Create;    Override

    Visibility:   public

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 Cre-
                ateSubNode (162  ) method of their parent.

    See also:    TResourceTreeNode.CreateSubNode (162  ), TResourceTreeNode.Add (161  )



                22.4.5         TRootResTreeNode.CreateSubNode

Declaration:     function  CreateSubNode(aDesc:  TResourceDesc)  :  TResourceTreeNode
                                                     ;    Override

    Visibility:   public



                22.4.6         TRootResTreeNode.Add

Declaration:     procedure  Add(aResource:  TAbstractResource);    Override

    Visibility:   public



                22.4.7         TRootResTreeNode.FindFreeID

Declaration:     function  FindFreeID(aType:  TResourceDesc)  :  TResID;    Override

    Visibility:   public



                                                                                 167




            Chapter   23



            Reference   for   unit   'resreader'



            23.1          Used  units



                                              Table 23.1:  Used units by unit 'resreader'


                                                              __Name___________Page_____
                                                                Classes           ??
                                                                resource         124
                                                                System            ??
                                                                sysutils          ??



            23.2          Overview


            This unit contains TResResourceReader (168  ), a TAbstractResourceReader (168  ) descendant
            that is able to read .res resource files.

            Adding this unit to a program's uses clause registers class TResResourceReader (168  ) with
            TResources (168  ).



            23.3          TResResourceReader



            23.3.1         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 (168  ), TResResourceWriter (168  )



                                                                         168

                ___________________________________________________CHAPTER_23.___REFERENCE_FOR_UNIT_'RESREADER'____________________*
 *___________________



                23.3.2         Method  overview

                __Page______Method___________________Description___________________________________________________________________*
 *___________
                  169       CheckMagic
                  169       Create
                  169       Destroy
                  169       GetDescription
                  169       GetExtensions
                __169_______Load___________________________________________________________________________________________________*
 *___________



                23.3.3         TResResourceReader.GetExtensions

Declaration:     function  GetExtensions  :  string;    Override

    Visibility:   protected



                23.3.4         TResResourceReader.GetDescription

Declaration:     function  GetDescription  :  string;    Override

    Visibility:   protected



                23.3.5         TResResourceReader.Load

Declaration:     procedure  Load(aResources:  TResources;aStream:  TStream);    Override

    Visibility:   protected



                23.3.6         TResResourceReader.CheckMagic

Declaration:     function  CheckMagic(aStream:  TStream)  :  Boolean;    Override

    Visibility:   protected



                23.3.7         TResResourceReader.Create

Declaration:     constructor  Create;    Override

    Visibility:   public



                23.3.8         TResResourceReader.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                                                                                 169




            Chapter   24



            Reference   for   unit   'reswriter'



            24.1          Used  units



                                               Table 24.1:  Used units by unit 'reswriter'


                                                              __Name___________Page_____
                                                                Classes           ??
                                                                resource         124
                                                                System            ??
                                                                sysutils          ??



            24.2          Overview


            This unit contains TResResourceWriter (170  ), a TAbstractResourceWriter (170  ) descendant
            that is able to write .res resource files.

            Adding this unit to a program's uses clause registers class TResResourceWriter (170  ) with
            TResources (170  ).



            24.3          TResResourceWriter



            24.3.1         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 (170  ), TResResourceReader (170  )



                                                                         170

                ___________________________________________________CHAPTER_24.___REFERENCE_FOR_UNIT_'RESWRITER'____________________*
 *___________________



                24.3.2         Method  overview

                __Page______Method___________________Description___________________________________________________________________*
 *___________
                  171       Create
                  171       GetDescription
                  171       GetExtensions
                __171_______Write__________________________________________________________________________________________________*
 *___________



                24.3.3         TResResourceWriter.GetExtensions

Declaration:     function  GetExtensions  :  string;    Override

    Visibility:   protected



                24.3.4         TResResourceWriter.GetDescription

Declaration:     function  GetDescription  :  string;    Override

    Visibility:   protected



                24.3.5         TResResourceWriter.Write

Declaration:     procedure  Write(aResources:  TResources;aStream:  TStream);    Override

    Visibility:   protected



                24.3.6         TResResourceWriter.Create

Declaration:     constructor  Create;    Override

    Visibility:   public



                                                                                 171




Chapter   25



Reference   for   unit



'stringtableresource'



25.1          Used  units



                            Table 25.1:  Used units by unit 'stringtableresource'


                                                  __Name___________Page_____
                                                    Classes           ??
                                                    resource         124
                                                    System            ??
                                                    sysutils          ??



25.2          Overview


This unit contains TStringTableResource (173  ), a TAbstractResource (172  ) descendant spe-
cialized in handling resource of type RT_STRING (172  ).

Adding this unit to a program's uses clause registers class TStringTableResource (173  ) for
type RT_STRING (172  ) with TResourceFactory (172  ).



25.3          Constants,  types  and  variables



25.3.1         Resource  strings

SIndexOutOfBounds  =  'String  ID  out  of  bounds:  %d'



SNameNotAllowed  =  'Resource  ID  must  be  an  ordinal  in  the  range  1-4096'



                                                             172

               ______________________________CHAPTER_25.___REFERENCE_FOR_UNIT_'STRINGTABLERESOURCE'________________________________*
 *__________________



               25.4          EStringTableIndexOutOfBoundsException



               25.4.1         Description

               This exception is raised when the id specified to access a string of TStringTableResource.Strings
               (176  )  property  is  not  in  the  range  TStringTableResource.FirstID  (175  )  -  TStringTableRe-
               source.LastID (176  ).


   See also:    TStringTableResource (173  ), TStringTableResource.Strings (176  ), TStringTableResource.FirstID
               (175  ), TStringTableResource.LastID (176  )



               25.5          EStringTableNameNotAllowedException



               25.5.1         Description

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


   See also:    TStringTableResource.Create (175  )



               25.6          EStringTableResourceException



               25.6.1         Description

               Base class for string table resource-related exceptions



               25.7          TStringTableResource



               25.7.1         Description

               This class represents a resource of type RT_STRING (172  ).

               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 (175  ) property.  Moreover, Count (176  ) property is always 16.

               Strings (176  ) 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 (172  ).
               Its name can't be changed too.  Attempts to do so result in a EResourceDescChangeNotAl-
               lowedException (172  ).



                                                                                173

                ______________________________CHAPTER_25.___REFERENCE_FOR_UNIT_'STRINGTABLERESOURCE'_______________________________*
 *___________________



                25.7.2         Method  overview

                __Page______Method__________________________________Description____________________________________________________*
 *___________
                  174       ChangeDescTypeAllowed
                  174       ChangeDescValueAllowed
                  175       Create                                  Creates a new string table resource
                  175       Destroy
                  174       GetName
                  174       GetType
                  174       NotifyResourcesLoaded
                __175_______UpdateRawData__________________________________________________________________________________________*
 *___________



                25.7.3         Property  overview

                __Page______Properties________Access_______Description_____________________________________________________________*
 *___________
                  176       Count             r            The number of strings contained in the string table
                  175       FirstID           rw           The ID of first the string contained in the string table
                  176       LastID            r            The ID of the last string contained in the string table
                __176_______Strings___________rw___________Indexed_array_of_strings_in_the_string_table____________________________*
 *___________



                25.7.4         TStringTableResource.GetType

Declaration:     function  GetType  :  TResourceDesc;    Override

    Visibility:   protected



                25.7.5         TStringTableResource.GetName

Declaration:     function  GetName  :  TResourceDesc;    Override

    Visibility:   protected



                25.7.6         TStringTableResource.ChangeDescTypeAllowed

Declaration:     function  ChangeDescTypeAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                  ;    Override

    Visibility:   protected



                25.7.7         TStringTableResource.ChangeDescValueAllowed

Declaration:     function  ChangeDescValueAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                   ;    Override

    Visibility:   protected



                25.7.8         TStringTableResource.NotifyResourcesLoaded

Declaration:     procedure  NotifyResourcesLoaded;    Override

    Visibility:   protected



                                                                                 174

                ______________________________CHAPTER_25.___REFERENCE_FOR_UNIT_'STRINGTABLERESOURCE'_______________________________*
 *___________________



                25.7.9         TStringTableResource.Create

    Synopsis:    Creates a new string table resource

Declaration:     constructor  Create;    Override
                constructor  Create(aType:  TResourceDesc;aName:  TResourceDesc);    Override

    Visibility:   public

Description:     Please  note  that  aType  parameter  is  not  used,  since  this  class  always  uses  RT_STRING
                (172  ) as type.

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

       Errors:   If aName is not of type dtID (172  ) and/or its value isn't in the range 1-4096, an EStringTable-
                NameNotAllowedException (173  ) exception is raised.

    See also:    TStringTableResource.FirstID (175  )



                25.7.10          TStringTableResource.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                25.7.11          TStringTableResource.UpdateRawData

Declaration:     procedure  UpdateRawData;    Override

    Visibility:   public



                25.7.12          TStringTableResource.FirstID

    Synopsis:    The ID of first the string contained in the string table

Declaration:     Property  FirstID  :  Word

    Visibility:   public

      Access:    Read,Write

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 (173  ), TStringTableResource.LastID (176  ), TStringTableResource.Strings
                (176  )



                                                                                 175

                ______________________________CHAPTER_25.___REFERENCE_FOR_UNIT_'STRINGTABLERESOURCE'_______________________________*
 *___________________



                25.7.13          TStringTableResource.LastID

    Synopsis:    The ID of the last string contained in the string table

Declaration:     Property  LastID  :  Word

    Visibility:   public

      Access:    Read

Description:     The value of this property is always FirstID (175  )+15.

    See also:    TStringTableResource (173  ), TStringTableResource.FirstID (175  ), TStringTableResource.Strings
                (176  )



                25.7.14          TStringTableResource.Count

    Synopsis:    The number of strings contained in the string table

Declaration:     Property  Count  :  Integer

    Visibility:   public

      Access:    Read

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

    See also:    TStringTableResource (173  ), TStringTableResource.FirstID (175  )



                25.7.15          TStringTableResource.Strings

    Synopsis:    Indexed array of strings in the string table

Declaration:     Property  Strings[id:  Word]:  string;  default

    Visibility:   public

      Access:    Read,Write

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 (175  ) to LastID (176  ).
                If the index specified isn't in this range, an EStringTableIndexOutOfBoundsException (173  )
                exception is raised.

 Remark:         If you need to access RawData (172  ) after you modified strings, be sure to call UpdateR-
                awData (172  ) first.  This isn't needed however when resource is written to a stream,  since
                TResources (172  ) takes care of it.

    See also:    TStringTableResource (173  ), TStringTableResource.FirstID (175  ), TStringTableResource.LastID
                (176  )



                                                                                 176




Chapter   26



Reference   for   unit



'versionconsts'



26.1          Overview


This unit contains constants used by TVersionResource (177  ).

Constants for TVersionFixedInfo.FileFlags (177  ):


     o  VS_FF_DEBUG (182  ).

     o  VS_FF_INFOINFERRED (182  ).

     o  VS_FF_PATCHED (182  ).

     o  VS_FF_PRERELEASE (182  ).

     o  VS_FF_PRIVATEBUILD (182  ).

     o  VS_FF_SPECIALBUILD (182  ).


Constants for TVersionFixedInfo.FileOS (177  ):


     o  VOS_UNKNOWN (181  )

     o  VOS_DOS (181  )

     o  VOS_OS216 (181  )

     o  VOS_OS232 (181  )

     o  VOS_NT (181  )

     o  VOS_ _WINDOWS16 (182  )

     o  VOS_ _WINDOWS32 (182  )

     o  VOS_ _PM16 (181  )

     o  VOS_ _PM32 (182  )

     o  VOS_DOS_WINDOWS16 (181  )



                                                             177

___________________________________________CHAPTER_26.___REFERENCE_FOR_UNIT_'VERSIONCONSTS'________________________________________*
 *___



     o VOS_DOS_WINDOWS32 (181  )

     o VOS_OS216_PM16 (181  )

     o VOS_OS232_PM32 (181  )

     o VOS_NT_WINDOWS32 (181  )


Constants for TVersionFixedInfo.FileType (177  ):


     o VFT_UNKNOWN (180  )

     o VFT_APP (180  )

     o VFT_DLL (180  )

     o VFT_DRV (180  )

     o VFT_FONT (180  )

     o VFT_VXD (181  )

     o VFT_STATIC_LIB (180  )


Constants for TVersionFixedInfo.FileSubType (177  ):


     o VFT2_UNKNOWN (180  )

     o VFT2_DRV_COMM (179  )

     o VFT2_DRV_PRINTER (179  )

     o VFT2_DRV_KEYBOARD (179  )

     o VFT2_DRV_LANGUAGE (179  )

     o VFT2_DRV_DISPLAY (179  )

     o VFT2_DRV_MOUSE (179  )

     o VFT2_DRV_NETWORK (179  )

     o VFT2_DRV_SYSTEM (180  )

     o VFT2_DRV_INSTALLABLE (179  )

     o VFT2_DRV_SOUND (179  )

     o VFT2_FONT_RASTER (180  )

     o VFT2_FONT_VECTOR (180  )

     o VFT2_FONT_TRUETYPE (180  )



                                                                 178

___________________________________________CHAPTER_26.___REFERENCE_FOR_UNIT_'VERSIONCONSTS'________________________________________*
 *___



26.2          Constants,  types  and  variables



26.2.1         Constants

VFT2_DRV_COMM  =  $0000000A


This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_DRV (180  ).


VFT2_DRV_DISPLAY  =  $00000004


This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_DRV (180  ).


VFT2_DRV_INSTALLABLE  =  $00000008


This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_DRV (180  ).


VFT2_DRV_KEYBOARD  =  $00000002


This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_DRV (180  ).


VFT2_DRV_LANGUAGE  =  $00000003


This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_DRV (180  ).


VFT2_DRV_MOUSE  =  $00000005


This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_DRV (180  ).


VFT2_DRV_NETWORK  =  $00000006


This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_DRV (180  ).


VFT2_DRV_PRINTER  =  $00000001


This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_DRV (180  ).


VFT2_DRV_SOUND  =  $00000009


This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_DRV (180  ).


VFT2_DRV_SYSTEM  =  $00000007



                                                                 179

___________________________________________CHAPTER_26.___REFERENCE_FOR_UNIT_'VERSIONCONSTS'________________________________________*
 *___



This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_DRV (180  ).


VFT2_FONT_RASTER  =  $00000001


This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_FONT (180  ).


VFT2_FONT_TRUETYPE  =  $00000003


This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_FONT (180  ).


VFT2_FONT_VECTOR  =  $00000002


This constant is used for TVersionFixedInfo.FileSubType (177  ) when TVersionFixedInfo.FileType
(177  ) is VFT_FONT (180  ).


VFT2_UNKNOWN  =  $00000000


This constant is used for TVersionFixedInfo.FileSubType (177  ).


VFT_APP  =  $00000001


This constant is used for TVersionFixedInfo.FileType (177  ).


VFT_DLL  =  $00000002


This constant is used for TVersionFixedInfo.FileType (177  ).


VFT_DRV  =  $00000003


This constant is used for TVersionFixedInfo.FileType (177  ).

The device driver type is specified in TVersionFixedInfo.FileSubType (177  ).


VFT_FONT  =  $00000004


This constant is used for TVersionFixedInfo.FileType (177  ).

The font driver type is specified in TVersionFixedInfo.FileSubType (177  ).


VFT_STATIC_LIB  =  $00000007


This constant is used for TVersionFixedInfo.FileType (177  ).


VFT_UNKNOWN  =  $00000000


This constant is used for TVersionFixedInfo.FileType (177  ).


VFT_VXD  =  $00000005



                                                                 180

___________________________________________CHAPTER_26.___REFERENCE_FOR_UNIT_'VERSIONCONSTS'________________________________________*
 *___



This constant is used for TVersionFixedInfo.FileType (177  ).


VOS_DOS  =  $00010000


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS_DOS_WINDOWS16  =  $00010001


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS_DOS_WINDOWS32  =  $00010004


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS_NT  =  $00040000


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS_NT_WINDOWS32  =  $00040004


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS_OS216  =  $00020000


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS_OS216_PM16  =  $00020002


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS_OS232  =  $00030000


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS_OS232_PM32  =  $00030003


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS_UNKNOWN  =  $00000000


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS__BASE  =  $00000000


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS__PM16  =  $00000002


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS__PM32  =  $00000003



                                                                 181

___________________________________________CHAPTER_26.___REFERENCE_FOR_UNIT_'VERSIONCONSTS'________________________________________*
 *___



This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS__WINDOWS16  =  $00000001


This constant is used for TVersionFixedInfo.FileOS (177  ).


VOS__WINDOWS32  =  $00000004


This constant is used for TVersionFixedInfo.FileOS (177  ).


VS_FFI_FILEFLAGSMASK  =  $0000003F


This constant is used mainly for TVersionFixedInfo.FileFlagsMask (177  ) to signal which bits
are used in TVersionFixedInfo.FileFlags (177  ) field.


VS_FF_DEBUG  =  $00000001


This constant is used for TVersionFixedInfo.FileFlags (177  ).


VS_FF_INFOINFERRED  =  $00000010


This constant is used for TVersionFixedInfo.FileFlags (177  ).


VS_FF_PATCHED  =  $00000004


This constant is used for TVersionFixedInfo.FileFlags (177  ).


VS_FF_PRERELEASE  =  $00000002


This constant is used for TVersionFixedInfo.FileFlags (177  ).


VS_FF_PRIVATEBUILD  =  $00000008


This constant is used for TVersionFixedInfo.FileFlags (177  ).

When this flag is set, a TVersionStringTable (177  ) in TVersionResource.StringFileInfo (177  )
should contain an item with PrivateBuild as key.


VS_FF_SPECIALBUILD  =  $00000020


This constant is used for TVersionFixedInfo.FileFlags (177  ).

When this flag is set, a TVersionStringTable (177  ) in TVersionResource.StringFileInfo (177  )
should contain an item with SpecialBuild as key.



                                                                 182




Chapter   27



Reference   for   unit



'versionresource'



27.1          Used  units



                              Table 27.1:  Used units by unit 'versionresource'


                                                __Name________________Page_____
                                                  Classes                 ??
                                                  resource               124
                                                  System                  ??
                                                  sysutils                ??
                                                  versiontypes           188



27.2          Overview


This unit contains TVersionResource (184  ), a TAbstractResource (183  ) descendant special-
ized in handling resource of type RT_VERSION (183  ).

Adding this unit to a program's uses clause registers class TVersionResource (184  ) for type
RT_VERSION (183  ) with TResourceFactory (183  ).



27.3          Constants,  types  and  variables



27.3.1         Types

TVerBlockHeader  =  packed  record
    length  :  Word;
    vallength  :  Word;
    valtype  :  Word;
    key  :  string;
end



This type is internally used by TVersionResource (184  )



                                                             183

               _______________________________________CHAPTER_27.___REFERENCE_FOR_UNIT_'VERSIONRESOURCE'___________________________*
 *__________________



               27.4          TVersionResource



               27.4.1         Description

               This class represents a resource of type RT_VERSION (183  ).

               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 (186  ), StringFileInfo (186  ) and VarFileInfo (187  ).

Remark:         This class doesn't allow its type to be changed to anything else than RT_VERSION (183  ),
               and its name to be different from 1.  Attempts to do so result in a EResourceDescChangeNo-
               tAllowedException (183  ).

Remark:         If you need to access RawData (183  ) after you modified something, be sure to call Updat-
               eRawData (183  ) first.  This isn't needed however when resource is written to a stream, since
               TResources (183  ) 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.



                                                                                184

                _______________________________________CHAPTER_27.___REFERENCE_FOR_UNIT_'VERSIONRESOURCE'__________________________*
 *___________________



                end;


    See also:    TVersionResource.FixedInfo (186  ), TVersionResource.StringFileInfo (186  ), TVersionResource.VarFileInfo
                (187  )



                27.4.2         Method  overview

                __Page______Method__________________________________Description____________________________________________________*
 *___________
                  185       ChangeDescTypeAllowed
                  185       ChangeDescValueAllowed
                  186       Create                                  Creates a new version information resource
                  186       Destroy
                  185       GetName
                  185       GetType
                  186       NotifyResourcesLoaded
                __186_______UpdateRawData__________________________________________________________________________________________*
 *___________



                27.4.3         Property  overview

                __Page______Properties_____________Access_______Description________________________________________________________*
 *___________
                  186       FixedInfo              r            Language independent part of version information
                  186       StringFileInfo         r            Language dependent part of version information
                __187_______VarFileInfo____________r____________List_of_supported_languages________________________________________*
 *___________



                27.4.4         TVersionResource.GetType

Declaration:     function  GetType  :  TResourceDesc;    Override

    Visibility:   protected



                27.4.5         TVersionResource.GetName

Declaration:     function  GetName  :  TResourceDesc;    Override

    Visibility:   protected



                27.4.6         TVersionResource.ChangeDescTypeAllowed

Declaration:     function  ChangeDescTypeAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                  ;    Override

    Visibility:   protected



                27.4.7         TVersionResource.ChangeDescValueAllowed

Declaration:     function  ChangeDescValueAllowed(aDesc:  TResourceDesc)  :  Boolean
                                                                   ;    Override

    Visibility:   protected



                                                                                 185

                _______________________________________CHAPTER_27.___REFERENCE_FOR_UNIT_'VERSIONRESOURCE'__________________________*
 *___________________



                27.4.8         TVersionResource.NotifyResourcesLoaded

Declaration:     procedure  NotifyResourcesLoaded;    Override

    Visibility:   protected



                27.4.9         TVersionResource.Create

    Synopsis:    Creates a new version information resource

Declaration:     constructor  Create;    Override
                constructor  Create(aType:  TResourceDesc;aName:  TResourceDesc);    Override

    Visibility:   public

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



                27.4.10          TVersionResource.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                27.4.11          TVersionResource.UpdateRawData

Declaration:     procedure  UpdateRawData;    Override

    Visibility:   public



                27.4.12          TVersionResource.FixedInfo

    Synopsis:    Language independent part of version information

Declaration:     Property  FixedInfo  :  TVersionFixedInfo

    Visibility:   public

      Access:    Read

    See also:    TVersionFixedInfo (183  )



                27.4.13          TVersionResource.StringFileInfo

    Synopsis:    Language dependent part of version information

Declaration:     Property  StringFileInfo  :  TVersionStringFileInfo

    Visibility:   public

      Access:    Read

    See also:    TVersionStringFileInfo (183  )



                                                                                 186

                _______________________________________CHAPTER_27.___REFERENCE_FOR_UNIT_'VERSIONRESOURCE'__________________________*
 *___________________



                27.4.14          TVersionResource.VarFileInfo

    Synopsis:    List of supported languages

Declaration:     Property  VarFileInfo  :  TVersionVarFileInfo

    Visibility:   public

      Access:    Read

    See also:    TVersionVarFileInfo (183  )



                                                                                 187




Chapter   28



Reference   for   unit   'versiontypes'



28.1          Used  units



                                Table 28.1:  Used units by unit 'versiontypes'


                                                  __Name___________Page_____
                                                    Classes           ??
                                                    resource         124
                                                    System            ??
                                                    sysutils          ??



28.2          Overview


This unit contains classes used by TVersionResource (188  ).



28.3          Constants,  types  and  variables



28.3.1         Resource  strings

SVerStrTableDuplicateKey  =  'Duplicate  key  ''%s'''



SVerStrTableKeyNotFound  =  'Key  ''%s''  not  found'



SVerStrTableNameNotAllowed  =  'Name  ''%s''  is  not  a  valid  8-cipher  hex  sequence'



28.3.2         Types

PVerTranslationInfo  =  ^TVerTranslationInfo


Pointer to a TVerTranslationInfo


TFileProductVersion  =  Array[0..3]  of  Word



                                                             188

            ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'__________________________*
 *_______________



            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  =  packed  record
               language  :  Word;
               codepage  :  Word;
            end



            This  record  represents  a  language  id  -  codepage  pair  that  is  used  by  TVersionVarFileInfo
            (200  ).



            28.4          EDuplicateKeyException



            28.4.1         Description

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


See also:    TVersionStringTable.Add (197  )



            28.5          EKeyNotFoundException



            28.5.1         Description

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


See also:    TVersionStringTable.Delete (198  ), TVersionStringTable.Values (199  )



            28.6          ENameNotAllowedException



            28.6.1         Description

            This exception is raised when an attempt is made to set Name (198  ) property of TVersion-
            StringTable (196  ) with a string that isn't an 8-cipher hexadecimal string.


See also:    TVersionStringTable.Create (197  ), TVersionStringTable.Name (198  )



            28.7          EVersionStringTableException



            28.7.1         Description

            Base class for version string table - related exceptions



                                                                             189

                ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'______________________*
 *___________________



                28.8          TVersionFixedInfo



                28.8.1         Description

                This  class  represents  the  language  independent  part  of  version  information,  and  is  always
                present in a version information resource.


    See also:    TVersionResource (188  ), TVersionResource.FixedInfo (188  )



                28.8.2         Method  overview

                __Page______Method_________Description_____________________________________________________________________________*
 *___________
                __190_______Create_________________________________________________________________________________________________*
 *___________



                28.8.3         Property  overview

                __Page______Properties________________Access______Description______________________________________________________*
 *___________
                  193       FileDate                  rw          The file creation timestamp.
                  191       FileFlags                 rw          The file flags
                  191       FileFlagsMask             rw          Mask for FileFlags
                  191       FileOS                    rw          The operating system the file was designed to run on
                  192       FileSubType               rw          Additional type information
                  192       FileType                  rw          The type of the file
                  190       FileVersion               rw          The file version
                __190_______ProductVersion____________rw__________The_product_version______________________________________________*
 *___________



                28.8.4         TVersionFixedInfo.Create

Declaration:     constructor  Create

    Visibility:   public



                28.8.5         TVersionFixedInfo.FileVersion

    Synopsis:    The file version

Declaration:     Property  FileVersion  :  TFileProductVersion

    Visibility:   public

      Access:    Read,Write

    See also:    TFileProductVersion (189  )



                28.8.6         TVersionFixedInfo.ProductVersion

    Synopsis:    The product version

Declaration:     Property  ProductVersion  :  TFileProductVersion

    Visibility:   public

      Access:    Read,Write

    See also:    TFileProductVersion (189  )



                                                                                 190

                ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'______________________*
 *___________________



                28.8.7         TVersionFixedInfo.FileFlagsMask

    Synopsis:    Mask for FileFlags

Declaration:     Property  FileFlagsMask  :  LongWord

    Visibility:   public

      Access:    Read,Write

Description:     This property specifies which bits of FileFlags (191  ) are valid.

                Usually it is VS_FFI_FILEFLAGSMASK (188  ).

    See also:    TVersionFixedInfo.FileFlags (191  )



                28.8.8         TVersionFixedInfo.FileFlags

    Synopsis:    The file flags

Declaration:     Property  FileFlags  :  LongWord

    Visibility:   public

      Access:    Read,Write

Description:     It is a combination of the following values:


                      oVS_FF_DEBUG (188  ).

                      oVS_FF_INFOINFERRED (188  ).

                      oVS_FF_PATCHED (188  ).

                      oVS_FF_PRERELEASE (188  ).

                      oVS_FF_PRIVATEBUILD (188  ).

                      oVS_FF_SPECIALBUILD (188  ).


    See also:    TVersionFixedInfo.FileFlagsMask (191  )



                28.8.9         TVersionFixedInfo.FileOS

    Synopsis:    The operating system the file was designed to run on

Declaration:     Property  FileOS  :  LongWord

    Visibility:   public

      Access:    Read,Write

Description:     It is one of the following values:


                      oVOS_UNKNOWN (188  )

                      oVOS_DOS (188  )

                      oVOS_OS216 (188  )

                      oVOS_OS232 (188  )

                      oVOS_NT (188  )


                combined with one of the following values:



                                                                                 191

                ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'______________________*
 *___________________



                      oVOS_ _WINDOWS16 (188  )

                      oVOS_ _WINDOWS32 (188  )

                      oVOS_ _PM16 (188  )

                      oVOS_ _PM32 (188  )


                Note:  some predefined combinations do exist:


                      oVOS_DOS_WINDOWS16 (188  )

                      oVOS_DOS_WINDOWS32 (188  )

                      oVOS_OS216_PM16 (188  )

                      oVOS_OS232_PM32 (188  )

                      oVOS_NT_WINDOWS32 (188  )



                28.8.10          TVersionFixedInfo.FileType

    Synopsis:    The type of the file

Declaration:     Property  FileType  :  LongWord

    Visibility:   public

      Access:    Read,Write

Description:     It can be one of the following values:


                      oVFT_UNKNOWN (188  )

                      oVFT_APP (188  )

                      oVFT_DLL (188  )

                      oVFT_DRV (188  )

                      oVFT_FONT (188  )

                      oVFT_VXD (188  )

                      oVFT_STATIC_LIB (188  )


    See also:    TVersionFixedInfo.FileSubType (192  )



                28.8.11          TVersionFixedInfo.FileSubType

    Synopsis:    Additional type information

Declaration:     Property  FileSubType  :  LongWord

    Visibility:   public

      Access:    Read,Write

Description:     This property is meaningful only for some values of FileSubType (192  ).  For all other types,
                this property must be zero.

                If FileSubType (192  ) is VFT_DRV (188  ):


                      oVFT2_UNKNOWN (188  )

                      oVFT2_DRV_COMM (188  )

                      oVFT2_DRV_PRINTER (188  )



                                                                                 192

                ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'______________________*
 *___________________



                      oVFT2_DRV_KEYBOARD (188  )

                      oVFT2_DRV_LANGUAGE (188  )

                      oVFT2_DRV_DISPLAY (188  )

                      oVFT2_DRV_MOUSE (188  )

                      oVFT2_DRV_NETWORK (188  )

                      oVFT2_DRV_SYSTEM (188  )

                      oVFT2_DRV_INSTALLABLE (188  )

                      oVFT2_DRV_SOUND (188  )


                If FileSubType (192  ) is VFT_FONT (188  ):


                      oVFT2_UNKNOWN (188  )

                      oVFT2_FONT_RASTER (188  )

                      oVFT2_FONT_VECTOR (188  )

                      oVFT2_FONT_TRUETYPE (188  )


    See also:    TVersionFixedInfo.FileType (192  )



                28.8.12          TVersionFixedInfo.FileDate

    Synopsis:    The file creation timestamp.

Declaration:     Property  FileDate  :  QWord

    Visibility:   public

      Access:    Read,Write

Description:     It is a 64 bit timestamp.



                28.9          TVersionStringFileInfo



                28.9.1         Description

                This class represents the language dependent part of version information.

                It is a list of TVersionStringTable (196  ) objects, each representing information for a specific
                language-codepage combination.


    See also:    TVersionResource (188  ), TVersionResource.StringFileInfo (188  ), TVersionStringTable (196  )



                28.9.2         Method  overview

                __Page______Method____________Description__________________________________________________________________________*
 *___________
                  194       Add               Adds a new string table
                  195       Clear             Deletes all string tables in the list
                  194       Create
                  195       Delete            Deletes a string table
                  194       Destroy           Destroys the object
                  194       GetCount
                  194       GetItem
                __194_______SetItem________________________________________________________________________________________________*
 *___________



                                                                                 193

                ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'______________________*
 *___________________



                28.9.3         Property  overview

                __Page______Properties________Access_______Description_____________________________________________________________*
 *___________
                  195       Count             r            The number of string tables in the object
                __195_______Items_____________rw___________Indexed_array_of_string_tables_in_the_object____________________________*
 *___________



                28.9.4         TVersionStringFileInfo.GetCount

Declaration:     function  GetCount  :  Integer

    Visibility:   protected



                28.9.5         TVersionStringFileInfo.GetItem

Declaration:     function  GetItem(index:  Integer)  :  TVersionStringTable

    Visibility:   protected



                28.9.6         TVersionStringFileInfo.SetItem

Declaration:     procedure  SetItem(index:  Integer;aValue:  TVersionStringTable)

    Visibility:   protected



                28.9.7         TVersionStringFileInfo.Create

Declaration:     constructor  Create

    Visibility:   public



                28.9.8         TVersionStringFileInfo.Destroy

    Synopsis:    Destroys the object

Declaration:     destructor  Destroy;    Override

    Visibility:   public

Description:Remark:All items are destroyed as well.

    See also:    TVersionStringFileInfo.Clear (195  )



                28.9.9         TVersionStringFileInfo.Add

    Synopsis:    Adds a new string table

Declaration:     procedure  Add(aStrTable:  TVersionStringTable)

    Visibility:   public

    See also:    TVersionStringFileInfo.Delete (195  )



                                                                                 194

                ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'______________________*
 *___________________



                28.9.10          TVersionStringFileInfo.Clear

    Synopsis:    Deletes all string tables in the list

Declaration:     procedure  Clear

    Visibility:   public

Description:     This method empties the object.  All string tables are freed.

    See also:    TVersionStringFileInfo.Delete (195  ), TVersionStringFileInfo.Add (194  )



                28.9.11          TVersionStringFileInfo.Delete

    Synopsis:    Deletes a string table

Declaration:     procedure  Delete(const  aIndex:  Integer)

    Visibility:   public

Description:     This method removes the string table identified by aIndex from the list.  The string table
                is freed.

    See also:    TVersionStringFileInfo.Clear (195  ), TVersionStringFileInfo.Add (194  )



                28.9.12          TVersionStringFileInfo.Count

    Synopsis:    The number of string tables in the object

Declaration:     Property  Count  :  Integer

    Visibility:   public

      Access:    Read

    See also:    TVersionStringFileInfo.Items (195  )



                28.9.13          TVersionStringFileInfo.Items

    Synopsis:    Indexed array of string tables in the object

Declaration:     Property  Items[index:  Integer]:  TVersionStringTable;  default

    Visibility:   public

      Access:    Read,Write

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 (195  )-1.

    See also:    TVersionStringFileInfo.Count (195  ), TVersionStringTable (196  )



                                                                                 195

            ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'__________________________*
 *_______________



            28.10            TVersionStringTable



            28.10.1          Description

            This class represents version information for a specific language-codepage combination.

            It is contained in a TVersionStringFileInfo (193  ) 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:


                 o  Comments

                 o  CompanyName

                 o  FileDescription

                 o  FileVersion

                 o  InternalName

                 o  LegalCopyright

                 o  LegalTrademarks

                 o  OriginalFilename

                 o  PrivateBuild (only if VS_FF_PRIVATEBUILD (188  ) is set in TVersionFixedInfo.FileFlags
                    (191  ))

                 o  ProductName

                 o  ProductVersion

                 o  SpecialBuild (only if VS_FF_SPECIALBUILD (188  ) is set in TVersionFixedInfo.FileFlags
                    (191  ))


See also:    TVersionStringFileInfo (193  ), TVersionStringTable.Name (198  ), TVersionStringTable.Keys
            (199  ), TVersionStringTable.Values (199  ), TVersionStringTable.ValuesByIndex (199  )



            28.10.2          Method  overview

            __Page______Method_________Description_________________________________________________________________________________*
 *_______
              197       Add            Adds a new item to the string table
              198       Clear          Deletes all items
              197       Create         Creates a new string table
              198       Delete         Deletes an item
            __197_______Destroy________Destroys_the_string_table___________________________________________________________________*
 *_______



            28.10.3          Property  overview

            __Page______Properties_______________Access_______Description__________________________________________________________*
 *_______
              198       Count                    r            The number of items in the object
              199       Keys                     r            Indexed array of keys in the object
              198       Name                     r            The name of the string table
              199       Values                   rw           Array of values in the object, accessed by key
            __199_______ValuesByIndex____________rw___________Indexed_array_of_values_in_the_object________________________________*
 *_______



                                                                             196

                ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'______________________*
 *___________________



                28.10.4          TVersionStringTable.Create

    Synopsis:    Creates a new string table

Declaration:     constructor  Create(const  aName:  string)

    Visibility:   public

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 (189  )
                exception is raised.

    See also:    TVersionStringTable.Name (198  )



                28.10.5          TVersionStringTable.Destroy

    Synopsis:    Destroys the string table

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                28.10.6          TVersionStringTable.Add

    Synopsis:    Adds a new item to the string table

Declaration:     procedure  Add(const  aKey:  string;const  aValue:  string)

    Visibility:   public

Description:     This methods adds a new key-value pair to the string table.

                Note that some predefined keys do exist.  See TVersionStringTable (196  ) for further infor-
                mation.

       Errors:   If an item with the same key already exists, an EDuplicateKeyException (189  ) exception is
                raised.

    See also:    TVersionStringTable  (196  ),  TVersionStringTable.Keys  (199  ),  TVersionStringTable.Values
                (199  ), TVersionStringTable.ValuesByIndex (199  )



                                                                                 197

                ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'______________________*
 *___________________



                28.10.7          TVersionStringTable.Clear

    Synopsis:    Deletes all items

Declaration:     procedure  Clear

    Visibility:   public

Description:     This method empties the object deleting all items.

    See also:    TVersionStringTable.Delete (198  )



                28.10.8          TVersionStringTable.Delete

    Synopsis:    Deletes an item

Declaration:     procedure  Delete(const  aIndex:  Integer);    Overload
                procedure  Delete(const  aKey:  string);    Overload

    Visibility:   public

Description:     The item to delete can be specified by its index or by its key.

       Errors:   If  aKey is not found, an EKeyNotFoundException (189  ) exception is raised.

    See also:    TVersionStringTable.Keys (199  ), TVersionStringTable.Values (199  ), TVersionStringTable.ValuesByIndex
                (199  )



                28.10.9          TVersionStringTable.Name

    Synopsis:    The name of the string table

Declaration:     Property  Name  :  string

    Visibility:   public

      Access:    Read

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 (189  ) exception is raised.

    See also:    TVersionStringTable.Create (197  )



                28.10.10           TVersionStringTable.Count

    Synopsis:    The number of items in the object

Declaration:     Property  Count  :  Integer

    Visibility:   public

      Access:    Read

    See also:    TVersionStringTable.ValuesByIndex (199  )



                                                                                 198

                ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'______________________*
 *___________________



                28.10.11           TVersionStringTable.Keys

    Synopsis:    Indexed array of keys in the object

Declaration:     Property  Keys[index:  Integer]:  string

    Visibility:   public

      Access:    Read

Description:     This property can be used to access all keys in the object.

                Values associated to keys are stored in ValuesByIndex (199  ) 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 (198  )-1.

                Note that some predefined keys do exist.  See TVersionStringTable (196  ) for further infor-
                mation.

    See also:    TVersionStringTable (196  ), TVersionStringTable.Values (199  ), TVersionStringTable.ValuesByIndex
                (199  )



                28.10.12           TVersionStringTable.ValuesByIndex

    Synopsis:    Indexed array of values in the object

Declaration:     Property  ValuesByIndex[index:  Integer]:  string

    Visibility:   public

      Access:    Read,Write

Description:     This property can be used to access all values in the object.

                Keys associated to values are stored in Keys (199  ) 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 (198  )-1.

    See also:    TVersionStringTable.Keys (199  ), TVersionStringTable.Values (199  )



                28.10.13           TVersionStringTable.Values

    Synopsis:    Array of values in the object, accessed by key

Declaration:     Property  Values[Key:  string]:  string;  default

    Visibility:   public

      Access:    Read,Write

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 (199  ) instead.

                If the key is not found, an EKeyNotFoundException (189  ) exception is raised.

    See also:    TVersionStringTable.Keys (199  ), TVersionStringTable.ValuesByIndex (199  )



                                                                                 199

                ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'______________________*
 *___________________



                28.11            TVersionVarFileInfo



                28.11.1          Description

                This class represents the language-codepage pairs that the program or dll supports.  It can
                be used to avoid including several RT_VERSION (188  ) resources for each language-codepage
                supported.

                It is a list of TVerTranslationInfo (189  ) records.


    See also:    TVersionResource.VarFileInfo (188  ), TVerTranslationInfo (189  )



                28.11.2          Method  overview

                __Page______Method____________Description__________________________________________________________________________*
 *___________
                  201       Add               Adds a new translation information item
                  201       Clear             Deletes all items
                  200       Create
                  201       Delete            Deletes an item
                  201       Destroy           Destroys the object
                  200       GetCount
                  200       GetItem
                __200_______SetItem________________________________________________________________________________________________*
 *___________



                28.11.3          Property  overview

                __Page______Properties________Access_______Description_____________________________________________________________*
 *___________
                  201       Count             r            The number of items in the object
                __202_______Items_____________rw___________Indexed_array_of_items_in_the_object____________________________________*
 *___________



                28.11.4          TVersionVarFileInfo.GetCount

Declaration:     function  GetCount  :  Integer

    Visibility:   protected



                28.11.5          TVersionVarFileInfo.GetItem

Declaration:     function  GetItem(index:  Integer)  :  TVerTranslationInfo

    Visibility:   protected



                28.11.6          TVersionVarFileInfo.SetItem

Declaration:     procedure  SetItem(index:  Integer;aValue:  TVerTranslationInfo)

    Visibility:   protected



                28.11.7          TVersionVarFileInfo.Create

Declaration:     constructor  Create

    Visibility:   public



                                                                                 200

                ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'______________________*
 *___________________



                28.11.8          TVersionVarFileInfo.Destroy

    Synopsis:    Destroys the object

Declaration:     destructor  Destroy;    Override

    Visibility:   public

Description:     All items are destroyed as well.

    See also:    TVersionVarFileInfo.Clear (201  )



                28.11.9          TVersionVarFileInfo.Add

    Synopsis:    Adds a new translation information item

Declaration:     procedure  Add(aInfo:  TVerTranslationInfo)

    Visibility:   public

    See also:    TVersionVarFileInfo.Items (202  )



                28.11.10           TVersionVarFileInfo.Clear

    Synopsis:    Deletes all items

Declaration:     procedure  Clear

    Visibility:   public

Description:     This method empties the object deleting all items.

    See also:    TVersionVarFileInfo.Delete (201  )



                28.11.11           TVersionVarFileInfo.Delete

    Synopsis:    Deletes an item

Declaration:     procedure  Delete(const  aIndex:  Integer)

    Visibility:   public

    See also:    TVersionVarFileInfo.Items (202  )



                28.11.12           TVersionVarFileInfo.Count

    Synopsis:    The number of items in the object

Declaration:     Property  Count  :  Integer

    Visibility:   public

      Access:    Read

    See also:    TVersionVarFileInfo.Items (202  )



                                                                                 201

                ______________________________________________CHAPTER_28.___REFERENCE_FOR_UNIT_'VERSIONTYPES'______________________*
 *___________________



                28.11.13           TVersionVarFileInfo.Items

    Synopsis:    Indexed array of items in the object

Declaration:     Property  Items[index:  Integer]:  TVerTranslationInfo;  default

    Visibility:   public

      Access:    Read,Write

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 (201  )-1.

    See also:    TVersionVarFileInfo.Count (201  )



                                                                                 202




               Chapter   29



               Reference   for   unit



               'winpeimagereader'



               29.1          Used  units



                                           Table 29.1:  Used units by unit 'winpeimagereader'


                                                                __Name_____________Page_____
                                                                  Classes             ??
                                                                  coffreader           52
                                                                  resource           124
                                                                  System              ??
                                                                  sysutils            ??



               29.2          Overview


               This unit contains TWinPEImageResourceReader (203  ), a TAbstractResourceReader (203  )
               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
               (203  ) with TResources (203  ).



               29.3          TWinPEImageResourceReader



               29.3.1         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
               (203  ) instead.


   See also:    TAbstractResourceReader (203  ), TCoffResourceReader (203  )



                                                                            203

                ___________________________________CHAPTER_29.___REFERENCE_FOR_UNIT_'WINPEIMAGEREADER'_____________________________*
 *___________________



                29.3.2         Method  overview

                __Page______Method________________________Description______________________________________________________________*
 *___________
                  204       CheckDosStub
                  204       CheckMagic
                  204       CheckPESignature
                  204       Create
                  205       Destroy
                  204       GetDescription
                  204       GetExtensions
                __204_______Load___________________________________________________________________________________________________*
 *___________



                29.3.3         TWinPEImageResourceReader.CheckDosStub

Declaration:     function  CheckDosStub(aStream:  TStream)  :  Boolean

    Visibility:   protected



                29.3.4         TWinPEImageResourceReader.CheckPESignature

Declaration:     function  CheckPESignature(aStream:  TStream)  :  Boolean

    Visibility:   protected



                29.3.5         TWinPEImageResourceReader.GetExtensions

Declaration:     function  GetExtensions  :  string;    Override

    Visibility:   protected



                29.3.6         TWinPEImageResourceReader.GetDescription

Declaration:     function  GetDescription  :  string;    Override

    Visibility:   protected



                29.3.7         TWinPEImageResourceReader.Load

Declaration:     procedure  Load(aResources:  TResources;aStream:  TStream);    Override

    Visibility:   protected



                29.3.8         TWinPEImageResourceReader.CheckMagic

Declaration:     function  CheckMagic(aStream:  TStream)  :  Boolean;    Override

    Visibility:   protected



                29.3.9         TWinPEImageResourceReader.Create

Declaration:     constructor  Create;    Override

    Visibility:   public



                                                                                 204

                ___________________________________CHAPTER_29.___REFERENCE_FOR_UNIT_'WINPEIMAGEREADER'_____________________________*
 *___________________



                29.3.10          TWinPEImageResourceReader.Destroy

Declaration:     destructor  Destroy;    Override

    Visibility:   public



                                                                                 205
