HRESULT CAgent::CreateFolder( const wchar_t *newArchiveName, const wchar_t *folderName, IFolderArchiveUpdateCallback *updateCallback100) { if (!CanUpdate()) return E_NOTIMPL; CUpdateCallbackAgent updateCallbackAgent; updateCallbackAgent.SetCallback(updateCallback100); CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback; CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec); CRecordVector<CUpdatePair2> updatePairs; UInt32 numItemsInArchive; RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive)); for (UInt32 i = 0; i < numItemsInArchive; i++) { CUpdatePair2 up2; up2.NewData = up2.NewProps = false; up2.IsAnti = false; // check it. up2.ArcIndex = i; updatePairs.Add(up2); } CUpdatePair2 up2; up2.NewData = up2.NewProps = true; up2.IsAnti = false; up2.DirIndex = 0; updatePairs.Add(up2); updatePairs.ReserveDown(); CDirItems dirItems; CDirItem di; di.Attrib = FILE_ATTRIBUTE_DIRECTORY; di.Size = 0; di.Name = _agentFolder->_proxyFolderItem->GetFullPathPrefix() + folderName; FILETIME ft; NTime::GetCurUtcFileTime(ft); di.CTime = di.ATime = di.MTime = ft; dirItems.Items.Add(di); updateCallbackSpec->Callback = &updateCallbackAgent; updateCallbackSpec->DirItems = &dirItems; updateCallbackSpec->UpdatePairs = &updatePairs; updateCallbackSpec->Archive = GetArchive(); return CommonUpdate(newArchiveName, updatePairs.Size(), updateCallback); }
HRESULT SortDatabase(CDatabase &db) { db.Streams.Sort(CompareStreamsByPos, NULL); { CRecordVector<int> sortedByHash; { for (int j = 0; j < db.Streams.Size(); j++) sortedByHash.Add(j); sortedByHash.Sort(CompareHashRefs, &db.Streams); } for (int i = 0; i < db.Items.Size(); i++) { CItem &item = db.Items[i]; item.StreamIndex = -1; if (item.HasStream()) item.StreamIndex = FindHash(db.Streams, sortedByHash, item.Hash); } } { CRecordVector<bool> used; int j; for (j = 0; j < db.Streams.Size(); j++) { const CStreamInfo &s = db.Streams[j]; used.Add(s.Resource.IsMetadata() && s.PartNumber == 1); } for (int i = 0; i < db.Items.Size(); i++) { CItem &item = db.Items[i]; if (item.StreamIndex >= 0) used[item.StreamIndex] = true; } for (j = 0; j < db.Streams.Size(); j++) if (!used[j]) { CItem item; item.StreamIndex = j; item.HasMetadata = false; db.Items.Add(item); } } db.Items.Sort(CompareItems, NULL); return S_OK; }
void EnumerateDirItems( const UString &baseFolderPrefix, // base (disk) prefix for scanning const UStringVector &fileNames, // names relative to baseFolderPrefix const UString &archiveNamePrefix, CObjectVector<CDirItem> &dirItems, UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes) { for(int i = 0; i < fileNames.Size(); i++) { const UString &fileName = fileNames[i]; NFind::CFileInfoW fileInfo; if (!NFind::FindFile(baseFolderPrefix + fileName, fileInfo)) { errorCodes.Add(::GetLastError()); errorPaths.Add(baseFolderPrefix + fileName); continue; } AddDirFileInfo(archiveNamePrefix, fileName, fileInfo, dirItems); if (fileInfo.IsDirectory()) { EnumerateDirectory(baseFolderPrefix, fileName + wchar_t(kDirDelimiter), archiveNamePrefix + fileInfo.Name + wchar_t(kDirDelimiter), dirItems, errorPaths, errorCodes); } } }
static void EnumerateDirectory( const UString &baseFolderPrefix, // base (disk) prefix for scanning const UString &directory, // additional disk prefix starting from baseFolderPrefix const UString &prefix, // logical prefix CObjectVector<CDirItem> &dirItems, UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes) { NFind::CEnumeratorW enumerator(baseFolderPrefix + directory + wchar_t(kAnyStringWildcard)); for (;;) { NFind::CFileInfoW fileInfo; bool found; if (!enumerator.Next(fileInfo, found)) { errorCodes.Add(::GetLastError()); errorPaths.Add(baseFolderPrefix + directory); return; } if (!found) break; AddDirFileInfo(prefix, directory + fileInfo.Name, fileInfo, dirItems); if (fileInfo.IsDirectory()) { EnumerateDirectory(baseFolderPrefix, directory + fileInfo.Name + wchar_t(kDirDelimiter), prefix + fileInfo.Name + wchar_t(kDirDelimiter), dirItems, errorPaths, errorCodes); } } }
void CDirItems::EnumerateDirectory(int phyParent, int logParent, const FString &phyPrefix, FStringVector &errorPaths, CRecordVector<DWORD> &errorCodes) { NFind::CEnumerator enumerator(phyPrefix + FCHAR_ANY_MASK); for (;;) { NFind::CFileInfo fi; bool found; if (!enumerator.Next(fi, found)) { errorCodes.Add(::GetLastError()); errorPaths.Add(phyPrefix); return; } if (!found) break; AddDirFileInfo(phyParent, logParent, fi, Items); if (fi.IsDir()) { const FString name2 = fi.Name + FCHAR_PATH_SEPARATOR; int parent = AddPrefix(phyParent, logParent, fs2us(name2)); EnumerateDirectory(parent, parent, phyPrefix + name2, errorPaths, errorCodes); } } }
void CDirItems::EnumerateDirItems2(const FString &phyPrefix, const UString &logPrefix, const FStringVector &filePaths, FStringVector &errorPaths, CRecordVector<DWORD> &errorCodes) { int phyParent = phyPrefix.IsEmpty() ? -1 : AddPrefix(-1, -1, fs2us(phyPrefix)); int logParent = logPrefix.IsEmpty() ? -1 : AddPrefix(-1, -1, logPrefix); for (int i = 0; i < filePaths.Size(); i++) { const FString &filePath = filePaths[i]; NFind::CFileInfo fi; const FString phyPath = phyPrefix + filePath; if (!fi.Find(phyPath)) { errorCodes.Add(::GetLastError()); errorPaths.Add(phyPath); continue; } int delimiter = filePath.ReverseFind(FCHAR_PATH_SEPARATOR); FString phyPrefixCur; int phyParentCur = phyParent; if (delimiter >= 0) { phyPrefixCur = filePath.Left(delimiter + 1); phyParentCur = AddPrefix(phyParent, logParent, fs2us(phyPrefixCur)); } AddDirFileInfo(phyParentCur, logParent, fi, Items); if (fi.IsDir()) { const FString name2 = fi.Name + FCHAR_PATH_SEPARATOR; int parent = AddPrefix(phyParentCur, logParent, fs2us(name2)); EnumerateDirectory(parent, parent, phyPrefix + phyPrefixCur + name2, errorPaths, errorCodes); } } ReserveDown(); }
void CDirItems::EnumerateDirectory(int phyParent, int logParent, const UString &phyPrefix, UStringVector &errorPaths, CRecordVector<DWORD> &errorCodes) { NFind::CEnumeratorW enumerator(phyPrefix + (wchar_t)kAnyStringWildcard); for (;;) { NFind::CFileInfoW fi; bool found; if (!enumerator.Next(fi, found)) { errorCodes.Add(::GetLastError()); errorPaths.Add(phyPrefix); return; } if (!found) break; AddDirFileInfo(phyParent, logParent, fi, Items); if (fi.IsDir()) { const UString name2 = fi.Name + (wchar_t)kDirDelimiter; int parent = AddPrefix(phyParent, logParent, name2); EnumerateDirectory(parent, parent, phyPrefix + name2, errorPaths, errorCodes); } } }
HRESULT CThreadCopyFrom::ProcessVirt() { UStringVector fileNames; CRecordVector<const wchar_t *> fileNamePointers; fileNames.Add(Name); fileNamePointers.Add(fileNames[0]); return FolderOperations->CopyFrom(PathPrefix, &fileNamePointers.Front(), fileNamePointers.Size(), UpdateCallback); };
void CPanel::GetAllItemIndices(CRecordVector<UInt32> &indices) const { indices.Clear(); UInt32 numItems; if (_folder->GetNumberOfItems(&numItems) == S_OK) for (UInt32 i = 0; i < numItems; i++) indices.Add(i); }
HRESULT DecompressArchive( IInArchive *archive, const UString &defaultName, const NWildcard::CCensorNode &wildcardCensor, const CExtractOptions &options, IExtractCallbackUI *callback) { CRecordVector<UInt32> realIndices; UInt32 numItems; RINOK(archive->GetNumberOfItems(&numItems)); for(UInt32 i = 0; i < numItems; i++) { UString filePath; RINOK(GetArchiveItemPath(archive, i, options.DefaultItemName, filePath)); bool isFolder; RINOK(IsArchiveItemFolder(archive, i, isFolder)); if (!wildcardCensor.CheckPath(filePath, !isFolder)) continue; realIndices.Add(i); } if (realIndices.Size() == 0) { callback->ThereAreNoFiles(); return S_OK; } CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback; CMyComPtr<IArchiveExtractCallback> extractCallback(extractCallbackSpec); UStringVector removePathParts; UString outDir = options.OutputDir; outDir.Replace(L"*", defaultName); if(!outDir.IsEmpty()) if(!NFile::NDirectory::CreateComplexDirectory(outDir)) { throw UString(L"Can not create output directory ") + outDir; } extractCallbackSpec->Init( archive, callback, options.StdOutMode, outDir, options.PathMode, options.OverwriteMode, removePathParts, options.DefaultItemName, options.ArchiveFileInfo.LastWriteTime, options.ArchiveFileInfo.Attributes); HRESULT result = archive->Extract(&realIndices.Front(), realIndices.Size(), options.TestMode? 1: 0, extractCallback); return callback->ExtractResult(result); }
static void SetSizes(const UInt64 **srcSizes, CRecordVector<UInt64> &sizes, CRecordVector<const UInt64 *> &sizePointers, UInt32 numItems) { sizes.Clear(); sizePointers.Clear(); for(UInt32 i = 0; i < numItems; i++) { if (srcSizes == 0 || srcSizes[i] == NULL) { sizes.Add(0); sizePointers.Add(NULL); } else { sizes.Add(*srcSizes[i]); sizePointers.Add(&sizes.Back()); } } }
static void CopyOneItem(CRecordVector<UInt64> &src, CRecordVector<UInt64> &dest, UInt32 item) { for (int i = 0; i < src.Size(); i++) if (src[i] == item) { dest.Add(item); src.Delete(i); return; } }
void CInArchive::ReadPackInfo( UInt64 &dataOffset, CRecordVector<UInt64> &packSizes, CRecordVector<bool> &packCRCsDefined, CRecordVector<UInt32> &packCRCs) { dataOffset = ReadNumber(); CNum numPackStreams = ReadNum(); WaitAttribute(NID::kSize); packSizes.Clear(); packSizes.Reserve(numPackStreams); for (CNum i = 0; i < numPackStreams; i++) packSizes.Add(ReadNumber()); UInt64 type; for (;;) { type = ReadID(); if (type == NID::kEnd) break; if (type == NID::kCRC) { ReadHashDigests(numPackStreams, packCRCsDefined, packCRCs); continue; } SkeepData(); } if (packCRCsDefined.IsEmpty()) { packCRCsDefined.Reserve(numPackStreams); packCRCsDefined.Clear(); packCRCs.Reserve(numPackStreams); packCRCs.Clear(); for (CNum i = 0; i < numPackStreams; i++) { packCRCsDefined.Add(false); packCRCs.Add(0); } } }
HRESULT SetProperties(IUnknown *unknown, const CObjectVector<CProperty> &properties) { if (properties.IsEmpty()) return S_OK; CMyComPtr<ISetProperties> setProperties; unknown->QueryInterface(IID_ISetProperties, (void **)&setProperties); if (!setProperties) return S_OK; UStringVector realNames; CPropVariant *values = new CPropVariant[properties.Size()]; try { int i; for(i = 0; i < properties.Size(); i++) { const CProperty &property = properties[i]; NCOM::CPropVariant propVariant; UString name = property.Name; if (property.Value.IsEmpty()) { if (!name.IsEmpty()) { wchar_t c = name.Back(); if (c == L'-') propVariant = false; else if (c == L'+') propVariant = true; if (propVariant.vt != VT_EMPTY) name.DeleteBack(); } } else ParseNumberString(property.Value, propVariant); realNames.Add(name); values[i] = propVariant; } CRecordVector<const wchar_t *> names; for(i = 0; i < realNames.Size(); i++) names.Add((const wchar_t *)realNames[i]); RINOK(setProperties->SetProperties(&names.Front(), values, names.Size())); } catch(...) { delete []values; throw; } delete []values; return S_OK; }
bool ParseVolumeSizes(const UString &s, CRecordVector<UInt64> &values) { values.Clear(); bool prevIsNumber = false; for (unsigned i = 0; i < s.Len();) { wchar_t c = s[i++]; if (c == L' ') continue; if (c == L'-') return true; if (prevIsNumber) { prevIsNumber = false; unsigned numBits = 0; switch (MyCharLower_Ascii(c)) { case 'b': continue; case 'k': numBits = 10; break; case 'm': numBits = 20; break; case 'g': numBits = 30; break; case 't': numBits = 40; break; } if (numBits != 0) { UInt64 &val = values.Back(); if (val >= ((UInt64)1 << (64 - numBits))) return false; val <<= numBits; for (; i < s.Len(); i++) if (s[i] == L' ') break; continue; } } i--; const wchar_t *start = s.Ptr(i); const wchar_t *end; UInt64 val = ConvertStringToUInt64(start, &end); if (start == end) return false; if (val == 0) return false; values.Add(val); prevIsNumber = true; i += (unsigned)(end - start); } return true; }
bool ParseVolumeSizes(const UString &s, CRecordVector<UInt64> &values) { values.Clear(); UStringVector destStrings; SplitString(s, destStrings); bool prevIsNumber = false; for (int i = 0; i < destStrings.Size(); i++) { UString subString = destStrings[i]; subString.MakeUpper(); if (subString.IsEmpty()) return false; if (subString == L"-") return true; if (prevIsNumber) { wchar_t c = subString[0]; UInt64 &value = values.Back(); prevIsNumber = false; switch(c) { case L'B': continue; case L'K': value <<= 10; continue; case L'M': value <<= 20; continue; case L'G': value <<= 30; continue; } } const wchar_t *start = subString; const wchar_t *end; UInt64 value = ConvertStringToUInt64(start, &end); if (start == end) return false; if (value == 0) return false; values.Add(value); prevIsNumber = true; UString rem = subString.Mid((int)(end - start)); if (!rem.IsEmpty()) destStrings.Insert(i + 1, rem); } return true; }
static HRESULT SetOutProperties(IOutFolderArchive *outArchive, UINT32 method) { CMyComPtr<ISetProperties> setProperties; if (outArchive->QueryInterface(IID_ISetProperties, (void **)&setProperties) == S_OK) { UStringVector realNames; realNames.Add(UString(L"x")); NCOM::CPropVariant value = (UInt32)method; CRecordVector<const wchar_t *> names; for (int i = 0; i < realNames.Size(); i++) names.Add(realNames[i]); RINOK(setProperties->SetProperties(&names.Front(), &value, names.Size())); } return S_OK; }
void CInArchive::ReadHashDigests(int numItems, CBoolVector &digestsDefined, CRecordVector<UInt32> &digests) { ReadBoolVector2(numItems, digestsDefined); digests.Clear(); digests.Reserve(numItems); for (int i = 0; i < numItems; i++) { UInt32 crc = 0; if (digestsDefined[i]) crc = ReadUInt32(); digests.Add(crc); } }
void UpdateProduce( const CRecordVector<CUpdatePair> &updatePairs, const CActionSet &actionSet, CRecordVector<CUpdatePair2> &operationChain, IUpdateProduceCallback *callback) { for (int i = 0; i < updatePairs.Size(); i++) { const CUpdatePair &pair = updatePairs[i]; CUpdatePair2 up2; up2.IsAnti = false; up2.DirIndex = pair.DirIndex; up2.ArcIndex = pair.ArcIndex; up2.NewData = up2.NewProps = true; switch(actionSet.StateActions[pair.State]) { case NPairAction::kIgnore: /* if (pair.State != NPairState::kOnlyOnDisk) IgnoreArchiveItem(m_ArchiveItems[pair.ArcIndex]); // cout << "deleting"; */ if (callback) callback->ShowDeleteFile(pair.ArcIndex); continue; case NPairAction::kCopy: if (pair.State == NPairState::kOnlyOnDisk) throw kUpdateActionSetCollision; up2.NewData = up2.NewProps = false; break; case NPairAction::kCompress: if (pair.State == NPairState::kOnlyInArchive || pair.State == NPairState::kNotMasked) throw kUpdateActionSetCollision; break; case NPairAction::kCompressAsAnti: up2.IsAnti = true; break; } operationChain.Add(up2); } operationChain.ReserveDown(); }
void CPanel::GetSelectedItemsIndices(CRecordVector<UInt32> &indices) const { indices.Clear(); /* int itemIndex = -1; while ((itemIndex = _listView.GetNextSelectedItem(itemIndex)) != -1) { LPARAM param; if (_listView.GetItemParam(itemIndex, param)) indices.Add(param); } */ FOR_VECTOR (i, _selectedStatusVector) if (_selectedStatusVector[i]) indices.Add(i); // HeapSort(&indices.Front(), indices.Size()); }
void CPanel::GetSelectedItemsIndices(CRecordVector<UInt32> &indices) const { indices.Clear(); /* int itemIndex = -1; while ((itemIndex = _listView.GetNextItem(itemIndex, LVNI_SELECTED)) != -1) { LPARAM param; if (_listView.GetItemParam(itemIndex, param)) indices.Add(param); } */ for (int i = 0; i < _selectedStatusVector.Size(); i++) if (_selectedStatusVector[i]) indices.Add(i); HeapSort(&indices.Front(), indices.Size()); }
void CPanel::CreateSevenZipMenu(HMENU menuSpec, const CRecordVector<UInt32> &operatedIndices, CMyComPtr<IContextMenu> &sevenZipContextMenu) { sevenZipContextMenu.Release(); CMenu menu; menu.Attach(menuSpec); // CMenuDestroyer menuDestroyer(menu); // menu.CreatePopup(); bool sevenZipMenuCreated = false; CZipContextMenu *contextMenuSpec = new CZipContextMenu; CMyComPtr<IContextMenu> contextMenu = contextMenuSpec; // if (contextMenu.CoCreateInstance(CLSID_CZipContextMenu, IID_IContextMenu) == S_OK) { /* CMyComPtr<IInitContextMenu> initContextMenu; if (contextMenu.QueryInterface(IID_IInitContextMenu, &initContextMenu) != S_OK) return; */ UString currentFolderUnicode = _currentFolderPrefix; UStringVector names; int i; for(i = 0; i < operatedIndices.Size(); i++) names.Add(currentFolderUnicode + GetItemRelPath(operatedIndices[i])); CRecordVector<const wchar_t *> namePointers; for(i = 0; i < operatedIndices.Size(); i++) namePointers.Add(names[i]); // NFile::NDirectory::MySetCurrentDirectory(currentFolderUnicode); if (contextMenuSpec->InitContextMenu(currentFolderUnicode, &namePointers.Front(), operatedIndices.Size()) == S_OK) { HRESULT res = contextMenu->QueryContextMenu(menu, 0, kSevenZipStartMenuID, kSystemStartMenuID - 1, 0); sevenZipMenuCreated = (HRESULT_SEVERITY(res) == SEVERITY_SUCCESS); if (sevenZipMenuCreated) sevenZipContextMenu = contextMenu; // int code = HRESULT_CODE(res); // int nextItemID = code; } } }
void CPanel::GetOperatedItemIndices(CRecordVector<UInt32> &indices) const { GetSelectedItemsIndices(indices); if (!indices.IsEmpty()) return; if (_listView.GetSelectedCount() == 0) return; int focusedItem = _listView.GetFocusedItem(); if (focusedItem >= 0) { if (_listView.IsItemSelected(focusedItem)) { int realIndex = GetRealItemIndex(focusedItem); if (realIndex != kParentIndex) indices.Add(realIndex); } } }
int CStartupInfo::Menu( unsigned int flags, const char *title, const char *helpTopic, const CSysStringVector &items, int selectedItem) { CRecordVector<FarMenuItem> farMenuItems; for(int i = 0; i < items.Size(); i++) { FarMenuItem item; item.Checked = 0; item.Separator = 0; item.Selected = (i == selectedItem); CSysString reducedString = items[i].Left(sizeof(item.Text) / sizeof(item.Text[0]) - 1); MyStringCopy(item.Text, (const char *)GetOemString(reducedString)); farMenuItems.Add(item); } return Menu(flags, title, helpTopic, &farMenuItems.Front(), farMenuItems.Size()); }
STDMETHODIMP CAgent::DeleteItems( const wchar_t *newArchiveName, const UInt32 *indices, UInt32 numItems, IFolderArchiveUpdateCallback *updateCallback100) { if (!CanUpdate()) return E_NOTIMPL; CUpdateCallbackAgent updateCallbackAgent; updateCallbackAgent.SetCallback(updateCallback100); CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback; CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec); CUIntVector realIndices; _agentFolder->GetRealIndices(indices, numItems, realIndices); CRecordVector<CUpdatePair2> updatePairs; int curIndex = 0; UInt32 numItemsInArchive; RINOK(GetArchive()->GetNumberOfItems(&numItemsInArchive)); for (UInt32 i = 0; i < numItemsInArchive; i++) { if (curIndex < realIndices.Size()) if (realIndices[curIndex] == i) { curIndex++; continue; } CUpdatePair2 up2; up2.NewData = up2.NewProps = false; up2.IsAnti = false; // check it. Maybe it can be undefined up2.ArcIndex = i; updatePairs.Add(up2); } updateCallbackSpec->UpdatePairs = &updatePairs; updateCallbackSpec->Archive = GetArchive(); updateCallbackSpec->Callback = &updateCallbackAgent; return CommonUpdate(newArchiveName, updatePairs.Size(), updateCallback); }
int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode) { if (numItems == 0) return FALSE; /* if (!m_ArchiverInfo.UpdateEnabled) { g_StartupInfo.ShowMessage(NMessageID::kUpdateNotSupportedForThisArchive); return FALSE; } */ if ((opMode & OPM_SILENT) == 0) { const char *msgItems[]= { g_StartupInfo.GetMsgString(NMessageID::kDeleteTitle), g_StartupInfo.GetMsgString(NMessageID::kDeleteFiles), g_StartupInfo.GetMsgString(NMessageID::kDeleteDelete), g_StartupInfo.GetMsgString(NMessageID::kDeleteCancel) }; char msg[1024]; if (numItems == 1) { sprintf(msg, g_StartupInfo.GetMsgString(NMessageID::kDeleteFile), panelItems[0].FindData.cFileName); msgItems[1] = msg; } else if (numItems > 1) { sprintf(msg, g_StartupInfo.GetMsgString(NMessageID::kDeleteNumberOfFiles), numItems); msgItems[1] = msg; } if (g_StartupInfo.ShowMessage(FMSG_WARNING, NULL, msgItems, sizeof(msgItems) / sizeof(msgItems[0]), 2) != 0) return (FALSE); } CScreenRestorer screenRestorer; CProgressBox progressBox; CProgressBox *progressBoxPointer = NULL; if ((opMode & OPM_SILENT) == 0 && (opMode & OPM_FIND ) == 0) { screenRestorer.Save(); progressBoxPointer = &progressBox; progressBox.Init( // g_StartupInfo.GetMsgString(NMessageID::kWaitTitle), g_StartupInfo.GetMsgString(NMessageID::kDeleting), 48); } CWorkDirTempFile tempFile; if (tempFile.CreateTempFile(m_FileName) != S_OK) return FALSE; CRecordVector<UINT32> indices; indices.Reserve(numItems); int i; for (i = 0; i < numItems; i++) indices.Add((UINT32)panelItems[i].UserData); //////////////////////////// // Save _folder; UStringVector pathVector; GetPathParts(pathVector); CMyComPtr<IOutFolderArchive> outArchive; HRESULT result = m_ArchiveHandler.QueryInterface(IID_IOutFolderArchive, &outArchive); if (result != S_OK) { g_StartupInfo.ShowMessage(NMessageID::kUpdateNotSupportedForThisArchive); return FALSE; } outArchive->SetFolder(_folder); CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp; CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec); updateCallbackSpec->Init(/* m_ArchiveHandler, */ progressBoxPointer); result = outArchive->DeleteItems(tempFile.OutStream, &indices.Front(), indices.Size(), updateCallback); updateCallback.Release(); outArchive.Release(); if (result == S_OK) { result = AfterUpdate(tempFile, pathVector); } if (result != S_OK) { ShowErrorMessage(result); return FALSE; } GetCurrentDir(); return TRUE; }
void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bool editMode) { const UString name = GetItemName(index); if (IsNameVirus(name)) { MessageBoxErrorLang(IDS_VIRUS, 0x03020284); return; } CMyComPtr<IFolderOperations> folderOperations; if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK) { MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208); return; } bool tryAsArchive = tryInternal && (!tryExternal || !DoItemAlwaysStart(name)); UString fullVirtPath = _currentFolderPrefix + name; NFile::NDirectory::CTempDirectoryW tempDirectory; tempDirectory.Create(kTempDirPrefix); UString tempDir = tempDirectory.GetPath(); UString tempDirNorm = tempDir; NFile::NName::NormalizeDirPathPrefix(tempDirNorm); UString tempFilePath = tempDirNorm + GetCorrectFsPath(name); CTempFileInfo tempFileInfo; tempFileInfo.ItemName = name; tempFileInfo.FolderPath = tempDir; tempFileInfo.FilePath = tempFilePath; tempFileInfo.NeedDelete = true; if (tryAsArchive) { CMyComPtr<IInArchiveGetStream> getStream; _folder.QueryInterface(IID_IInArchiveGetStream, &getStream); if (getStream) { CMyComPtr<ISequentialInStream> subSeqStream; getStream->GetStream(index, &subSeqStream); if (subSeqStream) { CMyComPtr<IInStream> subStream; subSeqStream.QueryInterface(IID_IInStream, &subStream); if (subStream) { bool encrypted; if (OpenItemAsArchive(subStream, tempFileInfo, fullVirtPath, encrypted) == S_OK) { tempDirectory.DisableDeleting(); RefreshListCtrl(); return; } } } } } CRecordVector<UInt32> indices; indices.Add(index); UStringVector messages; bool usePassword = false; UString password; if (_parentFolders.Size() > 0) { const CFolderLink &fl = _parentFolders.Back(); usePassword = fl.UsePassword; password = fl.Password; } HRESULT result = CopyTo(indices, tempDirNorm, false, true, &messages, usePassword, password); if (_parentFolders.Size() > 0) { CFolderLink &fl = _parentFolders.Back(); fl.UsePassword = usePassword; fl.Password = password; } if (!messages.IsEmpty()) return; if (result != S_OK) { if (result != E_ABORT) MessageBoxError(result); return; } if (tryAsArchive) { bool encrypted; if (OpenItemAsArchive(NULL, tempFileInfo, fullVirtPath, encrypted) == S_OK) { tempDirectory.DisableDeleting(); RefreshListCtrl(); return; } } CMyAutoPtr<CTmpProcessInfo> tmpProcessInfoPtr(new CTmpProcessInfo()); CTmpProcessInfo *tmpProcessInfo = tmpProcessInfoPtr.get(); tmpProcessInfo->FolderPath = tempDir; tmpProcessInfo->FilePath = tempFilePath; tmpProcessInfo->NeedDelete = true; tmpProcessInfo->UsePassword = usePassword; tmpProcessInfo->Password = password; if (!tmpProcessInfo->FileInfo.Find(tempFilePath)) return; CTmpProcessInfoRelease tmpProcessInfoRelease(*tmpProcessInfo); if (!tryExternal) return; CProcess process; HRESULT res; if (editMode) res = StartEditApplication(tempFilePath, (HWND)*this, process); else res = StartApplication(tempDirNorm, tempFilePath, (HWND)*this, process); if ((HANDLE)process == 0) return; tmpProcessInfo->Window = (HWND)(*this); tmpProcessInfo->FullPathFolderPrefix = _currentFolderPrefix; tmpProcessInfo->ItemName = name; tmpProcessInfo->ProcessHandle = process.Detach(); NWindows::CThread thread; if (thread.Create(MyThreadFunction, tmpProcessInfo) != S_OK) throw 271824; tempDirectory.DisableDeleting(); tmpProcessInfoPtr.release(); tmpProcessInfoRelease._needDelete = false; }
NFileOperationReturnCode::EEnum CPlugin::GetFilesReal(struct PluginPanelItem *panelItems, int itemsNumber, int move, const char *_aDestPath, int opMode, bool showBox) { if(move != 0) { g_StartupInfo.ShowMessage(NMessageID::kMoveIsNotSupported); return NFileOperationReturnCode::kError; } CSysString destPath = _aDestPath; NFile::NName::NormalizeDirPathPrefix(destPath); bool extractSelectedFiles = true; NExtract::CInfo extractionInfo; extractionInfo.PathMode = NExtract::NPathMode::kCurrentPathnames; extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt; bool silent = (opMode & OPM_SILENT) != 0; bool decompressAllItems = false; UString password = Password; bool passwordIsDefined = PasswordIsDefined; if (!silent) { const int kPathIndex = 2; ReadExtractionInfo(extractionInfo); const int kPathModeRadioIndex = 4; const int kOverwriteModeRadioIndex = kPathModeRadioIndex + 4; const int kNumOverwriteOptions = 6; const int kFilesModeIndex = kOverwriteModeRadioIndex + kNumOverwriteOptions; const int kXSize = 76; const int kYSize = 19; const int kPasswordYPos = 12; const int kXMid = kXSize / 2; AString oemPassword = UnicodeStringToMultiByte(password, CP_OEMCP); struct CInitDialogItem initItems[]={ { DI_DOUBLEBOX, 3, 1, kXSize - 4, kYSize - 2, false, false, 0, false, NMessageID::kExtractTitle, NULL, NULL }, { DI_TEXT, 5, 2, 0, 0, false, false, 0, false, NMessageID::kExtractTo, NULL, NULL }, { DI_EDIT, 5, 3, kXSize - 6, 3, true, false, DIF_HISTORY, false, -1, destPath, kExractPathHistoryName}, // { DI_EDIT, 5, 3, kXSize - 6, 3, true, false, 0, false, -1, destPath, NULL}, { DI_SINGLEBOX, 4, 5, kXMid - 2, 5 + 4, false, false, 0, false, NMessageID::kExtractPathMode, NULL, NULL }, { DI_RADIOBUTTON, 6, 6, 0, 0, false, extractionInfo.PathMode == NExtract::NPathMode::kFullPathnames, DIF_GROUP, false, NMessageID::kExtractPathFull, NULL, NULL }, { DI_RADIOBUTTON, 6, 7, 0, 0, false, extractionInfo.PathMode == NExtract::NPathMode::kCurrentPathnames, 0, false, NMessageID::kExtractPathCurrent, NULL, NULL }, { DI_RADIOBUTTON, 6, 8, 0, 0, false, extractionInfo.PathMode == NExtract::NPathMode::kNoPathnames, false, 0, NMessageID::kExtractPathNo, NULL, NULL }, { DI_SINGLEBOX, kXMid, 5, kXSize - 6, 5 + kNumOverwriteOptions, false, false, 0, false, NMessageID::kExtractOwerwriteMode, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 6, 0, 0, false, extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAskBefore, DIF_GROUP, false, NMessageID::kExtractOwerwriteAsk, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 7, 0, 0, false, extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kWithoutPrompt, 0, false, NMessageID::kExtractOwerwritePrompt, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 8, 0, 0, false, extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kSkipExisting, 0, false, NMessageID::kExtractOwerwriteSkip, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 9, 0, 0, false, extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRename, 0, false, NMessageID::kExtractOwerwriteAutoRename, NULL, NULL }, { DI_RADIOBUTTON, kXMid + 2, 10, 0, 0, false, extractionInfo.OverwriteMode == NExtract::NOverwriteMode::kAutoRenameExisting, 0, false, NMessageID::kExtractOwerwriteAutoRenameExisting, NULL, NULL }, { DI_SINGLEBOX, 4, 10, kXMid- 2, 10 + 3, false, false, 0, false, NMessageID::kExtractFilesMode, NULL, NULL }, { DI_RADIOBUTTON, 6, 11, 0, 0, false, true, DIF_GROUP, false, NMessageID::kExtractFilesSelected, NULL, NULL }, { DI_RADIOBUTTON, 6, 12, 0, 0, false, false, 0, false, NMessageID::kExtractFilesAll, NULL, NULL }, { DI_SINGLEBOX, kXMid, kPasswordYPos, kXSize - 6, kPasswordYPos + 2, false, false, 0, false, NMessageID::kExtractPassword, NULL, NULL }, { DI_PSWEDIT, kXMid + 2, kPasswordYPos + 1, kXSize - 8, 12, false, false, 0, false, -1, oemPassword, NULL}, { DI_TEXT, 3, kYSize - 4, 0, 0, false, false, DIF_BOXCOLOR|DIF_SEPARATOR, false, -1, "", NULL }, { DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, true, NMessageID::kExtractExtract, NULL, NULL }, { DI_BUTTON, 0, kYSize - 3, 0, 0, false, false, DIF_CENTERGROUP, false, NMessageID::kExtractCancel, NULL, NULL } }; const int kNumDialogItems = sizeof(initItems) / sizeof(initItems[0]); const int kOkButtonIndex = kNumDialogItems - 2; const int kPasswordIndex = kNumDialogItems - 4; FarDialogItem dialogItems[kNumDialogItems]; g_StartupInfo.InitDialogItems(initItems, dialogItems, kNumDialogItems); for (;;) { int askCode = g_StartupInfo.ShowDialog(kXSize, kYSize, kHelpTopicExtrFromSevenZip, dialogItems, kNumDialogItems); if (askCode != kOkButtonIndex) return NFileOperationReturnCode::kInterruptedByUser; destPath = dialogItems[kPathIndex].Data; destPath.Trim(); if (destPath.IsEmpty()) { if(!NFile::NDirectory::MyGetCurrentDirectory(destPath)) throw 318016; NFile::NName::NormalizeDirPathPrefix(destPath); break; } else { if(destPath[destPath.Length() - 1] == kDirDelimiter) break; } g_StartupInfo.ShowMessage("You must specify directory path"); } if (dialogItems[kPathModeRadioIndex].Selected) extractionInfo.PathMode = NExtract::NPathMode::kFullPathnames; else if (dialogItems[kPathModeRadioIndex + 1].Selected) extractionInfo.PathMode = NExtract::NPathMode::kCurrentPathnames; else if (dialogItems[kPathModeRadioIndex + 2].Selected) extractionInfo.PathMode = NExtract::NPathMode::kNoPathnames; else throw 31806; if (dialogItems[kOverwriteModeRadioIndex].Selected) extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAskBefore; else if (dialogItems[kOverwriteModeRadioIndex + 1].Selected) extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt; else if (dialogItems[kOverwriteModeRadioIndex + 2].Selected) extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kSkipExisting; else if (dialogItems[kOverwriteModeRadioIndex + 3].Selected) extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAutoRename; else if (dialogItems[kOverwriteModeRadioIndex + 4].Selected) extractionInfo.OverwriteMode = NExtract::NOverwriteMode::kAutoRenameExisting; else throw 31806; if (dialogItems[kFilesModeIndex].Selected) decompressAllItems = false; else if (dialogItems[kFilesModeIndex + 1].Selected) decompressAllItems = true; else throw 31806; SaveExtractionInfo(extractionInfo); if (dialogItems[kFilesModeIndex].Selected) extractSelectedFiles = true; else if (dialogItems[kFilesModeIndex + 1].Selected) extractSelectedFiles = false; else throw 31806; oemPassword = dialogItems[kPasswordIndex].Data; password = MultiByteToUnicodeString(oemPassword, CP_OEMCP); passwordIsDefined = !password.IsEmpty(); } NFile::NDirectory::CreateComplexDirectory(destPath); /* vector<int> realIndices; if (!decompressAllItems) GetRealIndexes(panelItems, itemsNumber, realIndices); */ CRecordVector<UINT32> indices; indices.Reserve(itemsNumber); for (int i = 0; i < itemsNumber; i++) indices.Add(panelItems[i].UserData); HRESULT result = ExtractFiles(decompressAllItems, &indices.Front(), itemsNumber, !showBox, extractionInfo.PathMode, extractionInfo.OverwriteMode, MultiByteToUnicodeString(destPath, CP_OEMCP), passwordIsDefined, password); // HRESULT result = ExtractFiles(decompressAllItems, realIndices, !showBox, // extractionInfo, destPath, passwordIsDefined, password); if (result != S_OK) { if (result == E_ABORT) return NFileOperationReturnCode::kInterruptedByUser; ShowErrorMessage(result); return NFileOperationReturnCode::kError; } // if(move != 0) // { // if(DeleteFiles(panelItems, itemsNumber, opMode) == FALSE) // return NFileOperationReturnCode::kError; // } return NFileOperationReturnCode::kSuccess; }
void CContentsView::OnCopy(bool move, bool copyToSame) { CContentsView &srcPanel = *this; CContentsView &destPanel = *this; CDisableTimerProcessing disableTimerProcessing1(destPanel); CDisableTimerProcessing disableTimerProcessing2(srcPanel); if (move) { if (!srcPanel.CheckBeforeUpdate(IDS_MOVE)) return; } else if (!srcPanel.DoesItSupportOperations()) { srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED); return; } CRecordVector<UInt32> indices; UString destPath; bool useDestPanel = false; { if (copyToSame) { int focusedItem = srcPanel.GetFocusedItem(); if (focusedItem < 0) return; int realIndex = srcPanel.GetRealItemIndex(focusedItem); if (realIndex == kParentIndex) return; indices.Add(realIndex); destPath = srcPanel.GetItemName(realIndex); } else { srcPanel.GetOperatedIndicesSmart(indices); if (indices.Size() == 0) return; destPath = destPanel.GetFsPath(); ReducePathToRealFileSystemPath(destPath); } } UStringVector copyFolders; // ReadCopyHistory(copyFolders); { CCopyDialog copyDialog; copyDialog.Strings = copyFolders; copyDialog.Value = destPath; LangString(move ? IDS_MOVE : IDS_COPY, copyDialog.Title); LangString(move ? IDS_MOVE_TO : IDS_COPY_TO, copyDialog.Static); copyDialog.Info = srcPanel.GetItemsInfoString(indices); if (copyDialog.DoModal() != IDOK) return; destPath = copyDialog.Value; } { if (destPath.IsEmpty()) { srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED); return; } UString correctName; if (!srcPanel.CorrectFsPath(destPath, correctName)) { srcPanel.MessageBoxError(E_INVALIDARG); return; } if (IsAbsolutePath(destPath)) destPath.Empty(); else destPath = srcPanel.GetFsPath(); destPath += correctName; #if defined(_WIN32) && !defined(UNDER_CE) if (destPath.Len() > 0 && destPath[0] == '\\') if (destPath.Len() == 1 || destPath[1] != '\\') { srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED); return; } #endif if (CompareFileNames(destPath, destPanel.GetFsPath()) == 0) { srcPanel.MessageBoxMyError(L"Can not copy files onto itself"); return; } bool destIsFsPath = false; if (IsAltPathPrefix(us2fs(destPath))) { // we allow alt streams dest only to alt stream folder in second panel srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED); return; /* FString basePath = us2fs(destPath); basePath.DeleteBack(); if (!DoesFileOrDirExist(basePath)) { srcPanel.MessageBoxError2Lines(basePath, ERROR_FILE_NOT_FOUND); // GetLastError() return; } destIsFsPath = true; */ } else { if (indices.Size() == 1 && !destPath.IsEmpty() && destPath.Back() != WCHAR_PATH_SEPARATOR) { int pos = destPath.ReverseFind_PathSepar(); if (pos < 0) { srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED); return; } { /* #ifdef _WIN32 UString name = destPath.Ptr(pos + 1); if (name.Find(L':') >= 0) { srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED); return; } #endif */ UString prefix = destPath.Left(pos + 1); if (!CreateComplexDir(us2fs(prefix))) { srcPanel.MessageBoxError2Lines(prefix, GetLastError()); return; } } // bool isFolder = srcPanael.IsItem_Folder(indices[0]); } else { NName::NormalizeDirPathPrefix(destPath); if (!CreateComplexDir(us2fs(destPath))) { srcPanel.MessageBoxError2Lines(destPath, GetLastError()); return; } } destIsFsPath = true; } if (!destIsFsPath) useDestPanel = true; // AddUniqueStringToHeadOfList(copyFolders, destPath); while (copyFolders.Size() > 20) copyFolders.DeleteBack(); // SaveCopyHistory(copyFolders); } bool useSrcPanel = !useDestPanel || !srcPanel.Is_IO_FS_Folder(); bool useTemp = useSrcPanel && useDestPanel; if (useTemp) { srcPanel.MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED); return; } CTempDir tempDirectory; FString tempDirPrefix; if (useTemp) { tempDirectory.Create(kTempDirPrefix); tempDirPrefix = tempDirectory.GetPath(); NFile::NName::NormalizeDirPathPrefix(tempDirPrefix); } CSelectedState srcSelState; CSelectedState destSelState; srcPanel.SaveSelectedState(srcSelState); destPanel.SaveSelectedState(destSelState); CDisableNotify disableNotify1(destPanel); CDisableNotify disableNotify2(srcPanel); HRESULT result = S_OK; if (useSrcPanel) { CCopyToOptions options; options.folder = useTemp ? fs2us(tempDirPrefix) : destPath; options.moveMode = move; options.includeAltStreams = true; options.replaceAltStreamChars = false; options.showErrorMessages = true; result = srcPanel.CopyTo(options, indices, NULL); } if (result == S_OK && useDestPanel) { UStringVector filePaths; UString folderPrefix; if (useTemp) folderPrefix = fs2us(tempDirPrefix); else folderPrefix = srcPanel.GetFsPath(); filePaths.ClearAndReserve(indices.Size()); FOR_VECTOR(i, indices) filePaths.AddInReserved(srcPanel.GetItemRelPath2(indices[i])); result = destPanel.CopyFrom(move, folderPrefix, filePaths, true, 0); } if (result != S_OK) { // disableNotify1.Restore(); // disableNotify2.Restore(); // For Password: // srcPanel.SetFocusToList(); // srcPanel.InvalidateList(NULL, true); if (result != E_ABORT) srcPanel.MessageBoxError(result, L"Error"); // return; } RefreshTitle(); if (copyToSame || move) { srcPanel.RefreshListCtrl(srcSelState); } if (!copyToSame) { destPanel.RefreshListCtrl(destSelState); srcPanel.KillSelection(); } disableNotify1.Restore(); disableNotify2.Restore(); srcPanel.SetFocus(); }
HRESULT DecompressArchives( CCodecs *codecs, const CIntVector &formatIndices, UStringVector &archivePaths, UStringVector &archivePathsFull, const NWildcard::CCensorNode &wildcardCensor, const CExtractOptions &optionsSpec, IOpenCallbackUI *openCallback, IExtractCallbackUI *extractCallback, UString &errorMessage, CDecompressStat &stat) { stat.Clear(); CExtractOptions options = optionsSpec; int i; UInt64 totalPackSize = 0; CRecordVector<UInt64> archiveSizes; for (i = 0; i < archivePaths.Size(); i++) { const UString &archivePath = archivePaths[i]; NFile::NFind::CFileInfoW fi; if (!NFile::NFind::FindFile(archivePath, fi)) throw "there is no such archive"; if (fi.IsDir()) throw "can't decompress folder"; archiveSizes.Add(fi.Size); totalPackSize += fi.Size; } CArchiveExtractCallback *extractCallbackSpec = new CArchiveExtractCallback; CMyComPtr<IArchiveExtractCallback> ec(extractCallbackSpec); bool multi = (archivePaths.Size() > 1); extractCallbackSpec->InitForMulti(multi, options.PathMode, options.OverwriteMode); if (multi) { RINOK(extractCallback->SetTotal(totalPackSize)); } for (i = 0; i < archivePaths.Size(); i++) { const UString &archivePath = archivePaths[i]; NFile::NFind::CFileInfoW fi; if (!NFile::NFind::FindFile(archivePath, fi)) throw "there is no such archive"; if (fi.IsDir()) throw "there is no such archive"; options.ArchiveFileInfo = fi; #ifndef _NO_CRYPTO openCallback->Open_ClearPasswordWasAskedFlag(); #endif RINOK(extractCallback->BeforeOpen(archivePath)); CArchiveLink archiveLink; CIntVector formatIndices2 = formatIndices; #ifndef _SFX if (formatIndices.IsEmpty()) { int pos = archivePath.ReverseFind(L'.'); if (pos >= 0) { UString s = archivePath.Mid(pos + 1); int index = codecs->FindFormatForExtension(s); if (index >= 0 && s == L"001") { s = archivePath.Left(pos); pos = s.ReverseFind(L'.'); if (pos >= 0) { int index2 = codecs->FindFormatForExtension(s.Mid(pos + 1)); if (index2 >= 0 && s.CompareNoCase(L"rar") != 0) { formatIndices2.Add(index2); formatIndices2.Add(index); } } } } } #endif HRESULT result = MyOpenArchive(codecs, formatIndices2, archivePath, archiveLink, openCallback); if (result == E_ABORT) return result; bool crypted = false; #ifndef _NO_CRYPTO crypted = openCallback->Open_WasPasswordAsked(); #endif RINOK(extractCallback->OpenResult(archivePath, result, crypted)); if (result != S_OK) continue; for (int v = 0; v < archiveLink.VolumePaths.Size(); v++) { int index = archivePathsFull.FindInSorted(archiveLink.VolumePaths[v]); if (index >= 0 && index > i) { archivePaths.Delete(index); archivePathsFull.Delete(index); totalPackSize -= archiveSizes[index]; archiveSizes.Delete(index); } } if (archiveLink.VolumePaths.Size() != 0) { totalPackSize += archiveLink.VolumesSize; RINOK(extractCallback->SetTotal(totalPackSize)); } #ifndef _NO_CRYPTO UString password; RINOK(openCallback->Open_GetPasswordIfAny(password)); if (!password.IsEmpty()) { RINOK(extractCallback->SetPassword(password)); } #endif options.DefaultItemName = archiveLink.GetDefaultItemName(); RINOK(DecompressArchive( archiveLink.GetArchive(), fi.Size + archiveLink.VolumesSize, wildcardCensor, options, extractCallback, extractCallbackSpec, errorMessage)); extractCallbackSpec->LocalProgressSpec->InSize += fi.Size + archiveLink.VolumesSize; extractCallbackSpec->LocalProgressSpec->OutSize = extractCallbackSpec->UnpackSize; if (!errorMessage.IsEmpty()) return E_FAIL; } stat.NumFolders = extractCallbackSpec->NumFolders; stat.NumFiles = extractCallbackSpec->NumFiles; stat.UnpackSize = extractCallbackSpec->UnpackSize; stat.NumArchives = archivePaths.Size(); stat.PackSize = extractCallbackSpec->LocalProgressSpec->InSize; return S_OK; }