STDMETHODIMP CCodecs::GetProperty(UINT32 index, PROPID propID, PROPVARIANT *value) { #ifdef EXPORT_CODECS if (index < g_NumCodecs) return GetMethodProperty(index, propID, value); #endif const CDllCodecInfo &ci = Codecs[index #ifdef EXPORT_CODECS - g_NumCodecs #endif ]; if (propID == NMethodPropID::kDecoderIsAssigned) { NWindows::NCOM::CPropVariant propVariant; propVariant = ci.DecoderIsAssigned; propVariant.Detach(value); return S_OK; } if (propID == NMethodPropID::kEncoderIsAssigned) { NWindows::NCOM::CPropVariant propVariant; propVariant = ci.EncoderIsAssigned; propVariant.Detach(value); return S_OK; } return Libs[ci.LibIndex].GetMethodProperty(ci.CodecIndex, propID, value); }
STDMETHODIMP P7ZipArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant prop; if (propID == kpidIsAnti) { prop = false; prop.Detach(value); return S_OK; } { const CDirItem &dirItem = (*DirItems)[index]; switch(propID) { case kpidPath: prop = dirItem.Name; break; case kpidIsDir: prop = dirItem.isDir(); break; case kpidSize: prop = dirItem.Size; break; case kpidAttrib: prop = dirItem.Attrib; break; case kpidCTime: prop = dirItem.CTime; break; case kpidATime: prop = dirItem.ATime; break; case kpidMTime: prop = dirItem.MTime; break; } } prop.Detach(value); return S_OK; }
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant prop; const CItemEx &item = _items[index]; switch(propID) { case kpidPath: prop = NItemName::GetOSName2(MultiByteToUnicodeString(item.Name, CP_OEMCP)); break; case kpidIsDir: prop = item.IsDir(); break; case kpidSize: prop = item.Size; break; case kpidPackSize: prop = item.GetPackSize(); break; case kpidMTime: if (item.MTime != 0) { FILETIME ft; NTime::UnixTimeToFileTime(item.MTime, ft); prop = ft; } break; case kpidUser: prop = MultiByteToUnicodeString(item.UserName, CP_OEMCP); break; case kpidGroup: prop = MultiByteToUnicodeString(item.GroupName, CP_OEMCP); break; } prop.Detach(value); return S_OK; COM_TRY_END }
STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant propVariant; switch(propID) { case NArchive::kName: propVariant = L"Cab"; break; case NArchive::kClassID: { if ((value->bstrVal = ::SysAllocStringByteLen( (const char *)&CLSID_CCabHandler, sizeof(GUID))) != 0) value->vt = VT_BSTR; return S_OK; } case NArchive::kExtension: propVariant = L"cab"; break; case NArchive::kUpdate: propVariant = false; break; case NArchive::kKeepName: propVariant = false; break; case NArchive::kStartSignature: { const char sig[] = { 0x4D, 0x53, 0x43, 0x46 }; if ((value->bstrVal = ::SysAllocStringByteLen(sig, 4)) != 0) value->vt = VT_BSTR; return S_OK; } } propVariant.Detach(value); return S_OK; }
STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant prop; if (_subArchiveMode) { switch(propID) { case kpidName: prop = _subArchiveName; break; } } else { switch(propID) { case kpidName: prop = _fileInfo.Name; break; case kpidIsDir: prop = _fileInfo.IsDir(); break; case kpidSize: prop = _fileInfo.Size; break; case kpidAttrib: prop = (UInt32)_fileInfo.Attrib; break; case kpidCTime: prop = _fileInfo.CTime; break; case kpidATime: prop = _fileInfo.ATime; break; case kpidMTime: prop = _fileInfo.MTime; break; } } prop.Detach(value); return S_OK; }
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant prop; const CVolumeDescriptor &vol = _archive.VolDescs[_archive.MainVolDescIndex]; switch(propID) { case kpidComment: { AString s; ADD_STRING("System", SystemId); ADD_STRING("Volume", VolumeId); ADD_STRING("VolumeSet", VolumeSetId); ADD_STRING("Publisher", PublisherId); ADD_STRING("Preparer", DataPreparerId); ADD_STRING("Application", ApplicationId); ADD_STRING("Copyright", CopyrightFileId); ADD_STRING("Abstract", AbstractFileId); ADD_STRING("Bib", BibFileId); prop = s; break; } case kpidCTime: { FILETIME utc; if (vol.CTime.GetFileTime(utc)) prop = utc; break; } case kpidMTime: { FILETIME utc; if (vol.MTime.GetFileTime(utc)) prop = utc; break; } // case kpidPhySize: break; // case kpidHeadersSize: break; case kpidError: if (_archive.IncorrectBigEndian) prop = "Incorrect big-endian headers"; break; } prop.Detach(value); return S_OK; COM_TRY_END }
STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant prop; switch(propID) { case kpidPackSize: prop = _packSize; break; } prop.Detach(value); return S_OK; }
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant prop; switch (propID) { case kpidPhySizeCantBeDetected: prop = true; break; } prop.Detach(value); return S_OK; }
STDMETHODIMP CRootFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant prop; switch(propID) { case kpidType: prop = L"RootFolder"; break; case kpidPath: prop = L""; break; } prop.Detach(value); return S_OK; }
STDMETHODIMP CPhysDriveFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant prop; switch(propID) { case kpidType: prop = L"PhysDrive"; break; case kpidPath: prop = (GetFullPath() + L"\\"); break; } prop.Detach(value); return S_OK; }
HRESULT C7ZipCompressCodecsInfo::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { C7ZipCodecInfo * pCodec = dynamic_cast<C7ZipCodecInfo *>(m_CodecInfoArray[index]); if (propID == NMethodPropID::kDecoderIsAssigned) { NWindows::NCOM::CPropVariant propVariant; propVariant = pCodec->DecoderAssigned; propVariant.Detach(value); return S_OK; } if (propID == NMethodPropID::kEncoderIsAssigned) { NWindows::NCOM::CPropVariant propVariant; propVariant = pCodec->EncoderAssigned; propVariant.Detach(value); return S_OK; } return pCodec->Functions->v.GetMethodProperty(pCodec->CodecIndex, propID, value); }
STDMETHODIMP CFSFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant prop; switch(propID) { case kpidType: prop = L"FSFolder"; break; case kpidPath: prop = _path; break; } prop.Detach(value); return S_OK; COM_TRY_END }
STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant prop; switch (propID) { case kpidPath: if (!_name.IsEmpty()) prop = _name; break; case kpidSize: if (_unpackSize_Defined || _inStream) prop = _unpackSize; break; case kpidPackSize: if (_packSize_Defined || _inStream) prop = _packSize; break; } prop.Detach(value); return S_OK; COM_TRY_END }
IMP_IInArchive_Props IMP_IInArchive_ArcProps_NO #define MACH_ARCH_ABI64 0x1000000 #define MACH_MACHINE_386 7 #define MACH_MACHINE_ARM 12 #define MACH_MACHINE_SPARC 14 #define MACH_MACHINE_PPC 18 #define MACH_MACHINE_PPC64 (MACH_MACHINE_PPC | MACH_ARCH_ABI64) #define MACH_MACHINE_AMD64 (MACH_MACHINE_386 | MACH_ARCH_ABI64) STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant prop; const CItem &item = _items[index]; switch(propID) { case kpidExtension: { const wchar_t *ext; if (item.IsTail) ext = L"tail"; else { switch(item.Type) { case MACH_MACHINE_386: ext = L"86"; break; case MACH_MACHINE_ARM: ext = L"arm"; break; case MACH_MACHINE_SPARC: ext = L"sparc"; break; case MACH_MACHINE_PPC: ext = L"ppc"; break; case MACH_MACHINE_PPC64: ext = L"ppc64"; break; case MACH_MACHINE_AMD64: ext = L"x64"; break; default: ext = L"unknown"; break; } } prop = ext; break; } case kpidSize: case kpidPackSize: prop = (UInt64)item.Size; break; } prop.Detach(value); return S_OK; }
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant prop; switch (propID) { case kpidPhySize: if (_phySize != 0) prop = _phySize; break; case kpidErrorFlags: { UInt32 v = 0; if (!_isArc) v |= kpv_ErrorFlags_IsNotArc;; if (_needMoreInput) v |= kpv_ErrorFlags_UnexpectedEnd; if (_dataError) v |= kpv_ErrorFlags_DataError; prop = v; } } prop.Detach(value); return S_OK; }
STDMETHODIMP CFSDrives::GetFolderProperty(PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant prop; switch(propID) { case kpidType: prop = L"FSDrives"; break; case kpidPath: if (_volumeMode) prop = kVolPrefix; else prop = LangString(IDS_COMPUTER, 0x03020300) + UString(WCHAR_PATH_SEPARATOR); break; } prop.Detach(value); return S_OK; COM_TRY_END }
STDMETHODIMP CArchiveOpener::GetProperty(PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant prop; switch(propID) { case kpidName: { QString Name = m_pArchive->m_ArchivePath; int Pos = m_pArchive->m_ArchivePath.lastIndexOf("/"); if(Pos != -1) Name.remove(0,Pos+1); prop = Name.toStdWString().c_str(); break; } default: Q_ASSERT(0); } prop.Detach(value); return S_OK; }
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant prop; const CItemEx &item = _items[index]; switch(propID) { case kpidPath: prop = NItemName::GetOSName(MultiByteToUnicodeString(item.Name, CP_OEMCP)); break; case kpidIsDir: prop = item.IsDir(); break; case kpidSize: case kpidPackSize: prop = (UInt64)item.Size; break; case kpidMTime: { FILETIME utcFileTime; if (item.ModificationTime != 0) NTime::UnixTimeToFileTime(item.ModificationTime, utcFileTime); else { utcFileTime.dwLowDateTime = 0; utcFileTime.dwHighDateTime = 0; } prop = utcFileTime; break; } /* case kpidinode: prop = item.inode; break; case kpidiChkSum: prop = item.ChkSum; break; */ } prop.Detach(value); return S_OK; COM_TRY_END }
STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant propVariant; switch(propID) { case NArchive::kName: propVariant = L"Chm"; break; case NArchive::kClassID: { if ((value->bstrVal = ::SysAllocStringByteLen( (const char *)&CLSID_CChmHandler, sizeof(GUID))) != 0) value->vt = VT_BSTR; return S_OK; } case NArchive::kExtension: propVariant = L"chm chi chq chw hxs hxi hxr hxq hxw lit"; break; case NArchive::kUpdate: propVariant = false; break; case NArchive::kKeepName: propVariant = false; break; case NArchive::kStartSignature: { const char sig[] = { 'I', 'T', 'S', 'F' }; if ((value->bstrVal = ::SysAllocStringByteLen(sig, 4)) != 0) value->vt = VT_BSTR; return S_OK; } case NArchive::kAssociate: { propVariant = false; break; } } propVariant.Detach(value); return S_OK; }
STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant propVariant; switch(propID) { case NArchive::kName: propVariant = L"BZip2"; break; case NArchive::kClassID: { if ((value->bstrVal = ::SysAllocStringByteLen( (const char *)&CLSID_CBZip2Handler, sizeof(GUID))) != 0) value->vt = VT_BSTR; return S_OK; } case NArchive::kExtension: propVariant = L"bz2 bzip2 tbz2 tbz"; break; case NArchive::kAddExtension: propVariant = L"* * .tar .tar"; break; case NArchive::kUpdate: propVariant = true; break; case NArchive::kKeepName: propVariant = true; break; case NArchive::kStartSignature: { const char sig[] = { 'B', 'Z', 'h' }; if ((value->bstrVal = ::SysAllocStringByteLen(sig, 3)) != 0) value->vt = VT_BSTR; return S_OK; } } propVariant.Detach(value); return S_OK; }
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant prop; switch (propID) { case kpidExtension: prop = "mslz"; break; case kpidIsNotArcType: prop = true; break; case kpidPhySize: if (_packSize_Defined) prop = _packSize; break; case kpidErrorFlags: { UInt32 v = 0; if (!_isArc) v |= kpv_ErrorFlags_IsNotArc;; if (_needMoreInput) v |= kpv_ErrorFlags_UnexpectedEnd; if (_dataAfterEnd) v |= kpv_ErrorFlags_DataAfterEnd; prop = v; } } prop.Detach(value); return S_OK; COM_TRY_END }
STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value) { NWindows::NCOM::CPropVariant propVariant; switch(propID) { case NArchive::kName: propVariant = L"Nsis"; break; case NArchive::kClassID: { if ((value->bstrVal = ::SysAllocStringByteLen( (const char *)&CLSID_CNsisHandler, sizeof(GUID))) != 0) value->vt = VT_BSTR; return S_OK; } case NArchive::kExtension: propVariant = L"exe"; break; case NArchive::kUpdate: propVariant = false; break; case NArchive::kStartSignature: { if ((value->bstrVal = ::SysAllocStringByteLen((const char *)NArchive::NNsis::kSignature, NArchive::NNsis::kSignatureSize)) != 0) value->vt = VT_BSTR; return S_OK; } case NArchive::kAssociate: { propVariant = false; break; } } propVariant.Detach(value); return S_OK; }
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant prop; const CBlock &block = _blocks[index]; switch (propID) { case kpidSize: prop = (UInt64)block.Data.GetPos(); break; case kpidVa: prop = block.Offset; break; case kpidPath: { if (_blocks.Size() != 1) { char s[16]; ConvertUInt32ToString(index, s); prop = s; } break; } } prop.Detach(value); return S_OK; COM_TRY_END }
STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN const CUpdatePair2 &updatePair = (*UpdatePairs)[index]; NWindows::NCOM::CPropVariant propVariant; if (propID == kpidIsAnti) { propVariant = updatePair.IsAnti; propVariant.Detach(value); return S_OK; } if (updatePair.IsAnti) { switch(propID) { case kpidIsFolder: case kpidPath: break; case kpidSize: propVariant = (UInt64)0; propVariant.Detach(value); return S_OK; default: propVariant.Detach(value); return S_OK; } } if(updatePair.ExistOnDisk) { const CDirItem &dirItem = (*DirItems)[updatePair.DirItemIndex]; switch(propID) { case kpidPath: propVariant = dirItem.Name; break; case kpidIsFolder: propVariant = dirItem.IsDirectory(); break; case kpidSize: propVariant = dirItem.Size; break; case kpidAttributes: propVariant = dirItem.Attributes; break; case kpidLastAccessTime: propVariant = dirItem.LastAccessTime; break; case kpidCreationTime: propVariant = dirItem.CreationTime; break; case kpidLastWriteTime: propVariant = dirItem.LastWriteTime; break; } } else { if (propID == kpidPath) { if (updatePair.NewNameIsDefined) { propVariant = updatePair.NewName; propVariant.Detach(value); return S_OK; } } if (updatePair.ExistInArchive && Archive) { UInt32 indexInArchive; if (ArchiveItems == 0) indexInArchive = updatePair.ArchiveItemIndex; else indexInArchive = (*ArchiveItems)[updatePair.ArchiveItemIndex].IndexInServer; return Archive->GetProperty(indexInArchive, propID, value); } } propVariant.Detach(value); return S_OK; COM_TRY_END }
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant prop; const CRefItem &refItem = _refItems[index]; const CItemEx &item = _items[refItem.ItemIndex]; switch(propID) { case kpidPath: { UString u; if (item.HasUnicodeName() && !item.UnicodeName.IsEmpty()) u = item.UnicodeName; else u = MultiByteToUnicodeString(item.Name, CP_OEMCP); prop = (const wchar_t *)NItemName::WinNameToOSName(u); break; } case kpidIsFolder: prop = item.IsDirectory(); break; case kpidSize: prop = item.UnPackSize; break; case kpidPackedSize: prop = GetPackSize(index); break; case kpidLastWriteTime: RarTimeToProp(item.LastWriteTime, prop); case kpidCreationTime: if (item.IsCreationTimeDefined) RarTimeToProp(item.CreationTime, prop); break; case kpidLastAccessTime: if (item.IsLastAccessTimeDefined) RarTimeToProp(item.LastAccessTime, prop); break; case kpidAttributes: prop = item.GetWinAttributes(); break; case kpidEncrypted: prop = item.IsEncrypted(); break; case kpidSolid: prop = IsSolid(index); break; case kpidCommented: prop = item.IsCommented(); break; case kpidSplitBefore: prop = item.IsSplitBefore(); break; case kpidSplitAfter: prop = _items[refItem.ItemIndex + refItem.NumItems - 1].IsSplitAfter(); break; case kpidCRC: { const CItemEx &lastItem = _items[refItem.ItemIndex + refItem.NumItems - 1]; prop = ((lastItem.IsSplitAfter()) ? item.FileCRC : lastItem.FileCRC); break; } case kpidUnpackVer: prop = item.UnPackVersion; break; case kpidMethod: { UString method; if (item.Method >= Byte('0') && item.Method <= Byte('5')) { method = L"m"; wchar_t temp[32]; ConvertUInt64ToString(item.Method - Byte('0'), temp); method += temp; if (!item.IsDirectory()) { method += L":"; ConvertUInt64ToString(16 + item.GetDictSize(), temp); method += temp; } } else { wchar_t temp[32]; ConvertUInt64ToString(item.Method, temp); method += temp; } prop = method; break; } case kpidHostOS: prop = (item.HostOS < kNumHostOSes) ? (kHostOS[item.HostOS]) : kUnknownOS; break; } prop.Detach(value); return S_OK; COM_TRY_END }
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant prop; if (index >= (UInt32)_archive.Refs.Size()) { index -= _archive.Refs.Size(); const CBootInitialEntry &be = _archive.BootEntries[index]; switch(propID) { case kpidPath: { // wchar_t name[32]; // ConvertUInt64ToString(index + 1, name); UString s = L"[BOOT]" WSTRING_PATH_SEPARATOR; // s += name; // s += L"-"; s += be.GetName(); prop = (const wchar_t *)s; break; } case kpidIsDir: prop = false; break; case kpidSize: case kpidPackSize: prop = (UInt64)_archive.GetBootItemSize(index); break; } } else { const CRef &ref = _archive.Refs[index]; const CDir &item = ref.Dir->_subItems[ref.Index]; switch(propID) { case kpidPath: // if (item.FileId.GetCapacity() >= 0) { UString s; if (_archive.IsJoliet()) s = item.GetPathU(); else s = MultiByteToUnicodeString(item.GetPath(_archive.IsSusp, _archive.SuspSkipSize), CP_OEMCP); int pos = s.ReverseFind(L';'); if (pos >= 0 && pos == s.Length() - 2) if (s[s.Length() - 1] == L'1') s = s.Left(pos); if (!s.IsEmpty()) if (s[s.Length() - 1] == L'.') s = s.Left(s.Length() - 1); prop = (const wchar_t *)NItemName::GetOSName2(s); } break; case kpidIsDir: prop = item.IsDir(); break; case kpidSize: case kpidPackSize: if (!item.IsDir()) prop = (UInt64)item.DataLength; break; case kpidMTime: { FILETIME utcFileTime; if (item.DateTime.GetFileTime(utcFileTime)) prop = utcFileTime; /* else { utcFileTime.dwLowDateTime = 0; utcFileTime.dwHighDateTime = 0; } */ break; } } } prop.Detach(value); return S_OK; COM_TRY_END }
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant prop; const CItemEx &item = m_Items[index]; switch (propID) { case kpidPath: { UString res; item.GetUnicodeString(item.Name, res, _forceCodePage, _specifiedCodePage); NItemName::ConvertToOSName2(res); prop = res; break; } case kpidIsDir: prop = item.IsDir(); break; case kpidSize: prop = item.Size; break; case kpidPackSize: prop = item.PackSize; break; case kpidTimeType: { FILETIME ft; UInt32 unixTime; UInt32 type; if (item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kMTime, ft)) type = NFileTimeType::kWindows; else if (item.CentralExtra.GetUnixTime(true, NFileHeader::NUnixTime::kMTime, unixTime)) type = NFileTimeType::kUnix; else type = NFileTimeType::kDOS; prop = type; break; } case kpidCTime: { FILETIME ft; if (item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kCTime, ft)) prop = ft; break; } case kpidATime: { FILETIME ft; if (item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kATime, ft)) prop = ft; break; } case kpidMTime: { FILETIME utc; bool defined = true; if (!item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kMTime, utc)) { UInt32 unixTime = 0; if (item.CentralExtra.GetUnixTime(true, NFileHeader::NUnixTime::kMTime, unixTime)) NTime::UnixTimeToFileTime(unixTime, utc); else { FILETIME localFileTime; if (item.Time == 0) defined = false; else if (!NTime::DosTimeToFileTime(item.Time, localFileTime) || !LocalFileTimeToFileTime(&localFileTime, &utc)) utc.dwHighDateTime = utc.dwLowDateTime = 0; } } if (defined) prop = utc; break; } case kpidAttrib: prop = item.GetWinAttrib(); break; case kpidPosixAttrib: { UInt32 attrib; if (item.GetPosixAttrib(attrib)) prop = attrib; break; } case kpidEncrypted: prop = item.IsEncrypted(); break; case kpidComment: { if (item.Comment.Size() != 0) { UString res; item.GetUnicodeString(BytesToString(item.Comment), res, _forceCodePage, _specifiedCodePage); prop = res; } break; } case kpidCRC: if (item.IsThereCrc()) prop = item.Crc; break; case kpidMethod: { UInt16 methodId = item.Method; AString m; if (item.IsEncrypted()) { if (methodId == NFileHeader::NCompressionMethod::kWzAES) { m += kMethod_AES; CWzAesExtra aesField; if (item.CentralExtra.GetWzAes(aesField)) { char s[16]; s[0] = '-'; ConvertUInt32ToString(((unsigned)aesField.Strength + 1) * 64 , s + 1); m += s; methodId = aesField.Method; } } else if (item.IsStrongEncrypted()) { CStrongCryptoExtra f; f.AlgId = 0; if (item.CentralExtra.GetStrongCrypto(f)) { const char *s = FindNameForId(k_StrongCryptoPairs, ARRAY_SIZE(k_StrongCryptoPairs), f.AlgId); if (s) m += s; else { m += kMethod_StrongCrypto; char temp[16]; temp[0] = ':'; ConvertUInt32ToString(f.AlgId, temp + 1); m += temp; } } else m += kMethod_StrongCrypto; } else m += kMethod_ZipCrypto; m += ' '; } { char temp[16]; const char *s = NULL; if (methodId < ARRAY_SIZE(kMethods)) s = kMethods[methodId]; else { s = FindNameForId(k_MethodIdNamePairs, ARRAY_SIZE(k_MethodIdNamePairs), methodId); if (!s) { ConvertUInt32ToString(methodId, temp); s = temp; } } m += s; if (methodId == NFileHeader::NCompressionMethod::kLZMA && item.IsLzmaEOS()) m += ":EOS"; } prop = m; break; } case kpidHostOS: { Byte hostOS = item.GetHostOS(); char temp[16]; const char *s = NULL; if (hostOS < ARRAY_SIZE(kHostOS)) s = kHostOS[hostOS]; else { ConvertUInt32ToString(hostOS, temp); s = temp; } prop = s; break; } case kpidUnpackVer: prop = (UInt32)item.ExtractVersion.Version; break; } prop.Detach(value); return S_OK; COM_TRY_END }
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant propVariant; const CItemEx &item = _items[index]; switch(propID) { case kpidPath: { UString s = NItemName::WinNameToOSName(MultiByteToUnicodeString(item.GetName(), CP_OEMCP)); if (!s.IsEmpty()) { if (s[s.Length() - 1] == WCHAR_PATH_SEPARATOR) s.Delete(s.Length() - 1); propVariant = s; } break; } case kpidIsFolder: propVariant = item.IsDirectory(); break; case kpidSize: propVariant = item.Size; break; case kpidPackedSize: propVariant = item.PackSize; break; case kpidLastWriteTime: { FILETIME utcFileTime; UInt32 unixTime; if (item.GetUnixTime(unixTime)) { NTime::UnixTimeToFileTime(unixTime, utcFileTime); } else { FILETIME localFileTime; if (DosTimeToFileTime(item.ModifiedTime, localFileTime)) { if (!LocalFileTimeToFileTime(&localFileTime, &utcFileTime)) utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; } else utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; } propVariant = utcFileTime; break; } /* case kpidAttributes: propVariant = (UInt32)item.Attributes; break; case kpidCommented: propVariant = item.IsCommented(); break; */ case kpidCRC: propVariant = (UInt32)item.CRC; break; case kpidMethod: { wchar_t method2[kMethodIdSize + 1]; method2[kMethodIdSize] = 0; for (int i = 0; i < kMethodIdSize; i++) method2[i] = item.Method[i]; propVariant = method2; break; } case kpidHostOS: propVariant = GetOS(item.OsId); break; } propVariant.Detach(value); return S_OK; COM_TRY_END }
STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN const CUpdatePair2 &up = (*UpdatePairs)[index]; NWindows::NCOM::CPropVariant prop; if (propID == kpidIsAnti) { prop = up.IsAnti; prop.Detach(value); return S_OK; } if (up.IsAnti) { switch(propID) { case kpidIsDir: case kpidPath: break; case kpidSize: prop = (UInt64)0; prop.Detach(value); return S_OK; default: prop.Detach(value); return S_OK; } } if (up.ExistOnDisk()) { const CDirItem &di = DirItems->Items[up.DirIndex]; switch(propID) { case kpidPath: { if (KeepOriginalItemNames) { if (up.ExistInArchive() && Archive) { UInt32 indexInArchive; if (ArcItems == 0) indexInArchive = up.ArcIndex; else indexInArchive = (*ArcItems)[up.ArcIndex].IndexInServer; return Archive->GetProperty(indexInArchive, propID, value); } } prop = DirItems->GetLogPath(up.DirIndex); break; } case kpidIsDir: prop = di.IsDir(); break; case kpidSize: prop = di.Size; break; case kpidAttrib: prop = di.Attrib; break; case kpidCTime: prop = di.CTime; break; case kpidATime: prop = di.ATime; break; case kpidMTime: prop = di.MTime; break; } } else { if (propID == kpidPath) { if (up.NewNameIndex >= 0) { prop = (*NewNames)[up.NewNameIndex]; prop.Detach(value); return S_OK; } } if (up.ExistInArchive() && Archive) { UInt32 indexInArchive; if (ArcItems == 0) indexInArchive = up.ArcIndex; else indexInArchive = (*ArcItems)[up.ArcIndex].IndexInServer; return Archive->GetProperty(indexInArchive, propID, value); } } prop.Detach(value); return S_OK; COM_TRY_END }
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value) { COM_TRY_BEGIN NWindows::NCOM::CPropVariant prop; const CItemEx &item = m_Items[index]; switch(propID) { case kpidPath: prop = NItemName::GetOSName2(item.GetUnicodeString(item.Name)); break; case kpidIsDir: prop = item.IsDir(); break; case kpidSize: prop = item.UnPackSize; break; case kpidPackSize: prop = item.PackSize; break; case kpidTimeType: { FILETIME utcFileTime; if (item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kTagTime, utcFileTime)) prop = (UInt32)NFileTimeType::kWindows; break; } case kpidCTime: { FILETIME ft; if (item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kCTime, ft)) prop = ft; break; } case kpidATime: { FILETIME ft; if (item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kATime, ft)) prop = ft; break; } case kpidMTime: { FILETIME utcFileTime; if (!item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kMTime, utcFileTime)) { FILETIME localFileTime; if (NTime::DosTimeToFileTime(item.Time, localFileTime)) { if (!LocalFileTimeToFileTime(&localFileTime, &utcFileTime)) utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; } else utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0; } prop = utcFileTime; break; } case kpidAttrib: prop = item.GetWinAttributes(); break; case kpidEncrypted: prop = item.IsEncrypted(); break; case kpidComment: prop = item.GetUnicodeString(BytesToString(item.Comment)); break; case kpidCRC: if (item.IsThereCrc()) prop = item.FileCRC; break; case kpidMethod: { UInt16 methodId = item.CompressionMethod; UString method; if (item.IsEncrypted()) { if (methodId == NFileHeader::NCompressionMethod::kWzAES) { method = kAESMethod; CWzAesExtraField aesField; if (item.CentralExtra.GetWzAesField(aesField)) { method += L"-"; wchar_t s[32]; ConvertUInt64ToString((aesField.Strength + 1) * 64 , s); method += s; method += L" "; methodId = aesField.Method; } } else { if (item.IsStrongEncrypted()) { CStrongCryptoField f; bool finded = false; if (item.CentralExtra.GetStrongCryptoField(f)) { for (int i = 0; i < sizeof(g_StrongCryptoPairs) / sizeof(g_StrongCryptoPairs[0]); i++) { const CStrongCryptoPair &pair = g_StrongCryptoPairs[i]; if (f.AlgId == pair.Id) { method += pair.Name; finded = true; break; } } } if (!finded) method += kStrongCryptoMethod; } else method += kZipCryptoMethod; method += L" "; } } if (methodId < kNumMethods) method += kMethods[methodId]; else switch (methodId) { case NFileHeader::NCompressionMethod::kLZMA: method += kLZMAMethod; if (item.IsLzmaEOS()) method += L":EOS"; break; case NFileHeader::NCompressionMethod::kBZip2: method += kBZip2Method; break; case NFileHeader::NCompressionMethod::kJpeg: method += kJpegMethod; break; case NFileHeader::NCompressionMethod::kWavPack: method += kWavPackMethod; break; case NFileHeader::NCompressionMethod::kPPMd: method += kPPMdMethod; break; default: { wchar_t s[32]; ConvertUInt64ToString(methodId, s); method += s; } } prop = method; break; } case kpidHostOS: prop = (item.MadeByVersion.HostOS < kNumHostOSes) ? (kHostOS[item.MadeByVersion.HostOS]) : kUnknownOS; break; } prop.Detach(value); return S_OK; COM_TRY_END }