如何使 Inno Setup 安装程序仅安装在 Windows 的服务器版本上
How to make Inno Setup installers install only on server versions of Windows
在我工作的公司中,我们使用 Inno Setup 来安装我们的软件产品。问题是我们的软件只与 Windows 服务器版本兼容。像 Windows Server 2008 和 Windows Server 2012。
我想做的是显示一条消息并阻止用户安装非服务器版本。例如 Windows 8 和 7。
我进行了搜索,可以使用 Windows 内部版本号检查 Windows 版本。但是 Windows 服务器版本的内部版本号与某些桌面相同。可以在这里查看:http://www.jrsoftware.org/ishelp/index.php?topic=winvernotes
有什么方法可以使用 Inno Setup 制作仅安装在 Windows 服务器版本上的安装程序?
从现在开始,谢谢大家。
您可以测试 GetWindowsVersionEx
function from InitializeSetup
event 返回的 TWindowsVersion.ProductType
。
[Code]
function InitializeSetup(): Boolean;
var
Version: TWindowsVersion;
begin
Result := True;
GetWindowsVersionEx(Version);
Log(Format('Product Type is %d', [Version.ProductType]));
if Version.ProductType = VER_NT_WORKSTATION then
begin
MsgBox('This product can be installed on Windows Server only.', mbError, MB_OK);
{ Abort installer }
Result := False;
end;
end;
我一直在防守和测试 Version.ProductType = VER_NT_WORKSTATION
。也许您想测试 Version.ProductType <> VER_NT_SERVER
或 Version.ProductType <> VER_NT_SERVER and Version.ProductType <> VER_NT_DOMAIN_CONTROLLER
.
有关详细信息,请参阅 OSVERSIONINFOEX
structure 的 wProductType
字段的文档。
另见 What is the simplest way to differentiate between Windows versions?
在我工作的公司中,我们使用 Inno Setup 来安装我们的软件产品。问题是我们的软件只与 Windows 服务器版本兼容。像 Windows Server 2008 和 Windows Server 2012。
我想做的是显示一条消息并阻止用户安装非服务器版本。例如 Windows 8 和 7。
我进行了搜索,可以使用 Windows 内部版本号检查 Windows 版本。但是 Windows 服务器版本的内部版本号与某些桌面相同。可以在这里查看:http://www.jrsoftware.org/ishelp/index.php?topic=winvernotes
有什么方法可以使用 Inno Setup 制作仅安装在 Windows 服务器版本上的安装程序?
从现在开始,谢谢大家。
您可以测试 GetWindowsVersionEx
function from InitializeSetup
event 返回的 TWindowsVersion.ProductType
。
[Code]
function InitializeSetup(): Boolean;
var
Version: TWindowsVersion;
begin
Result := True;
GetWindowsVersionEx(Version);
Log(Format('Product Type is %d', [Version.ProductType]));
if Version.ProductType = VER_NT_WORKSTATION then
begin
MsgBox('This product can be installed on Windows Server only.', mbError, MB_OK);
{ Abort installer }
Result := False;
end;
end;
我一直在防守和测试 Version.ProductType = VER_NT_WORKSTATION
。也许您想测试 Version.ProductType <> VER_NT_SERVER
或 Version.ProductType <> VER_NT_SERVER and Version.ProductType <> VER_NT_DOMAIN_CONTROLLER
.
有关详细信息,请参阅 OSVERSIONINFOEX
structure 的 wProductType
字段的文档。
另见 What is the simplest way to differentiate between Windows versions?