当前位置 : 主页 > 编程语言 > delphi >

inno setup可执行文件被视为病毒

来源:互联网 收集:自由互联 发布时间:2021-06-23
早上好, 我用Innosetup创建的exe被视为病毒! 它真的很烦人,因为我无法发送它们来帮助我的用户. 谁有人遇到过这个问题? 我使用InnoSetup 5.5,我实际上并没有复制文件,我只需生成一些命令
早上好,

我用Innosetup创建的exe被视为病毒!

它真的很烦人,因为我无法发送它们来帮助我的用户.
谁有人遇到过这个问题?

我使用InnoSetup 5.5,我实际上并没有复制文件,我只需生成一些命令来处理证书.

提前致谢

[编辑]

Inno剧本

所以它有点复杂,因为我需要使用psexec使管理员权限,删除以前的证书,然后安装新的

#define MyAppName "Update Certificate"
#define MyAppVersion "1.0" 
#define MyAppPublisher "kkk"
#define MyAppExeName "updateBase"
#define installConf "installConfig.exe"  
#define uninstallCert "unCert.exe"
#define psexec "psexec.exe"
#define passAdmin "password"


[Setup]

AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={localappdata}
DisableDirPage=yes
DisableReadyPage=yes
DisableWelcomePage=yes
PrivilegesRequired=none
CreateAppDir=no   
CreateUninstallRegKey = no    
OutputBaseFilename={#MyAppExeName}
Compression=lzma
SolidCompression=yes     
SetupIconFile=favicon.ico

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "{#installConf}"; Flags: dontcopy
Source: "{#psexec}";  Flags: dontcopy
Source: "{#uninstallCert}"; Flags: dontcopy

[Code]
var
  ResultCode: Integer;
  Page: TWizardPage;
  CustomPageID: Integer;
  InstallRadioButton: TNewRadioButton;
  DeleteRadioButton: TNewRadioButton;   
  UpdateRadioButton: TNewRadioButton;

procedure ExitProcess(exitCode:integer);
  external 'ExitProcess@kernel32.dll stdcall';

unCert.exe正在取消证书以删除它们

// Uninstall previous certificate 
function UninstallCertificat(): Boolean;var 
  arg: String;
begin   
      ExtractTemporaryFile('{#uninstallCert}');  
      ExtractTemporaryFile('{#psexec}');      
     arg :=  ' /accepteula -u Administrateur -p {#passAdmin} -i ' + AddQuotes(ExpandConstant('{tmp}\{#uninstallCert}')) ; 
     Result := Exec(AddQuotes(ExpandConstant('{tmp}\{#psexec}')),arg,'', SW_SHOW, ewWaitUntilTerminated, ResultCode);
     Log(AddQuotes(ExpandConstant('{tmp}\{#psexec}'))); 
     Log(AddQuotes(ExpandConstant('{tmp}\{#uninstallCert}')));
      if ResultCode <> 0 then begin
        MsgBox('InitializeSetup:' #13#13 'Certificat Uninstall Failed', mbError, MB_OK);
        ExitProcess(2);
      end else  begin;
          MsgBox('InitializeSetup:' #13#13 'Certificat Uninstall Done', mbInformation, MB_OK);
      end;
 end;          

 // Géneration des Mots de passe pour le certificats
function getPassWord(): string;
var
  computerName: string;
  V: string;
begin
  // Something to generate the password
end;



// Certificate installation 
function InstallCertificat(): Boolean;var 
  arg: String;
  Filename: string;
  pass: string;
begin
  pass := getPassWord();;                
  ExtractTemporaryFile('{#psexec}');      

  Filename := ExpandConstant('{tmp}\cert.p12');
  FileCopy(ExpandConstant('{src}\cert.p12'),ExpandConstant('{tmp}\cert.p12'), False);
     arg :=  ' /accepteula -u Administrateur -p {#passAdmin} -i ' + GetSystemDir() +'\certutil.exe -p ' + pass + ' -importPFX ' + Filename + ' NoExport'; 
     Result := Exec(AddQuotes(ExpandConstant('{tmp}\{#psexec}')),arg,'', SW_SHOW, ewWaitUntilTerminated, ResultCode);
      if ResultCode <> 0 then begin
        Log( SysErrorMessage(ResultCode));
        MsgBox('InitializeSetup:' #13#13 'Certificat Installation Failed', mbError, MB_OK);
        ExitProcess(2);
      end else  begin;
          MsgBox('InitializeSetup:' #13#13 'Certificat Installation Done' , mbInformation, MB_OK);
      end;
 end;
尝试注释掉“SetupIconFile”行.在我的情况下,防病毒的问题在于.ico文件.
网友评论