错误“无效的 ZStream 操作”Delphi 11.0

Error ' Invalid ZStream operation ' Delphi 11.0

我最近迁移到 Delphi 11.0 这行 'Zip.CopyFrom(Source, 0);生成'错误'Invalid ZStream operation'

uses system.ZLib;
...

    const
      ZLIB_GZIP_WINDOWBITS    = 31;
      ZLIB_DEFLATE_WINDOWBITS = 15;
    
    type
      TZLibCompressionLevel = TZCompressionLevel;

procedure ZLibCompressStream(Source, Dest: TStream; const Level: TZLibCompressionLevel;
        const GZipFormat: Boolean);
    var
      WindowBits: Integer;
      Zip: TZCompressionStream;
    begin
      if GZipFormat then
        WindowBits := ZLIB_GZIP_WINDOWBITS
      else
        WindowBits := ZLIB_DEFLATE_WINDOWBITS;
    
      Zip := TZCompressionStream.Create(Dest, Level, WindowBits);
      try
        Zip.CopyFrom(Source, 0);
      finally
        FreeAndNil(Zip);
      end;
    end;
    
    procedure TForm85.Button1Click(Sender: TObject);
    var s1,s2:TMemoryStream;
    begin
     s1:=TMemoryStream.Create;
     s1.LoadFromFile('h:.txt') ;
     s2:=TMemoryStream.Create;
     ZLibCompressStream(s1,s2,zcDefault,true);
    
    end;

在 Delphi 10 和之前没有错误发生

它似乎已在 11.1 中修复