Search code examples
c#rar

What's the file structure of a rar file compressed in store mode


I have many rars that a stored in store mode, that means they aren't compressed. I want to open them and read parts of the file that is "stored" in the rar. I think I can just open them if I knew the offset to the files.

Something in C# will do very well. I can't find anything on the web.


Solution

  • The file format is publicly available, but I can't find it as text on their site.

    When you install WinRAR, a text file with the technical information is put inside the Program Files WinRAR directory. You can also download "RAR for Linux" from the RAR download page and in that tar.gz file you can find the technote.txt file too:

              RAR version 4.00 - Technical information
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    

    THE ARCHIVE FORMAT DESCRIBED BELOW IS ONLY VALID FOR VERSIONS SINCE 1.50

    ReScene is a project for recreating rar archives from the extracted files. You need a .srr file for this. The source code is available. You may want to take a look at RarStream.cs. That file is used in MKV/AVI ReSample: it can reconstruct a sample video file of a couple of megabytes using a .srs and the original video file, that can still be packed in split rar archives.

    If you want something similar in other languages, I suggest you look at the unrar source from RarLab or at one of the following projects. They are open source and have the capabilities to play video files in RAR archives.

    Other interesting projects:

    • RARFileSource (a DirectShow filter that lets most video players read RAR files on the fly)
    • rarfs (Fuse module to mount uncompressed RAR archives)

    An other idea is to have a look at some comic book readers that support the .cbr format. This is just a rar archive with images stored in it.