9 126 GET_PRODUCT_ATTRIBS

LANSA Technical

9.126 GET_PRODUCT_ATTRIBS

Þ Note: Built-In Function Rules.

This BIF lists an installed product's attributes. Use and understanding of its return values requires knowledge of Windows Installer which you may obtain from the Internet. Indeed there are references to C header files in this description that may assist in understanding, and to give you a starting point in your search for further knowledge. LANSA cannot provide this to you.

For use with

LANSA for i

No

 

Visual LANSA for Windows

Yes

In RDMLX partitions only as it requires NCHAR or NVARCHAR fields.

Visual LANSA for Linux

No

 

 

 

Arguments

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

O

Upgrade code (defaults to the UPCD session value) Requires surrounding {} and hyphen delimiters adding up to 38 bytes. For example, {7121782D-DD4E-4E53-A83E-DFFE86AE6995}

38

38

 

 

 

 

Return Values

No

Type

Req/ Opt

Description

Min Len

Max Len

Min Dec

Max Dec

1

A

R

Return Code:

OK – Upgrade Code found
NR – Upgrade Code not known.
VE – Validation Error. A list format is incorrect. For example, Too few columns or incorrect column type.
OV – more attributes available than size of list. Extend list to obtain other attributes.
ER – Error. Could not complete request.

2

2

 

 

2

List

R

Product Attributes

Only contains entries if return code is OK or OV.

All attributes are returned. If an attribute is not valid in the current context then the Attribute Validity is set to ER and the Attribute Value is set to the API Error Code. Refer to MsiGetProductInfoEx() error codes for error code reason.
For example, 1608 is ERROR_UNKNOWN_PROPERTY.
The values can be looked up in winerror.h. Note that the error codes are all negated. Remove the negative sign to locate the meaning.

List structure is flexible with only these requirements:

NCHAR/NVARCHAR fields preferably with *LC attribute

Field 1, NCHAR or NVARCHAR =Attribute Id;

Field 2, NCHAR or NVARCHAR =Attribute Value;

Field 3, Alpha(2)=Attribute Validity:
OK,  ER = value not available,
OV = Attribute Value length is too short for the value.

1

2147483647

 

 

3

List

O

Patch Attributes

If the Patch List is provided then Patch Attributes are listed.

Only contains entries if Return Code is OK or OV.

All attributes are returned. If an attribute is not valid in the current context then the Attribute Validity is set to ER. And the Attribute Value is set to the API Error Code. Refer to MsiGetPatchInfoEx () error codes
e.g. -1608 is ERROR_UNKNOWN_PROPERTY.
The values can be looked up in winerror.h. Note that the error codes are all negated. Remove the negative sign to locate the meaning.

List structure is flexible with only these requirements:

NCHAR/NVARCHAR fields preferably with *LC attribute

Field 1, NCHAR or NVARCHAR =Attribute Id;
Field 2, NCHAR or NVARCHAR =Attribute Value;
Field 3, Alpha(2)=Attribute Validity: OK=valid,
ER = invalid ,
OV = Attribute Value length is too short for the value.

1

2147483647

 

 

 

 

Notes

This Built-In Function lists all products that are related to the Upgrade Code. The current Windows Installer documentation implies that there should only be one, but the code will list all products that are returned.

Products installed across all users in the system are listed. You may not have access rights to the Upgrade Code you have specified.

Attributes may be added to the list, so do not expect them in any particular order or even that the one you are looking for is returned. If the code lists a value, it will at least set the attribute return code to ER, it will not omit it from the list.

References are made below to attributes that are defined winerror.h and msi.h which are C header files.

Product Attributes

UpgradeCode - 38 byte GUID (Input value, but as it is optional the actual value used is returned in the list).

For each Product related to the Upgrade Code the following are returned:

ProductCode – 38 byte GUID

InstallContext – a value in the enumeration MSIINSTALLCONTEXT

SID – Security Identifier of the account under which this product instance exists.

The following values are easily mapped to the Attribute Identifier returned. For example, INSTALLPROPERTY_INSTALLEDPRODUCTNAME returns InstalledProductName. Listing the value used by C will enable you to search the Web for what the attribute means.

    INSTALLPROPERTY_INSTALLEDPRODUCTNAME,

    INSTALLPROPERTY_PACKAGENAME           ,

    INSTALLPROPERTY_TRANSFORMS            ,

    INSTALLPROPERTY_LANGUAGE              ,

    INSTALLPROPERTY_PRODUCTNAME           ,

    INSTALLPROPERTY_ASSIGNMENTTYPE        ,

    INSTALLPROPERTY_INSTANCETYPE          ,

    INSTALLPROPERTY_AUTHORIZED_LUA_APP    ,

    INSTALLPROPERTY_PACKAGECODE           ,

    INSTALLPROPERTY_VERSION               ,

    INSTALLPROPERTY_PRODUCTICON           ,

 

   // Product info attributes: installed information

 

    INSTALLPROPERTY_INSTALLEDPRODUCTNAME  ,

    INSTALLPROPERTY_VERSIONSTRING         ,

    INSTALLPROPERTY_HELPLINK              ,

    INSTALLPROPERTY_HELPTELEPHONE         ,

    INSTALLPROPERTY_INSTALLLOCATION       ,

    INSTALLPROPERTY_INSTALLSOURCE         ,

    INSTALLPROPERTY_INSTALLDATE           ,

    INSTALLPROPERTY_PUBLISHER             ,

    INSTALLPROPERTY_LOCALPACKAGE          ,

    INSTALLPROPERTY_URLINFOABOUT          ,

    INSTALLPROPERTY_URLUPDATEINFO         ,

    INSTALLPROPERTY_VERSIONMINOR          ,

    INSTALLPROPERTY_VERSIONMAJOR          ,

    INSTALLPROPERTY_PRODUCTID             ,

    INSTALLPROPERTY_REGCOMPANY            ,

    INSTALLPROPERTY_REGOWNER              ,

    INSTALLPROPERTY_INSTALLEDLANGUAGE     ,

    INSTALLPROPERTY_PRODUCTSTATE          ,

    INSTALLPROPERTY_LASTUSEDSOURCE        ,

    INSTALLPROPERTY_LASTUSEDTYPE          ,

    INSTALLPROPERTY_MEDIAPACKAGEPATH      ,

    INSTALLPROPERTY_DISKPROMPT,

 

For example, following is a list of a few of the attributes returned for an example Product. Note that the Attribute Value field length was only 30 so a number of attributes, such as UpgradeCode, have a status of OV. LANSA has implemented the standard behaviour of truncating the value:

Patch Attributes

Each of the attributes will be listed starting with the Patch Code. When a Patch Code entry repeats, its the start of another patch. There can be many patches in some products, such as the Microsoft Windows product itself, so it's advisable to use a dynamic list.

PatchCode – 38 byte GUID
   INSTALLPROPERTY_LOCALPACKAGE,

   INSTALLPROPERTY_PATCHTYPE,

   INSTALLPROPERTY_TRANSFORMS,

   INSTALLPROPERTY_INSTALLDATE,

   INSTALLPROPERTY_UNINSTALLABLE,

   INSTALLPROPERTY_PATCHSTATE,

   INSTALLPROPERTY_LUAENABLED,

   INSTALLPROPERTY_DISPLAYNAME,

   INSTALLPROPERTY_MOREINFOURL