Skip to content

Remarks when inserting Protection Macros

Code Virtualizer can convert x86, x64, and ARM64 code into virtual opcodes. Follow these guidelines to preserve the original behavior:

  • Avoid protecting loops (for, while, or do) that run many times.

  • Switch statements inside a protected area might not work because compilers can use jump tables that point directly into the code. Instead, protect the code inside each case separately.

  • Avoid placing protected areas around try-except clauses or Visual Basic On Error GoTo statements.

Testing your protected application

The protected application should behave like the original. If it crashes in a protected block, disable individual blocks in the Protection Macros panel and protect the application again to identify the cause.

Note for device-driver developers

Invalid macro placement in a driver can cause exceptions or a system fault. To prevent data loss during testing, always test protected drivers in VMware, Virtual PC, or another virtualized environment.