<< Click to Display Table of Contents >> Navigation: Code Virtualizer > Protecting an application > Protection Macros |
In the Protection Macros panel, you can see the assembly code that will be protected for each protection macro (VIRTUALIZER markers). You can also see if any ANSI or UNICODE strings are referenced inside each protection macro and decide if you want to protect those strings (see option Virtualize Strings in the Extra Options panel)
You can also enable or disable specific blocks from being protected. Normally, disabling macros from being protected is only required to find a problematic block in the protected application, which makes the application behave in a different way or produce an application exception. In case that you have problems protecting a specific macro, you should check that there is not a current macro restriction.
Macro Restrictions
Switch-case statements and try-except clauses cannot work with Code Virtualizer macros in most compilers.
Compilers generate a direct jump table in the data section which directly jumps to each "case" statement. When the code is virtualized, the jump goes into a virtualized (garbage) code and it produces exception. Switch-case and try-except clauses will be supported in a future version.
You can use a workaround to protect your switch-case statements with Code Virtualizer macros, like:
For switch-case:
switch (var) { case 0:
VIRTUALIZER_START
// your code
VIRTUALIZER_END
case 1:
VIRTUALIZER_START
// your code
VIRTUALIZER_END
... } |
For try-except:
try { VIRTUALIZER_START
// your code
VM_END }
except { VIRTUALIZER_START
// your code
VIRTUALIZER_END } |
Inserting Macros from a MAP file
To insert macros from a MAP file, just click on the Select from MAP file button. You can insert/remove macros by clicking on the name of the function.