For the complete documentation index, see llms.txt. This page is also available as Markdown.

Virtualization detection

LicenseSpring SDKs can detect virtualized, containerized, and cloud environments, and enforce a client-side policy that refuses to run when that policy is violated. This lets you tie a license to physical hardware even when raw hardware identifiers would otherwise reflect a VM rather than the host machine.

Migrating from the legacy detector (C++ SDK)

Legacy (deprecated)
Replacement
Notes

ExtendedOptions::enableVMDetection(true)

ExtendedOptions::setVirtualizationPolicy(policy)

Legacy detector needed a separate LicenseSpringVMD.dll on Windows. The new policy uses the cross-platform vm_detection module instead.

ExtendedOptions::isVMDetectionEnabled()

ExtendedOptions::getVirtualizationPolicy()

Policy is enforced once at least one environment class or platform is disallowed, rather than a single on/off flag.

Configuration::isVM()

Configuration::checkVirtualizationPolicy()

New call throws on violation instead of returning a bool.

Configuration::getDetectedVMName()

VirtualizationPolicy::getDisallowedPlatforms() set on the policy, matched by the vm_detection module

No direct 1:1 replacement, detected platform names now feed policy matching rather than a free-form getter.

VMDNotAvailableException

Handled via VirtualizationPolicy::disallowUndetermined() + VirtualEnvironmentNotAllowedException

Missing/failed detection module is now a policy choice, not always an error.

VMIsNotAllowedException

Unchanged — still reflects the server-side "Prevent Virtual Machine" license setting

Distinct from the new client-side VirtualEnvironmentNotAllowedException.

Ship LicenseSpringVMD.dll (Windows only)

Ship vm_detection.dll / libvm_detection.so / libvm_detection.dylib (all platforms)

Platform-specific name, loaded automatically when present alongside the app.

Prerequisites

You should have completed the Getting Started tutorial.

  • Initialized LicenseManager (or LicenseHandler) with the appropriate settings.

  • Created a LicenseID using either LicenseID::fromKey or LicenseID::fromUser, depending on your activation method.

  • Implemented basic license management: activation and license checks.

Detected environment classes

Rather than a single VM name, the SDK classifies environments into VirtualEnvironment classes. A machine can match several at once, for instance a container running inside a cloud instance.

Class
Covers

VirtualMachine

VMware, VirtualBox, QEMU/KVM, Microsoft Hyper-V, Xen Project, Parallels Desktop, Windows Virtual PC, Virtual Iron, bhyve, Project ACRN, QNX Hypervisor, UTM

Container

Docker, LXC, OpenVZ, FreeBSD Jail, Linux containers

CompatibilityLayer

Wine, WSL / WSL2

HostHypervisor

The machine itself exposes a hypervisor interface (can run guests)

CloudInstance

AWS, Microsoft Azure, GCP, and similar

Configuring a policy

Coming soon.

Coming soon.

A default-constructed VirtualizationPolicy disallows nothing. Enforcement only turns on once at least one environment class or platform is disallowed.

Deploying the detection module

Enforcement requires the LicenseSpring VM detection module alongside your application binary, loaded by its platform-specific name:

  • Windows: vm_detection.dll

  • Linux: libvm_detection.so

  • macOS: libvm_detection.dylib

If the module is missing, the machine is treated as undetermined, or rejected if disallowUndetermined(true) is set on the policy.

Enforcing the policy

  • Configuration::checkVirtualizationPolicy() - call explicitly, for example before activation.

  • License::localCheck() - enforced automatically on every local check.

Both throw VirtualEnvironmentNotAllowedException when the machine violates the configured policy.

Coming soon.

Coming soon.

Server-side "Prevent Virtual Machine" setting

Independent of the client-side policy above, a license can prevent activation on virtual machines through the LicenseSpring platform. Enabling Prevent Virtual Machine in the license settings blocks activation attempts within virtualized environments, so the software runs only on approved physical devices.

Coming soon.

Coming soon.

VMIsNotAllowedException is thrown when this platform-side policy is violated, distinct from VirtualEnvironmentNotAllowedException, which reflects the client-side VirtualizationPolicy.

Exceptions reference

Exception
Thrown when

VirtualEnvironmentNotAllowedException

The machine violates the client-side VirtualizationPolicy (checkVirtualizationPolicy() or License::localCheck()).

VMIsNotAllowedException

The server-side license setting is violated.

VMDNotAvailableException (deprecated)

Windows only: DLL not found, tampered with, or detection failed.

Last updated

Was this helpful?