Menu

Extract files into memory, password protected

2012-03-19
2012-12-07
  • Didar Uranov

    Didar Uranov - 2012-03-19

    Hello. I made an archive with 7zip. It is password protected, also headers are protected with -mhe switch.
    I want to decompress it into memory. Used Client7z (CPP\7zip\UI\Client7z) as an example. It works fine, but in this example I found out how to extract into some folder, but I need extract forward into memory, without extracting it first into a disk space.
    Help please.

     
  • Igor Pavlov

    Igor Pavlov - 2012-03-19

    Use  CBufPtrSeqOutStream object instead of COutFileStream.
    Change the code:
        _outFileStreamSpec = new COutFileStream;
        CMyComPtr<ISequentialOutStream> outStreamLoc(_outFileStreamSpec);
        if (!_outFileStreamSpec->Open(fullProcessedPath, CREATE_ALWAYS))

     
  • Didar Uranov

    Didar Uranov - 2012-03-19

    I'm not really good at 7z sources.
    I found some code that uses CBufPtrSeqOutStream, and its Init method requires(as I understand) the size of unpacked data.
    Could you please give an exact explanation on how to use CBufPtrSeqOutStream ?
    I have no folders inside my archieve, only files.

     
  • Igor Pavlov

    Igor Pavlov - 2012-03-20

    You can request uncompressed size of any file in archive with the following code:
              // Get uncompressed size of file
              NCOM::CPropVariant prop;
              archive->GetProperty(i, kpidSize, &prop);

     

Log in to post a comment.