With AxProtector NC protected applications various events are detected at runtime, e.g. during license management or execution of protection options (runtime checking, anti-reverse engineering, integrity protection, etc.).
In most cases, the default behavior for such events is to create an exception or even to terminate the protected application immediately. But the event description is displayed in a shortened form on the console.
In some cases, however, it may be desirable to be informed about such events not only on the console, but also via message texts in a graphical user interface. Then it is possible to react to them individually or even to define a completely own handling for them.
For non-NC based AxProtectors this was done so far via the so-called UserMessage setting (error texts). Here a standard implementation for a customizable interface was provided, as well as an interface with which individual reactions to events could be configured. However, the interface exists in its full form only under Windows.
For AxProtector NC protected applications there is now a similar handling of events: CpsEvents.
CpsEvents provides an interface for individual handling of license and anti-reverse engineering related events.
A cross-platform, customizable graphical user interface is planned for the future. So far, the interface is implemented via an adapter to the UserMessage (non-NC based AxProtectors). Likewise, existing UserMessage libraries can be used with the new NC-based AxProtectors. |
•Use
•Example implementation with a Firm Code 6000010.
•Additional parameter for the attribute CpsEvents
Use
To use the CpsEvents functionality, the corresponding CpsEvents attribute must be activated in the protect.WibuCpsConf file. This is done via :
CpsEvents: {}
If this option is set, the encrypted application looks for a cpsevents [Firm Code] directory next to the protected application at runtime. The cpsevents-[Firm Code] with the usermessage[Firm Code] AxProtector predecessor library can then be found there in the appropriate platform directories.
The [Firm Code] placeholder has to be replaced with the actual Firm Code that AxProtector NC uses to sign the data. This is either the one set in the LicensorFirmCode parameter, or in the first CodeMeter license.
If the protected application does not find a suitable CpsEvents library for the particular platform, it defaults to the default implementation of cpsrt, which only provides console output. |
Standard implementations of the CpsEvents library can be found in the AxProtector NC installation directories.
Example implementation with a Firm Code 6000010.
For the sample implementation, please proceed as follows:
1.Copy the cpsevents directories from the installation directory next to the protected application.
2.Rename the directory to cpsevents-6000010.
3.Change the names for all desired platforms in the respective directories.
Adding --6000010 between the name and the file extension.
Example structure for the Windows x64 platform: cpsevents-6000010 •win ox64 ▪cpsevents-6000010.dll ▪usermessage-6000010.dll
The error texts can be customized for different languages via *.ini files in the cpsevents directories. Furthermore you have the possibility to add your own logo and texts to the file for your own visual design. |
Additional parameter for the attribute CpsEvents
Using an individual name
If it is desired to use an individual name before the Firm Code identifier, this is possible via the Name parameter in the protect.WibuCpsConf file. It is important to specify the corresponding Firm Code, which is either set in the LicensorFirmCode parameter or in the first license.
CpsEvents: Name: myowneventhandling-6000010 |
Force CpsEvents
As mentioned before, the cpsrt falls back to its own default implementation for event handling if no CpsEvents library is found despite the feature being enabled.
This can be prevented by forcing the use of the library via a special parameter. For this purpose, the Required parameter must be set to the value true. By default this value is set to false.
CpsEvents: Required: true |
User data
If a custom CpsEvents is implemented, it can also be statically passed data that AxProtector NC embeds into the protected application. These user data are passed in every API command.
These data are read in as binary blob from any file.
CpsEvents: UserData: true File: C:\my\data\dir\data.bin |