#include "7zip/Archive/7z/7zDecode.h" class CMyProgress : public ICompressProgressInfo, public CMyUnknownImp { public: const UInt64 *InSize; const UInt64 *OutSize; HRESULT Result; NWindows::NSynchronization::CAutoResetEvent ProgressEvent; NWindows::NSynchronization::CAutoResetEvent WaitEvent; HRes Create() { RINOK(ProgressEvent.CreateIfNotCreated()); return WaitEvent.CreateIfNotCreated(); } void Init() { ProgressEvent.Reset(); WaitEvent.Reset(); } MY_UNKNOWN_IMP STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize) { /* InSize = inSize; OutSize = outSize; ProgressEvent.Set(); WaitEvent.Lock(); return Result; */ printf("in:%I64d, out:%I64d\n", *inSize, *outSize); return 0; } }; class CMyCryptoGetTextPassword : public ICryptoGetTextPassword, public CMyUnknownImp { public: UString Password; MY_UNKNOWN_IMP STDMETHOD(CryptoGetTextPassword)(BSTR *password) { return StringToBstr(Password, password); } }; int main(int argc, char **argv) { NArchive::N7z::CDecoder decoder(false); CInFileStream instream; instream.Open("E:/projects/lzma920/test.7z"); UInt64 packSizes = 0; instream.GetSize(&packSizes); NArchive::N7z::CFolder folder; folder. CStdOutFileStream outstream; CMyProgress progress; CMyCryptoGetTextPassword password; bool ispassword = true; HRESULT ret = decoder.Decode(&instream, 0, &packSizes, folder, &outstream, &progress, &password, ispassword, false, 0); if (ret) { printf("error\n"); } return 0; }