SK_SystemVirtualMachineDetect Function

Detects whether or not the protected application is being run in a virtual machine guest environment.


Reference the SK_VirtualMachineTypes enumeration for a list of hypervisors this function is designed to detect.

Failure to detect a virtual machine guest environment does not guarantee that the application is not running in one. This function simply makes an effort to detect the most common hypervisors while avoiding the possibility of running into false-positives. The guest environments this can detect include:

If calling this function causes a long or indefinite hang in your application, you may need to pass the SK_FLAGS_DISABLE_WMI flag to prevent this function from using WMI queries. While this kind of issue is not very common, it is especially possible to encounter when the protected application is a service that starts automatically, and does not have the Windows Management Instrumentation (WMI) service configured as a dependency.


SK_ResultCode SK_SystemVirtualMachineDetect(SK_ApiContext context, int flags, SK_VirtualMachineTypes *vmDetected);
Visual Basic
Declare Function SK_SystemVirtualMachineDetect(ByVal context As Long, ByVal flags As Long, ByRef vmDetected As Long) As Long


The API Context handle.
Any flags passed into this function-call.
Reference/pointer to an integer, which will point to a SK_VirtualMachineTypes value indicating what (if any) virtual machine guest environment was detected.


All possible return values are included in the SK_ResultCode enumeration. Return codes to expect include:

Result Code Description
SK_ResultCode.SK_ERROR_NONE No error.
SK_ResultCode.SK_ERROR_INVALID_ARGUMENTS Some or all of the arguments are invalid.
SK_ResultCode.SK_ERROR_PLATFORM_ERROR Platform specific API or system call fails.
SK_ResultCode.SK_ERROR_MEMORY_ALLOCATION Memory could not be allocated.
SK_ResultCode.SK_ERROR_LIBRARY_FUNCTION_UNAVAILABLE Required library function is missing.