7zip native support

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: 7zip native support

Post by *ghisler(Author) »

Dec means that 7zG doesn't pass the default values as we see them, only what is necessary.
Yes, I understood that, that's why my 7-Zip configuration dialog is slightly different from that in 7zg.exe:
The boxes "Dictionary size" and "Word size" have an extra entry "default", which tells Total Commander to NOT send a value to 7z.dll. The entries marked with * are those which are the default at the time this was written. Choosing one of these values instead of "default" WILL send the value to 7z.dll, because the default of a newer dll may be different.
For the box "Solid block size" I'm currently always passing the chosen value to the dll.

In Total Commander beta 6, I'm now storing the solid block size separately per pack method and pack rate as for the first two items. I'm also supporting the shortened parameter forms for the included 7-Zip dll. Here are all the changed regarding 7-Zip from the log:
12.11.24 Fixed: 7-Zip packer: Handle shortened custom parameters like -mfb273 instead of -mfb=273 for numeric parameters (32/64)
11.11.24 Added: 7-Zip packer (internal and external): When re-packing file to archive after editing, use same pack method as used previously for this file, e.g. LZMA2->LZMA2 (32/64)
11.11.24 Fixed: Pack files: Do not offer to replace characters like the colon ':' with underscores in parameters, e.g. 7z:c:\test\test.7z -m0=LZMA:mf=hc4 (32/64)
11.11.24 Fixed: Internal 7-Zip packer: Do not store subdirectories with a trailing backslash (32/64)
10.11.24 Fixed: 7-Zip packer: Custom parameter -mqs (sort names for solid archive) was not handled (32/64)
08.11.24 Added: 7-Zip packer: Store solid block size separately for each compression method and ratio (32/64)
07.11.24 Fixed: Internal 7-Zip packer: Slightly improved compression at higher ratios (e.g. LZMA, 9) by implementing a missing function (GetSize) in tcbit7z.dll (32/64)
Author of Total Commander
https://www.ghisler.com
lelik007
Member
Member
Posts: 173
Joined: 2021-04-20, 06:37 UTC

Re: 7zip native support

Post by *lelik007 »

2ghisler(Author)
Christian, I think it's for you.
https://sourceforge.net/p/sevenzip/discussion/45797/thread/434fc0435e/
User avatar
MaxX
Power Member
Power Member
Posts: 1166
Joined: 2012-03-23, 18:15 UTC
Location: UA

Re: 7zip native support

Post by *MaxX »

ghisler(Author) wrote: 2024-11-13, 13:51 UTC
Dec means that 7zG doesn't pass the default values as we see them, only what is necessary.
The boxes "Dictionary size" and "Word size" have an extra entry "default", which tells Total Commander to NOT send a value to 7z.dll.
So technically, I can just leave these selectables as default (don't use them at all) and just use command line instead of them?
Are there any limitations or conflicts either?
Ukrainian Total Commander Translator. Feedback and discuss.
lelik007
Member
Member
Posts: 173
Joined: 2021-04-20, 06:37 UTC

Re: 7zip native support

Post by *lelik007 »

2ghisler(Author)
2Dec
I've checked right now:
1. The archives are identical with the same settings, I've changed dictionary, word size and number of the threads.
2. I've put -md=128m and -md128m in "Extra Parameters" and they both worked and match GUI if 128 m dictionary is chosen.
3. -mqs and -mqs=on work, -mqs+ doesn't.
-mqs=on is a classic, I'm still disable the filters -mf=off instead of -mf- just by the habit.
And what is really important for me we got rid of unnecessary m like -mmd=128m
2MaxX
TC acts as 7zG.exe - it prioritizes the "Extra Parameters" field over GUI and for example this is the only way to use the third-party Formats and Codecs. But right now only "Method" and its sub-options work as I understand.
User avatar
MaxX
Power Member
Power Member
Posts: 1166
Joined: 2012-03-23, 18:15 UTC
Location: UA

Re: 7zip native support

Post by *MaxX »

Please, check this report:
viewtopic.php?t=84405
Ukrainian Total Commander Translator. Feedback and discuss.
User avatar
petermad
Power Member
Power Member
Posts: 15997
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: 7zip native support

Post by *petermad »

Testing 7-Zip packing in TC 11.50b6 has so far been giving identical archives when packing internal and external :-) Also when packing dll and exe files and subdirectories
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
lelik007
Member
Member
Posts: 173
Joined: 2021-04-20, 06:37 UTC

