4.41 beta

This commit is contained in:
Igor Pavlov
2006-05-09 00:00:00 +00:00
committed by Kornel Lesiński
parent bd9a40b0ed
commit 631462beb2
19 changed files with 209 additions and 194 deletions

View File

@@ -100,7 +100,11 @@ STDMETHODIMP CHandler::Close()
STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
{
*numItems = _archive.Items.Size() + 1;
*numItems = _archive.Items.Size()
#ifdef NSIS_SCRIPT
+ 1
#endif
;
return S_OK;
}
@@ -179,6 +183,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
{
COM_TRY_BEGIN
NWindows::NCOM::CPropVariant propVariant;
#ifdef NSIS_SCRIPT
if (index >= (UInt32)_archive.Items.Size())
{
switch(propID)
@@ -199,6 +204,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
}
}
else
#endif
{
const CItem &item = _archive.Items[index];
switch(propID)
@@ -277,9 +283,11 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
for(i = 0; i < numItems; i++)
{
UInt32 index = (allFilesMode ? i : indices[i]);
#ifdef NSIS_SCRIPT
if (index >= (UInt32)_archive.Items.Size())
totalSize += _archive.Script.Length();
else
#endif
{
UInt32 size;
if (_archive.IsSolid)
@@ -321,6 +329,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
#ifdef NSIS_SCRIPT
if (index >= (UInt32)_archive.Items.Size())
{
currentItemSize = _archive.Script.Length();
@@ -331,6 +340,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
RINOK(realOutStream->Write((const char *)_archive.Script, (UInt32)_archive.Script.Length(), NULL));
}
else
#endif
{
const CItem &item = _archive.Items[index];

View File

@@ -559,14 +559,54 @@ HRESULT CInArchive::ReadEntries(const CBlockHeader &bh)
e.Which = ReadUInt32();
for (UInt32 j = 0; j < kNumEntryParams; j++)
e.Params[j] = ReadUInt32();
#ifdef NSIS_SCRIPT
if (e.Which != EW_PUSHPOP && e.Which < sizeof(kCommandPairs) / sizeof(kCommandPairs[0]))
{
const CCommandPair &pair = kCommandPairs[e.Which];
Script += pair.Name;
}
#endif
switch (e.Which)
{
case EW_CREATEDIR:
{
prefix.Empty();
prefix = ReadString2(e.Params[0]);
#ifdef NSIS_SCRIPT
Script += " ";
Script += prefix;
#endif
break;
}
case EW_EXTRACTFILE:
{
CItem item;
item.Prefix = prefix;
UInt32 overwriteFlag = e.Params[0];
item.Name = ReadString2(e.Params[1]);
item.Pos = e.Params[2];
item.DateTime.dwLowDateTime = e.Params[3];
item.DateTime.dwHighDateTime = e.Params[4];
UInt32 allowIgnore = e.Params[5];
if (Items.Size() > 0)
{
/*
if (item.Pos == Items.Back().Pos)
continue;
*/
}
Items.Add(item);
#ifdef NSIS_SCRIPT
Script += " ";
Script += item.Name;
#endif
break;
}
#ifdef NSIS_SCRIPT
case EW_UPDATETEXT:
{
Script += " ";
@@ -583,14 +623,6 @@ HRESULT CInArchive::ReadEntries(const CBlockHeader &bh)
Script += UIntToString(e.Params[1]);
break;
}
case EW_CREATEDIR:
{
prefix.Empty();
Script += " ";
prefix = ReadString2(e.Params[0]);
Script += prefix;
break;
}
case EW_IFFILEEXISTS:
{
Script += " ";
@@ -639,28 +671,6 @@ HRESULT CInArchive::ReadEntries(const CBlockHeader &bh)
break;
}
case EW_EXTRACTFILE:
{
CItem item;
item.Prefix = prefix;
UInt32 overwriteFlag = e.Params[0];
item.Name = ReadString2(e.Params[1]);
item.Pos = e.Params[2];
item.DateTime.dwLowDateTime = e.Params[3];
item.DateTime.dwHighDateTime = e.Params[4];
UInt32 allowIgnore = e.Params[5];
if (Items.Size() > 0)
{
/*
if (item.Pos == Items.Back().Pos)
continue;
*/
}
Items.Add(item);
Script += " ";
Script += item.Name;
break;
}
case EW_DELETEFILE:
{
UInt64 flag = e.Params[1];
@@ -871,8 +881,11 @@ HRESULT CInArchive::ReadEntries(const CBlockHeader &bh)
}
Script += e.GetParamsString(numParams);
}
#endif
}
#ifdef NSIS_SCRIPT
Script += kCrLf;
#endif
}
{
@@ -1138,7 +1151,9 @@ HRESULT CInArchive::Open(IInStream *inStream, const UInt64 *maxCheckStartPositio
void CInArchive::Clear()
{
#ifdef NSIS_SCRIPT
Script.Empty();
#endif
Items.Clear();
}

View File

@@ -11,6 +11,8 @@
#include "NsisDecode.h"
// #define NSIS_SCRIPT
namespace NArchive {
namespace NNsis {
@@ -128,7 +130,9 @@ public:
UInt32 DictionarySize;
bool FilterFlag;
#ifdef NSIS_SCRIPT
AString Script;
#endif
UInt32 GetOffset() const { return IsSolid ? 4 : 0; }
UInt64 GetDataPos(int index)
{