ソースを参照

Archive extraction now supports the RAR5 format. No upate to is7z.dll required bceause it already supported RAR5.

Martijn Laan 5 ヶ月 前
コミット
176a10d031
2 ファイル変更8 行追加3 行削除
  1. 7 3
      Projects/Src/Compression.SevenZipDLLDecoder.pas
  2. 1 0
      whatsnew.htm

+ 7 - 3
Projects/Src/Compression.SevenZipDLLDecoder.pas

@@ -1012,11 +1012,15 @@ begin
     on E: EFileError do
       SevenZipWin32Error('CreateFile', E.ErrorCode);
   end;
-  const InStream: IInStream = TInStream.Create(F);
+  const InStream: IInStream = TInStream.Create(F); { InStream now owns F }
   var ScanSize := DefaultScanSize;
   const OpenCallback: IArchiveOpenCallback = TArchiveOpenFileCallback.Create(DisableFsRedir, ArchiveFileName, Password);
-  if Result.Open(InStream, @ScanSize, OpenCallback) <> S_OK then
-    SevenZipError(SetupMessages[msgArchiveIsCorrupted], 'Cannot open file as archive' { Just like Client7z.cpp });
+  if Result.Open(InStream, @ScanSize, OpenCallback) <> S_OK then begin
+    if clsid = CLSID_HandlerRar then { Try RAR5 instead of RAR4 }
+      Exit(OpenArchiveRedir(DisableFsRedir, ArchiveFilename, Password, CLSID_HandlerRar5, numItems))
+    else
+      SevenZipError(SetupMessages[msgArchiveIsCorrupted], 'Cannot open file as archive' { Just like Client7z.cpp });
+  end;
   if Result.GetNumberOfItems(numItems) <> S_OK then
     SevenZipError(SetupMessages[msgArchiveIsCorrupted], 'Cannot get number of items');
 

+ 1 - 0
whatsnew.htm

@@ -49,6 +49,7 @@ For conditions of distribution and use, see <a href="files/is/license.txt">LICEN
 <li>With disk spanning enabled, the maximum disk slice size has been increased from almost 2 GB to effectively unlimited (9223 PB).<br/>
     The default disk slice size is still <tt>2100000000</tt>, which is almost 2 GB. To update, you can simply set <tt>[Setup]</tt> section directive <tt>DiskSliceSize</tt> to <tt>max</tt>.</li>
 <li>All download functionality now supports TLS 1.3 when available. Support for TLS 1.0 and 1.1 has been removed on all versions of Windows.</li>
+<li>Archive extraction now supports the RAR5 format.</li>
 <li>Improved support for stretching 32-bit bitmaps with transparency.</li>
 <li>Compiler IDE: Added new <i>Automatically reload files</i> and <i>Allow Undo after reload</i> options. Both are enabled by default, consistent with most other modern editors, and improving integration with tools like Claude Code.</li>
 <li>Pascal Scripting: Added new <tt>LogFmt</tt> support function.</li>