cookie CmLtDoTransfer

Description

This function performs the actual transfer. The transferred Context File *.WibuCmRaC data is processed. The data for the license to be transferred is gathered, signed and eventually encrypted. The data is combined and returned in the Update File *.WibuCmRaU format.

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

tmr_02

Triple Mode Redundancy-related information (TMR)

  • C, C++
  • C#
  • Python

Syntax

int CMAPIENTRY CmLtDoTransfer(
HCMSysEntry hcmse, CMULONG flCtrl, CMLTTRANSFER* pcmltTransfer, const void* pRequest, CMUINT cbRequest, void* pUpdate, CMUINT cbUpdate);

Parameter

hcmse contains a handle opened by CmAccess / CmAccess2 on an Entry Access of the license to be transferred.

flCtrl contains one of the flags CM_LT_PUSH/CM_LT_RETURN describing the type of the programming / transfer.

pcmltTransfer contains a pointer to a CMLTTRANSFER structure. In this structure, the needed data for the desired transfer is set (see structure hmtoggle_plus1 CMLTTRANSFER).

pRequest points to a byte buffer containing the request data. Generally, this data has been created before using CmLtCreateContext() and transferred in form of a Context File *.WibuCmRaC.

cbRequest holds the size of the allocated memory in pRequest.

pUpdate points to a byte buffer to which the return data is copied to.
Here the created data is one-to-one copied in format Update File *:WibuCmRaU to the memory.

cbUpdate holds the size of the allocated memory in pUpdate.

Return

The exact number of bytes copied to pUpdate is returned.

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

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

information_weiss_klein26

However, make sure that CMLTTRANSFER::midPIOHistory holds the correctly set value; otherwise an error occurs.

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

Syntax

public bool CmLtDoTransfer(HCMSysEntry hcmse, CmLtFlags Ctrl, CmLtTransfer LtTransfer, byte[] Request, out byte[] Update);

Parameter

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

CmLtFlags Ctrl 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 Push specifies the push transfer type.

nav_open Return specifies that the license is returned to the old sender:
Please note that in this case, the hcmse handle must be an Entry Access.

nav_open CmdMask specifies mask bit values for programming the transfer.

CmLtTransfer LtTransfer contains the following parameter:

nav_open CmLtTransfer.Option Ctrl contains one of the following options:

nav_open MoveLicenses specifies that additionally the field LicenseQuantityToTransfer is set, which describes the number of LicenseQuantities to be transferred from this license.

nav_open BorrowLocalLicense specifies that additionally the field BorrowExpirationTime is set. The Borrow Expiration Time is not to exceed the defined MaxBorrowTime. The field LicenseQuantity 1 with LocalAccessOnly flag and a transfer depth of 1 are implicitely set.

nav_open CmdMask can be used to mask bits for specifying the type of the transfer.

and the following fields:

nav_open LicenseQuantityToTransfer contains the number of LicenseQuantities to be transferred.

nav_open BorrowExpirationTime contains the expiration time of borrowed licenses to be transferred.

nav_open PIOHistoryId contains the ID of the Product Item Option (PIO) History on which the current license transfer is based.
If this value is 0, the complete license transfer is performed.

Request contains the the request data. Generally, this data has been created before using CmLtCreateContext() and transferred in form of a Context File *.WibuCmRaC.

Update contains the return data one-to-one copied in format Update File *.WibuCmRaU to the memory.

Return

This function returns true. If an error occurred, false will be returned. If an error occurs, the exact reason can be detected using CmGetLastErrorCode2 () or CmGetLastErrorText () / CmGetLastErrorText2 ().

Notes

Available with CodeMeter Version 6.00 and higher.

Syntax

import cmapi
 
update = handleOfSender.CmLtDoTransfer(flCtrl: int, cmltTransfer: cma-pi.CMLTTRANSFER, context: bytes) -> bytes:
throws CodeMeterApiFailedException()

Parameter

handleOfSender is the handle opened by CmAccess / CmAccess2 on an Entry Access of the license to be transferred.

flCtrl contains one of the flags cmapi.CM_LT_PUSH/CM_LT_RETURN describing the type of the programming / transfer.

cmltTransfer is an object of type cmapi.CMLTTRANSFER. In this object, the needed data for the desired transfer is set (see hmtoggle_plus1 cmapi.CMLTTRANSFER).

context is a byte buffer containing the request data. Generally, this data has been created before using CmLtCreateContext() and transferred in form of a Context File *.WibuCmRaC.

update will be the byte buffer to which the return data is copied to.
Here the created data is one-to-one copied in format Update File *:WibuCmRaU to the memory.

 

Return

The buffer containing the update data.

•The function tries to allocate a buffer big enough to contain the data. If it fails, a CodeMeterApiFailedException is thrown. The exact reason can be detected using CmGetLastErrorCode () or CmGetLastErrorText ().

information_weiss_klein26

However, make sure that CMLTTRANSFER::midPIOHistory holds the correctly set value; otherwise an error occurs.

 

Notes

Available with CodeMeter Version 6.00 and higher.