Official support for 7z

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

vudu
Junior Member
Junior Member
Posts: 27
Joined: 2011-12-04, 19:52 UTC

Official support for 7z

Post by *vudu »

Hello,

Is in plan to add the official support for 7zip handling (at least unpacking) into the next version of Total Commander, instead of relying on an external plugin? As far as I know, 7z DLL is available for redistribution (GNU LGPL + unRAR restriction) so it would be nice to have 7zip support right "out of the box".
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50861
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I have indeed considered it, but unfortunately the DLL is huge because it supports also many other formats, and also supports packing...
Author of Total Commander
https://www.ghisler.com
Hurdet
Power Member
Power Member
Posts: 716
Joined: 2003-05-10, 18:02 UTC

Post by *Hurdet »

This can to be useful?
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

ghisler(Author),
You may not include it into standard package but notify users that it may be taken from 7-Zip.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50861
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2Hurdet
Thanks, that looks quite good, the dll would be 350MB zipped. But the port is from 2010, I wonder whether it can still handle current 7zip archives...

2MVV
I don't see the advantage compared to the existing plugins. But including an unpack-only dll would help the "normal" users, though, who would get a 7zip download and don't know what to do with it. Advanced users could still install one of the 7zip plugins.
Author of Total Commander
https://www.ghisler.com
umbra
Power Member
Power Member
Posts: 876
Joined: 2012-01-14, 20:41 UTC

Post by *umbra »

2ghisler(Author)
The advantage is that it can replace a lot of unmaintained plugins. In my case Total7zip replaced more than half a dozen other plugins for windows/linux archives, disk images and installers.

The ability to extract almost any common archive and pack to a few important ones is all I need. And while I like the plugin, I would still prefer an official support directly in TC. And who knows, maybe there would be some space for a few optimizations.
Windows 10 Pro x64, Windows 11 Pro x64
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

From 7z920_extra.7z:
7zxa.dll - library for extracting from 7z archives.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50861
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Wow, even better - only 170k!
Author of Total Commander
https://www.ghisler.com
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

Just make it interchangable with the full-fledged dll and I guess most people would be satisfied, provided that the dll calls are compatible (no idea).
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50861
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

OK, I have added support for internal 7zip unpacking now. It was quite a challenge because the 7zip dll uses OLE interfaces with multiple inherintance, which isn't supported at all by Delphi 2. So I had to write an in-between C++ dll which exports normal functions and calls the complex 7zip interfaces...
The advantage is that it can replace a lot of unmaintained plugins. In my case Total7zip replaced more than half a dozen other plugins for windows/linux archives, disk images and installers.
Where can I find out what formats are supported by the larger 7zip dll?
Author of Total Commander
https://www.ghisler.com
umbra
Power Member
Power Member
Posts: 876
Joined: 2012-01-14, 20:41 UTC

Post by *umbra »

7z's homepage wrote:Supported formats:
Packing / unpacking: 7z, XZ, BZIP2, GZIP, TAR, ZIP and WIM
Unpacking only: ARJ, CAB, CHM, CPIO, CramFS, DEB, DMG, FAT, HFS, ISO, LZH, LZMA, MBR, MSI, NSIS, NTFS, RAR, RPM, SquashFS, UDF, VHD, WIM, XAR and Z.
And a few others based on these.
Also, here is a source code for all 7z utils/libraries: http://sourceforge.net/projects/sevenzip/files/7-Zip/9.22/7z922.tar.bz2/download. It's not the newest one, but you might find an example in there of how to use the library.
Windows 10 Pro x64, Windows 11 Pro x64
vudu
Junior Member
Junior Member
Posts: 27
Joined: 2011-12-04, 19:52 UTC

Post by *vudu »

ghisler(Author) wrote:OK, I have added support for internal 7zip unpacking now.
Great, thanks!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50861
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks for the list! I already have the source code.

Btw, any 7zip experts here? I have tried to build the dll with VC6 and the Windows SDK as described in the readme, and the compiler goes through with no errors. However, the dll is only about 150k and does not even support the 7z native format. The precompiled dll works fine, though.
Author of Total Commander
https://www.ghisler.com
umbra
Power Member
Power Member
Posts: 876
Joined: 2012-01-14, 20:41 UTC

Post by *umbra »

I'm definitely not an expert, but I managed to compile it successfully. I'm using VS2012, but the procedure should be the same for older versions.
  1. Download and install VC6 or newer and Windows SDK for WinXP SP2 or newer.
  2. Download and extract 7z sources.
  3. Edit file "<7z_sources_root>\CPP\7zip\Bundles\Format7zF\Format7z.dsp" and on lines 56 and 83

    Code: Select all

    56: # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\7z.dll" /opt:NOWIN98
    
    83: # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\7z.dll" /pdbtype:sept
    change parameter "/out:" to anything you like.
  4. If you are using Visual Studio 2010 or newer, remove "/opt:NOWIN98" form all *.dsp or *.mak files. It's not supported anymore. It's only supposed to make the resulting binary a bit smaller - but slower too.
  5. Open a command prompt and use it for the following steps.
  6. Load Visual Studio environment variables by calling "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\vsvars32.bat" (use a proper path).
  7. Switch to 7z sources directory and specifically to "<7z_sources_root>\CPP\7zip\Bundles\Format7zF\".
  8. Run "nmake".
This way you can compile the big library supporting all formats (32-bit, roughly 900 KiB). For other libraries or tools, it should be similar.

I tried to load the projects to Visual Studio IDE, but I encountered several errors during the automatic conversion of project files and later during compilation. That's the reason, why I provided these command-line instructions.
Windows 10 Pro x64, Windows 11 Pro x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50861
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes I read that too that I would have to use command line make. But this doesn't solve my problem: I would like to step through the dll in the debugger, but this is only possible when compiling it within the IDE. :(

There is a project file
7zip\CPP\7zip\Archive\7z\7z.dsw

especially for VCC 6.0, and it loads without errors. But the compiled code is too small and cannot unpack anything. I tried to use your linker options in the IDE, but it didn't help.
Author of Total Commander
https://www.ghisler.com
Post Reply