我做的一个升级程序先用ftp下载,当21端口被封时改成http下载
其中http线程下载时出现问题
procedure THttpThread.execute;
var
 newVersion2,exe,temp:string;
 close:Boolean;
 Filenames:TStrings;
 i:integer;
 ini:TiniFile;
begin
  inherited;
  connected:=false;
  failed:=false;
  alive:=1;
  form1.idHTTP1.Host:='www.medlink.com.cn';
  form1.Gauge1.Visible:=false;
  form1.Label3.Caption:='连接耗时'+intTostr(form1.tick)+'秒';
 try
   form1.idhttp1.Connect(delay);
 except
   on E: Exception do
     begin
      err:=e.Message;
      failed:=true;
      exit;
     end;
 end;
  form1.Memo1.Lines.Add('连接上服务器');
  connected:=true;
  form1.BitBtn2.Enabled:=true;
  form1.BitBtn2.Caption:='停止';
  form1.BitBtn3.Enabled:=false;
  form1.Gauge1.Visible:=true;
  form1.Label3.Visible:=false;
  self.failed:=false;
  try
    filenames:=TStringList.create;
×××××××××××××××××××××××××××××××××××××××××××
    newversion2:=form1.GetNewVersion2(filenames,exe,close);      //返回下载文件名
    if form1.DownloadFile2(filenames) then
      begin
        showmessage(newversion2);
×××××××××××××××××××××××××××××××××××××××××××
        if not DirectoryExists(extractfilepath(paramstr(0))+'\update') then
           mkdir(extractfilepath(paramstr(0))+'\update');
        if not DirectoryExists(extractfilepath(paramstr(0))+'\backup') then
           mkdir(extractfilepath(paramstr(0))+'\backup');
        for i:=0 to filenames.Count-1 do
          begin
            copyfileto(extractfilepath(paramstr(0))+filenames[i],extractfilepath(paramstr(0))+'backup\'+filenames[i]);
            DeleteFile(extractfilepath(paramstr(0))+filenames[i]);
            copyfileto(extractfilepath(paramstr(0))+'update\'+filenames[i],extractfilepath(paramstr(0))+filenames[i]);
          end;
        form1.finished:=true;
        if not form1.aborted then
         begin
          ini:=Tinifile.Create(extractfilepath(paramstr(0))+'\sysconf.ini');
          temp:=Encrypt(newVersion2);
          ini.WriteString('VERSION','VALUE',temp);
          Application.MessageBox('升级成功!','智能升级0.2',mb_ok+MB_ICONINFORMATION);
          postMessage(Application.Handle,SX_CLOSE,0,0);
          end;
      end
    else
      failed:=true;
  except
    failed:=true;
  end;
end;
这段是读ini  文件的函数
function TForm1.GetNewVersion2(var fnames: TStrings; var exefile: string;
  var close: Boolean): string;
var
  ini:TiniFile;
  temp,temp1:string;
  i,j:integer;
  temp2:TFileStream;
begin
  Result:='';
  fnames.Clear;
  temp:=GetCurrentDir+'\version.ini';
  temp2:=TFileStream.Create(temp,fmCreate);
  form1.IdHTTP1.Get('http://www.medlink.com.cn/update/version.ini',temp2);
  ini:=TiniFile.Create(temp);
  result:=ini.ReadString('VERSION','VALUE','');
  temp:=ini.ReadString('VERSION','FILENAME','');
  exefile:=ini.ReadString('VERSION','EXECUTE','');
  if ini.ReadString('VERSION','APPCLOSE','-1')='1' then
    close:=true
  else
    close:=false;
  ini.Free;
  temp1:='';
  j:=0;
  for i:=1 to length(temp) do
    begin
      if temp[i]<>';' then
         temp1:=temp1+temp[i]
      else
        begin
         fnames.Insert(j,temp1);
         temp1:='';
         j:=j+1;
        end;
    end;
   DeleteFile(extractfilepath(paramstr(0))+'update\version.ini');
end;
同样的代码在ftp线程可以返回文件名和参数
但是在http线程代码执行后ini文件下载成功但是返回的参数和文件名为空