This commit is contained in:
Igor Pavlov
2005-12-04 00:00:00 +00:00
committed by Kornel Lesiński
parent e18587ba51
commit acac987575
19 changed files with 239 additions and 134 deletions

View File

@@ -140,11 +140,20 @@ private:
bool _encryptHeaders;
bool _copyMode;
UInt32 _defaultDicSize;
UInt32 _defaultAlgorithm;
UInt32 _defaultFastBytes;
UString _defaultMatchFinder;
UInt32 _defaultBZip2Passes;
UInt32 _defaultPpmdMemSize;
UInt32 _defaultPpmdOrder;
UInt32 _defaultDeflateFastBytes;
UInt32 _defaultDeflatePasses;
bool _autoFilter;
bool _multiThread;
UInt32 _level;
@@ -219,11 +228,20 @@ private:
_encryptHeaders = false;
_multiThread = false;
_copyMode = false;
_defaultDicSize = (1 << 21);
_defaultBZip2Passes = 1;
_defaultAlgorithm = 1;
_defaultFastBytes = 32;
_defaultMatchFinder = L"BT4";
_defaultBZip2Passes = 1;
_defaultPpmdMemSize = (1 << 24);
_defaultPpmdOrder = 6;
_defaultDeflateFastBytes = 32;
_defaultDeflatePasses = 1;
_level = 5;
_autoFilter = true;
_volumeMode = false;

View File

@@ -63,6 +63,9 @@ static CMethodID k_BZip2 = { { 0x4, 0x2, 0x2 }, 3 };
const wchar_t *kCopyMethod = L"Copy";
const wchar_t *kLZMAMethodName = L"LZMA";
const wchar_t *kBZip2MethodName = L"BZip2";
const wchar_t *kPpmdMethodName = L"PPMd";
const wchar_t *kDeflateMethodName = L"Deflate";
const wchar_t *kDeflate64MethodName = L"Deflate64";
const UInt32 kAlgorithmForX7 = 2;
const UInt32 kDicSizeForX7 = 1 << 23;
@@ -77,6 +80,18 @@ const UInt32 kAlgorithmForFast = 0;
const UInt32 kDicSizeForFast = 1 << 15;
static const wchar_t *kMatchFinderForFast = L"HC3";
const UInt32 kPpmdMemSizeX1 = (1 << 22);
const UInt32 kPpmdOrderX1 = 4;
const UInt32 kPpmdMemSizeX7 = (1 << 26);
const UInt32 kPpmdOrderX7 = 16;
const UInt32 kPpmdMemSizeX9 = (192 << 20);
const UInt32 kPpmdOrderX9 = 32;
const UInt32 kDeflateFastBytesForX7 = 64;
const UInt32 kDeflatePassesForX7 = 3;
const wchar_t *kDefaultMethodName = kLZMAMethodName;
static const wchar_t *kMatchFinderForHeaders = L"BT2";
@@ -91,6 +106,13 @@ static bool IsLZMethod(const UString &methodName)
static bool IsBZip2Method(const UString &methodName)
{ return (methodName.CompareNoCase(kBZip2MethodName) == 0); }
static bool IsPpmdMethod(const UString &methodName)
{ return (methodName.CompareNoCase(kPpmdMethodName) == 0); }
static bool IsDeflateMethod(const UString &methodName)
{ return (methodName.CompareNoCase(kDeflateMethodName) == 0) ||
(methodName.CompareNoCase(kDeflate64MethodName) == 0); }
STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type)
{
*type = NFileTimeType::kWindows;
@@ -262,27 +284,28 @@ HRESULT CHandler::SetCompressionMethod(
if (oneMethodInfo.MethodName.IsEmpty())
oneMethodInfo.MethodName = kDefaultMethodName;
if (IsLZMethod(oneMethodInfo.MethodName))
{
if (IsLZMAMethod(oneMethodInfo.MethodName))
{
SetOneMethodProp(oneMethodInfo,
NCoderPropID::kDictionarySize, _defaultDicSize);
SetOneMethodProp(oneMethodInfo,
NCoderPropID::kAlgorithm, _defaultAlgorithm);
SetOneMethodProp(oneMethodInfo,
NCoderPropID::kNumFastBytes, _defaultFastBytes);
SetOneMethodProp(oneMethodInfo,
NCoderPropID::kMatchFinder, (const wchar_t *)_defaultMatchFinder);
SetOneMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, _defaultDicSize);
SetOneMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, _defaultAlgorithm);
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, _defaultFastBytes);
SetOneMethodProp(oneMethodInfo, NCoderPropID::kMatchFinder, (const wchar_t *)_defaultMatchFinder);
if (multiThread)
SetOneMethodProp(oneMethodInfo,
NCoderPropID::kMultiThread, true);
SetOneMethodProp(oneMethodInfo, NCoderPropID::kMultiThread, true);
}
else if (IsDeflateMethod(oneMethodInfo.MethodName))
{
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, _defaultDeflateFastBytes);
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, _defaultDeflatePasses);
}
else if (IsBZip2Method(oneMethodInfo.MethodName))
{
SetOneMethodProp(oneMethodInfo,
NCoderPropID::kNumPasses, _defaultBZip2Passes);
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, _defaultBZip2Passes);
}
else if (IsPpmdMethod(oneMethodInfo.MethodName))
{
SetOneMethodProp(oneMethodInfo, NCoderPropID::kUsedMemorySize, _defaultPpmdMemSize);
SetOneMethodProp(oneMethodInfo, NCoderPropID::kOrder, _defaultPpmdOrder);
}
@@ -999,6 +1022,9 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
_defaultDicSize = kDicSizeForFast;
_defaultMatchFinder = kMatchFinderForFast;
_defaultBZip2Passes = 1;
_defaultPpmdMemSize = kPpmdMemSizeX1;
_defaultPpmdOrder = kPpmdOrderX1;
}
else if (_level < 7)
{
@@ -1011,6 +1037,12 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
_defaultDicSize = kDicSizeForX7;
_defaultFastBytes = kFastBytesForX7;
_defaultBZip2Passes = 2;
_defaultPpmdMemSize = kPpmdMemSizeX7;
_defaultPpmdOrder = kPpmdOrderX7;
_defaultDeflateFastBytes = kDeflateFastBytesForX7;
_defaultDeflatePasses = kDeflatePassesForX7;
}
else
{
@@ -1019,6 +1051,12 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
_defaultFastBytes = kFastBytesForX9;
_defaultMatchFinder = kMatchFinderForX9;
_defaultBZip2Passes = 7;
_defaultPpmdMemSize = kPpmdMemSizeX9;
_defaultPpmdOrder = kPpmdOrderX9;
_defaultDeflateFastBytes = kDeflateFastBytesForX7;
_defaultDeflatePasses = kDeflatePassesForX7;
}
continue;
}

