Page 7 of 13
Re: 7zip native support
Posted: 2024-11-13, 13:51 UTC
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)
Re: 7zip native support
Posted: 2024-11-13, 14:51 UTC
by lelik007
Re: 7zip native support
Posted: 2024-11-13, 15:12 UTC
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?
Re: 7zip native support
Posted: 2024-11-13, 16:43 UTC
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.
Re: 7zip native support
Posted: 2024-11-13, 17:49 UTC
by MaxX
Please, check this report:
viewtopic.php?t=84405
Re: 7zip native support
Posted: 2024-11-13, 19:07 UTC
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
Re: 7zip native support
Posted: 2024-11-13, 19:44 UTC
by lelik007
2
ghisler(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
Re: 7zip native support
Posted: 2024-11-14, 03:39 UTC
by Dec
The object that implements the IArchiveUpdateCallback interface does NOT implement the IArchiveUpdateCallbackFile interface.
Re: 7zip native support
Posted: 2024-11-14, 07:52 UTC
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.
Re: 7zip native support
Posted: 2024-11-14, 08:08 UTC
by Dec
This bug:
viewtopic.php?t=84405 (yx=9 does not work as expected)
Re: 7zip native support
Posted: 2024-11-14, 10:26 UTC
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?
Re: 7zip native support
Posted: 2024-11-14, 11:09 UTC
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).
Re: 7zip native support
Posted: 2024-11-14, 11:18 UTC
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
Re: 7zip native support
Posted: 2024-11-18, 03:56 UTC
by lelik007
2
ghisler(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.
Re: 7zip native support
Posted: 2024-11-18, 10:33 UTC
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"?