mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 14:07:00 -06:00
9.11
This commit is contained in:
committed by
Kornel Lesiński
parent
db5eb6d638
commit
993daef9cb
@@ -44,6 +44,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
||||
{
|
||||
case kpidClusterSize: prop = (UInt32)1 << _db.SectorSizeBits; break;
|
||||
case kpidSectorSize: prop = (UInt32)1 << _db.MiniSectorSizeBits; break;
|
||||
case kpidMainSubfile: if (_db.MainSubfile >= 0) prop = (UInt32)_db.MainSubfile; break;
|
||||
}
|
||||
prop.Detach(value);
|
||||
return S_OK;
|
||||
|
||||
@@ -174,8 +174,9 @@ bool CompoundMsiNameToFileName(const UString &name, UString &resultName)
|
||||
return true;
|
||||
}
|
||||
|
||||
static UString ConvertName(const Byte *p)
|
||||
static UString ConvertName(const Byte *p, bool &isMsi)
|
||||
{
|
||||
isMsi = false;
|
||||
UString s;
|
||||
for (int i = 0; i < kNameSizeMax; i += 2)
|
||||
{
|
||||
@@ -186,10 +187,19 @@ static UString ConvertName(const Byte *p)
|
||||
}
|
||||
UString msiName;
|
||||
if (CompoundMsiNameToFileName(s, msiName))
|
||||
{
|
||||
isMsi = true;
|
||||
return msiName;
|
||||
}
|
||||
return CompoundNameToFileName(s);
|
||||
}
|
||||
|
||||
static UString ConvertName(const Byte *p)
|
||||
{
|
||||
bool isMsi;
|
||||
return ConvertName(p, isMsi);
|
||||
}
|
||||
|
||||
UString CDatabase::GetItemPath(UInt32 index) const
|
||||
{
|
||||
UString s;
|
||||
@@ -207,6 +217,7 @@ UString CDatabase::GetItemPath(UInt32 index) const
|
||||
|
||||
HRESULT CDatabase::Open(IInStream *inStream)
|
||||
{
|
||||
MainSubfile = -1;
|
||||
static const UInt32 kHeaderSize = 512;
|
||||
Byte p[kHeaderSize];
|
||||
RINOK(ReadStream_FALSE(inStream, p, kHeaderSize));
|
||||
@@ -353,7 +364,26 @@ HRESULT CDatabase::Open(IInStream *inStream)
|
||||
}
|
||||
}
|
||||
|
||||
return AddNode(-1, root.SonDid);
|
||||
RINOK(AddNode(-1, root.SonDid));
|
||||
|
||||
unsigned numCabs = 0;
|
||||
for (int i = 0; i < Refs.Size(); i++)
|
||||
{
|
||||
const CItem &item = Items[Refs[i].Did];
|
||||
if (item.IsDir() || numCabs > 1)
|
||||
continue;
|
||||
bool isMsiName;
|
||||
UString msiName = ConvertName(item.Name, isMsiName);
|
||||
if (isMsiName && msiName.Right(4).CompareNoCase(L".cab") == 0)
|
||||
{
|
||||
numCabs++;
|
||||
MainSubfile = i;
|
||||
}
|
||||
}
|
||||
if (numCabs > 1)
|
||||
MainSubfile = -1;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -88,6 +88,8 @@ public:
|
||||
int SectorSizeBits;
|
||||
int MiniSectorSizeBits;
|
||||
|
||||
Int32 MainSubfile;
|
||||
|
||||
void Clear();
|
||||
bool IsLargeStream(UInt64 size) const { return size >= LongStreamMinSize; }
|
||||
UString GetItemPath(UInt32 index) const;
|
||||
|
||||
Reference in New Issue
Block a user