VM macro

<< Click to Display Table of Contents >>

Navigation:  WinLicense > SecureEngine® Macros >

VM macro

The VM macro allows you to mark regions of code that will be executed inside the SecureEngine® Virtual Machine. When the CPU is going to execute the code inside your VM macro, SecureEngine® will take control and will emulate the original code inside the macro with virtual opcodes that only the SecureEngine® Virtual machine can understand.


The VM macro is the original name used in older versions of our protection. In newer versions of our protection we recommend that you specify the name of the Virtual Machine that will be used to virtualize the code inside the START - END markers. For example, instead of using "VM_START/END" for a block of code, you should select which Virtual Machine (from the Virtual Machine panel) will be used to virtualize that code (example "VM_TIGER_WHITE_START/END")


We strongly recommend the use of this macro whenever possible, due to its flexibility and continuos improvement in the internal protection of these macros.


NOTE: The current version of SecureEgine® does not support this macro for .NET languages or Visual Basic compiled in PCode mode.

Click to expand/collapseShow Delphi Macro Usage
Click to expand/collapseShow C/C++ Macro Usage
Click to expand/collapseShow Visual Basic Macro Usage





To make sure that you have inserted a VM macro in a right place in your application, you should be aware of the following details:


To avoid a performance decrease, you should avoid tight loops (FOR, WHILE, DO...) with a big number of iterations inside the VM macro. If a specif code is called many times per second you should avoid putting a VM macro or select a lighter virtual machine macro like VM_TIGER_WHITE


Switch/Case statements inside the macro might not work properly in some compiled applications. Notice that Switch statements are named in a different way in different programming languages ("Case" --> Delphi, "Select Case" --> VB, etc).


Exception handling inside the macro will not work properly. You should avoid putting VM macros around try-except clauses. For Visual Basic, "try-except" clauses corresponds to "On Error" statements.