【问题标题】:Allow running Inno Setup installer only once只允许运行一次 Inno Setup 安装程序
【发布时间】:2021-09-15 00:42:09
【问题描述】:

我想将我的软件的一些免费副本提供给某些用户,但我想防止 Inno Setup 安装程序也在其他计算机上运行。所以我希望安装程序在一台计算机上只运行一次,然后再也不运行。

【问题讨论】:

    标签: inno-setup


    【解决方案1】:

    提供在线服务,安装人员将检查以确定是否允许安装。该服务应计算安装并做出相应的响应。

    function InitializeSetup(): Boolean;
    var
      WinHttpReq: Variant;
    begin
      Result := False;
    
      Log('Checking installation online...');
      try
        WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
        WinHttpReq.Open('GET', 'https://www.example.com/install_check.php', false);
        WinHttpReq.Send();
        if WinHttpReq.Status = 200 then
        begin
          Log('Installation was allowed...');
          Result := True;
        end
          else
        begin
          Log(Format('Installation was not allowed with %d: %s...', [
            WinHttpReq.Status, WinHttpReq.StatusText]));
          MsgBox('Installation is not allowed.', mbError, MB_OK);      
        end;
      except
        Log(Format('Installation check failed: %s', [GetExceptionMessage]));
        MsgBox('Error checking if the installation is allowed.', mbError, MB_OK);      
      end;
    end;
    

    一个简单的服务器端验证 PHP 脚本 (install_check.php) 如下:

    <?
    
    $flag_file = "/data/install_check";
    if (file_exists($flag_file))
    {
        $msg = "This installer was already installed";
        header("HTTP/1.0 401 $msg");
        echo $msg;
    }
    else
    {
        echo "Can install";
        touch($flag_file);
    }
    

    相关问题:
    Inno Setup - How to validate serial number online


    尽管从 Inno Setup 安装程序中提取文件很容易。您可以通过加密安装并从在线服务中检索解密密码来改善这一点。

    通过不返回密码,您将有效地阻止安装。

    Read Inno Setup encryption key from Internet instead of password box

    【讨论】:

    • 我们快到了。现在我有一个 php 脚本、inno 设置脚本和一个 woocommerce 许可证添加。相当努力
    猜你喜欢
    • 2010-11-06
    • 1970-01-01
    • 2019-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多