CmCreateProductItemOption
Description
CmCreateProductItemOption() concatenates a security sequence for adding or updating a Product Item Option. This function must be called once or more before a CmCreateSequence() call to add or update one or more Product Item Options.
|
Triple Mode Redundancy-related information (TMR)
|
Syntax
int CMAPIENTRY CmCreateProductItemOption(HCMSysEntry hcmse, CMULONG flCtrl, void *pvPio, CMUINT cbPio)
Parameter
hcmse contains a handle opened by CmAccess / CmAccess2. The access mode must be Entry Access to a FSB Entry. The handle is related to a CmLocal or a CmLAN subsystem with a connected CmDongle.
flCtrl contains one of the following commands:
CM_CPIO_PRODUCTCODE adds a Product Code to the internally created structure to create a Product Item. pvPio is pointing to a
CMCPIO_PRODUCTCODE structure.
|
CMCPIO_PRODUCTCODE specifies contains the data for setting a programming sequence with CmCreateProductItemOption() for a Product Code. Syntax
Parameter mflTvbCtrl can be specified the following flags. The flags can be or'ed each other.
musFirmItemReference contains the Firm Item Reference of the Firm Item the Product Code should be added or updated. musProductItemReference contains the Reference of the Product Item, which will be the successor of the newly added Product Item or which is the Product Item to update. If this value is 0, the Product Item is created at the end of the Product Item list. mulProductCode contains the Product Code to add or to be updated. mulReserve is reserved for future purposes.
|
CM_CPIO_FEATUREMAP adds a Feature Map to the internally created structure to create a Product Item. pvPio is pointing to a CMULONG value describing this Product Item Option.
CM_CPIO_MAINTENANCEPERIOD adds a Feature Map to the internally created structure to create a Product Item. pvPio is pointing to a (see structure
CMCPIO_MAINTENANCEPERIOD).
Structure CMCPIO_MAINTENANCEPERIOD CMCPIO_MAINTENANCEPERIOD sets the parameters for programming a Maintenance Period entry into Firm Item : Product Item of a CmContainer. Syntax
Parameter mcmStartPeriod specifies a
mcmEndPeriod specifies a CMTIME structure containing the end date of the Maintenance Period.
|
CM_CPIO_EXPTIME adds an Expiration Time to the internally created structure to create a Product Item. pvPio is pointing to a CMTIME structure describing this Product Item Option.
CM_CPIO_USAGEPERIOD adds a Usage Period to the internally created structure to create a Product Item. pvPio is pointing to a CMUINT value describing the value (in seconds) of the usage period once the Usage Period was activated by CmCrypt(). Knowledge Base article
CM_CPIO_ACTTIME adds an Activation Time to the internally created structure to create a Product Item. pvPio is pointing to a CMTIME structure describing this Product Item Option.
CM_CPIO_UNITCOUNTER adds a Unit Counter to the internally created structure to create a Product Item. pvPio is pointing to a CMULONG value describing this Product Item Option.
CM_CPIO_PROTDATA adds a Protected Data to the internally created structure to create a Product Item. pvPio is pointing to a
CMCPIO_PROTDATA structure describing this Product Item Option.
|
CMCPIO_PROTDATA sets the parameters for programming a Protected Data entry into Firm Item : Product Item of a CmContainer. Syntax
Parameter mcbData specifies the length of the data stored in mabData. mabData contains the data of the Extended Protected Data. The maximum length of the data is 256 bytes. mabReserve is reserved for future purposes.
|
CM_CPIO_EXTPROTDATA adds an Extended Protected Data to the internally created structure to create a Product Item. pvPio is pointing to a
CMCPIO_EXTPROTDATA structure value describing this Product Item Option.
|
CMCPIO_EXTPROTDATA sets the parameters for programming a Extended Protected Data entry into Firm Item : Product Item of a CmContainer. Syntax
Parameter musExtType specifies the Extended Type of this Extended Protected Data. The Extended Type is the index of the current Extended Protected Data in the complete Firm Item : Product Item. This is a value between 0..255. The Extended Types 128..255 are reserved for WIBU-SYSTEMS. mcbData specifies the length of the data stored in mabData. mulReserve is reserved for future purposes. mabData contains the data of the Extended Protected Data. The maximum length of the data is 256 bytes.
|
CM_CPIO_HIDDENDATA adds a Hidden Data to the internally created structure to create a Product Item. pvPio is pointing to a
CMCPIO_HIDDENDATA structure describing this Product Item Option.
Structure CMCPIO_HIDDENDATA CMCPIO_HIDDENDATA sets the parameters for programming a HiddenData entry into Firm Item : Product Item of a CmContainer. Syntax
Parameter musExtType specifies the Extended Type of this Hidden Data. The Extended Type is the index of the current Hidden Data in the complete Firm Item : Product Item. This is a value between 0..255. The Extended Types 128..255 are reserved for Wibu-Systems. mcbTotal specifies the total length of the data to be stored in Hidden Data. The maximum length is 256 bytes. The difference between mcbData and mcbTotal is filled with random values. mcbData specifies the length of the real data stored in mabData. This value must be less or equal to mcbTotal. The maximum length is 256 bytes. mabReserve is reserved for future purposes. mulHiddenDataAccessCode specifies Hidden Data Access Code (HDAC) of this Hidden Data. mabData contains the data of the Hidden Data. The maximum length of the data is 256 bytes. Parameter For generating a random Hidden Data inside a CmContainer see here. If you want to update a Hidden Data (with CmCreateProductItemOption()/CM_CPIO_UPDATE), then the mulHiddenDataAccessCode (HDAC) must be set to 0. If you want to update a Hidden Data Access Code (HDAC) (with CmCreateProductItemOption()/CM_CPIO_UPDATE) the mcbTotal must be set to -1 (0xFFFF). Here only the HDAC can be updated, not the Hidden Data itself.
|
CM_CPIO_SECRETDATA adds a Secret Data to the internally created structure to create a Product Item. pvPio is pointing to a
CMCPIO_SECRETDATA structure describing this Product Item Option.
|
CMCPIO_SECRETDATA sets the parameters for programming a Secret Data entry into Firm Item : Product Item of a CmContainer. Syntax
Parameter musExtType specifies the Extended Type of this Secret Data. The Extended Type is the index of the current Secret Data in the complete Firm Item : Product Item. This is a value between 0..255. The Extended Types 128..255 are reserved for Wibu-Systems. mcbTotal specifies the total length of the data stored in Secret Data. The maximum length is 256 bytes. The difference between mcbData and mcbTotal is filled with random values. mcbData specifies the length of the real data stored in mabData. This value must be less or equal to mcbTotal. The maximum length is 256 bytes. musReserve is reserved for future purposes. mabData contains the data of the Secret Data. The maximum length of the data is 256 bytes. Notes For generating a random Secret Data inside a CmContainer see here.
|
CM_CPIO_USERDATA adds User Data to the internally created structure to create a Product Item. pvPio is pointing to a
CMCPIO_USERDATA structure describing this Product Item Option.
|
CMCPIO_USERDATA sets the parameters for programming a User Data entry into Firm Item : Product Item of a CmContainer. Syntax
Parameter mcbData specifies the length of the data stored in mabData. mabReserve is reserved for future purposes. mabData contains the data of the User Data. The maximum length of the data is 256 bytes.
|
CM_CPIO_TEXT adds Text to the internally created structure to create a Product Item. pvPio is pointing to a (see structure
CMCPIO_TEXT).
|
CMCPIO_TEXT sets the parameters for programming a Text entry into Firm Item : Product Item of a CmContainer. Syntax
Parameter mcchText specifies the length of the data stored in mausText. mabReserve is reserved for future purposes. mausText contains the data of the Text. The maximum length of the data is 256 bytes.
|
CM_CPIO_DELETEALL deletes all Product Item Options of the currently accessed Product Item. The Product Code is the only option available after this task. In this case pvPio can be NULL and cbPio can be 0.
CM_CPIO_CHANGEDEPENDENCY changes the dependency flags of the Product Item Options created after this command. pvPio is pointing to a CMULONG value value describing this Product Item Option. The CMULONG value contains an or'ed combination of the flags CM_PIOPC_DATA (data dependency), CM_PIOPC_FUC (Firm Update Counter dependency) and CM_PIOPC_SERIAL (Serial Number dependency).
The following flags must be or'ed with the flags above in special situations.
CM_CPIO_ADD: The first call of CmCreateProductItemOption to concatenate a programming sequence must have this flag set, if the programming sequence is intended to add a Product Item. This flag sets the add mode for creating the PIO. This flag can also be set to switch from update mode to add mode. The first call must always be the addition of a Product Code (CM_CPIO_PRODUCTCODE).
CM_CPIO_UPDATE: The first call of CmCreateProductItemOption to concatenate a programming sequence must have this flag set, if the programming sequence is intended to update a Product Item. This flag sets the update mode for creating the PIO. This flag can also be set to switch from add mode to update mode. The first call must always be the addition of a Product Code (CM_CPIO_PRODUCTCODE).
CM_CPIO_RELATIVE: This option specifies that the updated value should be modified relatively. It can only be combined with CM_CPIO_ACTTIME, CM_CPIO_EXPTIME or CM_CPIO_UNITCOUNTER. In these cases the set value is always an unsigned long value, specifying therelative value. The value can also be negative.
CM_CPIO_TERMINATE: The last call of CmCreateProductItemOption to concatenate a programming sequence must have this flag set to terminate the internal process.
CM_CPIO_DELETE_PIO: This flag can be combined with all CM_CPIO_...… commands and implies that the set Product Item Option will be deleted. In this case pvPio can be NULL and cbPio can be 0.
pvPio contains a structure depending on the flCtrl flag (see above).
cbPio contains the length of the structure stored in pvPio.
Return
TRUE, if the entry was added to the security sequence - FALSE, if not.
Notes
This function is only for Licensor side because a FSB is needed.
The following flags (and the corresponding functionality) are only available since CodeMeter Version 4.30:
•CM_CPIO_MAINTENANCEPERIOD
Syntax
public bool CmCreateProductItemOption(HCMSysEntry hcmse, CmCreateProductItemOptionOption Ctrl , object Pio)
|
Parameter
hcmse contains a handle opened by CmAccess / CmAccess2. Access Mode must be Entry Access to the FSB entry of the desired Firm Code. If the Firm Code is an evaluation Firm Code the access can be SubSystem Access. A matching entry in the CmLicensor/CmFirm.wbc file has to exist in both cases.
Ctrl covers the following fields:
ProductCode adds a Product Code to the internally created structure to create a Product Item. Pio is a
CmCreatePioProductCode class.
|
CmCreatePioProductCode specifies contains the data for setting a programming sequence with CmCreateProductItemOption() for a Product Code. Syntax
Parameter TvbCtrl can be specified the following flags. The flags can be or'ed each other.
FirmItemReference contains the Firm Item Reference of the Firm Item the Product Code should be added or updated. ProductItemReference contains the Reference of the Product Item, which will be the successor of the newly added Product Item or which is the Product Item to update. If this value is 0, the Product Item is created at the end of the Product Item list. ProductCode contains the Product Code to add or to be updated. MajorVersion tba. MinorVersion tba.
|
FeatureMap adds a Feature Map to the internally created structure to create a Product Item. Pio is a uint value describing this Product Item Option.
ExpirationTime adds an Expiration Time to the internally created structure to create a Product Item. Pio is a
CmTime class describing this Product Item Option.
|
CmTime sets or gets the time to or from a CmContainer. Syntax
Parameter Year specifies the value of the year (e.g. 2003). Month specifies the value of the month (1..12). Day specifies the value of the day (1..31). Hours specifies the value of the hours (0..23). Minutes specifies the value of the minutes (0..59). Seconds specifies the value of the seconds (0..59). SecondsSince01_01_2000 specifies the time in seconds since 01/01/2000.
|
ActivationTime adds an Activation Time to the internally created structure to create a Product Item. Pio is a CmTime class describing this Product Item Option.
UnitCounter adds a Unit Counter to the internally created structure to create a Product Item.Pio is a uint value describing this Product Item Option.
ProtectedData adds a Protected Data to the internally created structure to create a Product Item. Pio is a
CmCreatePioProtectedData class describing this Product Item Option.
ExtendedProtectedData adds an Extended Protected Data to the internally created structure to create a Product Item. Pio is a
CmCreatePioExtendedProtectedData class value describing this Product Item Option.
Class CmCreatePioExtendedProtectedData CmCreatePioExtendedProtectedData sets the parameters for programming a Extended Protected Data entry into Firm Item : Product Item of a CmContainer. Syntax
Parameter ExtType specifies the Extended Type of this Extended Protected Data. The Extended Type is the index of the current Extended Protected Data in the complete Firm Item : Product Item. This is a value between 0..255. The Extended Types 128..255 are reserved for Wibu-Systems. DataLen specifies the length of the data stored. The maximum length of the data is 256 bytes. Data contains the data of the Extended Protected Data.
|
HiddenData adds a Hidden Data to the internally created structure to create a Product Item.Pio is a
CmCreatePioHiddenData structure describing this Product Item Option.
Class CmCreatePioHiddenData CmCreatePioHiddenData sets the parameters for programming a HiddenData entry into Firm Item / Product Item of a CmContainer. Syntax
Parameter ExtType specifies the Extended Type of this Hidden Data. The Extended Type is the index of the current Hidden Data in the complete Firm Item : Product Item. This is a value between 0..255. The Extended Types 128..255 are reserved for Wibu-Systems. Total specifies the total length of the data to be stored in Hidden Data. The maximum length is 256 bytes. The difference between Data and Total is filled with random values. DataLen specifies the length of the real data stored. This value must be less or equal to Total. The maximum length is 256 bytes. HiddenDataAccessCode specifies Hidden Data Access Code (HDAC) of this Hidden Data. Data contains the data of the Hidden Data. Note For generating a random Hidden Data inside a CmContainer see here. If you want to update a Hidden Data (with CmCreateProductItemOption()/Update), then the HiddenDataAccessCode (HDAC) must be set to 0. If you want to update a Hidden Data Access Code (HDAC) (with CmCreateProductItemOption()/Update), the Total must be set to -1 (0xFFFF). Here only the HDAC can be updated, not the Hidden Data itself.
|
SecretData adds a Secret Data to the internally created structure to create a Product Item. Pio is a
CmCreatePioSecretData class describing this Product Item Option.
|
CmCreatePioSecretData sets the parameters for programming a Secret Data entry into Firm Item : Product Item of a CmContainer. Syntax
Parameter ExtType specifies the Extended Type of this Secret Data. The Extended Type is the index of the current Secret Data in the complete Firm Item : Product Item. This is a value between 0..255. The Extended Types 128..255 are reserved for Wibu-Systems. Total specifies the total length of the data stored in Secret Data. The maximum length is 256 bytes. The difference between Data and Total is filled with random values. DataLen specifies the length of the real data stored. This value must be less or equal to Total. The maximum length is 256 bytes. Data contains the data of the Secret Data. Notes For generating a random Secret Data inside a CmContainer see here.
|
UserData adds User Data to the internally created structure to create a Product Item. Pio is a
CmCreatePioUserData class describing this Product Item Option.
|
CmCreatePioUserData sets the parameters for programming a User Data entry into Firm Item : Product Item of a CmContainer. Syntax
Parameter DataLen specifies the length of the data stored. The maximum length of the data is 256 bytes. Data contains the data of the User Data.
|
Text adds Text to the internally created structure to create a Product Item. Pio is a
CmCreatePioText class describing this Product Item Option.
|
CmCreatePioText sets the parameters for programming a Text entry into Firm Item : Product Item of a CmContainer. Syntax
Parameter Text contains the data of the Text. The maximum length of the data is 256 bytes.
|
DeleteAll deletes all Product Item Options of the currently accessed Product Item. The Product Code is the only option available after this task. In this case, Pio can be null.
ChangeDependency changes the Dependency contains the dependency of the dynamic added entry from the enum GlobalProductCodeOption. It can be have one or more of the following flags:
Data specifies that the parameter depends on the contents of the data of the Firm Item.
Fuc specifies that the parameter depends on the Firm Update Counter of the Firm Item.
Serial specifies that the parameter depends on the Serial Number of the CmContainer.
UsagePeriod adds a Usage Period to the internally created structure to create a Product Item. Pio is a uint describing the value (in seconds) of the usage period once the Usage Period was activated by CmCrypt(). Knowledge Base article
MaintenancePeriod adds a Feature Map to the internally created structure to create a Product Item. Pio is a
CmCreatePioMaintenancePeriod class describing this Product Item Option. The Firmware version has to be at minimum 1.18.
Class CmCreatePioMaintenancePeriod CmCreatePioMaintenancePeriod sets the parameters for programming a Maintenance Period entry into Firm Item : Product Item of a CmContainer. Syntax
Parameter StartPeriod specifies a
EndPeriod specifies a CmTime class containing the end date of the Maintenance Period.
|
CmdMask specifies mask bit values for creating Product Item Options.
Add The first call of CmCreateProductItemOption to concatenate a programming sequence must have this flag set, if the programming sequence is intended to add a Product Item. This flag sets the add mode for creating the PIO. This flag can also be set to switch from update mode to add mode. The first call must always be the addition of a Product Code (ProductCode).
Update The first call of CmCreateProductItemOption to concatenate a programming sequence must have this flag set, if the programming sequence is intended to update a Product Item. This flag sets the update mode for creating the PIO. This flag can also be set to switch from add mode to update mode. The first call must always be the addition of a Product Code (ProductCode).
DeletePio This flag can be combined with all CmCreateProductItemOption... commands and implies that the set Product Item Option will be deleted. In this case Pio can be null.
Relative This option specifies that the updated value should be modified relatively. It can only be combined with ActivationTime, ExpirationTime or UnitCounter. In these cases the set value is always an unsigned long value, specifying the relative value. The value can also be negative.
Terminate The last call of CmCreateProductItemOption to concatenate a programming sequence must have this flag set to terminate the internal process.
pio contains a class depending on the Ctrl flag (see above).
Return
true, if the entry was added to the security sequence - false, if not.
Notes
This function is only for Licensor side because a FSB is needed.
The following flag (and the corresponding functionality) is only available since CodeMeter Version 4.30:
•MaintenancePeriod
Not implemented.