You are not logged in.
Firstly, the 7z.dll wrapper is excellent (and fast!) and has made a huge difference to my Delphi project. I'm using it against version 24.8 of 7z.dll
Thank you so much for making this work available.
There is one issue, but I'm also bringing a solution.
Fully encrypted RAR5 archives (where the filenames are also encrypted) require a password up-front just to open the archive, regardless of what you then want to do with the contents of the archive.
As a result, New7zReader in mormot.lib.win7zip.pas will fail to open such an archive.
I have therefore amended (cough, hacked) New7zReader as follows to add an optional password:
function New7zReader(const name: TFileName; fmt: T7zFormatHandler = fhUndefined; const lib: TFileName = ''; const pw: string = ''): I7zReader;
begin
if fmt = fhUndefined then
fmt := T7zLib.FormatDetect(name);
result := T7zReader.Create(T7zLib.Create(lib), fmt, {libowned=}true);
result.setPassword(pw);
result.OpenFile(name);
end;
Including the password at this stage allows fully encrypted RAR5 files to be opened. The password parameter is optional because other archive types, even other RAR5 archive types, do not require the password at this early stage.
If you want to use an instance of T7zLib to create the I7zReader interface, the same amendment must be made to the NewReader function.
Finally, the format handler auto-detection for the current RAR5 format in T7zLib.FormatDetect is the wrong way around [for me]. It should be:
if h.c[1] = $0001071a then
result := fhRar5
else
result := fhRar;
All three types of RAR5 archives created with WinRAR v7.10 have the $0001071a signature: no encryption; encrypted contents but unencrypted file names; encrypted contents and encrypted file names.
Setting the format handler to fhRar (rather than fhRar5) will fail to open them.
I don't have an earlier version of WinRAR so I'm not able to test this against earlier versions of the RAR format, and WinRAR no longer allows you to create RAR4-compatible archives, so results may vary.
I hope this info may be of help to anyone else using such archives.
Baz.
Offline
I have merged https://github.com/synopse/mORMot2/pull/345
and made some minor fixes
as https://github.com/synopse/mORMot2/commit/a88f57456
Thanks for the feedback!
Offline
The pleasure is all mine
Offline