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.
|
Triple Mode Redundancy-related information (TMR)
|
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
CMLTTRANSFER).
|
CMLTTRANSFER specifies the data of the license to be transferred. Syntax
Parameter mflCtrl contains one of the following flags describing the type of the transfer.
mcLicenseQuantityToTransfer contains the number of LicenseQuantities to be transferred. mcmBorrowExpirationTime contains the Expiration Time of borrowed licenses to be transferred. midPIOHistory 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. •This value is updated on the current value when the function returns. In the case of the error, that the buffer in pUpdate is too small, the function can be called again using a buffer having enough memory allocated (see CMERROR_TRANSFER_BUFFER_OVERFLOW). mabReserved[228] is reserved for future purposes.
|
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..
|
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.
|
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. |
Push specifies the push transfer type.
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.
CmdMask specifies mask bit values for programming the transfer.
CmLtTransfer LtTransfer contains the following parameter:
CmLtTransfer.Option Ctrl contains one of the following options:
MoveLicenses specifies that additionally the field LicenseQuantityToTransfer is set, which describes the number of LicenseQuantities to be transferred from this license.
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.
CmdMask can be used to mask bits for specifying the type of the transfer.
and the following fields:
LicenseQuantityToTransfer contains the number of LicenseQuantities to be transferred.
BorrowExpirationTime contains the expiration time of borrowed licenses to be transferred.
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
cmapi.CMLTTRANSFER).
|
CMLTTRANSFER specifies the data of the license to be transferred. Syntax
Parameter mflCtrl contains one of the following flags describing the type of the transfer.
mcUnitsToTransfer contains the number of units to be transferred from this license. mcLicenseQuantityToTransfer contains the number of LicenseQuantities to be transferred. mcmBorrowExpirationTime contains the Expiration Time of borrowed licenses to be transferred. midPIOHistory 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. •This value is updated on the current value when the function returns. In the case of the error, that the buffer in pUpdate is too small, the function can be called again using a buffer having enough memory allocated (see CMERROR_TRANSFER_BUFFER_OVERFLOW). mabReserved[228] is reserved for future purposes.
|
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 ().
|
However, make sure that CMLTTRANSFER::midPIOHistory holds the correctly set value; otherwise an error occurs. |
Notes
Available with CodeMeter Version 6.00 and higher.