Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

7z c++ update callback to access memory block

2014-03-03
2014-03-03
  • Roman Scherzer
    Roman Scherzer
    2014-03-03

    Hi,

    I need a little help to find an update callback which is able to access the currently worked on memory block and its size. Or in generall a way to decompress a file blockwise in memory.

    My task is to calculate hash values (sha1, sha256, etc) for the files inside a 7zip archive...(without unpacking them to disk and read in the file from there...)so I need to open the file, fine, no problem.....but where is a place where I can hookup the hash calculation updates?

    All I found in the SDK was the progress printer..but that did not help me..

    Can someone please point me to the right direction?

    Cheers

     
  • Igor Pavlov
    Igor Pavlov
    2014-03-03

    Client7z.cpp:
    CArchiveExtractCallback::GetStream

    _outFileStreamSpec = new COutFileStream;
    CMyComPtr<ISequentialOutStream> outStreamLoc(_outFileStreamSpec);
    if (!_outFileStreamSpec->Open(fullProcessedPath, CREATE_ALWAYS))
    {
      PrintError("Can not open output file", fullProcessedPath);
      return E_ABORT;
    }
    

    You must create object of your class, that implements ISequentialOutStream and calculates Hash

     
  • Roman Scherzer
    Roman Scherzer
    2014-03-03

    Ah...thanks...now I even found the CCrcOutStream class in bench.cpp which seems to do what I need... :-)

    Thanks