Home » Support » User Manual » Working with VMProtect » Preparing a project » SDK functions

SDK functions

SDK functions can be integrated to the source code of the protected application to set boundaries of the protected areas, to detect debuggers or virtualization tools.

Code markers

Service functions

Licensing functions

VMProtectBegin

void VMProtectBegin(const char *MarkerName);

The marker identifying the beginning of the protected area of the code. A call to VMProtectBegin must be placed before the first command (or procedure or function call) of the protected code block. MarkerName defines the name of the marker that looks like “VMProtectMarker”+MarkerNamе in VMProtect. For example, a marker VMProtectBegin(‘CheckRegistration’) will look as VMProtectMarker “CheckRegistration”. If the name of the marker is not set, it is given a unique name in the form of “VMProtectMarker”+marker_serial_number. You can set the compilation type of the given protected block in VMProtect.

VMProtectBeginVirtualization

void VMProtectBeginVirtualization(const char *MarkerName);

The marker identifying the beginning of the protected area of the code with the predefined “virtualization” compilation type. MarkerName defines the name of the marker. The compilation type of this marker cannot be changed during further work with VMProtect.

VMProtectBeginMutation

void VMProtectBeginMutation(const char *MarkerName);

The marker identifying the beginning of the protected area of the code with the predefined “mutation” compilation type. MarkerName defines the name of the marker. The compilation type of this marker cannot be changed during further work with VMProtect.

VMProtectBeginUltra

void VMProtectBeginUltra(const char *MarkerName);

The marker identifying the beginning of the protected area of the code with the predefined “ultra (virtualization+mutation)” compilation type. MarkerName defines the name of the marker. The compilation type of this marker cannot be changed during further work with VMProtect.

VMProtectBeginVirtualizationByKey

void VMProtectBeginVirtualizationLockByKey(const char *MarkerName);

The marker identifying the beginning of the protected area of the code with the predefined “virtualization” compilation type and the enabled “Lock to key” option. MarkerName defines the name of the marker. The compilation type of this marker cannot be changed during further work with VMProtect.

VMProtectBeginUltraLockByKey

void VMProtectBeginUltraLockByKey(const char *MarkerName);

The marker identifying the beginning of the protected area of the code with the predefined “ultra (virtualization+mutation)” compilation type and the enabled “Lock to key” option. MarkerName defines the name of the marker. The compilation type of this marker cannot be changed during further work with VMProtect.

VMProtectEnd

void VMProtectEnd(void);

The marker identifying the end of the protected area of the code. The call to VMProtectEnd must be placed after the last command (procedure or function call) of the protected code block.

VMProtectIsProtected

bool VMProtectIsProtected(void);

The MProtectIsProtected function returns True if the file is processed by VMProtect.

VMProtectIsDebuggerPresent

bool VMProtectIsDebuggerPresent(bool CheckKernelMode);

The VMProtectIsDebuggerPresent function allows to detect the launch of the application under a debugger. The result (True/False) can be processed with in-app protection mechanisms. If CheckKernelMode=False the function checks for User-mode debuggers (OllyDBG, WinDBG etc.). If CheckKernelMode=True, both User-mode and Kernel-mode debuggers (SoftICE, Syser etc.). When protecting drivers, the value of CheckKernelMode does not make sense, because drivers always work in the kernel mode, so presence of kernel-mode debugger is always checked.

VMProtectIsVirtualMachinePresent

bool VMProtectIsVirtualMachinePresent(void);

The VMProtectIsVirtualMachinePresent function allows to detect the launch of the application under a virtual machine tool: VMware, Virtual PC, VirtualBox, Sandboxie. The result (True/False) can be processed with in-app protection mechanisms.

VMProtectIsValidImageCRC

bool VMProtectIsValidImageCRC(void);

The VMProtectIsValidImageCRC function detects the fact that the executable module has been changed in the memory of the process (only unchangeable segments of code and data are checked). The result (True/False) can be processed with in-app protection mechanisms.

VMProtectDecryptStringA

const char * VMProtectDecryptStringA(const char *Value);

The VMProtectDecryptStringA function decrypts the ANSI string constant – Value. To decrypt the constant, you must include it to the list of protected objects .

VMProtectDecryptStringW

const wchar_t * VMProtectDecryptStringW(const wchar_t *Value);

The VMProtectDecryptStringW function decrypts the Unicode string constant – Value. To decrypt the constant, you must include it to the list of protected objects.

VMProtectFreeString

bool VMProtectFreeString(const void *Value);

The VMProtectFreeString function frees dynamic memory allocated for the decrypted string. It is not necessary to free up memory, but if you do this – you must use this function. If VMProtectDecryptStringA/VMProtectDecryptStringW are used with the same parameters for the second time without destroying previously decrypted string, additional memory is not allocated.