Description

CmExecuteRemoteUpdate executes a firmware update of the CodeMeter Chip, as specified in the given Wibu Binary file, for the given box.

  • C, C++

Syntax

int CmExecuteFieldUpdate (const CMBOXINFO * pcmBoxInfo, const unsigned char * pbWbb, unsigned int cbSize)

information_weiss_klein26

The FieldUpdate WBB File in pbWbb has to contain a single staged or a double staged FieldUpdate. It has to correspond with the mulFirmwareBuild and the musSiliconRevision of the specified box, as returned by CmGetInfo (..., CM_GEI_CHIPINFO, ...).

The update's serial number range has to cover the mulSerialNumber of pcmBoxInfo. Only CodeMeter Chips of type 0x97 or larger (see musChipType in CMCHIPINFO ) can be updated with this function.

Parameter

pcmBoxInfo contains the hmtoggle_plus1 CMBOXINFO structure that specifies the dongle which is to be updated.

pbWbb contains the pointer to the buffer with the WBB file.

cbSize contains the length of the WBB file.

 

Code

CMBOXINFO *cmbxinfo;

CMBYTE *wbb;

HCMSysEntry hsub;

CMACCESS2 cmacc;

int nb_boxes, success;

 

memset(&cmacc, 0, sizeof(cmacc));

cmacc.mflCtrl = CM_ACCESS_SUBSYSTEM;

hsub = CmAccess2(CM_ACCESS_LOCAL, &cmacc);

 

if ((hsub != NULL) && (CmGetBoxes(hsub, CM_GB_DONGLE, cmbxinfo, 0) > 0)) {

  cmbxinfo = malloc(sizeof(CMBOXINFO) * (size_t)nb_boxes);

  CmGetBoxes(hsub, CM_GB_DONGLE, cmbxinfo, (size_t)nb_boxes);

  wbb = read_file_to_buffer();

  success = CmExecuteFieldUpdate(&cmbxinfo[0], wbb, sizeof(*wbb));

  if (success == 0) {

    printf("Error: %d\n", CmGetLastErrorCode());

  }

  free(wbb);

  free(cmbxinfo);

  CmRelease(hsub);

}