从Internet读取Inno Setup加密密钥,而不是密码框 [英] Read Inno Setup encryption key from Internet instead of password box

查看:15
本文介绍了从Internet读取Inno Setup加密密钥,而不是密码框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望安装程序从HTTPGET请求读取密码,而不是直接从用户读取密码。是否有方法绕过密码框并执行此操作?

推荐答案

使用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]

这篇关于从Internet读取Inno Setup加密密钥,而不是密码框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