delphi - 如何阻止我的应用程序在 Virtualbox 上运行?

标签 delphi delphi-10.2-tokyo

我已经尝试过this unit检测我的应用程序是否在 Oracle VirtualBox 中运行,但它没有检测 VirtualBox。

我已经在 VirtualBox 中安装了 Windows 7 进行了测试。

有什么有效的方法可以阻止我的 VCL 应用程序在 VirtualBox 中运行吗?

最佳答案

您可以使用Win32_BaseBoard WMI 类并检查 Product 字符串是否包含单词“Virtual

例如:

function _IsOSVirtual(): Boolean;
const
  v = 'virtual';
Begin
  Result := False;
  CoInitialize(nil);
  try
     if Pos(v, LowerCase(GetWin32_BaseBoard('Product'))) > 0 then
      Result := True;
  finally
    CoUninitialize;
  end;
end;

关于delphi - 如何阻止我的应用程序在 Virtualbox 上运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43817157/

相关文章:

delphi - 如何在 Delphi 中使用 RTTI 或 TypeInfo 获取枚举的有效范围

Delphi:右括号可选?

delphi - 为什么try... except end; 没有捕获异常?

Delphi编译器IntToStr()和Integer.ToString()之间的区别?

Delphi 将项目添加到 cxgrid 上的 cxcombobox,而不使用列的 oninitpopup 事件

delphi - 如何临时加载字体?

arrays - 不兼容类型 : 'Dynamic array' and 'array of string' in Delphi

使用 Windows 成像组件 (WIC) 的 Delphi 2007

delphi - 在应用程序启动时覆盖区域设置

delphi - 如何在其他组件后面显示视频?