View File

@@ -7,6 +7,10 @@
/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
#ifdef _SZ_ALLOC_DEBUG
#ifdef _WIN32
#include <windows.h>
#endif
#include <stdio.h>
int g_allocCount = 0;
int g_allocCountTemp = 0;
@@ -42,6 +46,9 @@ void *SzAllocTemp(size_t size)
#ifdef _SZ_ALLOC_DEBUG
fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTemp);
g_allocCountTemp++;
#ifdef _WIN32
return HeapAlloc(GetProcessHeap(), 0, size);
#endif
#endif
return malloc(size);
}
@@ -54,6 +61,10 @@ void SzFreeTemp(void *address)
g_allocCountTemp--;
fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp);
}
#ifdef _WIN32
HeapFree(GetProcessHeap(), 0, address);
return;
#endif
#endif
free(address);
}

View File

@@ -380,12 +380,12 @@ SZ_RESULT SzWaitAttribute(CSzData *sd, UInt64 attribute)
}
}
SZ_RESULT SzReadBoolVector(CSzData *sd, size_t numItems, int **v, void * (*allocFunc)(size_t size))
SZ_RESULT SzReadBoolVector(CSzData *sd, size_t numItems, Byte **v, void * (*allocFunc)(size_t size))
{
Byte b = 0;
Byte mask = 0;
size_t i;
RINOK(MySzInAlloc((void **)v, numItems * sizeof(int), allocFunc));
RINOK(MySzInAlloc((void **)v, numItems * sizeof(Byte), allocFunc));
for(i = 0; i < numItems; i++)
{
if (mask == 0)
@@ -393,20 +393,20 @@ SZ_RESULT SzReadBoolVector(CSzData *sd, size_t numItems, int **v, void * (*alloc
RINOK(SzReadByte(sd, &b));
mask = 0x80;
}
(*v)[i] = ((b & mask) != 0);
(*v)[i] = (Byte)(((b & mask) != 0) ? 1 : 0);
mask >>= 1;
}
return SZ_OK;
}
SZ_RESULT SzReadBoolVector2(CSzData *sd, size_t numItems, int **v, void * (*allocFunc)(size_t size))
SZ_RESULT SzReadBoolVector2(CSzData *sd, size_t numItems, Byte **v, void * (*allocFunc)(size_t size))
{
Byte allAreDefined;
size_t i;
RINOK(SzReadByte(sd, &allAreDefined));
if (allAreDefined == 0)
return SzReadBoolVector(sd, numItems, v, allocFunc);
RINOK(MySzInAlloc((void **)v, numItems * sizeof(int), allocFunc));
RINOK(MySzInAlloc((void **)v, numItems * sizeof(Byte), allocFunc));
for(i = 0; i < numItems; i++)
(*v)[i] = 1;
return SZ_OK;
@@ -415,7 +415,7 @@ SZ_RESULT SzReadBoolVector2(CSzData *sd, size_t numItems, int **v, void * (*allo
SZ_RESULT SzReadHashDigests(
CSzData *sd,
size_t numItems,
int **digestsDefined,
Byte **digestsDefined,
UInt32 **digests,
void * (*allocFunc)(size_t size))
{
@@ -435,7 +435,7 @@ SZ_RESULT SzReadPackInfo(
CFileSize *dataOffset,
UInt32 *numPackStreams,
CFileSize **packSizes,
int **packCRCsDefined,
Byte **packCRCsDefined,
UInt32 **packCRCs,
void * (*allocFunc)(size_t size))
{
@@ -467,7 +467,7 @@ SZ_RESULT SzReadPackInfo(
}
if (*packCRCsDefined == 0)
{
RINOK(MySzInAlloc((void **)packCRCsDefined, (size_t)*numPackStreams * sizeof(int), allocFunc));
RINOK(MySzInAlloc((void **)packCRCsDefined, (size_t)*numPackStreams * sizeof(Byte), allocFunc));
RINOK(MySzInAlloc((void **)packCRCs, (size_t)*numPackStreams * sizeof(UInt32), allocFunc));
for(i = 0; i < *numPackStreams; i++)
{
@@ -589,7 +589,7 @@ SZ_RESULT SzGetNextFolderItem(CSzData *sd, CFolder *folder, void * (*allocFunc)(
SZ_RESULT SzReadUnPackInfo(
CSzData *sd,
UInt32 *numFolders,
CFolder **folders,
CFolder **folders, /* for allocFunc */
void * (*allocFunc)(size_t size),
ISzAlloc *allocTemp)
{
@@ -636,7 +636,7 @@ SZ_RESULT SzReadUnPackInfo(
if (type == k7zIdCRC)
{
SZ_RESULT res;
int *crcsDefined = 0;
Byte *crcsDefined = 0;
UInt32 *crcs = 0;
res = SzReadHashDigests(sd, *numFolders, &crcsDefined, &crcs, allocTemp->Alloc);
if (res == SZ_OK)
@@ -663,9 +663,8 @@ SZ_RESULT SzReadSubStreamsInfo(
CFolder *folders,
UInt32 *numUnPackStreams,
CFileSize **unPackSizes,
int **digestsDefined,
Byte **digestsDefined,
UInt32 **digests,
void * (*allocFunc)(size_t size),
ISzAlloc *allocTemp)
{
UInt64 type = 0;
@@ -707,9 +706,9 @@ SZ_RESULT SzReadSubStreamsInfo(
}
else
{
*unPackSizes = (CFileSize *)allocFunc((size_t)*numUnPackStreams * sizeof(CFileSize));
*unPackSizes = (CFileSize *)allocTemp->Alloc((size_t)*numUnPackStreams * sizeof(CFileSize));
RINOM(*unPackSizes);
*digestsDefined = (int *)allocTemp->Alloc((size_t)*numUnPackStreams * sizeof(int));
*digestsDefined = (Byte *)allocTemp->Alloc((size_t)*numUnPackStreams * sizeof(Byte));
RINOM(*digestsDefined);
*digests = (UInt32 *)allocTemp->Alloc((size_t)*numUnPackStreams * sizeof(UInt32));
RINOM(*digests);
@@ -762,7 +761,7 @@ SZ_RESULT SzReadSubStreamsInfo(
if (type == k7zIdCRC)
{
int digestIndex = 0;
int *digestsDefined2 = 0;
Byte *digestsDefined2 = 0;
UInt32 *digests2 = 0;
SZ_RESULT res = SzReadHashDigests(sd, numDigests, &digestsDefined2, &digests2, allocTemp->Alloc);
if (res == SZ_OK)
@@ -809,9 +808,9 @@ SZ_RESULT SzReadStreamsInfo(
CFileSize *dataOffset,
CArchiveDatabase *db,
UInt32 *numUnPackStreams,
CFileSize **unPackSizes,
int **digestsDefined,
UInt32 **digests,
CFileSize **unPackSizes, /* allocTemp */
Byte **digestsDefined, /* allocTemp */
UInt32 **digests, /* allocTemp */
void * (*allocFunc)(size_t size),
ISzAlloc *allocTemp)
{
@@ -839,7 +838,7 @@ SZ_RESULT SzReadStreamsInfo(
case k7zIdSubStreamsInfo:
{
RINOK(SzReadSubStreamsInfo(sd, db->NumFolders, db->Folders,
numUnPackStreams, unPackSizes, digestsDefined, digests, allocFunc, allocTemp));
numUnPackStreams, unPackSizes, digestsDefined, digests, allocTemp));
break;
}
default:
@@ -928,10 +927,12 @@ SZ_RESULT SzReadFileNames(CSzData *sd, UInt32 numFiles, CFileItem *files,
SZ_RESULT SzReadHeader2(
CSzData *sd,
CArchiveDatabaseEx *db,
CFileSize **unPackSizes,
int **digestsDefined,
UInt32 **digests,
CArchiveDatabaseEx *db, /* allocMain */
CFileSize **unPackSizes, /* allocTemp */
Byte **digestsDefined, /* allocTemp */
UInt32 **digests, /* allocTemp */
Byte **emptyStreamVector, /* allocTemp */
Byte **emptyFileVector, /* allocTemp */
ISzAlloc *allocMain,
ISzAlloc *allocTemp)
{
@@ -939,6 +940,7 @@ SZ_RESULT SzReadHeader2(
UInt32 numUnPackStreams = 0;
UInt32 numFiles = 0;
CFileItem *files = 0;
UInt32 numEmptyStreams = 0;
UInt32 i;
RINOK(SzReadID(sd, &type));
@@ -962,10 +964,6 @@ SZ_RESULT SzReadHeader2(
db->ArchiveInfo.DataStartPosition += db->ArchiveInfo.StartPositionAfterHeader;
RINOK(SzReadID(sd, &type));
}
else
{
return SZE_NOTIMPL;
}
if (type == k7zIdEnd)
return SZ_OK;
@@ -975,21 +973,12 @@ SZ_RESULT SzReadHeader2(
RINOK(SzReadNumber32(sd, &numFiles));
db->Database.NumFiles = numFiles;
RINOK(MySzInAlloc((void **)&files, (size_t)numFiles * sizeof(CFileItem), allocTemp->Alloc));
RINOK(MySzInAlloc((void **)&files, (size_t)numFiles * sizeof(CFileItem), allocMain->Alloc));
db->Database.Files = files;
for(i = 0; i < numFiles; i++)
SzFileInit(files + i);
/*
CBoolVector emptyStreamVector;
emptyStreamVector.Reserve((size_t)numFiles);
for(i = 0; i < numFiles; i++)
emptyStreamVector.Add(false);
CBoolVector emptyFileVector;
UInt32 numEmptyStreams = 0;
*/
while(1)
{
UInt64 type;
@@ -1014,30 +1003,17 @@ SZ_RESULT SzReadHeader2(
}
case k7zIdEmptyStream:
{
/*
RINOK(ReadBoolVector((UInt32)numFiles, emptyStreamVector))
UInt32 i;
for (i = 0; i < (UInt32)emptyStreamVector.Size(); i++)
if (emptyStreamVector[i])
RINOK(SzReadBoolVector(sd, numFiles, emptyStreamVector, allocTemp->Alloc));
numEmptyStreams = 0;
for (i = 0; i < numFiles; i++)
if ((*emptyStreamVector)[i])
numEmptyStreams++;
emptyFileVector.Reserve(numEmptyStreams);
antiFileVector.Reserve(numEmptyStreams);
for (i = 0; i < numEmptyStreams; i++)
{
emptyFileVector.Add(false);
antiFileVector.Add(false);
}
break;
*/
return SZE_NOTIMPL;
}
case k7zIdEmptyFile:
{
/*
RINOK(ReadBoolVector(numEmptyStreams, emptyFileVector))
RINOK(SzReadBoolVector(sd, numEmptyStreams, emptyFileVector, allocTemp->Alloc));
break;
*/
return SZE_NOTIMPL;
}
default:
{
@@ -1046,38 +1022,36 @@ SZ_RESULT SzReadHeader2(
}
}
/*
{
UInt32 emptyFileIndex = 0;
UInt32 sizeIndex = 0;
for(i = 0; i < numFiles; i++)
{
CFileItem *file = files + i;
file.HasStream = !emptyStreamVector[(UInt32)i];
if(file.HasStream)
file->IsAnti = 0;
if (*emptyStreamVector == 0)
file->HasStream = 1;
else
file->HasStream = (Byte)((*emptyStreamVector)[i] ? 0 : 1);
if(file->HasStream)
{
file.IsDirectory = false;
file.IsAnti = false;
file.UnPackSize = unPackSizes[sizeIndex];
file.FileCRC = digests[sizeIndex];
file.IsFileCRCDefined = digestsDefined[sizeIndex];
file->IsDirectory = 0;
file->Size = (*unPackSizes)[sizeIndex];
file->FileCRC = (*digests)[sizeIndex];
file->IsFileCRCDefined = (Byte)(*digestsDefined)[sizeIndex];
sizeIndex++;
}
else
{
file.IsDirectory = !emptyFileVector[emptyFileIndex];
file.IsAnti = antiFileVector[emptyFileIndex];
if (*emptyFileVector == 0)
file->IsDirectory = 1;
else
file->IsDirectory = (Byte)((*emptyFileVector)[emptyFileIndex] ? 0 : 1);
emptyFileIndex++;
file.UnPackSize = 0;
file.IsFileCRCDefined = false;
file->Size = 0;
file->IsFileCRCDefined = 0;
}
}
*/
for(i = 0; i < numFiles; i++)
{
CFileItem *file = files + i;
file->Size = (*unPackSizes)[i];
file->FileCRC = (*digests)[i];
file->IsFileCRCDefined = (Byte)(*digestsDefined)[i];
}
return SzArDbExFill(db, allocMain->Alloc);
}
@@ -1089,14 +1063,19 @@ SZ_RESULT SzReadHeader(
ISzAlloc *allocTemp)
{
CFileSize *unPackSizes = 0;
int *digestsDefined = 0;
Byte *digestsDefined = 0;
UInt32 *digests = 0;
Byte *emptyStreamVector = 0;
Byte *emptyFileVector = 0;
SZ_RESULT res = SzReadHeader2(sd, db,
&unPackSizes, &digestsDefined, &digests,
&emptyStreamVector, &emptyFileVector,
allocMain, allocTemp);
allocTemp->Free(unPackSizes);
allocTemp->Free(digestsDefined);
allocTemp->Free(digests);
allocTemp->Free(emptyStreamVector);
allocTemp->Free(emptyFileVector);
return res;
}
@@ -1107,7 +1086,7 @@ SZ_RESULT SzReadAndDecodePackedStreams2(
CFileSize baseOffset,
CArchiveDatabase *db,
CFileSize **unPackSizes,
int **digestsDefined,
Byte **digestsDefined,
UInt32 **digests,
#ifndef _LZMA_IN_CB
Byte **inBuffer,
@@ -1177,7 +1156,7 @@ SZ_RESULT SzReadAndDecodePackedStreams(
{
CArchiveDatabase db;
CFileSize *unPackSizes = 0;
int *digestsDefined = 0;
Byte *digestsDefined = 0;
UInt32 *digests = 0;
#ifndef _LZMA_IN_CB
Byte *inBuffer = 0;

View File

@@ -75,7 +75,7 @@ typedef struct _CArchiveDatabase
{
UInt32 NumPackStreams;
CFileSize *PackSizes;
int *PackCRCsDefined;
Byte *PackCRCsDefined;
UInt32 *PackCRCs;
UInt32 NumFolders;
CFolder *Folders;

View File

@@ -71,7 +71,7 @@ int main(int numargs, char *args[])
ISzAlloc allocImp;
ISzAlloc allocTempImp;
printf("\n7z ANSI-C Decoder 4.26 Copyright (c) 1999-2005 Igor Pavlov 2005-08-02\n");
printf("\n7z ANSI-C Decoder 4.30 Copyright (c) 1999-2005 Igor Pavlov 2005-11-20\n");
if (numargs == 1)
{
printf(
@@ -145,10 +145,18 @@ int main(int numargs, char *args[])
size_t offset;
size_t outSizeProcessed;
CFileItem *f = db.Database.Files + i;
if (f->IsDirectory)
printf("Directory ");
else
printf(testCommand ?
"Testing ":
"Extracting");
printf(" %s", f->Name);
if (f->IsDirectory)
{
printf("\n");
continue;
}
res = SzExtract(&archiveStream.InStream, &db, i,
&blockIndex, &outBuffer, &outBufferSize,
&offset, &outSizeProcessed,

View File

@@ -73,6 +73,13 @@ STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value)
case NArchive::kKeepName:
propVariant = false;
break;
case NArchive::kStartSignature:
{
const unsigned char sig[] = { 'u', 's', 't', 'a', 'r' };
if ((value->bstrVal = ::SysAllocStringByteLen((const char *)sig, 5)) != 0)
value->vt = VT_BSTR;
return S_OK;
}
}
propVariant.Detach(value);
return S_OK;

View File

@@ -4,6 +4,7 @@ LIBS = $(LIBS) user32.lib oleaut32.lib Advapi32.lib
CFLAGS = $(CFLAGS) -I ../../../ \
-DEXCLUDE_COM \
-DNO_REGISTRY \
-D_NO_CRYPTO \
-DFORMAT_7Z \
-DCOMPRESS_BCJ_X86 \
-DCOMPRESS_BCJ2 \

View File

@@ -35,6 +35,18 @@ extern "C"
using namespace NCommandLineParser;
#ifdef _WIN32
bool g_IsNT = false;
static inline bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
#endif
static const char *kCantAllocate = "Can not allocate memory";
static const char *kReadError = "Read error";
static const char *kWriteError = "Write error";
@@ -86,7 +98,7 @@ static void PrintHelp()
"<Switches>\n"
" -a{N}: set compression mode - [0, 2], default: 2 (max)\n"
" -d{N}: set dictionary - [0,28], default: 23 (8MB)\n"
" -fb{N}: set number of fast bytes - [5, 255], default: 128\n"
" -fb{N}: set number of fast bytes - [5, 273], default: 128\n"
" -lc{N}: set number of literal context bits - [0, 8], default: 3\n"
" -lp{N}: set number of literal pos bits - [0, 4], default: 0\n"
" -pb{N}: set number of pos bits - [0, 4], default: 2\n"
@@ -134,7 +146,11 @@ static bool GetNumber(const wchar_t *s, UInt32 &value)
int main2(int n, const char *args[])
{
fprintf(stderr, "\nLZMA 4.27 Copyright (c) 1999-2005 Igor Pavlov 2005-08-07\n");
#ifdef _WIN32
g_IsNT = IsItWindowsNT();
#endif
fprintf(stderr, "\nLZMA 4.30 Copyright (c) 1999-2005 Igor Pavlov 2005-11-20\n");
if (n == 1)
{

View File

@@ -144,8 +144,12 @@ static bool DoItemAlwaysStart(const UString &name)
int extPos = name.ReverseFind('.');
if (extPos < 0)
return false;
const UString ext = name.Mid(extPos + 1);
return (ext == UString(L"exe") || ext == UString(L"bat") || ext == UString(L"com"));
UString ext = name.Mid(extPos + 1);
ext.MakeLower();
return (ext == UString(L"exe") ||
ext == UString(L"bat") ||
ext == UString(L"com") ||
ext == UString(L"chm"));
}
static HANDLE StartEditApplication(const UString &path, HWND window)

View File

@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 4
#define MY_VER_MINOR 30
#define MY_VERSION "4.30 beta"
#define MY_7ZIP_VERSION "7-Zip 4.30 beta"
#define MY_DATE "2005-11-18"
#define MY_VER_MINOR 31
#define MY_VERSION "4.31"
#define MY_7ZIP_VERSION "7-Zip 4.31"
#define MY_DATE "2005-12-04"
#define MY_COPYRIGHT "Copyright (c) 1999-2005 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE

View File

@@ -111,12 +111,15 @@ HRESULT DecompressArchives(
archivePathsFull.Delete(index);
}
}
#ifndef _NO_CRYPTO
UString password;
RINOK(openCallback->GetPasswordIfAny(password));
if (!password.IsEmpty())
{
RINOK(extractCallback->SetPassword(password));
}
#endif
options.DefaultItemName = archiveLink.GetDefaultItemName();
RINOK(DecompressArchive(

View File

@@ -119,12 +119,21 @@ bool CSystemPage::OnInit()
return CPropertyPage::OnInit();
}
STDAPI DllRegisterServer(void);
STDAPI DllUnregisterServer(void);
LONG CSystemPage::OnApply()
{
if (IsButtonCheckedBool(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU))
{
DllRegisterServer();
NZipRootRegistry::AddContextMenuHandler();
}
else
{
DllUnregisterServer();
NZipRootRegistry::DeleteContextMenuHandler();
}
SaveCascadedMenu(IsButtonCheckedBool(IDC_SYSTEM_CASCADED_MENU));
UINT32 flags = 0;

View File

@@ -8,7 +8,9 @@
#include "Common/StdInStream.h"
#include "Common/StringConvert.h"
#ifndef _NO_CRYPTO
#include "../../FileManager/Resource/PasswordDialog/PasswordDialog.h"
#endif
HRESULT COpenCallbackGUI::CheckBreak()
{

View File

@@ -54,9 +54,6 @@ In that example 7-Zip will use 512KB solid blocks. So it needs to decompress onl
Limitations of current version of 7z ANSI-C Decoder
---------------------------------------------------
- It doesn't support separated "folder" items inside archive.
But you still can use files that are in subfolders
- It doesn't support empty files (size = 0) inside archive.
- It reads only "FileName", "Size", and "CRC" information for each file in archive.
- It supports only LZMA and Copy (no compression) methods.
- It converts original UTF-16 Unicode file names to UTF-8 Unicode file names.

View File

@@ -2,8 +2,8 @@
;Defines
!define VERSION_MAJOR 4
!define VERSION_MINOR 30
!define VERSION_POSTFIX_FULL " beta"
!define VERSION_MINOR 31
!define VERSION_POSTFIX_FULL ""
!ifdef WIN64
!ifdef IA64
!define VERSION_SYS_POSTFIX_FULL " for Windows IA-64"
@@ -60,7 +60,6 @@
SetCompressorDictSize 4
!endif
!else
SetCompressor zlib
SetCompress off
!endif
@@ -195,6 +194,7 @@ Section
File eo.txt
File es.txt
File et.txt
File eu.txt
File ext.txt
File fa.txt
File fi.txt
@@ -397,6 +397,7 @@ Section "Uninstall"
Delete $INSTDIR\Lang\eo.txt
Delete $INSTDIR\Lang\es.txt
Delete $INSTDIR\Lang\et.txt
Delete $INSTDIR\Lang\eu.txt
Delete $INSTDIR\Lang\ext.txt
Delete $INSTDIR\Lang\fa.txt
Delete $INSTDIR\Lang\fi.txt

View File

@@ -3,9 +3,9 @@ Sources history of the 7-Zip
Version 4.30 beta 2005-11-18
--------------------------------------
- Security.h::AddLockMemoryPrivilege - installs "Large pages" fature
- MemoryLock.h::EnableLockMemoryPrivilege - enables "Large pages" fature
- Alloc.h::SetLargePageSize - sets optimal LargePageSize size;
- Security.h::AddLockMemoryPrivilege - installs "Large pages" feature
- MemoryLock.h::EnableLockMemoryPrivilege - enables "Large pages" feature
- Alloc.h::SetLargePageSize - sets optimal LargePageSize size
Version 4.27 2005-09-21

View File

@@ -1,7 +1,7 @@
LZMA SDK 4.27
LZMA SDK 4.30
-------------
LZMA SDK 4.27 Copyright (C) 1999-2005 Igor Pavlov
LZMA SDK 4.30 Copyright (C) 1999-2005 Igor Pavlov
LZMA SDK provides developers with documentation, source code,
and sample code necessary to write software that uses LZMA compression.
@@ -91,6 +91,7 @@ LZMA SDK includes:
- C++ source code for file->file LZMA compressing and decompressing
- ANSI-C compatible source code for LZMA decompressing
- Compiled file->file LZMA compressing/decompressing program for Windows system
- C# source code for file->file LZMA compressing and decompressing
ANSI-C LZMA decompression code was ported from original C++ sources to C.
Also it was simplified and optimized for code size.
@@ -100,7 +101,7 @@ But it is fully compatible with LZMA from 7-Zip.
UNIX/Linux version
------------------
To compile C++ version of file->file LZMA, go to directory
SRC/7zip/Compress/LZMA_Alone
C/7zip/Compress/LZMA_Alone
and type "make" or "make clean all" to recompile all.
In some UNIX/Linux versions you must compile LZMA with static libraries.
@@ -112,7 +113,8 @@ LIB = -lm -static
Files
---------------------
SRC - directory with source code
C - C / CPP source code
CS - C# source code
lzma.txt - LZMA SDK description (this file)
7zFormat.txt - 7z Format description
7zC.txt - 7z ANSI-C Decoder description (this file)
@@ -126,7 +128,7 @@ history.txt - history of the LZMA SDK
Source code structure
---------------------
SRC
C - C / CPP files
Common - common files for C++ projects
Windows - common files for Windows related code
7zip - files related to 7-Zip Project
@@ -151,11 +153,20 @@ SRC
Archive - files related to archiving
7z_C - 7z ANSI-C Decoder
CS - C# files
7zip
Common - some common files for 7-Zip
Compress - files related to compression/decompression
LZ - files related to LZ (Lempel-Ziv) compression algorithm
LZMA - LZMA compression/decompression
LzmaAlone - file->file LZMA compression/decompression
RangeCoder - Range Coder (special code of compression/decompression)
Source code of LZMA SDK is only part of big 7-Zip project. That is
why LZMA SDK uses such complex source code structure.
You can find ANSI-C LZMA decompressing code at folder
SRC/7zip/Compress/LZMA_C
C/7zip/Compress/LZMA_C
7-Zip doesn't use that ANSI-C LZMA code and that code was developed
specially for this SDK. And files from LZMA_C do not need files from
other directories of SDK for compiling.
@@ -224,7 +235,7 @@ Usage: LZMA <e|d> inputFile outputFile [<switches>...]
For decompressing file compressed by LZMA method with dictionary
size D = 2^N you need about D bytes of memory (RAM).
-fb{N}: set number of fast bytes - [5, 255], default: 128
-fb{N}: set number of fast bytes - [5, 273], default: 128
Usually big number gives a little bit better compression ratio
and slower compression process.

View File

@@ -1,4 +1,4 @@
7-Zip 4.30 Sources
7-Zip 4.31 Sources
------------------
7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP.