This commit is contained in:
Igor Pavlov
2015-01-03 00:00:00 +00:00
committed by Kornel Lesiński
parent 7e021179cd
commit 0713a3ab80
153 changed files with 2744 additions and 1485 deletions

View File

@@ -321,13 +321,13 @@ STDMETHODIMP CHandler::GetRawProp(UInt32 index, PROPID propID, const void **data
if (/* _db.IsTree && propID == kpidName ||
!_db.IsTree && */ propID == kpidPath)
{
const wchar_t *name = _db.GetName(index);
if (name)
if (_db.NameOffsets && _db.NamesBuf)
{
size_t size = (_db.NameOffsets[index + 1] - _db.NameOffsets[index]) * 2;
size_t offset = _db.NameOffsets[index];
size_t size = (_db.NameOffsets[index + 1] - offset) * 2;
if (size < ((UInt32)1 << 31))
{
*data = (void *)name;
*data = (const void *)(_db.NamesBuf + offset * 2);
*dataSize = (UInt32)size;
*propType = NPropDataType::kUtf16z;
}
@@ -607,7 +607,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
}
*/
case kpidPath: return _db.GetPath(index, value);
case kpidPath: return _db.GetPath_Prop(index, value);
#ifndef _SFX
case kpidMethod: return SetMethodToProp(_db.FileIndexToFolderIndexMap[index2], value);
case kpidBlock:

View File

@@ -102,7 +102,7 @@ class CHandler:
{
public:
MY_QUERYINTERFACE_BEGIN2(IInArchive)
// MY_QUERYINTERFACE_ENTRY(IArchiveGetRawProps)
MY_QUERYINTERFACE_ENTRY(IArchiveGetRawProps)
#ifdef __7Z_SET_PROPERTIES
MY_QUERYINTERFACE_ENTRY(ISetProperties)
#endif

View File

@@ -301,10 +301,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
const CFileItem &fi = db->Files[ui.IndexInArchive];
if (!ui.NewProps)
{
NCOM::CPropVariant prop;
RINOK(_db.GetPath(ui.IndexInArchive, &prop));
if (prop.vt == VT_BSTR)
name = prop.bstrVal;
_db.GetPath(ui.IndexInArchive, name);
}
ui.IsDir = fi.IsDir;
ui.Size = fi.Size;

View File

@@ -2,6 +2,12 @@
#include "StdAfx.h"
#ifdef _WIN32
#include <wchar.h>
#else
#include <ctype.h>
#endif
#include "../../../../C/7zCrc.h"
#include "../../../../C/CpuArch.h"
@@ -496,26 +502,83 @@ void CFolders::ParseFolderInfo(unsigned folderIndex, CFolder &folder) const
}
HRESULT CDatabase::GetPath(unsigned index, PROPVARIANT *path) const
void CDatabase::GetPath(unsigned index, UString &path) const
{
path.Empty();
if (!NameOffsets || !NamesBuf)
return;
size_t offset = NameOffsets[index];
size_t size = NameOffsets[index + 1] - offset - 1;
if (size >= (1 << 20))
return;
wchar_t *s = path.GetBuffer((unsigned)size);
const Byte *p = ((const Byte *)NamesBuf + offset * 2);
#if defined(_WIN32) && defined(MY_CPU_LE)
wmemcpy(s, (const wchar_t *)p, size);
#else
for (size_t i = 0; i < size; i++)
{
*s = Get16(p);
p += 2;
s++;
}
#endif
path.ReleaseBuffer((unsigned)size);
}
HRESULT CDatabase::GetPath_Prop(unsigned index, PROPVARIANT *path) const throw()
{
PropVariant_Clear(path);
if (!NameOffsets || !NamesBuf)
return S_OK;
size_t offset = NameOffsets[index];
size_t size = NameOffsets[index + 1] - offset;
if (size >= (1 << 14))
return S_OK;
RINOK(PropVarEm_Alloc_Bstr(path, (unsigned)size - 1));
wchar_t *s = path->bstrVal;
const Byte *p = ((const Byte *)NamesBuf + offset * 2);
for (size_t i = 0; i < size; i++)
{
wchar_t c = Get16(p);
p += 2;
#if WCHAR_PATH_SEPARATOR != L'/'
if (c == L'/')
c = WCHAR_PATH_SEPARATOR;
#endif
*s++ = c;
}
return S_OK;
/*
unsigned cur = index;
unsigned size = 0;
// for (int i = 0;; i++)
for (int i = 0;; i++)
{
size_t len = NameOffsets[cur + 1] - NameOffsets[cur];
size += (unsigned)len;
if (/* i > 256 || */ len > (1 << 12) || size > (1 << 14))
if (i > 256 || len > (1 << 14) || size > (1 << 14))
return PropVarEm_Set_Str(path, "[TOO-LONG]");
/*
cur = Files[cur].Parent;
if (cur < 0)
break;
*/
}
size--;
@@ -539,16 +602,13 @@ HRESULT CDatabase::GetPath(unsigned index, PROPVARIANT *path) const
*s = c;
}
while (--len);
/*
const CFileItem &file = Files[cur];
cur = file.Parent;
if (cur < 0)
*/
return S_OK;
/*
*(--s) = (file.IsAltStream ? ':' : WCHAR_PATH_SEPARATOR);
*/
}
*/
}
void CInArchive::WaitId(UInt64 id)

View File

@@ -111,7 +111,7 @@ struct CDatabase: public CFolders
*/
CByteBuffer NamesBuf;
CObjArray<size_t> NameOffsets; // numFiles + 1, conatins offsets of UINt16 symbols.
CObjArray<size_t> NameOffsets; // numFiles + 1, offsets of utf-16 symbols
/*
void ClearSecure()
@@ -148,14 +148,15 @@ struct CDatabase: public CFolders
bool IsItemAnti(unsigned index) const { return (index < IsAnti.Size() && IsAnti[index]); }
// bool IsItemAux(unsigned index) const { return (index < IsAux.Size() && IsAux[index]); }
const wchar_t * GetName(unsigned index) const
const void * GetName(unsigned index) const
{
if (!NameOffsets || !NamesBuf)
return NULL;
return (const wchar_t *)(const Byte *)NamesBuf + NameOffsets[index];
return (const void *)((const Byte *)NamesBuf + NameOffsets[index] * 2);
};
HRESULT GetPath(unsigned index, PROPVARIANT *path) const;
void GetPath(unsigned index, UString &path) const;
HRESULT GetPath_Prop(unsigned index, PROPVARIANT *path) const throw();
};
struct CInArchiveInfo

View File

@@ -1018,7 +1018,7 @@ HRESULT Update(
else
{
GetFile(*db, ui.IndexInArchive, file, file2);
name = db->GetName(ui.IndexInArchive);
db->GetPath(ui.IndexInArchive, name);
}
/*
@@ -1152,7 +1152,8 @@ HRESULT Update(
CFileItem file;
CFileItem2 file2;
GetFile(*db, fi, file, file2);
UString name = db->GetName(fi);
UString name;
db->GetPath(fi, name);
if (file.HasStream)
{
indexInFolder++;
@@ -1278,7 +1279,7 @@ HRESULT Update(
else
{
GetFile(*db, ui.IndexInArchive, file, file2);
name = db->GetName(ui.IndexInArchive);
db->GetPath(ui.IndexInArchive, name);
}
if (file2.IsAnti || file.IsDir)
return E_FAIL;

View File

@@ -114,6 +114,7 @@ API_FUNC_static_IsArc IsArc_Apm(const Byte *p, size_t size)
return k_IsArc_Res_NO;
return k_IsArc_Res_YES;
}
}
HRESULT CHandler::ReadTables(IInStream *stream)
{

View File

@@ -15,7 +15,7 @@ static unsigned g_NumArcs = 0;
static unsigned g_DefaultArcIndex = 0;
static const CArcInfo *g_Arcs[kNumArcsMax];
void RegisterArc(const CArcInfo *arcInfo)
void RegisterArc(const CArcInfo *arcInfo) throw()
{
if (g_NumArcs < kNumArcsMax)
{

View File

@@ -160,6 +160,7 @@ API_FUNC_static_IsArc IsArc_Arj(const Byte *p, size_t size)
return k_IsArc_Res_YES;
}
}
static HRESULT ReadString(const Byte *p, unsigned &size, AString &res)
{

View File

@@ -131,6 +131,7 @@ API_FUNC_static_IsArc IsArc_BZip2(const Byte *p, size_t size)
return k_IsArc_Res_YES;
return k_IsArc_Res_NO;
}
}
STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 *, IArchiveOpenCallback *)
{

View File

@@ -15,14 +15,19 @@ class CMultiStream:
UInt64 _pos;
UInt64 _totalLength;
unsigned _streamIndex;
public:
struct CSubStreamInfo
{
CMyComPtr<IInStream> Stream;
UInt64 Size;
UInt64 GlobalOffset;
UInt64 LocalPos;
CSubStreamInfo(): Size(0), GlobalOffset(0), LocalPos(0) {}
};
CObjectVector<CSubStreamInfo> Streams;
HRESULT Init()

View File

@@ -120,10 +120,10 @@ struct CItem
UInt64 HeaderPos;
bool IsBin() const { return Type == k_Type_BinLe || Type == k_Type_BinBe; }
bool IsCrcFormat() const { return Type == k_Type_HexCrc; };
bool IsCrcFormat() const { return Type == k_Type_HexCrc; }
bool IsDir() const { return (Mode & 0170000) == 0040000; }
bool IsTrailer() const { return strcmp(Name, kName_TRAILER) == 0; }
UInt64 GetDataPosition() const { return HeaderPos + HeaderSize; };
UInt64 GetDataPosition() const { return HeaderPos + HeaderSize; }
};
enum EErrorType
@@ -273,6 +273,7 @@ API_FUNC_static_IsArc IsArc_Cpio(const Byte *p, size_t size)
return k_IsArc_Res_NO;
return k_IsArc_Res_YES;
}
}
#define READ_STREAM(_dest_, _size_) \
{ size_t processed = (_size_); RINOK(Read(_dest_, &processed)); \

View File

@@ -2,6 +2,10 @@
#include "StdAfx.h"
#if defined(_7ZIP_LARGE_PAGES)
#include "../../../C/Alloc.h"
#endif
#include "../../Common/MyInitGuid.h"
#include "../../Common/ComTry.h"
@@ -40,7 +44,7 @@ STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
STDAPI SetLargePageMode()
{
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
#if defined(_7ZIP_LARGE_PAGES)
SetLargePageSize();
#endif
return S_OK;

View File

@@ -4,7 +4,7 @@
#include "../../Common/MyInitGuid.h"
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
#if defined(_7ZIP_LARGE_PAGES)
#include "../../../C/Alloc.h"
#endif
@@ -67,7 +67,7 @@ STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
STDAPI SetLargePageMode()
{
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
#if defined(_7ZIP_LARGE_PAGES)
SetLargePageSize();
#endif
return S_OK;

View File

@@ -641,8 +641,8 @@ static const STATPROPSTG kProps[] =
{ NULL, kpidVa, VT_UI8 },
{ NULL, kpidType, VT_BSTR },
{ NULL, kpidCharacts, VT_BSTR }
, { L"Link Section", kpidLinkSection, VT_BSTR}
, { L"Info Section", kpidInfoSection, VT_BSTR}
, { (LPOLESTR)L"Link Section", kpidLinkSection, VT_BSTR}
, { (LPOLESTR)L"Info Section", kpidInfoSection, VT_BSTR}
};
IMP_IInArchive_Props_WITH_NAME

View File

@@ -118,6 +118,7 @@ API_FUNC_static_IsArc IsArc_Fat(const Byte *p, size_t size)
CHeader h;
return h.Parse(p) ? k_IsArc_Res_YES : k_IsArc_Res_NO;
}
}
bool CHeader::Parse(const Byte *p)
{
@@ -801,12 +802,12 @@ static const STATPROPSTG kArcProps[] =
{ NULL, kpidMTime, VT_FILETIME},
{ NULL, kpidVolumeName, VT_BSTR},
{ L"FATs", kpidNumFats, VT_UI4},
{ (LPOLESTR)L"FATs", kpidNumFats, VT_UI4},
{ NULL, kpidSectorSize, VT_UI4},
{ NULL, kpidId, VT_UI4},
// { L"OEM Name", kpidOemName, VT_BSTR},
// { L"Volume Name", kpidVolName, VT_BSTR},
// { L"File System Type", kpidFileSysType, VT_BSTR}
// { (LPOLESTR)L"OEM Name", kpidOemName, VT_BSTR},
// { (LPOLESTR)L"Volume Name", kpidVolName, VT_BSTR},
// { (LPOLESTR)L"File System Type", kpidFileSysType, VT_BSTR}
// { NULL, kpidSectorsPerTrack, VT_UI4},
// { NULL, kpidNumHeads, VT_UI4},
// { NULL, kpidHiddenSectors, VT_UI4}

View File

@@ -318,6 +318,7 @@ API_FUNC_static_IsArc IsArc_Gz(const Byte *p, size_t size)
return Is_Deflate(p, size);
}
}
HRESULT CItem::ReadHeader(NDecoder::CCOMCoder *stream)
{

View File

@@ -183,17 +183,26 @@ Notes:
Some IInArchive handlers will work incorrectly in that case.
*/
/* MSVC allows the code where there is throw() in declaration of function,
but there is no throw() in definition of function. */
#ifdef _MSC_VER
#define MY_NO_THROW_DECL_ONLY throw()
#else
#define MY_NO_THROW_DECL_ONLY
#endif
#define INTERFACE_IInArchive(x) \
STDMETHOD(Open)(IInStream *stream, const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *openCallback) throw() x; \
STDMETHOD(Close)() throw() x; \
STDMETHOD(GetNumberOfItems)(UInt32 *numItems) throw() x; \
STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) throw() x; \
STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, Int32 testMode, IArchiveExtractCallback *extractCallback) throw() x; \
STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value) throw() x; \
STDMETHOD(GetNumberOfProperties)(UInt32 *numProps) throw() x; \
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) throw() x; \
STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProps) throw() x; \
STDMETHOD(GetArchivePropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) throw() x;
STDMETHOD(Open)(IInStream *stream, const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *openCallback) MY_NO_THROW_DECL_ONLY x; \
STDMETHOD(Close)() MY_NO_THROW_DECL_ONLY x; \
STDMETHOD(GetNumberOfItems)(UInt32 *numItems) MY_NO_THROW_DECL_ONLY x; \
STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) MY_NO_THROW_DECL_ONLY x; \
STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, Int32 testMode, IArchiveExtractCallback *extractCallback) MY_NO_THROW_DECL_ONLY x; \
STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value) MY_NO_THROW_DECL_ONLY x; \
STDMETHOD(GetNumberOfProperties)(UInt32 *numProps) MY_NO_THROW_DECL_ONLY x; \
STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) MY_NO_THROW_DECL_ONLY x; \
STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProps) MY_NO_THROW_DECL_ONLY x; \
STDMETHOD(GetArchivePropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) MY_NO_THROW_DECL_ONLY x;
ARCHIVE_INTERFACE(IInArchive, 0x60)
{
@@ -444,7 +453,7 @@ ARCHIVE_INTERFACE(IArchiveAllowTail, 0x05)
// #define k_IsArc_Res_YES_LOW_PROB 3
#define API_FUNC_IsArc EXTERN_C UInt32 WINAPI
#define API_FUNC_static_IsArc EXTERN_C static UInt32 WINAPI
#define API_FUNC_static_IsArc extern "C" { static UInt32 WINAPI
extern "C"
{

View File

@@ -219,6 +219,7 @@ API_FUNC_static_IsArc IsArc_Ihex(const Byte *p, size_t size)
return k_IsArc_Res_YES;
}
}
STDMETHODIMP CHandler::Open(IInStream *stream, const UInt64 *, IArchiveOpenCallback *)
{

View File

@@ -88,7 +88,7 @@ static void AddString(AString &s, const char *name, const Byte *p, unsigned size
}
}
#define ADD_STRING(n, v) AddString(s, n, vol. ## v, sizeof(vol. ## v))
#define ADD_STRING(n, v) AddString(s, n, vol. v, sizeof(vol. v))
static void AddErrorMessage(AString &s, const char *message)
{

View File

@@ -73,6 +73,7 @@ API_FUNC_static_IsArc IsArc_Lzh(const Byte *p, size_t size)
return k_IsArc_Res_NO;
return k_IsArc_Res_YES;
}
}
struct CItem
{

View File

@@ -332,6 +332,7 @@ API_FUNC_static_IsArc IsArc_Lzma(const Byte *p, size_t size)
return k_IsArc_Res_NO;
return k_IsArc_Res_YES;
}
}
API_FUNC_static_IsArc IsArc_Lzma86(const Byte *p, size_t size)
{
@@ -342,6 +343,7 @@ API_FUNC_static_IsArc IsArc_Lzma86(const Byte *p, size_t size)
return k_IsArc_Res_NO;
return IsArc_Lzma(p + 1, size - 1);
}
}
STDMETHODIMP CHandler::Open(IInStream *inStream, const UInt64 *, IArchiveOpenCallback *)
{

View File

@@ -342,9 +342,9 @@ static const STATPROPSTG kProps[] =
{ NULL, kpidSize, VT_UI8},
{ NULL, kpidFileSystem, VT_BSTR},
{ NULL, kpidOffset, VT_UI8},
{ L"Primary", kpidPrimary, VT_BOOL},
{ L"Begin CHS", kpidBegChs, VT_BSTR},
{ L"End CHS", kpidEndChs, VT_BSTR}
{ (LPOLESTR)L"Primary", kpidPrimary, VT_BOOL},
{ (LPOLESTR)L"Begin CHS", kpidBegChs, VT_BSTR},
{ (LPOLESTR)L"End CHS", kpidEndChs, VT_BSTR}
};
IMP_IInArchive_Props_WITH_NAME

View File

@@ -63,7 +63,7 @@ public:
}
HRESULT CDecoder::SetToPos(UInt64 pos, ICompressProgressInfo *progress); // for solid
HRESULT SetToPos(UInt64 pos, ICompressProgressInfo *progress); // for solid
HRESULT Decode(CByteBuffer *outBuf, bool unpackSizeDefined, UInt32 unpackSize,
ISequentialOutStream *realOutStream, ICompressProgressInfo *progress,
UInt32 &packSizeRes, UInt32 &unpackSizeRes);

View File

@@ -582,13 +582,13 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
if (!dataError)
{
UInt32 unpackSize = 0;
bool unpackSize_Defined = false;
// UInt32 unpackSize = 0;
// bool unpackSize_Defined = false;
bool writeToTemp1 = writeToTemp;
if (item.IsUninstaller)
{
unpackSize = item.PatchSize;
unpackSize_Defined = true;
// unpackSize = item.PatchSize;
// unpackSize_Defined = true;
if (!readFromTemp)
writeToTemp = true;
writeToTemp1 = writeToTemp;

View File

@@ -3777,7 +3777,7 @@ HRESULT CInArchive::ReadEntries(const CBlockHeader &bh)
for (UInt32 j = i - 1; j >= kkk + 3; j--)
{
const Byte *pCmd = p - kCmdSize * (kkk - j);
const Byte *pCmd = p + kCmdSize * (j - kkk);
AddParam(GET_CMD_PARAM(pCmd, 0));
}
NewLine();

View File

@@ -97,11 +97,11 @@ bool CHeader::Parse(const Byte *p)
if (p[0x1FE] != 0x55 || p[0x1FF] != 0xAA)
return false;
int codeOffset = 0;
// int codeOffset = 0;
switch (p[0])
{
case 0xE9: codeOffset = 3 + (Int16)Get16(p + 1); break;
case 0xEB: if (p[2] != 0x90) return false; codeOffset = 2 + (int)(signed char)p[1]; break;
case 0xE9: /* codeOffset = 3 + (Int16)Get16(p + 1); */ break;
case 0xEB: if (p[2] != 0x90) return false; /* codeOffset = 2 + (int)(signed char)p[1]; */ break;
default: return false;
}
unsigned sectorsPerClusterLog;
@@ -2175,20 +2175,20 @@ static const STATPROPSTG kProps[] =
// { NULL, kpidLink, VT_BSTR},
// { L"Link 2", kpidLink2, VT_BSTR},
// { L"Link Type", kpidLinkType, VT_UI2},
// { (LPOLESTR)L"Link 2", kpidLink2, VT_BSTR},
// { (LPOLESTR)L"Link Type", kpidLinkType, VT_UI2},
{ NULL, kpidINode, VT_UI8},
{ NULL, kpidMTime, VT_FILETIME},
{ NULL, kpidCTime, VT_FILETIME},
{ NULL, kpidATime, VT_FILETIME},
// { L"Record Modified", kpidRecMTime, VT_FILETIME},
// { (LPOLESTR)L"Record Modified", kpidRecMTime, VT_FILETIME},
// { L"Modified 2", kpidMTime2, VT_FILETIME},
// { L"Created 2", kpidCTime2, VT_FILETIME},
// { L"Accessed 2", kpidATime2, VT_FILETIME},
// { L"Record Modified 2", kpidRecMTime2, VT_FILETIME},
// { (LPOLESTR)L"Modified 2", kpidMTime2, VT_FILETIME},
// { (LPOLESTR)L"Created 2", kpidCTime2, VT_FILETIME},
// { (LPOLESTR)L"Accessed 2", kpidATime2, VT_FILETIME},
// { (LPOLESTR)L"Record Modified 2", kpidRecMTime2, VT_FILETIME},
{ NULL, kpidAttrib, VT_UI4},
{ NULL, kpidNumBlocks, VT_UI4},
@@ -2223,7 +2223,7 @@ static const STATPROPSTG kArcProps[] =
{ NULL, kpidFileSystem, VT_BSTR},
{ NULL, kpidClusterSize, VT_UI4},
{ NULL, kpidSectorSize, VT_UI4},
{ L"Record Size", kpidRecordSize, VT_UI4},
{ (LPOLESTR)L"Record Size", kpidRecordSize, VT_UI4},
{ NULL, kpidHeadersSize, VT_UI8},
{ NULL, kpidCTime, VT_FILETIME},
{ NULL, kpidId, VT_UI8},

View File

@@ -784,27 +784,27 @@ static const STATPROPSTG kArcProps[] =
{ NULL, kpidChecksum, VT_UI4},
{ NULL, kpidName, VT_BSTR},
{ L"Image Size", kpidImageSize, VT_UI4},
{ L"Section Alignment", kpidSectAlign, VT_UI4},
{ L"File Alignment", kpidFileAlign, VT_UI4},
{ L"Code Size", kpidCodeSize, VT_UI4},
{ L"Initialized Data Size", kpidInitDataSize, VT_UI4},
{ L"Uninitialized Data Size", kpidUnInitDataSize, VT_UI4},
{ L"Linker Version", kpidLinkerVer, VT_BSTR},
{ L"OS Version", kpidOsVer, VT_BSTR},
{ L"Image Version", kpidImageVer, VT_BSTR},
{ L"Subsystem Version", kpidSubsysVer, VT_BSTR},
{ L"Subsystem", kpidSubSystem, VT_BSTR},
{ L"DLL Characteristics", kpidDllCharacts, VT_BSTR},
{ L"Stack Reserve", kpidStackReserve, VT_UI8},
{ L"Stack Commit", kpidStackCommit, VT_UI8},
{ L"Heap Reserve", kpidHeapReserve, VT_UI8},
{ L"Heap Commit", kpidHeapCommit, VT_UI8},
{ L"Image Base", kpidImageBase, VT_UI8},
{ (LPOLESTR)L"Image Size", kpidImageSize, VT_UI4},
{ (LPOLESTR)L"Section Alignment", kpidSectAlign, VT_UI4},
{ (LPOLESTR)L"File Alignment", kpidFileAlign, VT_UI4},
{ (LPOLESTR)L"Code Size", kpidCodeSize, VT_UI4},
{ (LPOLESTR)L"Initialized Data Size", kpidInitDataSize, VT_UI4},
{ (LPOLESTR)L"Uninitialized Data Size", kpidUnInitDataSize, VT_UI4},
{ (LPOLESTR)L"Linker Version", kpidLinkerVer, VT_BSTR},
{ (LPOLESTR)L"OS Version", kpidOsVer, VT_BSTR},
{ (LPOLESTR)L"Image Version", kpidImageVer, VT_BSTR},
{ (LPOLESTR)L"Subsystem Version", kpidSubsysVer, VT_BSTR},
{ (LPOLESTR)L"Subsystem", kpidSubSystem, VT_BSTR},
{ (LPOLESTR)L"DLL Characteristics", kpidDllCharacts, VT_BSTR},
{ (LPOLESTR)L"Stack Reserve", kpidStackReserve, VT_UI8},
{ (LPOLESTR)L"Stack Commit", kpidStackCommit, VT_UI8},
{ (LPOLESTR)L"Heap Reserve", kpidHeapReserve, VT_UI8},
{ (LPOLESTR)L"Heap Commit", kpidHeapCommit, VT_UI8},
{ (LPOLESTR)L"Image Base", kpidImageBase, VT_UI8},
{ NULL, kpidComment, VT_BSTR},
// { L"Address Of Entry Point", kpidAddressOfEntryPoint, VT_UI8},
// { L"Base Of Code", kpidBaseOfCode, VT_UI8},
// { L"Base Of Data", kpidBaseOfData32, VT_UI8},
// { (LPOLESTR)L"Address Of Entry Point", kpidAddressOfEntryPoint, VT_UI8},
// { (LPOLESTR)L"Base Of Code", kpidBaseOfCode, VT_UI8},
// { (LPOLESTR)L"Base Of Data", kpidBaseOfData32, VT_UI8},
};
static const Byte kProps[] =
@@ -2089,6 +2089,7 @@ API_FUNC_static_IsArc IsArc_Pe(const Byte *p, size_t size)
return k_IsArc_Res_NO;
return k_IsArc_Res_YES;
}
}
HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
{
@@ -2719,6 +2720,7 @@ API_FUNC_static_IsArc IsArc_Te(const Byte *p, size_t size)
return k_IsArc_Res_NO;
return k_IsArc_Res_YES;
}
}
struct CSection
@@ -2799,8 +2801,8 @@ static const STATPROPSTG kArcProps[] =
{
// { NULL, kpidHeadersSize, VT_UI4 },
{ NULL, kpidCpu, VT_BSTR},
{ L"Subsystem", kpidSubSystem, VT_BSTR },
// { L"Image Base", kpidImageBase, VT_UI8 }
{ (LPOLESTR)L"Subsystem", kpidSubSystem, VT_BSTR },
// { (LPOLESTR)L"Image Base", kpidImageBase, VT_UI8 }
};
IMP_IInArchive_Props

View File

@@ -359,7 +359,7 @@ static int ReadTime(const Byte *p, unsigned size, Byte mask, CRarTime &rarTime)
#define READ_TIME_2(_mask_, _def_, _ttt_) \
_def_ = ((_mask_ & 8) != 0); if (_def_) \
{ if (size < 4) return false; \
_ttt_ ## .DosTime = Get32(p); p += 4; size -= 4; \
_ttt_ .DosTime = Get32(p); p += 4; size -= 4; \
READ_TIME(_mask_, _ttt_); } \
bool CInArchive::ReadHeaderReal(const Byte *p, unsigned size, CItem &item)

View File

@@ -801,6 +801,8 @@ struct CItem
int Node;
int Parent;
UInt32 Ptr;
CItem(): Node(-1), Parent(-1), Ptr(0) {}
};
struct CData
@@ -1198,7 +1200,7 @@ HRESULT CHandler::Decompress(ISequentialOutStream *outStream, Byte *outBuf, bool
{
ECoderStatus status;
XzUnpacker_Init(&_xz);
SRes res = XzUnpacker_Code(&_xz, dest, &destLen, _inputBuffer, &srcLen, LZMA_FINISH_END, &status);
SRes res = XzUnpacker_Code(&_xz, dest, &destLen, _inputBuffer, &srcLen, CODER_FINISH_END, &status);
if (res != 0)
return SResToHRESULT(res);
if (status != CODER_STATUS_NEEDS_MORE_INPUT || !XzUnpacker_IsStreamWasFinished(&_xz))

View File

@@ -61,6 +61,7 @@ API_FUNC_static_IsArc IsArc_Swf(const Byte *p, size_t size)
return k_IsArc_Res_NO;
return k_IsArc_Res_YES;
}
}
API_FUNC_static_IsArc IsArc_Swfc(const Byte *p, size_t size)
{
@@ -100,6 +101,7 @@ API_FUNC_static_IsArc IsArc_Swfc(const Byte *p, size_t size)
return k_IsArc_Res_YES;
}
}
struct CItem
{

View File

@@ -226,6 +226,7 @@ STDMETHODIMP CHandler::OpenSeq(ISequentialInStream *stream)
{
Close();
_seqStream = stream;
_isArc = true;
return S_OK;
}

View File

@@ -556,7 +556,7 @@ struct CCapsuleHeader
UInt32 OffsetToLongDescription;
UInt32 OffsetToApplicableDevices;
void Clear() { memset(this, 0, sizeof(this)); }
void Clear() { memset(this, 0, sizeof(*this)); }
void Parse(const Byte *p)
{

View File

@@ -612,10 +612,10 @@ static const STATPROPSTG kArcProps[] =
{ NULL, kpidCTime, VT_FILETIME},
{ NULL, kpidClusterSize, VT_UI8},
{ NULL, kpidMethod, VT_BSTR},
{ L"Parent", kpidParent, VT_BSTR},
{ (LPOLESTR)L"Parent", kpidParent, VT_BSTR},
{ NULL, kpidCreatorApp, VT_BSTR},
{ NULL, kpidHostOS, VT_BSTR},
{ L"Saved State", kpidSavedState, VT_BOOL},
{ (LPOLESTR)L"Saved State", kpidSavedState, VT_BOOL},
{ NULL, kpidId, VT_BSTR}
};

View File

@@ -63,8 +63,8 @@ static const STATPROPSTG kArcProps[] =
{ NULL, kpidIsVolume, VT_BOOL},
{ NULL, kpidVolume, VT_UI4},
{ NULL, kpidNumVolumes, VT_UI4},
{ L"Images", kpidNumImages, VT_UI4},
{ L"Boot Image", kpidBootImage, VT_UI4}
{ (LPOLESTR)L"Images", kpidNumImages, VT_UI4},
{ (LPOLESTR)L"Boot Image", kpidBootImage, VT_UI4}
};
static const char *kMethodLZX = "LZX";

View File

@@ -100,6 +100,7 @@ API_FUNC_static_IsArc IsArc_Z(const Byte *p, size_t size)
return k_IsArc_Res_NO;
return k_IsArc_Res_YES;
}
}
STDMETHODIMP CHandler::Open(IInStream *stream,
const UInt64 * /* maxCheckStartPosition */,