RPMST Templates

<< Click to Display Table of Contents >>

RayPack > 7.3 u6 > User Guide > Advanced Topics 

RPMST Templates

A Transform Template is nothing more than a simple XML file, with the file extension .rpmst. This template can be used to create a transform file that contains predefined information which will be applied during the creation of all transform files created with RayPack. This ensures a uniform base for all transforms created.

 

Transform Template Structure

Below is an abbreviated example of a transform template. Basically using this template, every transform file that uses it will contain:

A top level feature named "Demo_Feature", this feature will have a component named "Demo_Branding" assigned to it. This component in turn will contain three resources of the type registry.  The properties ALLUSERS, ARPNOMODIFY, ARPNOREMOVE, ARPNOREPAIR, REBOOT, RebootYesNo, REBOOTPROMPT, ROOTDRIVE will be assigned default values. The feature and its component will only be installed in the default installation directory if the feature is not present on the system or a reinstall (repair) is initiated. The summary information stream properties Author, Comments, Subject, Title and Keywords are also set to default / dynamic values. Notice that any special characters must be escaped. For example, see the text &lt;PackagerInitials&gt; and how it has been escaped using the less-than and greater-than characters.      

 

<?xml version="1.0" encoding="UTF-8"?>

<Settings>

  <!-- This is demonstration of transform template configuration. 
  Any tables can be added - just make sure that any tables referenced here are 
  also present in source(vendor) MSI  -->

  <SIS Author="&lt;PackagerInitials&gt;" Comments="Created: $TIME$ - $DATE$" 
       Subject="" Title="$PROJECTNAME$" Keywords="MST Template 1.0.0" />

  <Tables>

    <Table Name="Feature">

 <Row Feature="Demo_Feature" Feature_Parent="" Title="Demo_Branding" 
            Description="Branding Feature" Display="0" Level="1" 
            Directory_="INSTALLDIR" Attributes="16"/>

    </Table> 

    <Table Name="Component">

 <Row Component="Demo_Branding" ComponentId="$GUID$" 
            Directory_="INSTALLDIR" Attributes="4" 
            Condition="NOT Installed OR REINSTALL" 
            KeyPath="Demo_registry1"/>

    </Table>

    <Table Name="FeatureComponents">

 <Row Feature_="Demo_Branding" Component_="Demo_Branding"/>

    </Table>    

    <Table Name="Registry">

        <Row Registry="Demo_registry1" Root="2" 
             Key="Software\Demo\Packages\[ProductName]\[ProductVersion]" 
             Name="*" Value="" 
             Component_="Demo_Branding"/>

        <Row Registry="Demo_registry2" Root="2" 
             Key="Software\Demo\Packages\[ProductName]\[ProductVersion]" 
             Name="-" Value="" 
             Component_="Demo_Branding"/>

        <Row Registry="Demo_registry3" Root="2" 
             Key="Software\Demo\Packages\[ProductName]\[ProductVersion]" 
             Name="Application Name" Value="[ProductName]" 
             Component_="Demo_Branding"/>

    </Table>

    <Table Name="Property">

      <Row Property="ALLUSERS" Value="1"/>

      <Row Property="ARPNOMODIFY" Value="1"/>

      <Row Property="ARPNOREMOVE" Value="1"/>

      <Row Property="ARPNOREPAIR" Value="1"/>

      <Row Property="REBOOT" Value="ReallySuppress"/>

      <Row Property="RebootYesNo" Value="No"/>

      <Row Property="REBOOTPROMPT" Value="S"/>

      <Row Property="ROOTDRIVE" Value="C:\"/>

    </Table>

  </Tables> 

</Settings>

 

Settings Element

The <Settings> element has no attributes and has two child elements, the <SIS> and the <Tables> elements. While theoretically possible, both child elements could be empty. This would make the use of a template nonsensical.

 

SIS Element

The <SIS> element can contain attributes that are/can be present in the Summary Information Stream, provided that they can be represented as a string value. It is recommend that only the SIS properties shown in the example be set using the transform template.

 

