<< Click to Display Table of Contents >> Navigation: Code Virtualizer > SecureEngine Macros > Virtualizer macro |
The VIRTUALIZER 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 Virtualizer 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 "VIRTUALIZER_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 "VIRTUALIZER_TIGER_WHITE_START/END")
We strongly recommend the use of this macro whenever possible, due to its flexibility and continuous improvement in the internal protection of these macros.
{$I VIRTUALIZER_TIGER_BLACK_START.inc}
// your code goes here
{$I VIRTUALIZER_TIGER_BLACK_END.inc} |
VIRTUALIZER_TIGER_BLACK_START
// your code goes here
VIRTUALIZER_TIGER_BLACK_END |
Call VarPtr("VIRTUALIZER_START")
' your code goes here
Call VarPtr("VIRTUALIZER_END") |
Remarks
To make sure that you have inserted a VIRTUALIZER 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 VIRTUALIZER macro. If a specif code is called many times per second you should avoid putting a VIRTUALIZER macro or select a lighter virtual machine macro like VIRTUALIZER_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 VIRTUALIZER macros around try-except clauses. For Visual Basic, "try-except" clauses corresponds to "On Error" statements.