[Code]
 function FileExist(): Boolean;
  begin
    if (FileExists(ExpandConstant('{src}')+ '\custom')) then
      begin
        Result := True;
    end
    else
      begin
        Result := False;
      end;
  end;

function GetRunParam(PName:String):Boolean;
var
  CmdLine : String;
  CmdLineLen : Integer;
  i : Integer;
begin
    Result := true;
    CmdLineLen:=ParamCount();
    for i:=0 to CmdLineLen do
    begin
    CmdLine:=ParamStr(i);
    if CmdLine= PName then
      begin
          CmdLine:=ParamStr(i+1);
          Result := false;
          Exit;
      end;
    end;
end;

function GetWebParam(PName:String):Boolean;
var
  CmdLine : String;
  CmdLineLen : Integer;
  i : Integer;
begin
    Result := false;
    CmdLineLen:=ParamCount();
    for i:=0 to CmdLineLen do
    begin
    CmdLine:=ParamStr(i);
    if CmdLine= PName then
      begin
          CmdLine:=ParamStr(i+1);
          Result := true;
          Exit;
      end;
    end;
end;

function getpath(Default: string ): string;
begin
  if(GetWebParam('/SUPPRESSMSGBOXES')) then
        Result := ExpandConstant('{src}')
  else
        Result := ExpandConstant('{param:path|{pf}}') + '\Passper\Passper for RAR'
end;

function IsAppRunning(const FileName: string): Boolean;
var
  FWMIService: Variant;
  FSWbemLocator: Variant;
  FWbemObjectSet: Variant;
begin
  Result := false;
  FSWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator');
  FWMIService := FSWbemLocator.ConnectServer('', 'root\CIMV2', '', '');
  FWbemObjectSet := FWMIService.ExecQuery(Format('SELECT Name FROM Win32_Process Where Name="%s"',[FileName]));
  Result := (FWbemObjectSet.Count > 0);
  FWbemObjectSet := Unassigned;
  FWMIService := Unassigned;
  FSWbemLocator := Unassigned;
end;

function InitializeSetup(): Boolean;
begin
 Result := IsAppRunning('Passper for RAR.exe');
  if Result then
  begin
      MsgBox('The programe is running. Please close the programe before install. ', mbError, MB_OK);
      Result :=false
  end
  else
      Result :=true
end;

function InitializeUninstall(): Boolean;
begin
 Result := IsAppRunning('Passper for RAR.exe');
  if Result then
  begin
      MsgBox('The programe is running. Please close the programe before uninstall. ', mbError, MB_OK);
       Result :=false
  end
  else
    Result :=true
end;