Menu

#263 How 7z choose extract format when using open inside / inside*

open
None
5
2018-07-06
2018-07-05
No

Hello Igor,

I have a sample file in the attachment. When I using 7z to open inside * (correspond to -t * ) the file, I found it open using VHD format to open the file, while when I use open inside the file, it using MBR format to open the file.
I would like to know in the 7z c++ code, which portion of code that pick the file format use to open/extract the file based on input parameters, when the file can be open/extract successfully by more than 1 format? I have tried to review the code but no luck so far.

1 Attachments

Discussion

  • Igor Pavlov

    Igor Pavlov - 2018-07-06

    -t* opens only one level.
    7-zip by default opens all levels:
    1) VHD
    2) MBR
    3) FAT
    You can see all levels with Info button.

     
  • Phan Tiến Hưng

    Hello Igor,
    I would like to use "open inside", but I don't know which portion of code will cover the "open inside" feature. Could you please a block of code C++ of 7z demonstrate how to do it?
    Thank you.

     
  • Igor Pavlov

    Igor Pavlov - 2018-07-06

    OpenArchive.h
    CArchiveLink

     
  • Phan Tiến Hưng

    Update to the question
    In the code I found file OpenArchive.cpp, function Open(COpenOptions &op) when open inside, continuously checking for archive property "kpidMainSubfile" and by checking if the value from "kpidMainSubfile" < numItems => decide to check if the sub file inside the first file is the one we should open as "open inside".
    I also read this ticket: https://sourceforge.net/p/sevenzip/discussion/45798/thread/dcea4192/ and it seem 7z.exe use "kpidMainSubfile" archive property to check if the sub file is main file, and should be open by "open inside". Am I right?

     
  • Igor Pavlov

    Igor Pavlov - 2018-07-06

    yes

     
  • Phan Tiến Hưng

    Hello,
    In the attachment I draw a simple flow chart to demonstrate to flow (that I understand) how 7z choose which kind of archive type we should use to open/extract the archive, when we use "open inside" feature.
    Could you correct me if I were wrong?

    Thank you very much!

     
  • Igor Pavlov

    Igor Pavlov - 2018-07-06

    OpenArchive.cpp is 3500 lines of code.
    So there are some complex rules to handle with some cases like SFX archives. And I don't keep all these rules in my head.
    It works as it works.
    It's complicated.

     
  • Phan Tiến Hưng

    Thank you very much for your support!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.