mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 07:14:56 -06:00
4.56 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
b67ffe691b
commit
acd742622d
@@ -195,7 +195,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
0,
|
||||
#endif
|
||||
startIndex,
|
||||
&efi.ExtractStatuses, extractCallback, testMode);
|
||||
&efi.ExtractStatuses, extractCallback, testMode, _crcSize != 0);
|
||||
|
||||
RINOK(result);
|
||||
|
||||
|
||||
@@ -113,13 +113,14 @@ STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSiz
|
||||
STDMETHODIMP CFolderInStream::GetSubStreamSize(UInt64 subStream, UInt64 *value)
|
||||
{
|
||||
*value = 0;
|
||||
if (subStream < Sizes.Size())
|
||||
int subStreamIndex = (int)subStream;
|
||||
if (subStreamIndex < 0 || subStream > Sizes.Size())
|
||||
return E_FAIL;
|
||||
if (subStreamIndex < Sizes.Size())
|
||||
{
|
||||
*value= Sizes[(int)(size_t)subStream];
|
||||
*value= Sizes[subStreamIndex];
|
||||
return S_OK;
|
||||
}
|
||||
if (subStream > Sizes.Size())
|
||||
return E_FAIL;
|
||||
if (!_currentSizeIsDefined)
|
||||
return S_FALSE;
|
||||
*value = _currentSize;
|
||||
|
||||
@@ -19,7 +19,8 @@ HRESULT CFolderOutStream::Init(
|
||||
UInt32 startIndex,
|
||||
const CBoolVector *extractStatuses,
|
||||
IArchiveExtractCallback *extractCallback,
|
||||
bool testMode)
|
||||
bool testMode,
|
||||
bool checkCrc)
|
||||
{
|
||||
_archiveDatabase = archiveDatabase;
|
||||
_ref2Offset = ref2Offset;
|
||||
@@ -29,6 +30,8 @@ HRESULT CFolderOutStream::Init(
|
||||
_extractCallback = extractCallback;
|
||||
_testMode = testMode;
|
||||
|
||||
_checkCrc = checkCrc;
|
||||
|
||||
_currentIndex = 0;
|
||||
_fileIsOpen = false;
|
||||
return WriteEmptyFiles();
|
||||
@@ -49,7 +52,7 @@ HRESULT CFolderOutStream::OpenFile()
|
||||
RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode));
|
||||
|
||||
_outStreamWithHashSpec->SetStream(realOutStream);
|
||||
_outStreamWithHashSpec->Init();
|
||||
_outStreamWithHashSpec->Init(_checkCrc);
|
||||
if (askMode == NArchive::NExtract::NAskMode::kExtract &&
|
||||
(!realOutStream))
|
||||
{
|
||||
@@ -100,7 +103,7 @@ STDMETHODIMP CFolderOutStream::Write(const void *data,
|
||||
if (_filePos == fileSize)
|
||||
{
|
||||
bool digestsAreEqual;
|
||||
if (fileInfo.IsFileCRCDefined)
|
||||
if (fileInfo.IsFileCRCDefined && _checkCrc)
|
||||
digestsAreEqual = fileInfo.FileCRC == _outStreamWithHashSpec->GetCRC();
|
||||
else
|
||||
digestsAreEqual = true;
|
||||
|
||||
@@ -36,6 +36,8 @@ private:
|
||||
bool _testMode;
|
||||
|
||||
bool _fileIsOpen;
|
||||
|
||||
bool _checkCrc;
|
||||
UInt64 _filePos;
|
||||
|
||||
HRESULT OpenFile();
|
||||
@@ -47,7 +49,8 @@ public:
|
||||
UInt32 startIndex,
|
||||
const CBoolVector *extractStatuses,
|
||||
IArchiveExtractCallback *extractCallback,
|
||||
bool testMode);
|
||||
bool testMode,
|
||||
bool checkCrc);
|
||||
HRESULT FlushCorrupted(Int32 resultEOperationResult);
|
||||
HRESULT WasWritingFinished();
|
||||
};
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace N7z {
|
||||
|
||||
CHandler::CHandler()
|
||||
{
|
||||
_crcSize = 4;
|
||||
|
||||
#ifdef EXTRACT_ONLY
|
||||
#ifdef COMPRESS_MT
|
||||
_numThreads = NWindows::NSystem::GetNumberOfProcessors();
|
||||
|
||||
@@ -110,7 +110,9 @@ private:
|
||||
#ifdef COMPRESS_MT
|
||||
UInt32 _numThreads;
|
||||
#endif
|
||||
|
||||
|
||||
UInt32 _crcSize;
|
||||
|
||||
#else
|
||||
|
||||
CRecordVector<CBind> _binds;
|
||||
|
||||
@@ -6,3 +6,4 @@ EXPORTS
|
||||
CreateObject PRIVATE
|
||||
GetNumberOfMethods PRIVATE
|
||||
GetMethodProperty PRIVATE
|
||||
SetLargePageMode PRIVATE
|
||||
|
||||
@@ -759,9 +759,23 @@ HRESULT CInArchive::OpenHighLevel(IInStream *inStream, CFilesDatabase &database)
|
||||
li.ResetInterval = ReadUInt32();
|
||||
li.WindowSize = ReadUInt32();
|
||||
li.CacheSize = ReadUInt32();
|
||||
if (li.ResetInterval != 2 && li.ResetInterval != 4)
|
||||
if (
|
||||
li.ResetInterval != 1 &&
|
||||
li.ResetInterval != 2 &&
|
||||
li.ResetInterval != 4 &&
|
||||
li.ResetInterval != 8 &&
|
||||
li.ResetInterval != 16 &&
|
||||
li.ResetInterval != 32 &&
|
||||
li.ResetInterval != 64)
|
||||
return S_FALSE;
|
||||
if (li.WindowSize != 2 && li.WindowSize != 4)
|
||||
if (
|
||||
li.WindowSize != 1 &&
|
||||
li.WindowSize != 2 &&
|
||||
li.WindowSize != 4 &&
|
||||
li.WindowSize != 8 &&
|
||||
li.WindowSize != 16 &&
|
||||
li.WindowSize != 32 &&
|
||||
li.WindowSize != 64)
|
||||
return S_FALSE;
|
||||
numDWORDS -= 5;
|
||||
while (numDWORDS-- != 0)
|
||||
|
||||
@@ -468,6 +468,7 @@ void COutHandler::Init()
|
||||
_level = 5;
|
||||
_autoFilter = true;
|
||||
_volumeMode = false;
|
||||
_crcSize = 4;
|
||||
InitSolid();
|
||||
}
|
||||
|
||||
@@ -481,6 +482,7 @@ void COutHandler::BeforeSetProperty()
|
||||
mainDicSize = 0xFFFFFFFF;
|
||||
mainDicMethodIndex = 0xFFFFFFFF;
|
||||
minNumber = 0;
|
||||
_crcSize = 4;
|
||||
}
|
||||
|
||||
HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &value)
|
||||
@@ -507,6 +509,13 @@ HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &val
|
||||
return SetSolidSettings(name);
|
||||
}
|
||||
|
||||
if (name == L"CRC")
|
||||
{
|
||||
_crcSize = 4;
|
||||
name.Delete(0, 3);
|
||||
return ParsePropValue(name, value, _crcSize);
|
||||
}
|
||||
|
||||
UInt32 number;
|
||||
int index = ParseStringToUInt32(name, number);
|
||||
UString realName = name.Mid(index);
|
||||
|
||||
@@ -26,6 +26,8 @@ public:
|
||||
UInt32 _numThreads;
|
||||
#endif
|
||||
|
||||
UInt32 _crcSize;
|
||||
|
||||
CObjectVector<COneMethodInfo> _methods;
|
||||
bool _removeSfxBlock;
|
||||
|
||||
|
||||
@@ -33,9 +33,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
||||
#ifndef _UNICODE
|
||||
g_IsNT = IsItWindowsNT();
|
||||
#endif
|
||||
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
|
||||
SetLargePageSize();
|
||||
#endif
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -50,3 +47,10 @@ STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
|
||||
return CreateArchiver(clsid, iid, outObject);
|
||||
}
|
||||
|
||||
STDAPI SetLargePageMode()
|
||||
{
|
||||
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
|
||||
SetLargePageSize();
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -43,9 +43,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
||||
g_IsNT = IsItWindowsNT();
|
||||
#endif
|
||||
#endif
|
||||
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
|
||||
SetLargePageSize();
|
||||
#endif
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -76,3 +73,10 @@ STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
|
||||
// COM_TRY_END
|
||||
}
|
||||
|
||||
STDAPI SetLargePageMode()
|
||||
{
|
||||
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
|
||||
SetLargePageSize();
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user