The following attributes of the SIS element are supported and have direct mapping to one of the supported summary properties (see https://msdn.microsoft.com/en-us/library/aa372049(v=vs.85).aspx for a complete list):

 

Author

CharacterCount

Codepage

Comments

CreateTimeDate

LastPrinted

LastSavedTimeDate

CreatingApplication

Keywords

LastSavedby

PageCount

RevisionNumber

Security

Subject

Template

Title

WordCount

 

The following extra attributes have no direct translation to SIS attributes:

 

DatabaseCodepage
A numeric value representing the code page of the whole database (not to be confused with SIS code page and with ProductLanguage).
 

Languages
A list of comma separated numeric values representing supported languages (in LCID format)

 

Platform
A value representing the package target platform.

 

finger1

Note:

Languages and Platform values can be combined together and represented as a single value of Template attribute separated by a semicolon, for example <SIS Template="Intel64;0,1031" ...

 

Tables Element

The <Tables> element has no attributes and 1 to n child <Table> elements.

 

Table Element

The <Table> element has one attribute and 1 to n child <Row> elements. The Name attribute is case sensitive and must be unique.

The following example would signify that the Feature table is to be edited.

<Table Name="Feature">

...

...

</Table>

 

Row Element

The <Row> element may contain multiple attributes. The attributes correspond with the column names (case sensitive) of the MSI table that is the Name attribute of the parent <Table> element.

 

<Table Name="Feature">

    <Row Feature="Demo_Feature" 
         Feature_Parent="" Title="Demo_Branding" 
         Description="Branding Feature" 
         Display="0" 
         Level="1"  

         Directory_="INSTALLDIR" 

         Attributes="16"/>

...

...                                

</Table>

 

Please ensure that all columns are set with values. If a column entry is to be set to empty, use an empty string value ="".

If the row template is used to add a new row, it is recommended to specify all cell values. At minimum, the columns required by the MSI schema have to be specified.

If the row template is used to edit an existing row, at minimum the columns forming the Primary Key have to be specified plus the columns to be updated.

 

RowUpdate Element

The <RowUpdate> element has a similar behavior to the <Row> element.

The only difference is that the values specified by this node will be inserted only if the row with a given ID already exist. For example, the following syntax:

 

<Table Name="Feature">

    <RowUpdate Feature="Demo_Feature" Description="Updated branding Feature" />

</Table>

 

updates the description of a feature Demo_Feature to "Updated branding Feature". If the feature does not exist, no action is done.

 

Please ensure that all required columns including columns forming table's Primary Key are set with values.

 

finger1

Note:

As one can see, theoretically any MSI table can be populated in the transform file using the transform template. The only exception to this are streams in the Binary and Icon tables which have to be represented using a special RPMST syntax.

 

Replaceable Tokens

The transform template also supports tokens that can be replaced during the creation of a transform file. Generally a token can be identified as a string entity contained within dollar characters. The following tokens are supported at present:

 

$TIME$
The current time (HH:mm:ss)
 

$DATE$
The current date (dd/MM/yy)
 

$GUID$
A new GUID (uppercased, enclosed in curly braces)
 

$MACHINENAME$
The current machine name
 

$PROJECTNAME$
The current project name

 

$USERNAME$
The current user name

 

For example, to add a custom properties ProjectCreatedOn and ProjectCreatedBy which should by default be populated with the current date, time and creator of the project, the following snippet can be used:

 

<Table Name="Property">

 <Row 

         Property="ProjectCreatedOn" 

         Value="$DATE$ $TIME$" />

 <Row 

         Property="ProjectCreatedBy" 

         Value="$USERNAME$ on $MACHINENAME$" />

</Table>

 

Binary Streams

RPMST syntax supports stream cells. The stream has to be represented as a base64-encoded string, representing the binary content of the stream. It is recommended to simply add a stream using RayPack and then export the RPMST template rather than creating binary values manually.

 

Below is an example of how to define a stream in the template:

 

<Settings>

  <Tables>

    <Table Name="Binary">

      <RowUpdate Name="Binary1" Data="MzNERC0zQjgyLTAxQjEtMzNFMC02MEQy" />

    </Table>

  </Tables>

</Settings>

 

finger1

Be aware:

Stream cells do not support replaceable tokens.

 

Real-life Sample: ActiveSetup

The snippet below can be used to automatically add required Active Setup entries:

 

<Settings>

  <Tables>

    <Table Name="Feature">

      <Row Feature="ActiveSetup" Title="Active Setup" Description="A feature for Active Setup

      components" Display="0" Level="1" Attributes="16" />

    </Table>

    <Table Name="Registry">

      <Row 
        Registry="ActiveSetup_Default" 
        Root="2" 
        Key="SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode]" 
        Value="[ProductName] [ProductVersion]" 
        Component_="ActiveSetup" />

      <Row 
        Registry="ActiveSetup_Version" 
        Root="2" 
        Key="SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode]" 
        Name="Version" 
        Value="1,0,0,0" 
        Component_="ActiveSetup" />

      <Row 
        Registry="ActiveSetup_StubPath" 
        Root="2" 
        Key="SOFTWARE\Microsoft\Active Setup\Installed Components\[ProductCode]" 
        Name="StubPath" 
        Value="msiexec.exe /fpums [ProductCode] /qn " 
        Component_="ActiveSetup" />

    </Table>

    <Table Name="Component">

      <Row 
        Component="ActiveSetup" 
        ComponentId="*" 
        Directory_="TARGETDIR" 
        Attributes="4" 
        KeyPath="ActiveSetup_StubPath" />

    </Table>

    <Table Name="FeatureComponents">

      <Row 
        Feature_="ActiveSetup" 
        Component_="ActiveSetup" />

    </Table>

  </Tables>

</Settings>

 

finger1

Note:

This and a few more samples are available by default in the following folder: <PackPoint>\Templates\Custom.