Author Topic: SFX archives support  (Read 19411 times)

espkk

  • Junior Member
  • **
  • Posts: 40
    • View Profile
SFX archives support
« on: June 28, 2017, 15:54:19 »
Hello, Mathias
Is it possible to make SFX archives support? 7zfm deals with such files. I guess this requires just to check file for MZ sig and if overlay exists, check it as normal archive

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4386
    • View Profile
    • Multi Commander
Re: SFX archives support
« Reply #1 on: June 28, 2017, 22:24:08 »
Problem is that all EXE file have MZ as first bytes.

And you can't just open it as a any 7z file. it require a lot of special handling.

espkk

  • Junior Member
  • **
  • Posts: 40
    • View Profile
Re: SFX archives support
« Reply #2 on: June 29, 2017, 18:02:55 »
I mean FS plugins can do this check if the file has appropriate archive ext
For example: FS-7zip can't open 7z file if it's SFX, but checking it for SFX is just a few lines of code(and ms of time)
Same with File>Unpack files...
So no need to check every .exe file

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4386
    • View Profile
    • Multi Commander
Re: SFX archives support
« Reply #3 on: June 29, 2017, 18:06:11 »
Since the file is named .exe the extension will not even handle that file.
So it is so easy

espkk

  • Junior Member
  • **
  • Posts: 40
    • View Profile
Re: SFX archives support
« Reply #4 on: June 29, 2017, 18:12:47 »
I quite often see the files packed as SFX with 7z extension
This is because most of archivers read them, but if there is no suitable archiver, you can rename 7z to exe and unpack it as SFX
Also if the file is SFX with .exe extension, it would be handy to alt+f6 them, instead of running SFX(out of harm's way)

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4386
    • View Profile
    • Multi Commander
Re: SFX archives support
« Reply #5 on: June 29, 2017, 18:17:13 »
But if they have the extension .7z they are not SFX .. SFX are self extracting so they are exe that will unpack them self.

espkk

  • Junior Member
  • **
  • Posts: 40
    • View Profile
Re: SFX archives support
« Reply #6 on: June 29, 2017, 18:30:28 »
Generally, SFX is a concatenation of a program to unpack it's overlay(what is right after PE in the same file) and the archive itself
So, the offset of an archive is always known from the outside. Many archivers open SFX like usual archives by skipping PE program. It's useful because you can use your archiver to unpack this file, but if you don't have proper one, you can just rename it to exe...

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4386
    • View Profile
    • Multi Commander
Re: SFX archives support
« Reply #7 on: June 29, 2017, 18:36:23 »
Yes I know. But if the files is called .exe the extension will not open it, and if it is a .7z but is marked as a exe then the extension will not recognize it.
I use the free 7zip lib. it only open 7z files.


Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4386
    • View Profile
    • Multi Commander
Re: SFX archives support
« Reply #8 on: June 29, 2017, 18:57:25 »
And I do not have the time to develop my own 7z parser. :)
But if you have code for it... then send me it and I can see if it can be used

espkk

  • Junior Member
  • **
  • Posts: 40
    • View Profile
Re: SFX archives support
« Reply #9 on: June 29, 2017, 19:02:53 »
I thought lib decompresses buffer, not the entire file... Ok, then it's probably not a good idea, especially if you don't have the time for it
BTW, stock 7z console(which is also opensource) supports such files:
Quote
7-Zip [64] 16.04 : Copyright (c) 1999-2016 Igor Pavlov : 2016-10-04

Scanning the drive for archives:
1 file, 1685398 bytes (1646 KiB)

Listing archive: t.7z

--
Path = t.7z
Warning: The archive is open with offset
Type = 7z
Offset = 162816
Physical Size = 1522582
Headers Size = 106
Method = LZMA2:1536k
Solid = -
Blocks = 1

P.S. Is there a way to call FS plugin manually? I mean to force them to read a file using scripts or API?

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4386
    • View Profile
    • Multi Commander
Re: SFX archives support
« Reply #10 on: June 29, 2017, 19:16:22 »
Quote
7-Zip [64] 16.04 : Copyright (c) 1999-2016 Igor Pavlov : 2016-10-04

Scanning the drive for archives:
1 file, 1685398 bytes (1646 KiB)

Listing archive: t.7z

--
Path = t.7z
Warning: The archive is open with offset
Type = 7z
Offset = 162816
Physical Size = 1522582
Headers Size = 106
Method = LZMA2:1536k
Solid = -
Blocks = 1
Their console app contains everything, their api lib for 7z do not.
And if you ever looked at the API for 7z, You run away screaming. It is so messy

P.S. Is there a way to call FS plugin manually? I mean to force them to read a file using scripts or API?
Not in a way that would solve this. since the 7z lib used do not support sfx.
I think you need to write/use a tool that strip away the sfx part
« Last Edit: June 29, 2017, 19:19:22 by Mathias (Author) »

espkk

  • Junior Member
  • **
  • Posts: 40
    • View Profile
Re: SFX archives support
« Reply #11 on: June 29, 2017, 20:29:15 »
Thanks, but I've meant can I open normal archive(not SFX) file as folder(thro' FS plugin) from script and from C++ API?

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4386
    • View Profile
    • Multi Commander
Re: SFX archives support
« Reply #12 on: June 29, 2017, 22:09:05 »
Yes if you set a browse path that ends in a backslash it will browse into that path
eg   C:\MyFolder\MyArchive.zip     then it will got to C:\MyFolder and set focus to MyArchive.zip
But if you do C:\MyFolder\MyArchove.zip\ then it will go to the content of the archive file.