【问题标题】:Read Inno Setup encryption key from Internet instead of password box从 Internet 读取 Inno Setup 加密密钥而不是密码框
【发布时间】:2021-09-05 16:02:56
【问题描述】:

我希望设置从 HTTP GET 请求中读取密码,而不是直接从用户那里读取密码。有什么方法可以绕过密码框并做到这一点?

【问题讨论】:

    标签: inno-setup


    【解决方案1】:

    使用WinHttpRequest对象读取密钥,将其插入密码框并提交密码页面:

    [Setup]
    Password=123
    Encryption=yes
    
    [Code]
    procedure ExitProcess(uExitCode: Integer);
      external 'ExitProcess@kernel32.dll stdcall';
      
    const
      BN_CLICKED = 0;
      WM_COMMAND = $0111;
      CN_BASE = $BC00;
      CN_COMMAND = CN_BASE + WM_COMMAND;
      
    procedure CurPageChanged(CurPageID: Integer);
    var
      WinHttpReq: Variant;
      Error: string;
      Param: LongInt;
    begin
      if CurPageID = wpPassword then
      begin
        WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
        WinHttpReq.Open('GET', 'https://www.example.com/password.txt', False);
        WinHttpReq.Send('');
        if WinHttpReq.Status <> 200 then
        begin
          Error :=
            'Error checking for decryption key: ' +
            IntToStr(WinHttpReq.Status) + ' ' + WinHttpReq.StatusText;
          MsgBox(Error, mbError, MB_OK);
          ExitProcess(1);
        end
          else
        begin
          WizardForm.PasswordEdit.Text := Trim(WinHttpReq.ResponseText);
          Param := 0 or BN_CLICKED shl 16;
          // post the click notification message to the next button
          PostMessage(WizardForm.NextButton.Handle, CN_COMMAND, Param, 0);
        end;
      end;
    end;
    

    使用以下代码:


    请注意,从安装程序中提取 URL 并找出密码并不难。见Disassembling strings from Inno Setup [Code]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-26
      • 1970-01-01
      • 2019-09-26
      • 2011-01-18
      • 1970-01-01
      • 2016-09-28
      • 1970-01-01
      • 2020-11-28
      相关资源
      最近更新 更多