Re: 7zip native support

Post by *lelik007 »

2ghisler(Author)
For whatever reason -mx -myx9 myx=9 act as -myx0 myx=0 but for the internal packer only.
Please, check this issue out: viewtopic.php?t=84405
Dec
Member
Member
Posts: 123
Joined: 2006-11-23, 12:48 UTC

Re: 7zip native support

Post by *Dec »

The object that implements the IArchiveUpdateCallback interface does NOT implement the IArchiveUpdateCallbackFile interface.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: 7zip native support

Post by *ghisler(Author) »

2Dec
What is that needed for? I'm using the library bit7z to interface with the 7-Zip library. It doesn't implement this interface, but I'm still getting identical archives as with 7zg.exe now.
Author of Total Commander
https://www.ghisler.com
Dec
Member
Member
Posts: 123
Joined: 2006-11-23, 12:48 UTC

Re: 7zip native support

Post by *Dec »

ghisler(Author) wrote: 2024-11-14, 07:52 UTCWhat is that needed for?
This bug: viewtopic.php?t=84405 (yx=9 does not work as expected)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: 7zip native support

Post by *ghisler(Author) »

I see - it's strange that the 7z.dll doesn't just call GetStream instead of GetStream2 if IArchiveUpdateCallbackFile isn't implemented. Do I need to do different processing depending on the notifyOp parameter? I see that it's implemented in
CPP\7zip\UI\Common\UpdateCallback.cpp
but here mode is only used for the following cases:
- packing from stdin - not relevant for Total Commander-
- preserveATime - why should this be set for analyze?
const bool preserveATime = (PreserveATime
|| mode == NUpdateNotifyOp::kAnalyze); // 22.00 : we don't change access time in Analyze pass.
does the file time matter at all for the analyze pass?
Author of Total Commander
https://www.ghisler.com
Dec
Member
Member
Posts: 123
Joined: 2006-11-23, 12:48 UTC

Re: 7zip native support

Post by *Dec »

I don't know all the details, but it looks like this. When yx=9, 7z.dll requests file data twice. At the first stage, data is requested to determine the file type (whether the file is exe/wav). Determining the file type requires reading data from the file. And reading data from the file changes the file's last access time. At the second stage, data is requested for compression. 7z.dll can save the last access time in the archive if the ta=on key is present. And 7z.dll can request the file's last access time via the IStreamGetProps interface (it is not implemented in your code), and this last access time will already be changed at the first stage. Therefore, when reading data at the first stage, the last access time should not change. This is done by calling SetFileTime(Handle, nil, TFileTime(-1), nil).
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: 7zip native support

Post by *ghisler(Author) »

Ah, I see - I don't think that I need to implement this, because the DLL does actually access the file (even for analyzing), so the last access time should definitely change. For now I have implemented GetStream2 the same way as GetStream to make -myx9 work:
https://www.totalcommander.ch/beta/tcbit7z_getstream2.zip
Author of Total Commander
https://www.ghisler.com
lelik007
Member
Member
Posts: 173
Joined: 2021-04-20, 06:37 UTC

Re: 7zip native support

Post by *lelik007 »

2ghisler(Author)
Christian I read TC's "Help":
It supports both the long form like -mx=9 and the short form -mx9, but not -mx (where the default would be 9). If no parameter is provided, the 7-Zip dll will use the default value for that parameter, e.g. -mx is the same as -mx=9.
Hm, what's bold isn't true, right? -mx works now, also as -mqs and I even unchecked "Header Encryption" but put -mhe (the shortest form) in "Extra Parameters" and it worked - that archive came out with the encrypted headers.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50386
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: 7zip native support

Post by *ghisler(Author) »

Thanks, I forgot to remove that part after adding support for options without parameters.

-mqs+ and -mqs- are currently not supported, I don't know how to pass that to the dll. Maybe as "on" and "off"?
Author of Total Commander
https://www.ghisler.com
Post Reply