CmEmbedded_4c_transp CmLtCreateContext

Description

This function represents the first step of a return or push license transfer but also on programming a usual entry using the Firm Security Box (FSB). Here all necessary data of the target side is collected (including the required, eventually signed, public key certificates) and is established in the format of a Context File *.WibuCmRaC.

For more details see the respective knowledge base article on license transfer.

Syntax

int CMAPIENTRY CmLtCreateContext(
HCMSysEntry hcmse, CMULONG flCtrl, const CMLTREQUEST *pcmltRequest, const void *pContextForPull, CMUINT cbContextForPull, void *pContext, CMUINT cbContext);

Parameter

hcmse contains a handle opened by CmAccess2 (can be Box Access, Entry Access or Firm Item Access). Principally, a Box Access handle is set.

flCtrl must contain one of the following flags describing the programming / type of the transfer. The corresponding data is further processed and the transfer is performed.

information_weiss_klein26

The transfer or programming types are stored in the output data and remain across the protocol. Thus the flag must not be specified for the following API functions.

nav_open CM_LT_FSB specifies programming a license entry using a Firm Security Box (FSB).

pcmltRequest contains a pointer to a CMLTREQUEST structure. In this structure, only the value of mulFirmCode is set. This will create the context of this Firm Code and not for the complete CmContainer content. All other values of this structure are ignored for now (see structure hmtoggle_plus1 CMLTREQUEST).

pContext points to a byte buffer to which the return data is copied to.
Here the created data is one-to-one copied in format Context File *.WibuCmRaC to the memory.

cbContext holds the size of the allocated memory in pContext.

Return

The exact number of bytes copied to pContext is returned.

•If the number of bytes is smaller or equal to cbContext, no error occurred and the data has been copied to pContext.

•If the number is larger than cbContext no data has been returned and the error code CMERROR_BUFFER_OVERFLOW (--> CmGetLastErrorCode () or CmGetLastErrorText () / CmGetLastErrorText2 ()) is set, because the buffer size was too small. Then the call can be repeated using a buffer pContext having enough memory allocated.

•If a value of 0 is returned, another error has occurred. The exact reason can be detected using CmGetLastErrorCode () or CmGetLastErrorText () / CmGetLastErrorText2 ().

Notes

Basically, it is appropriate for the first call to use a buffer size which has been defined huge enough before.

 

Available with CodeMeter Version 6.00 and higher.