WupiExecuteMovedCodeId

CodeMoving is a protection technique of CodeMeter Protection Suite. In this process, code that requires protection, usually in the form of separate functions, can not only be encrypted, but its execution can additionally be moved to a secured environment. Currently, the CmContainer types CmDongle and CmCloudContainer provide this secured environment.

Each CodeMoving function is marked with a unique functionId. This Id is later used in the encryption definition (*.wbc file) to link to the actual CodeMoving function. Furthermore, a stateId is passed for each call.

To provide that data can be exchanged between the program component and the function executed in the CmDongle or in CodeMeter Cloud, the two parameters input and output are available.

According to the CodeMoving function description, the pointers must point to memory areas that provide space for the struct input and struct output structures. The input contents are finally filled beforehand by the program component, whereas the contents of the memory referenced by output are only filled after the WupiExecuteMovedCodeId call if output data is desired.

  • C, C++
  • C#

WupiExecuteMovedCodeId(int functionId, int stateId, const void* input, void* output);

 

This function represents the linkage of a CodeMoving function. The API command is placed in the original source code at the calling location.

Parameter

Description

functionId

uniquely identifies with a number the function to be moved.
Via this Id the link to the actual CodeMoving function is established later in the encryption definition (*.wbc file).

stateID

contains the so-called state handle.  
The state handle represents a kind of session, which is maintained during the entire program runtime.

The number of state handles is limited to 30 for CmDongles. With CodeMeter Cloud, this limitation does not exist, i.e. an almost infinite number of instances can work in parallel with CodeMoving in the Cloud.

input output

So that data can be exchanged between the program component and the function executed in the CmDongle or in CodeMeter Cloud, the two parameters input and output are available

Below are selected error codes that may occur when executing a CodeMoving function.

System error

-17 ErrorNoBlurryBoxHandleAvailable

There are no more free state handles available.

0x70000000

Internal error that occurred from the command call.

0x70000003

The received data is too small.

0x70000004

The received payload data is invalid.

0x70000005

The received payload data does not have the expected length.

CmDongle error

0x8000XXXX

An error occurred in the trusted anchor during execution
XXXX defines the error more precisely. The following value can occur more frequently during the development of a CodeMoving function.

1702 ERR_CPU_BAD_RAM_ACCESS

An invalid memory access was detected.

1703 ERR_CPU_NULL_ACCESS

Memory address zero was accessed.

1704 ERR_CPU_BAD_STACK_ACCESS

The stack is overflowed.

1705 ERR_CPU_DIVIDE_BY_ZERO

A division by zero was performed.

1707 ERR_CPU_INSTRUCTION_LIMIT_REACHED

The limit of the maximum executable instructions was reached.

1751 ERR_CPU_LIBRARY_FUNCTION_ERROR

A CodeMoving API function threw an error.

1752 ERR_CPU_LIBRARY_INVALID_PARAMETER

An invalid parameter was passed to a CodeMoving API function.

 

Not yet implemented in C#.