windows - InnoSetup - 如何要求用户键入许可证 key 或产品 key 并将该代码与编译常量匹配?

标签 windows security windows-8 installation inno-setup

我必须分发一个使用 innoSetup 制作的 setup.exe,每个用户和每台 PC 都必须获得许可。

我想给他们一个像 Windows 8.1 这样的许可证 key /产品 key ,他们必须在 InnoSetup 中输入。并将其与嵌入式常量匹配或通过互联网直播。验证完成后,setup.exe 将完成,否则将无法安装。

是否有关于 innosetup 的示例,请问我该怎么做?

最佳答案

要创建用于输入序列号的页面,您可以启用 UserInfoPage 指令并为 CheckSerial 事件编写处理程序:

#define SerialNumber "123456"

[Setup]
AppName=My Program
AppVersion=1.5
UserInfoPage=yes
DefaultDirName={pf}\My Program

[Code]
function CheckSerial(Serial: String): Boolean;
begin
  Result := Serial = '{#SerialNumber}';
end;

无效序列号:
enter image description here

有效序列号:
enter image description here

我使用了预处理器定义的常量,因为它可以让您简化构建过程。然后你可以从脚本外部定义这样的常量,使用 extended command line compiler 和 make 例如将使用定义的序列号build设置的批处理脚本。

您只需从上述脚本中删除第一行(硬编码),然后运行如下命令行(对于序列号 654321):

iscc "/dSerialNumber=654321" "C:\Script.iss"

当然,实际上您需要注意输出设置文件及其序列号的管理,但您选择的系统由您决定。 Command line compiler 允许您指定输出路径和文件名,这足以构建这样的系统。

关于windows - InnoSetup - 如何要求用户键入许可证 key 或产品 key 并将该代码与编译常量匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25683329/

相关文章:

sockets - Web套接字: Is it bad to always use SSL when making an online game?

security - GLassfish SSL 配置页面级别

windows - 创建开发人员许可证后,我可以更改用于 Visual Studio 的 Microsoft 帐户吗?

xaml - 如何在 XAML、Windows 8 的 super 按钮栏中设置设置属性?

c# - 有没有办法防止 png/jpg 图像被转换为​​位图图像

windows - “npm-windows-upgrade”未被识别为内部或外部命令

c# - Windows 8 Metro TextBlock 动画

security - 跨域收藏夹图标是否存在安全风险?

Python:无法在 Windows 中连续捕获键盘中断?

windows - emacs:标准输入不是 tty