Skip to content

StrEncrypt macro

The VIRTUALIZER_STR_ENCRYPT/VIRTUALIZER_STR_ENCRYPTW macro marks a region whose referenced strings will be encrypted during protection. At runtime, the SecureEngine Virtual Machine decrypts each string to a location different from the original one. The original string data is destroyed and never used by the protected application.

Use VIRTUALIZER_STR_ENCRYPTW for Unicode strings.

Delphi Macro Usage

{$I VirtualizerStrEncrypt_Start.inc}

// your code goes here

{$I VirtualizerStrEncrypt_End.inc}

C/C++ Macro Usage

VIRTUALIZER_STR_ENCRYPT_START

// your code goes here

VIRTUALIZER_STR_ENCRYPT_END

Visual Basic Macro Usage

Call VarPtr("VirtualizerStrEncryptStart")

' your code goes here

Call VarPtr("VirtualizerStrEncryptEnd")

Named Macro Usage

Use VIRTUALIZER_STR_ENCRYPT_START_NAMED for ANSI strings and VIRTUALIZER_STR_ENCRYPTW_START_NAMED for Unicode strings. The label is displayed in the Protection Macros panel and during protection.

ANSI example:

VIRTUALIZER_STR_ENCRYPT_START_NAMED("ServerAddress")

// your code that references ANSI strings goes here

VIRTUALIZER_STR_ENCRYPT_END

Unicode example:

VIRTUALIZER_STR_ENCRYPTW_START_NAMED("UnicodeMessages")

// your code that references Unicode strings goes here

VIRTUALIZER_STR_ENCRYPTW_END

Named start markers use the normal corresponding end markers. Pass a non-empty, NUL-terminated UTF-8 label containing 1 to 255 bytes, excluding the terminator. This label remains UTF-8 even when naming a Unicode String Encrypt block. Control characters are not accepted. A string literal is recommended so Code Virtualizer can recover the label reliably.

Remarks

For additional protection, place a VIRTUALIZER macro around STR_ENCRYPT. This also virtualizes the code that uses the strings:

VIRTUALIZER_START

  VIRTUALIZER_STR_ENCRYPT_START

  ' your code goes here

 VIRTUALIZER_STR_ENCRYPT_END

VIRTUALIZER_END