mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 12:07:08 -06:00
4.20
This commit is contained in:
committed by
Kornel Lesiński
parent
8c1b5c7b7e
commit
3c510ba80b
@@ -2,11 +2,9 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <initguid.h>
|
||||
|
||||
#include "Common/MyInitGuid.h"
|
||||
#include "Common/ComTry.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
|
||||
#include "../../ICoder.h"
|
||||
#include "../../IPassword.h"
|
||||
#include "../Common/CodecsPath.h"
|
||||
@@ -19,46 +17,6 @@ DEFINE_GUID(CLSID_CCrypto_AES128_Decoder,
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
/*
|
||||
static bool GetBaseFolderPrefix(TCHAR *path)
|
||||
{
|
||||
TCHAR fullPath[MAX_PATH + 1];
|
||||
if (::GetModuleFileName(g_hInstance, fullPath, MAX_PATH) == 0)
|
||||
return false;
|
||||
// fullPath = "7-zip\Format\Rar.dll"
|
||||
LPTSTR fileNamePointer;
|
||||
TCHAR p[MAX_PATH + 1];
|
||||
DWORD needLength = ::GetFullPathName(fullPath, MAX_PATH + 1,
|
||||
p, &fileNamePointer);
|
||||
if (needLength == 0 || needLength >= MAX_PATH)
|
||||
return false;
|
||||
*fileNamePointer = 0;
|
||||
// p = "7-zip\Format\"
|
||||
int len = lstrlen(p);
|
||||
if (len == 0)
|
||||
return false;
|
||||
if (p[len - 1] != '\\')
|
||||
return false;
|
||||
p[len - 1] = 0;
|
||||
// p = "7-zip\Format"
|
||||
needLength = ::GetFullPathName(p, MAX_PATH + 1,
|
||||
path, &fileNamePointer);
|
||||
if (needLength == 0 || needLength >= MAX_PATH)
|
||||
return false;
|
||||
// fileNamePointer -> "7-zip\"+
|
||||
*fileNamePointer = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GetCompressFolderPrefix(TCHAR *path)
|
||||
{
|
||||
if (!GetBaseFolderPrefix(path))
|
||||
return false;
|
||||
lstrcat(path, TEXT("Codecs\\"));
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
void GetCryptoFolderPrefix(TCHAR *path)
|
||||
{
|
||||
CSysString s = GetCodecsFolderPrefix();
|
||||
@@ -154,6 +112,14 @@ STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value)
|
||||
case NArchive::kKeepName:
|
||||
propVariant = false;
|
||||
break;
|
||||
case NArchive::kStartSignature:
|
||||
{
|
||||
if ((value->bstrVal = ::SysAllocStringByteLen(
|
||||
(const char *)NArchive::NRar::NHeader::kMarker,
|
||||
NArchive::NRar::NHeader::kMarkerSize)) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
propVariant.Detach(value);
|
||||
return S_OK;
|
||||
|
||||
@@ -122,7 +122,15 @@ SOURCE=.\StdAfx.h
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\SDK\Common\Buffer.h
|
||||
SOURCE=..\..\..\Common\Alloc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Alloc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Buffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -134,7 +142,15 @@ SOURCE=..\..\..\Common\CRC.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\SDK\Common\DynamicBuffer.h
|
||||
SOURCE=..\..\..\Common\DynamicBuffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\IntToString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\IntToString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -190,27 +206,11 @@ SOURCE=..\Common\CoderLoader.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\CoderMixer.cpp
|
||||
SOURCE=..\Common\FilterCoder.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\CoderMixer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\CoderMixer2.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\CoderMixer2.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\CrossThreadProgress.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\CrossThreadProgress.h
|
||||
SOURCE=..\Common\FilterCoder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -398,14 +398,6 @@ SOURCE=..\..\Common\ProgressUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamBinder.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamBinder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamObjects.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -418,6 +410,14 @@ SOURCE=..\..\Common\StreamObjects.h
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\7z\7zMethodID.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\7z\7zMethodID.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\7z\7zMethods.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -6,28 +6,26 @@
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/ComTry.h"
|
||||
|
||||
#include "../../Common/StreamObjects.h"
|
||||
// #include "Interface/EnumStatProp.h"
|
||||
#include "../../Common//ProgressUtils.h"
|
||||
#include "../../IPassword.h"
|
||||
#include "Common/IntToString.h"
|
||||
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "../../IPassword.h"
|
||||
|
||||
#include "../../Common//ProgressUtils.h"
|
||||
#include "../../Compress/Copy/CopyCoder.h"
|
||||
|
||||
#include "../Common/OutStreamWithCRC.h"
|
||||
#include "../Common/CoderMixer.h"
|
||||
#include "../Common/CoderLoader.h"
|
||||
#include "../Common/CodecsPath.h"
|
||||
#include "../7z/7zMethods.h"
|
||||
|
||||
// #include "../../../Compress/Interface/CompressInterface.h"
|
||||
// #include "../../../Crypto/Cipher/Common/CipherInterface.h"
|
||||
#include "../../Crypto/Rar20/Rar20Cipher.h"
|
||||
#include "../../Crypto/RarAES/RarAES.h"
|
||||
|
||||
#include "../Common/OutStreamWithCRC.h"
|
||||
#include "../Common/CoderLoader.h"
|
||||
#include "../Common/CodecsPath.h"
|
||||
#include "../Common/FilterCoder.h"
|
||||
|
||||
#include "../7z/7zMethods.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NTime;
|
||||
|
||||
@@ -96,10 +94,10 @@ STATPROPSTG kArchiveProperties[] =
|
||||
{ NULL, kpidCommented, VT_BOOL},
|
||||
};
|
||||
|
||||
UINT64 CHandler::GetPackSize(int refIndex) const
|
||||
UInt64 CHandler::GetPackSize(int refIndex) const
|
||||
{
|
||||
const CRefItem &refItem = _refItems[refIndex];
|
||||
UINT64 totalPackSize = 0;
|
||||
UInt64 totalPackSize = 0;
|
||||
for (int i = 0; i < refItem.NumItems; i++)
|
||||
totalPackSize += _items[refItem.ItemIndex + i].PackSize;
|
||||
return totalPackSize;
|
||||
@@ -123,13 +121,13 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::GetNumberOfProperties(UINT32 *numProperties)
|
||||
STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties)
|
||||
{
|
||||
*numProperties = sizeof(kProperties) / sizeof(kProperties[0]);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::GetPropertyInfo(UINT32 index,
|
||||
STDMETHODIMP CHandler::GetPropertyInfo(UInt32 index,
|
||||
BSTR *name, PROPID *propID, VARTYPE *varType)
|
||||
{
|
||||
if(index >= sizeof(kProperties) / sizeof(kProperties[0]))
|
||||
@@ -141,13 +139,13 @@ STDMETHODIMP CHandler::GetPropertyInfo(UINT32 index,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UINT32 *numProperties)
|
||||
STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties)
|
||||
{
|
||||
*numProperties = sizeof(kArchiveProperties) / sizeof(kArchiveProperties[0]);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::GetArchivePropertyInfo(UINT32 index,
|
||||
STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32 index,
|
||||
BSTR *name, PROPID *propID, VARTYPE *varType)
|
||||
{
|
||||
if(index >= sizeof(kArchiveProperties) / sizeof(kArchiveProperties[0]))
|
||||
@@ -159,7 +157,7 @@ STDMETHODIMP CHandler::GetArchivePropertyInfo(UINT32 index,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::GetNumberOfItems(UINT32 *numItems)
|
||||
STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
|
||||
{
|
||||
*numItems = _refItems.Size();
|
||||
return S_OK;
|
||||
@@ -169,17 +167,17 @@ static bool RarTimeToFileTime(const CRarTime &rarTime, FILETIME &result)
|
||||
{
|
||||
if (!DosTimeToFileTime(rarTime.DosTime, result))
|
||||
return false;
|
||||
UINT64 &value = *(UINT64 *)&result;
|
||||
value += (int)rarTime.LowSecond * 10000000;
|
||||
UINT64 subTime = ((UINT64)rarTime.SubTime[2] << 16) +
|
||||
((UINT64)rarTime.SubTime[1] << 8) +
|
||||
((UINT64)rarTime.SubTime[0]);
|
||||
// value += (subTime * 10000000) >> 24;
|
||||
value += subTime;
|
||||
UInt64 value = (((UInt64)result.dwHighDateTime) << 32) + result.dwLowDateTime;
|
||||
value += (UInt64)rarTime.LowSecond * 10000000;
|
||||
value += ((UInt64)rarTime.SubTime[2] << 16) +
|
||||
((UInt64)rarTime.SubTime[1] << 8) +
|
||||
((UInt64)rarTime.SubTime[0]);
|
||||
result.dwLowDateTime = (DWORD)value;
|
||||
result.dwHighDateTime = DWORD(value >> 32);
|
||||
return true;
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::GetProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
|
||||
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
NWindows::NCOM::CPropVariant propVariant;
|
||||
@@ -270,7 +268,7 @@ STDMETHODIMP CHandler::GetProperty(UINT32 index, PROPID propID, PROPVARIANT *va
|
||||
/*
|
||||
case kpidDictionarySize:
|
||||
if (!item.IsDirectory())
|
||||
propVariant = UINT32(0x10000 << item.GetDictSize());
|
||||
propVariant = UInt32(0x10000 << item.GetDictSize());
|
||||
break;
|
||||
*/
|
||||
case kpidCRC:
|
||||
@@ -289,23 +287,23 @@ STDMETHODIMP CHandler::GetProperty(UINT32 index, PROPID propID, PROPVARIANT *va
|
||||
case kpidMethod:
|
||||
{
|
||||
UString method;
|
||||
if (item.Method >= BYTE('0') && item.Method <= BYTE('5'))
|
||||
if (item.Method >= Byte('0') && item.Method <= Byte('5'))
|
||||
{
|
||||
method = L"m";
|
||||
wchar_t temp[32];
|
||||
_itow (item.Method - BYTE('0'), temp, 10);
|
||||
ConvertUInt64ToString(item.Method - Byte('0'), temp);
|
||||
method += temp;
|
||||
if (!item.IsDirectory())
|
||||
{
|
||||
method += L":";
|
||||
_itow (16 + item.GetDictSize(), temp, 10);
|
||||
ConvertUInt64ToString(16 + item.GetDictSize(), temp);
|
||||
method += temp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wchar_t temp[32];
|
||||
_itow (item.Method, temp, 10);
|
||||
ConvertUInt64ToString(item.Method, temp);
|
||||
method += temp;
|
||||
}
|
||||
propVariant = method;
|
||||
@@ -407,7 +405,7 @@ public:
|
||||
};
|
||||
|
||||
STDMETHODIMP CHandler::Open(IInStream *stream,
|
||||
const UINT64 *maxCheckStartPosition,
|
||||
const UInt64 *maxCheckStartPosition,
|
||||
IArchiveOpenCallback *openArchiveCallback)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
@@ -415,6 +413,7 @@ STDMETHODIMP CHandler::Open(IInStream *stream,
|
||||
try
|
||||
{
|
||||
CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
|
||||
CMyComPtr<ICryptoGetTextPassword> getTextPassword;
|
||||
CMyComPtr<IArchiveOpenCallback> openArchiveCallbackWrap = openArchiveCallback;
|
||||
|
||||
CVolumeName seqName;
|
||||
@@ -423,8 +422,9 @@ STDMETHODIMP CHandler::Open(IInStream *stream,
|
||||
{
|
||||
openArchiveCallbackWrap.QueryInterface(IID_IArchiveOpenVolumeCallback, &openVolumeCallback);
|
||||
RINOK(openArchiveCallback->SetTotal(NULL, NULL));
|
||||
UINT64 numFiles = _items.Size();
|
||||
UInt64 numFiles = _items.Size();
|
||||
RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL));
|
||||
openArchiveCallbackWrap.QueryInterface(IID_ICryptoGetTextPassword, &getTextPassword);
|
||||
}
|
||||
|
||||
while(true)
|
||||
@@ -467,14 +467,15 @@ STDMETHODIMP CHandler::Open(IInStream *stream,
|
||||
return S_FALSE;
|
||||
|
||||
if (_archives.IsEmpty())
|
||||
{
|
||||
archive.GetArchiveInfo(_archiveInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
CItemEx item;
|
||||
while(archive.GetNextItem(item))
|
||||
while(true)
|
||||
{
|
||||
HRESULT result = archive.GetNextItem(item, getTextPassword);
|
||||
if (result == S_FALSE)
|
||||
break;
|
||||
RINOK(result);
|
||||
if (item.IgnoreItem())
|
||||
continue;
|
||||
|
||||
@@ -499,7 +500,7 @@ STDMETHODIMP CHandler::Open(IInStream *stream,
|
||||
_items.Add(item);
|
||||
if (openArchiveCallback != NULL)
|
||||
{
|
||||
UINT64 numFiles = _items.Size();
|
||||
UInt64 numFiles = _items.Size();
|
||||
RINOK(openArchiveCallback->SetCompleted(&numFiles, NULL));
|
||||
}
|
||||
}
|
||||
@@ -526,23 +527,23 @@ STDMETHODIMP CHandler::Close()
|
||||
|
||||
struct CMethodItem
|
||||
{
|
||||
BYTE RarUnPackVersion;
|
||||
Byte RarUnPackVersion;
|
||||
CMyComPtr<ICompressCoder> Coder;
|
||||
};
|
||||
|
||||
|
||||
STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
INT32 _aTestMode, IArchiveExtractCallback *_anExtractCallback)
|
||||
STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
Int32 _aTestMode, IArchiveExtractCallback *_anExtractCallback)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
CMyComPtr<ICryptoGetTextPassword> getTextPassword;
|
||||
bool testMode = (_aTestMode != 0);
|
||||
CMyComPtr<IArchiveExtractCallback> extractCallback = _anExtractCallback;
|
||||
UINT64 censoredTotalUnPacked = 0,
|
||||
UInt64 censoredTotalUnPacked = 0,
|
||||
// censoredTotalPacked = 0,
|
||||
importantTotalUnPacked = 0;
|
||||
// importantTotalPacked = 0;
|
||||
bool allFilesMode = (numItems == UINT32(-1));
|
||||
bool allFilesMode = (numItems == UInt32(-1));
|
||||
if (allFilesMode)
|
||||
numItems = _refItems.Size();
|
||||
if(numItems == 0)
|
||||
@@ -551,14 +552,15 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
CRecordVector<int> importantIndexes;
|
||||
CRecordVector<bool> extractStatuses;
|
||||
|
||||
for(UINT32 t = 0; t < numItems; t++)
|
||||
for(UInt32 t = 0; t < numItems; t++)
|
||||
{
|
||||
int index = allFilesMode ? t : indices[t];
|
||||
const CRefItem &refItem = _refItems[index];
|
||||
const CItemEx &item = _items[refItem.ItemIndex];
|
||||
censoredTotalUnPacked += item.UnPackSize;
|
||||
// censoredTotalPacked += item.PackSize;
|
||||
for(int j = lastIndex; j <= index; j++)
|
||||
int j;
|
||||
for(j = lastIndex; j <= index; j++)
|
||||
// if(!_items[_refItems[j].ItemIndex].IsSolid())
|
||||
if(!IsSolid(j))
|
||||
lastIndex = j;
|
||||
@@ -578,9 +580,9 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
}
|
||||
|
||||
extractCallback->SetTotal(importantTotalUnPacked);
|
||||
UINT64 currentImportantTotalUnPacked = 0;
|
||||
UINT64 currentImportantTotalPacked = 0;
|
||||
UINT64 currentUnPackSize, currentPackSize;
|
||||
UInt64 currentImportantTotalUnPacked = 0;
|
||||
UInt64 currentImportantTotalPacked = 0;
|
||||
UInt64 currentUnPackSize, currentPackSize;
|
||||
|
||||
/*
|
||||
CSysString path = GetCodecsFolderPrefix() + TEXT("Rar29.dll");
|
||||
@@ -603,15 +605,17 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
NCompress::CCopyCoder *copyCoderSpec = NULL;
|
||||
CMyComPtr<ICompressCoder> copyCoder;
|
||||
|
||||
CCoderMixer *mixerCoderSpec;
|
||||
CMyComPtr<ICompressCoder> mixerCoder;
|
||||
// CCoderMixer *mixerCoderSpec;
|
||||
// CMyComPtr<ICompressCoder> mixerCoder;
|
||||
// bool mixerCoderStoreMethod;
|
||||
// int mixerCryptoVersion;
|
||||
|
||||
bool mixerCoderStoreMethod;
|
||||
CFilterCoder *filterStreamSpec = new CFilterCoder;
|
||||
CMyComPtr<ISequentialInStream> filterStream = filterStreamSpec;
|
||||
|
||||
int mixerCryptoVersion;
|
||||
|
||||
CMyComPtr<ICompressCoder> rar20CryptoDecoder;
|
||||
CMyComPtr<ICompressCoder> rar29CryptoDecoder;
|
||||
NCrypto::NRar20::CDecoder *rar20CryptoDecoderSpec;
|
||||
CMyComPtr<ICompressFilter> rar20CryptoDecoder;
|
||||
CMyComPtr<ICompressFilter> rar29CryptoDecoder;
|
||||
|
||||
CFolderInStream *folderInStreamSpec = NULL;
|
||||
CMyComPtr<ISequentialInStream> folderInStream;
|
||||
@@ -624,14 +628,14 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
¤tImportantTotalUnPacked));
|
||||
CMyComPtr<ISequentialOutStream> realOutStream;
|
||||
|
||||
INT32 askMode;
|
||||
Int32 askMode;
|
||||
if(extractStatuses[i])
|
||||
askMode = testMode ? NArchive::NExtract::NAskMode::kTest :
|
||||
NArchive::NExtract::NAskMode::kExtract;
|
||||
else
|
||||
askMode = NArchive::NExtract::NAskMode::kSkip;
|
||||
|
||||
UINT32 index = importantIndexes[i];
|
||||
UInt32 index = importantIndexes[i];
|
||||
|
||||
const CRefItem &refItem = _refItems[index];
|
||||
const CItemEx &item = _items[refItem.ItemIndex];
|
||||
@@ -674,8 +678,8 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
outStreamSpec->Init(realOutStream);
|
||||
realOutStream.Release();
|
||||
|
||||
UINT64 packedPos = currentImportantTotalPacked;
|
||||
UINT64 unpackedPos = currentImportantTotalUnPacked;
|
||||
UInt64 packedPos = currentImportantTotalPacked;
|
||||
UInt64 unpackedPos = currentImportantTotalUnPacked;
|
||||
|
||||
/*
|
||||
for (int partIndex = 0; partIndex < 1; partIndex++)
|
||||
@@ -710,11 +714,12 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
&packedPos,
|
||||
&unpackedPos);
|
||||
|
||||
UINT64 packSize = currentPackSize;
|
||||
UInt64 packSize = currentPackSize;
|
||||
|
||||
// packedPos += item.PackSize;
|
||||
// unpackedPos += 0;
|
||||
|
||||
CMyComPtr<ISequentialInStream> inStream;
|
||||
if (item.IsEncrypted())
|
||||
{
|
||||
CMyComPtr<ICryptoSetPassword> cryptoSetPassword;
|
||||
@@ -722,28 +727,24 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
{
|
||||
if (!rar29CryptoDecoder)
|
||||
{
|
||||
rar29CryptoDecoder = new NCrypto::NRar29::CDecoder();
|
||||
rar29CryptoDecoder = new NCrypto::NRar29::CDecoder;
|
||||
// RINOK(rar29CryptoDecoder.CoCreateInstance(CLSID_CCryptoRar29Decoder));
|
||||
}
|
||||
CMyComPtr<ICompressSetDecoderProperties> cryptoProperties;
|
||||
RINOK(rar29CryptoDecoder.QueryInterface(IID_ICompressSetDecoderProperties,
|
||||
CMyComPtr<ICompressSetDecoderProperties2> cryptoProperties;
|
||||
RINOK(rar29CryptoDecoder.QueryInterface(IID_ICompressSetDecoderProperties2,
|
||||
&cryptoProperties));
|
||||
CSequentialInStreamImp *inStreamSpec = new CSequentialInStreamImp;
|
||||
CMyComPtr<ISequentialInStream> inStreamProperties(inStreamSpec);
|
||||
inStreamSpec->Init(item.Salt, item.HasSalt() ? sizeof(item.Salt) : 0);
|
||||
RINOK(cryptoProperties->SetDecoderProperties(inStreamProperties));
|
||||
RINOK(rar29CryptoDecoder.QueryInterface(IID_ICryptoSetPassword,
|
||||
&cryptoSetPassword));
|
||||
RINOK(cryptoProperties->SetDecoderProperties2(item.Salt, item.HasSalt() ? sizeof(item.Salt) : 0));
|
||||
filterStreamSpec->Filter = rar29CryptoDecoder;
|
||||
}
|
||||
else if (item.UnPackVersion >= 20)
|
||||
{
|
||||
if (!rar20CryptoDecoder)
|
||||
{
|
||||
rar20CryptoDecoder = new NCrypto::NRar20::CDecoder();
|
||||
rar20CryptoDecoderSpec = new NCrypto::NRar20::CDecoder;
|
||||
rar20CryptoDecoder = rar20CryptoDecoderSpec;
|
||||
// RINOK(rar20CryptoDecoder.CoCreateInstance(CLSID_CCryptoRar20Decoder));
|
||||
}
|
||||
RINOK(rar20CryptoDecoder.QueryInterface(IID_ICryptoSetPassword,
|
||||
&cryptoSetPassword));
|
||||
filterStreamSpec->Filter = rar20CryptoDecoder;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -751,6 +752,8 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
|
||||
continue;
|
||||
}
|
||||
RINOK(filterStreamSpec->Filter.QueryInterface(IID_ICryptoSetPassword,
|
||||
&cryptoSetPassword));
|
||||
|
||||
if (!getTextPassword)
|
||||
extractCallback.QueryInterface(IID_ICryptoGetTextPassword,
|
||||
@@ -761,23 +764,39 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
RINOK(getTextPassword->CryptoGetTextPassword(&password));
|
||||
if (item.UnPackVersion >= 29)
|
||||
{
|
||||
CByteBuffer buffer;
|
||||
UString unicodePassword(password);
|
||||
const UInt32 sizeInBytes = unicodePassword.Length() * 2;
|
||||
buffer.SetCapacity(sizeInBytes);
|
||||
for (int i = 0; i < unicodePassword.Length(); i++)
|
||||
{
|
||||
wchar_t c = unicodePassword[i];
|
||||
((Byte *)buffer)[i * 2] = (Byte)c;
|
||||
((Byte *)buffer)[i * 2 + 1] = (Byte)(c >> 8);
|
||||
}
|
||||
RINOK(cryptoSetPassword->CryptoSetPassword(
|
||||
(const BYTE *)(const wchar_t *)password,
|
||||
password.Length() * sizeof(wchar_t)));
|
||||
(const Byte *)buffer, sizeInBytes));
|
||||
}
|
||||
else
|
||||
{
|
||||
AString oemPassword = UnicodeStringToMultiByte(
|
||||
(const wchar_t *)password, CP_OEMCP);
|
||||
RINOK(cryptoSetPassword->CryptoSetPassword(
|
||||
(const BYTE *)(const char *)oemPassword, oemPassword.Length()));
|
||||
(const Byte *)(const char *)oemPassword, oemPassword.Length()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RINOK(cryptoSetPassword->CryptoSetPassword(0, 0));
|
||||
}
|
||||
filterStreamSpec->SetInStream(folderInStream);
|
||||
inStream = filterStream;
|
||||
}
|
||||
else
|
||||
{
|
||||
inStream = folderInStream;
|
||||
}
|
||||
CMyComPtr<ICompressCoder> commonCoder;
|
||||
switch(item.Method)
|
||||
{
|
||||
case '0':
|
||||
@@ -787,39 +806,7 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
copyCoderSpec = new NCompress::CCopyCoder;
|
||||
copyCoder = copyCoderSpec;
|
||||
}
|
||||
|
||||
if (item.IsEncrypted())
|
||||
{
|
||||
{
|
||||
if (!mixerCoder || !mixerCoderStoreMethod ||
|
||||
item.UnPackVersion != mixerCryptoVersion)
|
||||
{
|
||||
mixerCoder.Release();
|
||||
mixerCoderSpec = new CCoderMixer;
|
||||
mixerCoder = mixerCoderSpec;
|
||||
if (item.UnPackVersion >= 29)
|
||||
mixerCoderSpec->AddCoder(rar29CryptoDecoder);
|
||||
else
|
||||
mixerCoderSpec->AddCoder(rar20CryptoDecoder);
|
||||
mixerCoderSpec->AddCoder(copyCoder);
|
||||
mixerCoderSpec->FinishAddingCoders();
|
||||
mixerCoderStoreMethod = true;
|
||||
mixerCryptoVersion = item.UnPackVersion;
|
||||
}
|
||||
mixerCoderSpec->ReInit();
|
||||
mixerCoderSpec->SetCoderInfo(0, &packSize, &item.UnPackSize);
|
||||
mixerCoderSpec->SetCoderInfo(1, &item.UnPackSize, &item.UnPackSize);
|
||||
mixerCoderSpec->SetProgressCoderIndex(1);
|
||||
|
||||
RINOK(mixerCoder->Code(folderInStream, outStream,
|
||||
NULL, NULL, compressProgress));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RINOK(copyCoder->Code(folderInStream, outStream,
|
||||
NULL, NULL, compressProgress));
|
||||
}
|
||||
commonCoder = copyCoder;
|
||||
break;
|
||||
}
|
||||
case '1':
|
||||
@@ -846,7 +833,7 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
mi.RarUnPackVersion = item.UnPackVersion;
|
||||
N7z::CMethodID methodID = { { 0x04, 0x03 } , 3 };
|
||||
|
||||
BYTE myID;
|
||||
Byte myID;
|
||||
if (item.UnPackVersion < 20)
|
||||
myID = 1;
|
||||
else if (item.UnPackVersion < 29)
|
||||
@@ -867,58 +854,16 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
}
|
||||
CMyComPtr<ICompressCoder> decoder = methodItems[m].Coder;
|
||||
|
||||
CMyComPtr<ICompressSetDecoderProperties> compressSetDecoderProperties;
|
||||
RINOK(decoder.QueryInterface(IID_ICompressSetDecoderProperties,
|
||||
CMyComPtr<ICompressSetDecoderProperties2> compressSetDecoderProperties;
|
||||
RINOK(decoder.QueryInterface(IID_ICompressSetDecoderProperties2,
|
||||
&compressSetDecoderProperties));
|
||||
|
||||
BYTE isSolid = (
|
||||
// item.IsSolid()
|
||||
IsSolid(index)
|
||||
||
|
||||
item.IsSplitBefore())
|
||||
? 1: 0;
|
||||
Byte isSolid =
|
||||
(IsSolid(index) || item.IsSplitBefore()) ? 1: 0;
|
||||
|
||||
CSequentialInStreamImp *inStreamSpec = new CSequentialInStreamImp;
|
||||
CMyComPtr<ISequentialInStream> inStreamProperties(inStreamSpec);
|
||||
inStreamSpec->Init(&isSolid, 1);
|
||||
RINOK(compressSetDecoderProperties->SetDecoderProperties(inStreamProperties));
|
||||
RINOK(compressSetDecoderProperties->SetDecoderProperties2(&isSolid, 1));
|
||||
|
||||
HRESULT result;
|
||||
if (item.IsEncrypted())
|
||||
{
|
||||
if (!mixerCoder || mixerCoderStoreMethod)
|
||||
{
|
||||
mixerCoder.Release();
|
||||
mixerCoderSpec = new CCoderMixer;
|
||||
mixerCoder = mixerCoderSpec;
|
||||
if (item.UnPackVersion >= 29)
|
||||
mixerCoderSpec->AddCoder(rar29CryptoDecoder);
|
||||
else
|
||||
mixerCoderSpec->AddCoder(rar20CryptoDecoder);
|
||||
mixerCoderSpec->AddCoder(decoder);
|
||||
mixerCoderSpec->FinishAddingCoders();
|
||||
mixerCoderStoreMethod = false;
|
||||
}
|
||||
mixerCoderSpec->ReInit();
|
||||
mixerCoderSpec->SetCoderInfo(1, &packSize,
|
||||
&item.UnPackSize);
|
||||
mixerCoderSpec->SetProgressCoderIndex(1);
|
||||
result = mixerCoder->Code(folderInStream, outStream,
|
||||
NULL, NULL, compressProgress);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = decoder->Code(folderInStream, outStream,
|
||||
&packSize, &item.UnPackSize, compressProgress);
|
||||
}
|
||||
if (result == S_FALSE)
|
||||
{
|
||||
outStream.Release();
|
||||
RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError));
|
||||
continue;
|
||||
}
|
||||
if (result != S_OK)
|
||||
return result;
|
||||
commonCoder = decoder;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -926,6 +871,18 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
|
||||
continue;
|
||||
}
|
||||
HRESULT result = commonCoder->Code(inStream, outStream,
|
||||
&packSize, &item.UnPackSize, compressProgress);
|
||||
if (item.IsEncrypted())
|
||||
filterStreamSpec->ReleaseInStream();
|
||||
if (result == S_FALSE)
|
||||
{
|
||||
outStream.Release();
|
||||
RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kDataError));
|
||||
continue;
|
||||
}
|
||||
if (result != S_OK)
|
||||
return result;
|
||||
|
||||
/*
|
||||
if (refItem.NumItems == 1 &&
|
||||
@@ -961,11 +918,11 @@ STDMETHODIMP CHandler::Extract(const UINT32* indices, UINT32 numItems,
|
||||
}
|
||||
|
||||
/*
|
||||
STDMETHODIMP CHandler::ExtractAllItems(INT32 testMode,
|
||||
STDMETHODIMP CHandler::ExtractAllItems(Int32 testMode,
|
||||
IArchiveExtractCallback *extractCallback)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
CRecordVector<UINT32> indices;
|
||||
CRecordVector<UInt32> indices;
|
||||
indices.Reserve(_refItems.Size());
|
||||
for(int i = 0; i < _refItems.Size(); i++)
|
||||
indices.Add(i);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Rar/Handler.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __RAR_HANDLER_H
|
||||
#define __RAR_HANDLER_H
|
||||
|
||||
@@ -20,22 +18,22 @@ public:
|
||||
MY_UNKNOWN_IMP
|
||||
|
||||
STDMETHOD(Open)(IInStream *aStream,
|
||||
const UINT64 *aMaxCheckStartPosition,
|
||||
const UInt64 *aMaxCheckStartPosition,
|
||||
IArchiveOpenCallback *anOpenArchiveCallback);
|
||||
STDMETHOD(Close)();
|
||||
STDMETHOD(GetNumberOfItems)(UINT32 *numItems);
|
||||
STDMETHOD(GetProperty)(UINT32 index, PROPID propID, PROPVARIANT *value);
|
||||
STDMETHOD(Extract)(const UINT32* indices, UINT32 numItems,
|
||||
INT32 testMode, IArchiveExtractCallback *anExtractCallback);
|
||||
STDMETHOD(GetNumberOfItems)(UInt32 *numItems);
|
||||
STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value);
|
||||
STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems,
|
||||
Int32 testMode, IArchiveExtractCallback *anExtractCallback);
|
||||
|
||||
STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value);
|
||||
|
||||
STDMETHOD(GetNumberOfProperties)(UINT32 *numProperties);
|
||||
STDMETHOD(GetPropertyInfo)(UINT32 index,
|
||||
STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties);
|
||||
STDMETHOD(GetPropertyInfo)(UInt32 index,
|
||||
BSTR *name, PROPID *propID, VARTYPE *varType);
|
||||
|
||||
STDMETHOD(GetNumberOfArchiveProperties)(UINT32 *numProperties);
|
||||
STDMETHOD(GetArchivePropertyInfo)(UINT32 index,
|
||||
STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties);
|
||||
STDMETHOD(GetArchivePropertyInfo)(UInt32 index,
|
||||
BSTR *name, PROPID *propID, VARTYPE *varType);
|
||||
|
||||
private:
|
||||
@@ -44,7 +42,7 @@ private:
|
||||
CObjectVector<CInArchive> _archives;
|
||||
NArchive::NRar::CInArchiveInfo _archiveInfo;
|
||||
|
||||
UINT64 GetPackSize(int refIndex) const;
|
||||
UInt64 GetPackSize(int refIndex) const;
|
||||
// NArchive::NRar::CInArchive _archive;
|
||||
|
||||
bool IsSolid(int refIndex)
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
// Archive::Rar::Headers.cpp
|
||||
// Archive/Rar/Headers.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "RarHeader.h"
|
||||
#include "Common/CRC.h"
|
||||
|
||||
static void UpdateCRCBytesWithoutStartBytes(CCRC &crc, const void *data,
|
||||
UINT32 size, UINT32 exludeSize)
|
||||
{
|
||||
crc.Update(((const BYTE *)data) + exludeSize, size - exludeSize);
|
||||
}
|
||||
|
||||
namespace NArchive{
|
||||
namespace NRar{
|
||||
namespace NHeader{
|
||||
|
||||
BYTE kMarker[kMarkerSize] = {0x52 + 1, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00};
|
||||
Byte kMarker[kMarkerSize] = {0x52 + 1, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00};
|
||||
|
||||
class CMarkerInitializer
|
||||
{
|
||||
@@ -23,42 +16,6 @@ public:
|
||||
CMarkerInitializer() { kMarker[0]--; };
|
||||
};
|
||||
|
||||
static CMarkerInitializer aMarkerInitializer;
|
||||
|
||||
namespace NArchive
|
||||
{
|
||||
UINT16 CBlock::GetRealCRC() const
|
||||
{
|
||||
CCRC crc;
|
||||
UpdateCRCBytesWithoutStartBytes(crc, this,
|
||||
sizeof(*this), sizeof(CRC));
|
||||
return UINT16(crc.GetDigest());
|
||||
}
|
||||
}
|
||||
|
||||
namespace NFile
|
||||
{
|
||||
/*
|
||||
UINT16 CBlock32::GetRealCRC(const void *aName, UINT32 aNameSize,
|
||||
bool anExtraDataDefined, BYTE *anExtraData) const
|
||||
{
|
||||
CCRC crc;
|
||||
UpdateCRCBytesWithoutStartBytes(crc, this,
|
||||
sizeof(*this), sizeof(HeadCRC));
|
||||
crc.Update(aName, aNameSize);
|
||||
if (anExtraDataDefined)
|
||||
crc.Update(anExtraData, 8);
|
||||
return UINT16(crc.GetDigest());
|
||||
}
|
||||
UINT16 CBlock64::GetRealCRC(const void *aName, UINT32 aNameSize) const
|
||||
{
|
||||
CCRC crc;
|
||||
UpdateCRCBytesWithoutStartBytes(crc, this,
|
||||
sizeof(*this), sizeof(HeadCRC));
|
||||
crc.Update(aName, aNameSize);
|
||||
return UINT16(crc.GetDigest());
|
||||
}
|
||||
*/
|
||||
}
|
||||
static CMarkerInitializer markerInitializer;
|
||||
|
||||
}}}
|
||||
@@ -1,21 +1,16 @@
|
||||
// Archive::Rar::Header.h
|
||||
|
||||
#pragma once
|
||||
// Archive/RarHeader.h
|
||||
|
||||
#ifndef __ARCHIVE_RAR_HEADER_H
|
||||
#define __ARCHIVE_RAR_HEADER_H
|
||||
|
||||
#include "Common/Types.h"
|
||||
|
||||
#pragma pack(push, PragmaRarHeaders)
|
||||
#pragma pack(push, 1)
|
||||
|
||||
namespace NArchive{
|
||||
namespace NRar{
|
||||
namespace NHeader{
|
||||
|
||||
const int kMarkerSize = 7;
|
||||
extern BYTE kMarker[kMarkerSize];
|
||||
extern Byte kMarker[kMarkerSize];
|
||||
|
||||
const int kArchiveSolid = 0x1;
|
||||
|
||||
@@ -38,26 +33,27 @@ namespace NBlockType
|
||||
|
||||
namespace NArchive
|
||||
{
|
||||
const UINT16 kVolume = 1;
|
||||
const UINT16 kComment = 2;
|
||||
const UINT16 kLock = 4;
|
||||
const UINT16 kSolid = 8;
|
||||
const UINT16 kNewVolName = 0x10; // ('volname.partN.rar')
|
||||
const UINT16 kAuthenticity = 0x20;
|
||||
const UINT16 kRecovery = 0x40;
|
||||
const UINT16 kBlockEncryption = 0x80;
|
||||
const UINT16 kFirstVolume = 0x100; // (set only by RAR 3.0 and later)
|
||||
const UInt16 kVolume = 1;
|
||||
const UInt16 kComment = 2;
|
||||
const UInt16 kLock = 4;
|
||||
const UInt16 kSolid = 8;
|
||||
const UInt16 kNewVolName = 0x10; // ('volname.partN.rar')
|
||||
const UInt16 kAuthenticity = 0x20;
|
||||
const UInt16 kRecovery = 0x40;
|
||||
const UInt16 kBlockEncryption = 0x80;
|
||||
const UInt16 kFirstVolume = 0x100; // (set only by RAR 3.0 and later)
|
||||
|
||||
struct CBlock
|
||||
{
|
||||
UINT16 CRC;
|
||||
BYTE Type;
|
||||
UINT16 Flags;
|
||||
UINT16 Size;
|
||||
UINT16 Reserved1;
|
||||
UINT32 Reserved2;
|
||||
UINT16 GetRealCRC() const;
|
||||
UInt16 CRC;
|
||||
Byte Type;
|
||||
UInt16 Flags;
|
||||
UInt16 Size;
|
||||
UInt16 Reserved1;
|
||||
UInt32 Reserved2;
|
||||
// UInt16 GetRealCRC() const;
|
||||
};
|
||||
const int kArchiveHeaderSize = 13;
|
||||
|
||||
const int kBlockHeadersAreEncrypted = 0x80;
|
||||
}
|
||||
@@ -85,60 +81,62 @@ namespace NFile
|
||||
|
||||
const int kLongBlock = 1 << 15;
|
||||
|
||||
/*
|
||||
struct CBlock
|
||||
{
|
||||
// UINT16 HeadCRC;
|
||||
// BYTE Type;
|
||||
// UINT16 Flags;
|
||||
// UINT16 HeadSize;
|
||||
UINT32 PackSize;
|
||||
UINT32 UnPackSize;
|
||||
BYTE HostOS;
|
||||
UINT32 FileCRC;
|
||||
UINT32 Time;
|
||||
BYTE UnPackVersion;
|
||||
BYTE Method;
|
||||
UINT16 NameSize;
|
||||
UINT32 Attributes;
|
||||
// UInt16 HeadCRC;
|
||||
// Byte Type;
|
||||
// UInt16 Flags;
|
||||
// UInt16 HeadSize;
|
||||
UInt32 PackSize;
|
||||
UInt32 UnPackSize;
|
||||
Byte HostOS;
|
||||
UInt32 FileCRC;
|
||||
UInt32 Time;
|
||||
Byte UnPackVersion;
|
||||
Byte Method;
|
||||
UInt16 NameSize;
|
||||
UInt32 Attributes;
|
||||
};
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
struct CBlock32
|
||||
{
|
||||
UINT16 HeadCRC;
|
||||
BYTE Type;
|
||||
UINT16 Flags;
|
||||
UINT16 HeadSize;
|
||||
UINT32 PackSize;
|
||||
UINT32 UnPackSize;
|
||||
BYTE HostOS;
|
||||
UINT32 FileCRC;
|
||||
UINT32 Time;
|
||||
BYTE UnPackVersion;
|
||||
BYTE Method;
|
||||
UINT16 NameSize;
|
||||
UINT32 Attributes;
|
||||
UINT16 GetRealCRC(const void *aName, UINT32 aNameSize,
|
||||
bool anExtraDataDefined = false, BYTE *anExtraData = 0) const;
|
||||
UInt16 HeadCRC;
|
||||
Byte Type;
|
||||
UInt16 Flags;
|
||||
UInt16 HeadSize;
|
||||
UInt32 PackSize;
|
||||
UInt32 UnPackSize;
|
||||
Byte HostOS;
|
||||
UInt32 FileCRC;
|
||||
UInt32 Time;
|
||||
Byte UnPackVersion;
|
||||
Byte Method;
|
||||
UInt16 NameSize;
|
||||
UInt32 Attributes;
|
||||
UInt16 GetRealCRC(const void *aName, UInt32 aNameSize,
|
||||
bool anExtraDataDefined = false, Byte *anExtraData = 0) const;
|
||||
};
|
||||
struct CBlock64
|
||||
{
|
||||
UINT16 HeadCRC;
|
||||
BYTE Type;
|
||||
UINT16 Flags;
|
||||
UINT16 HeadSize;
|
||||
UINT32 PackSizeLow;
|
||||
UINT32 UnPackSizeLow;
|
||||
BYTE HostOS;
|
||||
UINT32 FileCRC;
|
||||
UINT32 Time;
|
||||
BYTE UnPackVersion;
|
||||
BYTE Method;
|
||||
UINT16 NameSize;
|
||||
UINT32 Attributes;
|
||||
UINT32 PackSizeHigh;
|
||||
UINT32 UnPackSizeHigh;
|
||||
UINT16 GetRealCRC(const void *aName, UINT32 aNameSize) const;
|
||||
UInt16 HeadCRC;
|
||||
Byte Type;
|
||||
UInt16 Flags;
|
||||
UInt16 HeadSize;
|
||||
UInt32 PackSizeLow;
|
||||
UInt32 UnPackSizeLow;
|
||||
Byte HostOS;
|
||||
UInt32 FileCRC;
|
||||
UInt32 Time;
|
||||
Byte UnPackVersion;
|
||||
Byte Method;
|
||||
UInt16 NameSize;
|
||||
UInt32 Attributes;
|
||||
UInt32 PackSizeHigh;
|
||||
UInt32 UnPackSizeHigh;
|
||||
UInt16 GetRealCRC(const void *aName, UInt32 aNameSize) const;
|
||||
};
|
||||
*/
|
||||
|
||||
@@ -158,57 +156,56 @@ namespace NFile
|
||||
|
||||
namespace NBlock
|
||||
{
|
||||
const UINT16 kLongBlock = 1 << 15;
|
||||
const UInt16 kLongBlock = 1 << 15;
|
||||
struct CBlock
|
||||
{
|
||||
UINT16 CRC;
|
||||
BYTE Type;
|
||||
UINT16 Flags;
|
||||
UINT16 HeadSize;
|
||||
// UINT32 DataSize;
|
||||
UInt16 CRC;
|
||||
Byte Type;
|
||||
UInt16 Flags;
|
||||
UInt16 HeadSize;
|
||||
// UInt32 DataSize;
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
struct CSubBlock
|
||||
{
|
||||
UINT16 HeadCRC;
|
||||
BYTE HeadType;
|
||||
UINT16 Flags;
|
||||
UINT16 HeadSize;
|
||||
UINT32 DataSize;
|
||||
UINT16 SubType;
|
||||
BYTE Level; // Reserved : Must be 0
|
||||
UInt16 HeadCRC;
|
||||
Byte HeadType;
|
||||
UInt16 Flags;
|
||||
UInt16 HeadSize;
|
||||
UInt32 DataSize;
|
||||
UInt16 SubType;
|
||||
Byte Level; // Reserved : Must be 0
|
||||
};
|
||||
|
||||
struct CCommentBlock
|
||||
{
|
||||
UINT16 HeadCRC;
|
||||
BYTE HeadType;
|
||||
UINT16 Flags;
|
||||
UINT16 HeadSize;
|
||||
UINT16 UnpSize;
|
||||
BYTE UnpVer;
|
||||
BYTE Method;
|
||||
UINT16 CommCRC;
|
||||
UInt16 HeadCRC;
|
||||
Byte HeadType;
|
||||
UInt16 Flags;
|
||||
UInt16 HeadSize;
|
||||
UInt16 UnpSize;
|
||||
Byte UnpVer;
|
||||
Byte Method;
|
||||
UInt16 CommCRC;
|
||||
};
|
||||
|
||||
|
||||
struct CProtectHeader
|
||||
{
|
||||
UINT16 HeadCRC;
|
||||
BYTE HeadType;
|
||||
UINT16 Flags;
|
||||
UINT16 HeadSize;
|
||||
UINT32 DataSize;
|
||||
BYTE Version;
|
||||
UINT16 RecSectors;
|
||||
UINT32 TotalBlocks;
|
||||
BYTE Mark[8];
|
||||
UInt16 HeadCRC;
|
||||
Byte HeadType;
|
||||
UInt16 Flags;
|
||||
UInt16 HeadSize;
|
||||
UInt32 DataSize;
|
||||
Byte Version;
|
||||
UInt16 RecSectors;
|
||||
UInt32 TotalBlocks;
|
||||
Byte Mark[8];
|
||||
};
|
||||
*/
|
||||
|
||||
}}}
|
||||
|
||||
#pragma pack(pop)
|
||||
#pragma pack(pop, PragmaRarHeaders)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,8 +19,9 @@ void CInArchive::ThrowExceptionWithCode(
|
||||
throw CInArchiveException(cause);
|
||||
}
|
||||
|
||||
bool CInArchive::Open(IInStream *inStream, const UINT64 *searchHeaderSizeLimit)
|
||||
bool CInArchive::Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit)
|
||||
{
|
||||
m_CryptoMode = false;
|
||||
if(inStream->Seek(0, STREAM_SEEK_CUR, &m_StreamStartPosition) != S_OK)
|
||||
return false;
|
||||
m_Position = m_StreamStartPosition;
|
||||
@@ -39,14 +40,13 @@ void CInArchive::Close()
|
||||
|
||||
static inline bool TestMarkerCandidate(const void *aTestBytes)
|
||||
{
|
||||
// return (memcmp(aTestBytes, NHeader::kMarker, NHeader::kMarkerSize) == 0);
|
||||
for (UINT32 i = 0; i < NHeader::kMarkerSize; i++)
|
||||
if (((const BYTE *)aTestBytes)[i] != NHeader::kMarker[i])
|
||||
for (UInt32 i = 0; i < NHeader::kMarkerSize; i++)
|
||||
if (((const Byte *)aTestBytes)[i] != NHeader::kMarker[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CInArchive::FindAndReadMarker(const UINT64 *searchHeaderSizeLimit)
|
||||
bool CInArchive::FindAndReadMarker(const UInt64 *searchHeaderSizeLimit)
|
||||
{
|
||||
// if (m_Length < NHeader::kMarkerSize)
|
||||
// return false;
|
||||
@@ -55,8 +55,8 @@ bool CInArchive::FindAndReadMarker(const UINT64 *searchHeaderSizeLimit)
|
||||
if(m_Stream->Seek(m_StreamStartPosition, STREAM_SEEK_SET, NULL) != S_OK)
|
||||
return false;
|
||||
|
||||
BYTE marker[NHeader::kMarkerSize];
|
||||
UINT32 processedSize;
|
||||
Byte marker[NHeader::kMarkerSize];
|
||||
UInt32 processedSize;
|
||||
ReadBytes(marker, NHeader::kMarkerSize, &processedSize);
|
||||
if(processedSize != NHeader::kMarkerSize)
|
||||
return false;
|
||||
@@ -64,24 +64,24 @@ bool CInArchive::FindAndReadMarker(const UINT64 *searchHeaderSizeLimit)
|
||||
return true;
|
||||
|
||||
CByteDynamicBuffer dynamicBuffer;
|
||||
static const UINT32 kSearchMarkerBufferSize = 0x10000;
|
||||
static const UInt32 kSearchMarkerBufferSize = 0x10000;
|
||||
dynamicBuffer.EnsureCapacity(kSearchMarkerBufferSize);
|
||||
BYTE *buffer = dynamicBuffer;
|
||||
UINT32 numBytesPrev = NHeader::kMarkerSize - 1;
|
||||
Byte *buffer = dynamicBuffer;
|
||||
UInt32 numBytesPrev = NHeader::kMarkerSize - 1;
|
||||
memmove(buffer, marker + 1, numBytesPrev);
|
||||
UINT64 curTestPos = m_StreamStartPosition + 1;
|
||||
UInt64 curTestPos = m_StreamStartPosition + 1;
|
||||
while(true)
|
||||
{
|
||||
if (searchHeaderSizeLimit != NULL)
|
||||
if (curTestPos - m_StreamStartPosition > *searchHeaderSizeLimit)
|
||||
return false;
|
||||
UINT32 numReadBytes = kSearchMarkerBufferSize - numBytesPrev;
|
||||
UInt32 numReadBytes = kSearchMarkerBufferSize - numBytesPrev;
|
||||
ReadBytes(buffer + numBytesPrev, numReadBytes, &processedSize);
|
||||
UINT32 numBytesInBuffer = numBytesPrev + processedSize;
|
||||
UInt32 numBytesInBuffer = numBytesPrev + processedSize;
|
||||
if (numBytesInBuffer < NHeader::kMarkerSize)
|
||||
return false;
|
||||
UINT32 numTests = numBytesInBuffer - NHeader::kMarkerSize + 1;
|
||||
for(UINT32 pos = 0; pos < numTests; pos++, curTestPos++)
|
||||
UInt32 numTests = numBytesInBuffer - NHeader::kMarkerSize + 1;
|
||||
for(UInt32 pos = 0; pos < numTests; pos++, curTestPos++)
|
||||
{
|
||||
if (TestMarkerCandidate(buffer + pos))
|
||||
{
|
||||
@@ -98,29 +98,36 @@ bool CInArchive::FindAndReadMarker(const UINT64 *searchHeaderSizeLimit)
|
||||
return false;
|
||||
}
|
||||
|
||||
//bool boolIsItCorrectArchive;
|
||||
|
||||
void CInArchive::ThrowUnexpectedEndOfArchiveException()
|
||||
{
|
||||
ThrowExceptionWithCode(CInArchiveException::kUnexpectedEndOfArchive);
|
||||
}
|
||||
|
||||
bool CInArchive::ReadBytesAndTestSize(void *data, UINT32 size)
|
||||
bool CInArchive::ReadBytesAndTestSize(void *data, UInt32 size)
|
||||
{
|
||||
UINT32 processedSize;
|
||||
if (m_CryptoMode)
|
||||
{
|
||||
const Byte *bufData = (const Byte *)m_DecryptedData;
|
||||
UInt32 bufSize = m_DecryptedDataSize;
|
||||
UInt32 i;
|
||||
for (i = 0; i < size && m_CryptoPos < bufSize; i++)
|
||||
((Byte *)data)[i] = bufData[m_CryptoPos++];
|
||||
return (i == size);
|
||||
}
|
||||
UInt32 processedSize;
|
||||
m_Stream->Read(data, size, &processedSize);
|
||||
return (processedSize == size);
|
||||
}
|
||||
|
||||
void CInArchive::ReadBytesAndTestResult(void *data, UINT32 size)
|
||||
void CInArchive::ReadBytesAndTestResult(void *data, UInt32 size)
|
||||
{
|
||||
if(!ReadBytesAndTestSize(data,size))
|
||||
ThrowUnexpectedEndOfArchiveException();
|
||||
}
|
||||
|
||||
HRESULT CInArchive::ReadBytes(void *data, UINT32 size, UINT32 *processedSize)
|
||||
HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
UINT32 realProcessedSize;
|
||||
UInt32 realProcessedSize;
|
||||
HRESULT result = m_Stream->Read(data, size, &realProcessedSize);
|
||||
if(processedSize != NULL)
|
||||
*processedSize = realProcessedSize;
|
||||
@@ -128,17 +135,36 @@ HRESULT CInArchive::ReadBytes(void *data, UINT32 size, UINT32 *processedSize)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CInArchive::ReadMarkerAndArchiveHeader(const UINT64 *searchHeaderSizeLimit)
|
||||
bool CInArchive::ReadMarkerAndArchiveHeader(const UInt64 *searchHeaderSizeLimit)
|
||||
{
|
||||
if (!FindAndReadMarker(searchHeaderSizeLimit))
|
||||
return false;
|
||||
|
||||
UINT32 processedSize;
|
||||
ReadBytes(&m_ArchiveHeader, sizeof(m_ArchiveHeader), &processedSize);
|
||||
if (processedSize != sizeof(m_ArchiveHeader))
|
||||
Byte buf[NHeader::NArchive::kArchiveHeaderSize];
|
||||
UInt32 processedSize;
|
||||
ReadBytes(buf, sizeof(buf), &processedSize);
|
||||
if (processedSize != sizeof(buf))
|
||||
return false;
|
||||
|
||||
if(m_ArchiveHeader.CRC != m_ArchiveHeader.GetRealCRC())
|
||||
m_CurData = buf;
|
||||
m_CurPos = 0;
|
||||
m_PosLimit = sizeof(buf);
|
||||
|
||||
m_ArchiveHeader.CRC = ReadUInt16();
|
||||
m_ArchiveHeader.Type = ReadByte();
|
||||
m_ArchiveHeader.Flags = ReadUInt16();
|
||||
m_ArchiveHeader.Size = ReadUInt16();
|
||||
m_ArchiveHeader.Reserved1 = ReadUInt16();
|
||||
m_ArchiveHeader.Reserved2 = ReadUInt32();
|
||||
|
||||
CCRC crc;
|
||||
crc.UpdateByte(m_ArchiveHeader.Type);
|
||||
crc.UpdateUInt16(m_ArchiveHeader.Flags);
|
||||
crc.UpdateUInt16(m_ArchiveHeader.Size);
|
||||
crc.UpdateUInt16(m_ArchiveHeader.Reserved1);
|
||||
crc.UpdateUInt32(m_ArchiveHeader.Reserved2);
|
||||
|
||||
UInt32 u = crc.GetDigest();
|
||||
if(m_ArchiveHeader.CRC != (crc.GetDigest() & 0xFFFF))
|
||||
ThrowExceptionWithCode(CInArchiveException::kArchiveHeaderCRCError);
|
||||
if (m_ArchiveHeader.Type != NHeader::NBlockType::kArchiveHeader)
|
||||
return false;
|
||||
@@ -151,7 +177,7 @@ void CInArchive::SkipArchiveComment()
|
||||
{
|
||||
if (!m_SeekOnArchiveComment)
|
||||
return;
|
||||
AddToSeekValue(m_ArchiveHeader.Size - sizeof(m_ArchiveHeader));
|
||||
AddToSeekValue(m_ArchiveHeader.Size - NHeader::NArchive::kArchiveHeaderSize);
|
||||
m_SeekOnArchiveComment = false;
|
||||
}
|
||||
|
||||
@@ -160,17 +186,17 @@ void CInArchive::GetArchiveInfo(CInArchiveInfo &archiveInfo) const
|
||||
archiveInfo.StartPosition = m_ArchiveStartPosition;
|
||||
archiveInfo.Flags = m_ArchiveHeader.Flags;
|
||||
archiveInfo.CommentPosition = m_ArchiveCommentPosition;
|
||||
archiveInfo.CommentSize = m_ArchiveHeader.Size - sizeof(m_ArchiveHeader);
|
||||
archiveInfo.CommentSize = m_ArchiveHeader.Size - NHeader::NArchive::kArchiveHeaderSize;
|
||||
}
|
||||
|
||||
static void DecodeUnicodeFileName(const char *name, const BYTE *encName,
|
||||
static void DecodeUnicodeFileName(const char *name, const Byte *encName,
|
||||
int encSize, wchar_t *unicodeName, int maxDecSize)
|
||||
{
|
||||
int encPos = 0;
|
||||
int decPos = 0;
|
||||
int flagBits = 0;
|
||||
BYTE flags = 0;
|
||||
BYTE highByte = encName[encPos++];
|
||||
Byte flags = 0;
|
||||
Byte highByte = encName[encPos++];
|
||||
while (encPos < encSize && decPos < maxDecSize)
|
||||
{
|
||||
if (flagBits == 0)
|
||||
@@ -195,7 +221,7 @@ static void DecodeUnicodeFileName(const char *name, const BYTE *encName,
|
||||
int length = encName[encPos++];
|
||||
if (length & 0x80)
|
||||
{
|
||||
BYTE correction = encName[encPos++];
|
||||
Byte correction = encName[encPos++];
|
||||
for (length = (length & 0x7f) + 2;
|
||||
length > 0 && decPos < maxDecSize; length--, decPos++)
|
||||
unicodeName[decPos] = ((name[decPos] + correction) & 0xff) + (highByte << 8);
|
||||
@@ -212,32 +238,32 @@ static void DecodeUnicodeFileName(const char *name, const BYTE *encName,
|
||||
unicodeName[decPos < maxDecSize ? decPos : maxDecSize - 1] = 0;
|
||||
}
|
||||
|
||||
void CInArchive::ReadName(const BYTE *data, CItemEx &item, int nameSize)
|
||||
void CInArchive::ReadName(CItemEx &item, int nameSize)
|
||||
{
|
||||
int sizeFileName = nameSize;
|
||||
item.UnicodeName.Empty();
|
||||
if (sizeFileName > 0)
|
||||
if (nameSize > 0)
|
||||
{
|
||||
m_NameBuffer.EnsureCapacity(sizeFileName + 1);
|
||||
m_NameBuffer.EnsureCapacity(nameSize + 1);
|
||||
char *buffer = (char *)m_NameBuffer;
|
||||
|
||||
memmove(buffer, data, sizeFileName);
|
||||
for (int i = 0; i < nameSize; i++)
|
||||
buffer[i] = ReadByte();
|
||||
|
||||
int mainLen;
|
||||
for (mainLen = 0; mainLen < sizeFileName; mainLen++)
|
||||
for (mainLen = 0; mainLen < nameSize; mainLen++)
|
||||
if (buffer[mainLen] == '\0')
|
||||
break;
|
||||
buffer[mainLen] = '\0';
|
||||
item.Name = buffer;
|
||||
|
||||
int unicodeNameSizeMax = MyMin(sizeFileName, (0x400));
|
||||
int unicodeNameSizeMax = MyMin(nameSize, (0x400));
|
||||
_unicodeNameBuffer.EnsureCapacity(unicodeNameSizeMax + 1);
|
||||
|
||||
if((m_BlockHeader.Flags & NHeader::NFile::kUnicodeName) != 0 &&
|
||||
mainLen < sizeFileName)
|
||||
mainLen < nameSize)
|
||||
{
|
||||
DecodeUnicodeFileName(buffer, (const BYTE *)buffer + mainLen + 1,
|
||||
sizeFileName - (mainLen + 1), _unicodeNameBuffer, unicodeNameSizeMax);
|
||||
DecodeUnicodeFileName(buffer, (const Byte *)buffer + mainLen + 1,
|
||||
nameSize - (mainLen + 1), _unicodeNameBuffer, unicodeNameSizeMax);
|
||||
item.UnicodeName = _unicodeNameBuffer;
|
||||
}
|
||||
}
|
||||
@@ -245,157 +271,232 @@ void CInArchive::ReadName(const BYTE *data, CItemEx &item, int nameSize)
|
||||
item.Name.Empty();
|
||||
}
|
||||
|
||||
static const BYTE *ReadTime(const BYTE *data, BYTE mask, CRarTime &rarTime)
|
||||
Byte CInArchive::ReadByte()
|
||||
{
|
||||
if (m_CurPos >= m_PosLimit)
|
||||
throw CInArchiveException(CInArchiveException::kIncorrectArchive);
|
||||
return m_CurData[m_CurPos++];
|
||||
}
|
||||
|
||||
UInt16 CInArchive::ReadUInt16()
|
||||
{
|
||||
UInt16 value = 0;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Byte b = ReadByte();
|
||||
value |= (UInt16(b) << (8 * i));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
UInt32 CInArchive::ReadUInt32()
|
||||
{
|
||||
UInt32 value = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Byte b = ReadByte();
|
||||
value |= (UInt32(b) << (8 * i));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
void CInArchive::ReadTime(Byte mask, CRarTime &rarTime)
|
||||
{
|
||||
rarTime.LowSecond = ((mask & 4) != 0) ? 1 : 0;
|
||||
int numDigits = (mask & 3);
|
||||
rarTime.SubTime[0] = rarTime.SubTime[1] = rarTime.SubTime[2] = 0;
|
||||
for (int i = 0; i < numDigits; i++)
|
||||
rarTime.SubTime[3 - numDigits + i] = *data++;
|
||||
return data;
|
||||
rarTime.SubTime[3 - numDigits + i] = ReadByte();
|
||||
}
|
||||
|
||||
void CInArchive::ReadHeaderReal(const BYTE *data, CItemEx &item)
|
||||
void CInArchive::ReadHeaderReal(CItemEx &item)
|
||||
{
|
||||
const BYTE *dataStart = data;
|
||||
const NHeader::NFile::CBlock &fileHeader =
|
||||
*(const NHeader::NFile::CBlock *)data;
|
||||
// UINT32 sizeFileName = fileHeader.NameSize;
|
||||
|
||||
item.Flags = m_BlockHeader.Flags;
|
||||
item.PackSize = fileHeader.PackSize;
|
||||
item.UnPackSize = fileHeader.UnPackSize;
|
||||
item.HostOS = fileHeader.HostOS;
|
||||
item.FileCRC = fileHeader.FileCRC;
|
||||
item.LastWriteTime.DosTime = fileHeader.Time;
|
||||
item.PackSize = ReadUInt32();
|
||||
item.UnPackSize = ReadUInt32();
|
||||
item.HostOS = ReadByte();
|
||||
item.FileCRC = ReadUInt32();
|
||||
item.LastWriteTime.DosTime = ReadUInt32();
|
||||
item.UnPackVersion = ReadByte();
|
||||
item.Method = ReadByte();
|
||||
int nameSize = ReadUInt16();
|
||||
item.Attributes = ReadUInt32();
|
||||
|
||||
item.LastWriteTime.LowSecond = 0;
|
||||
item.LastWriteTime.SubTime[0] =
|
||||
item.LastWriteTime.SubTime[1] =
|
||||
item.LastWriteTime.SubTime[2] = 0;
|
||||
|
||||
|
||||
item.UnPackVersion = fileHeader.UnPackVersion;
|
||||
item.Method = fileHeader.Method;
|
||||
item.Attributes = fileHeader.Attributes;
|
||||
|
||||
data += sizeof(fileHeader);
|
||||
item.LastWriteTime.SubTime[1] =
|
||||
item.LastWriteTime.SubTime[2] = 0;
|
||||
|
||||
if((item.Flags & NHeader::NFile::kSize64Bits) != 0)
|
||||
{
|
||||
item.PackSize |= (*((const UINT64 *)data)) << 32;
|
||||
data += sizeof(UINT32);
|
||||
item.UnPackSize |= (*((const UINT64 *)data)) << 32;
|
||||
data += sizeof(UINT32);
|
||||
item.PackSize |= ((UInt64)ReadUInt32() << 32);
|
||||
item.UnPackSize |= ((UInt64)ReadUInt32() << 32);
|
||||
}
|
||||
|
||||
ReadName(data, item, fileHeader.NameSize);
|
||||
data += fileHeader.NameSize;
|
||||
ReadName(item, nameSize);
|
||||
|
||||
if (item.HasSalt())
|
||||
{
|
||||
memmove(item.Salt, data, sizeof(item.Salt));
|
||||
data += sizeof(item.Salt);
|
||||
}
|
||||
for (int i = 0; i < sizeof(item.Salt); i++)
|
||||
item.Salt[i] = ReadByte();
|
||||
|
||||
if (item.HasExtTime())
|
||||
{
|
||||
BYTE access = (*data) >> 4;
|
||||
data++;
|
||||
BYTE modif = (*data) >> 4;
|
||||
BYTE creat = (*data) & 0xF;
|
||||
data++;
|
||||
if ((modif & 8) != 0)
|
||||
data = ReadTime(data, modif, item.LastWriteTime);
|
||||
if (item.IsCreationTimeDefined = ((creat & 8) != 0))
|
||||
Byte accessMask = ReadByte() >> 4;
|
||||
Byte b = ReadByte();
|
||||
Byte modifMask = b >> 4;
|
||||
Byte createMask = b & 0xF;
|
||||
if ((modifMask & 8) != 0)
|
||||
ReadTime(modifMask, item.LastWriteTime);
|
||||
if (item.IsCreationTimeDefined = ((createMask & 8) != 0))
|
||||
{
|
||||
item.CreationTime.DosTime = *(const UINT32 *)data;
|
||||
data += sizeof(UINT32);
|
||||
data = ReadTime(data, creat, item.CreationTime);
|
||||
item.CreationTime.DosTime = ReadUInt32();
|
||||
ReadTime(createMask, item.CreationTime);
|
||||
}
|
||||
if (item.IsLastAccessTimeDefined = ((access & 8) != 0))
|
||||
if (item.IsLastAccessTimeDefined = ((accessMask & 8) != 0))
|
||||
{
|
||||
item.LastAccessTime.DosTime = *(const UINT32 *)data;
|
||||
data += sizeof(UINT32);
|
||||
data = ReadTime(data, access, item.LastAccessTime);
|
||||
item.LastAccessTime.DosTime = ReadUInt32();
|
||||
ReadTime(accessMask, item.LastAccessTime);
|
||||
}
|
||||
}
|
||||
|
||||
UINT16 fileHeaderWithNameSize =
|
||||
sizeof(NHeader::NBlock::CBlock) + data - dataStart;
|
||||
UInt16 fileHeaderWithNameSize = (UInt16)m_CurPos;
|
||||
|
||||
item.Position = m_Position;
|
||||
item.MainPartSize = fileHeaderWithNameSize;
|
||||
item.CommentSize = m_BlockHeader.HeadSize - fileHeaderWithNameSize;
|
||||
|
||||
|
||||
if (m_CryptoMode)
|
||||
item.AlignSize = (16 - ((m_BlockHeader.HeadSize) & 0xF)) & 0xF;
|
||||
else
|
||||
item.AlignSize = 0;
|
||||
AddToSeekValue(m_BlockHeader.HeadSize);
|
||||
}
|
||||
|
||||
void CInArchive::AddToSeekValue(UINT64 addValue)
|
||||
void CInArchive::AddToSeekValue(UInt64 addValue)
|
||||
{
|
||||
m_Position += addValue;
|
||||
}
|
||||
|
||||
bool CInArchive::GetNextItem(CItemEx &item)
|
||||
HRESULT CInArchive::GetNextItem(CItemEx &item, ICryptoGetTextPassword *getTextPassword)
|
||||
{
|
||||
if ((m_ArchiveHeader.Flags &
|
||||
NHeader::NArchive::kBlockHeadersAreEncrypted) != 0)
|
||||
return false;
|
||||
if (m_SeekOnArchiveComment)
|
||||
SkipArchiveComment();
|
||||
while (true)
|
||||
{
|
||||
if(!SeekInArchive(m_Position))
|
||||
return false;
|
||||
if(!ReadBytesAndTestSize(&m_BlockHeader, sizeof(m_BlockHeader)))
|
||||
return false;
|
||||
return S_FALSE;
|
||||
if (!m_CryptoMode && (m_ArchiveHeader.Flags &
|
||||
NHeader::NArchive::kBlockHeadersAreEncrypted) != 0)
|
||||
{
|
||||
m_CryptoMode = false;
|
||||
if (getTextPassword == 0)
|
||||
return S_FALSE;
|
||||
if(!SeekInArchive(m_Position))
|
||||
return S_FALSE;
|
||||
if (!m_RarAES)
|
||||
{
|
||||
m_RarAESSpec = new NCrypto::NRar29::CDecoder;
|
||||
m_RarAES = m_RarAESSpec;
|
||||
}
|
||||
// Salt
|
||||
const UInt32 kSaltSize = 8;
|
||||
Byte salt[kSaltSize];
|
||||
if(!ReadBytesAndTestSize(salt, kSaltSize))
|
||||
return false;
|
||||
m_Position += kSaltSize;
|
||||
RINOK(m_RarAESSpec->SetDecoderProperties2(salt, kSaltSize))
|
||||
// Password
|
||||
CMyComBSTR password;
|
||||
RINOK(getTextPassword->CryptoGetTextPassword(&password))
|
||||
UString unicodePassword(password);
|
||||
|
||||
RINOK(m_RarAESSpec->CryptoSetPassword(
|
||||
(const Byte *)(const wchar_t *)unicodePassword,
|
||||
unicodePassword.Length() * 2));
|
||||
|
||||
const UInt32 kDecryptedBufferSize = (1 << 12);
|
||||
if (m_DecryptedData.GetCapacity() == 0)
|
||||
{
|
||||
m_DecryptedData.SetCapacity(kDecryptedBufferSize);
|
||||
}
|
||||
RINOK(m_RarAES->Init());
|
||||
RINOK(m_Stream->Read((Byte *)m_DecryptedData, kDecryptedBufferSize, &m_DecryptedDataSize));
|
||||
m_DecryptedDataSize = m_RarAES->Filter((Byte *)m_DecryptedData, m_DecryptedDataSize);
|
||||
|
||||
m_CryptoMode = true;
|
||||
m_CryptoPos = 0;
|
||||
}
|
||||
|
||||
m_FileHeaderData.EnsureCapacity(7);
|
||||
if(!ReadBytesAndTestSize((Byte *)m_FileHeaderData, 7))
|
||||
return S_FALSE;
|
||||
|
||||
m_CurData = (Byte *)m_FileHeaderData;
|
||||
m_CurPos = 0;
|
||||
m_PosLimit = 7;
|
||||
m_BlockHeader.CRC = ReadUInt16();
|
||||
m_BlockHeader.Type = ReadByte();
|
||||
m_BlockHeader.Flags = ReadUInt16();
|
||||
m_BlockHeader.HeadSize = ReadUInt16();
|
||||
|
||||
if (m_BlockHeader.HeadSize < 7)
|
||||
ThrowExceptionWithCode(CInArchiveException::kIncorrectArchive);
|
||||
|
||||
if (m_BlockHeader.Type == NHeader::NBlockType::kEndOfArchive)
|
||||
return S_FALSE;
|
||||
|
||||
if (m_BlockHeader.Type == NHeader::NBlockType::kFileHeader)
|
||||
{
|
||||
m_FileHeaderData.EnsureCapacity(m_BlockHeader.HeadSize);
|
||||
UINT32 headerSize = m_BlockHeader.HeadSize - sizeof(m_BlockHeader);
|
||||
ReadBytesAndTestResult(m_FileHeaderData, headerSize);
|
||||
CCRC crc;
|
||||
crc.Update(&m_BlockHeader.Type, sizeof(m_BlockHeader) -
|
||||
sizeof(m_BlockHeader.CRC));
|
||||
|
||||
ReadHeaderReal(m_FileHeaderData, item);
|
||||
|
||||
crc.Update(m_FileHeaderData, headerSize - item.CommentSize);
|
||||
if ((crc.GetDigest() & 0xFFFF) != m_BlockHeader.CRC)
|
||||
m_CurData = (Byte *)m_FileHeaderData;
|
||||
m_PosLimit = m_BlockHeader.HeadSize;
|
||||
ReadBytesAndTestResult(m_CurData + m_CurPos, m_BlockHeader.HeadSize - 7);
|
||||
ReadHeaderReal(item);
|
||||
if ((CCRC::CalculateDigest(m_CurData + 2,
|
||||
m_BlockHeader.HeadSize - item.CommentSize - 2) & 0xFFFF) != m_BlockHeader.CRC)
|
||||
ThrowExceptionWithCode(CInArchiveException::kFileHeaderCRCError);
|
||||
|
||||
FinishCryptoBlock();
|
||||
m_CryptoMode = false;
|
||||
SeekInArchive(m_Position); // Move Position to compressed Data;
|
||||
AddToSeekValue(item.PackSize); // m_Position points Tto next header;
|
||||
return true;
|
||||
AddToSeekValue(item.PackSize); // m_Position points to next header;
|
||||
return S_OK;
|
||||
}
|
||||
if (m_CryptoMode && m_BlockHeader.HeadSize > (1 << 12))
|
||||
return E_FAIL; // it's for bad passwords
|
||||
if ((m_BlockHeader.Flags & NHeader::NBlock::kLongBlock) != 0)
|
||||
{
|
||||
UINT32 dataSize;
|
||||
ReadBytesAndTestResult(&dataSize, sizeof(dataSize)); // test it
|
||||
m_FileHeaderData.EnsureCapacity(7 + 4);
|
||||
m_CurData = (Byte *)m_FileHeaderData;
|
||||
ReadBytesAndTestResult(m_CurData + m_CurPos, 4); // test it
|
||||
m_PosLimit = 7 + 4;
|
||||
UInt32 dataSize = ReadUInt32();
|
||||
AddToSeekValue(dataSize);
|
||||
if (m_CryptoMode && dataSize > (1 << 27))
|
||||
return E_FAIL; // it's for bad passwords
|
||||
m_CryptoPos = m_BlockHeader.HeadSize;
|
||||
}
|
||||
else
|
||||
m_CryptoPos = 0;
|
||||
AddToSeekValue(m_BlockHeader.HeadSize);
|
||||
FinishCryptoBlock();
|
||||
m_CryptoMode = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CInArchive::DirectGetBytes(void *data, UINT32 size)
|
||||
void CInArchive::DirectGetBytes(void *data, UInt32 size)
|
||||
{
|
||||
m_Stream->Read(data, size, NULL);
|
||||
}
|
||||
|
||||
|
||||
bool CInArchive::SeekInArchive(UINT64 position)
|
||||
bool CInArchive::SeekInArchive(UInt64 position)
|
||||
{
|
||||
UINT64 newPosition;
|
||||
UInt64 newPosition;
|
||||
m_Stream->Seek(position, STREAM_SEEK_SET, &newPosition);
|
||||
return newPosition == position;
|
||||
}
|
||||
|
||||
ISequentialInStream* CInArchive::CreateLimitedStream(UINT64 position, UINT64 size)
|
||||
ISequentialInStream* CInArchive::CreateLimitedStream(UInt64 position, UInt64 size)
|
||||
{
|
||||
CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
|
||||
CMyComPtr<ISequentialInStream> inStream(streamSpec);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// RarIn.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __ARCHIVE_RAR_IN_H
|
||||
#define __ARCHIVE_RAR_IN_H
|
||||
|
||||
@@ -9,6 +7,9 @@
|
||||
#include "Common/Exception.h"
|
||||
#include "Common/MyCom.h"
|
||||
#include "../../IStream.h"
|
||||
#include "../../ICoder.h"
|
||||
#include "../../Common/StreamObjects.h"
|
||||
#include "../../Crypto/RarAES/RarAES.h"
|
||||
#include "RarHeader.h"
|
||||
#include "RarItem.h"
|
||||
|
||||
@@ -32,9 +33,9 @@ public:
|
||||
class CInArchiveInfo
|
||||
{
|
||||
public:
|
||||
UINT64 StartPosition;
|
||||
UInt64 StartPosition;
|
||||
WORD Flags;
|
||||
UINT64 CommentPosition;
|
||||
UInt64 CommentPosition;
|
||||
WORD CommentSize;
|
||||
bool IsSolid() const { return (Flags & NHeader::NArchive::kSolid) != 0; }
|
||||
bool IsCommented() const { return (Flags & NHeader::NArchive::kComment) != 0; }
|
||||
@@ -46,49 +47,75 @@ class CInArchive
|
||||
{
|
||||
CMyComPtr<IInStream> m_Stream;
|
||||
|
||||
UINT64 m_StreamStartPosition;
|
||||
UINT64 m_Position;
|
||||
UINT64 m_ArchiveStartPosition;
|
||||
UInt64 m_StreamStartPosition;
|
||||
UInt64 m_Position;
|
||||
UInt64 m_ArchiveStartPosition;
|
||||
|
||||
NHeader::NArchive::CBlock m_ArchiveHeader;
|
||||
CDynamicBuffer<char> m_NameBuffer;
|
||||
CDynamicBuffer<wchar_t> _unicodeNameBuffer;
|
||||
bool m_SeekOnArchiveComment;
|
||||
UINT64 m_ArchiveCommentPosition;
|
||||
UInt64 m_ArchiveCommentPosition;
|
||||
|
||||
void ReadName(const BYTE *data, CItemEx &item, int nameSize);
|
||||
void ReadHeaderReal(const BYTE *data, CItemEx &item);
|
||||
void ReadName(CItemEx &item, int nameSize);
|
||||
void ReadHeaderReal(CItemEx &item);
|
||||
|
||||
HRESULT ReadBytes(void *data, UINT32 size, UINT32 *aProcessedSize);
|
||||
bool ReadBytesAndTestSize(void *data, UINT32 size);
|
||||
void ReadBytesAndTestResult(void *data, UINT32 size);
|
||||
HRESULT ReadBytes(void *data, UInt32 size, UInt32 *aProcessedSize);
|
||||
bool ReadBytesAndTestSize(void *data, UInt32 size);
|
||||
void ReadBytesAndTestResult(void *data, UInt32 size);
|
||||
|
||||
bool FindAndReadMarker(const UINT64 *searchHeaderSizeLimit);
|
||||
bool FindAndReadMarker(const UInt64 *searchHeaderSizeLimit);
|
||||
void ThrowExceptionWithCode(CInArchiveException::CCauseType cause);
|
||||
void ThrowUnexpectedEndOfArchiveException();
|
||||
|
||||
void AddToSeekValue(UINT64 addValue);
|
||||
void AddToSeekValue(UInt64 addValue);
|
||||
|
||||
protected:
|
||||
|
||||
CDynamicBuffer<BYTE> m_FileHeaderData;
|
||||
|
||||
NHeader::NBlock::CBlock m_BlockHeader;
|
||||
CDynamicBuffer<Byte> m_FileHeaderData;
|
||||
|
||||
bool ReadMarkerAndArchiveHeader(const UINT64 *searchHeaderSizeLimit);
|
||||
NHeader::NBlock::CBlock m_BlockHeader;
|
||||
|
||||
NCrypto::NRar29::CDecoder *m_RarAESSpec;
|
||||
CMyComPtr<ICompressFilter> m_RarAES;
|
||||
|
||||
Byte *m_CurData; // it must point to start of Rar::Block
|
||||
UInt32 m_CurPos;
|
||||
UInt32 m_PosLimit;
|
||||
Byte ReadByte();
|
||||
UInt16 ReadUInt16();
|
||||
UInt32 ReadUInt32();
|
||||
void ReadTime(Byte mask, CRarTime &rarTime);
|
||||
|
||||
CBuffer<Byte> m_DecryptedData;
|
||||
UInt32 m_DecryptedDataSize;
|
||||
|
||||
bool m_CryptoMode;
|
||||
UInt32 m_CryptoPos;
|
||||
void FinishCryptoBlock()
|
||||
{
|
||||
if (m_CryptoMode)
|
||||
while ((m_CryptoPos & 0xF) != 0)
|
||||
{
|
||||
m_CryptoPos++;
|
||||
m_Position++;
|
||||
}
|
||||
}
|
||||
|
||||
bool ReadMarkerAndArchiveHeader(const UInt64 *searchHeaderSizeLimit);
|
||||
public:
|
||||
bool Open(IInStream *inStream, const UINT64 *searchHeaderSizeLimit);
|
||||
bool Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit);
|
||||
void Close();
|
||||
bool GetNextItem(CItemEx &item);
|
||||
HRESULT GetNextItem(CItemEx &item, ICryptoGetTextPassword *getTextPassword);
|
||||
|
||||
void SkipArchiveComment();
|
||||
|
||||
void GetArchiveInfo(CInArchiveInfo &archiveInfo) const;
|
||||
|
||||
void DirectGetBytes(void *data, UINT32 size);
|
||||
void DirectGetBytes(void *data, UInt32 size);
|
||||
|
||||
bool SeekInArchive(UINT64 position);
|
||||
ISequentialInStream *CreateLimitedStream(UINT64 position, UINT64 size);
|
||||
bool SeekInArchive(UInt64 position);
|
||||
ISequentialInStream *CreateLimitedStream(UInt64 position, UInt64 size);
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RarItem.cpp
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "RarItem.h"
|
||||
#include "RarHeader.h"
|
||||
@@ -39,7 +39,7 @@ bool CItem::IgnoreItem() const
|
||||
return false;
|
||||
}
|
||||
|
||||
UINT32 CItem::GetDictSize() const
|
||||
UInt32 CItem::GetDictSize() const
|
||||
{ return (Flags >> NHeader::NFile::kDictBitStart) & NHeader::NFile::kDictMask; }
|
||||
|
||||
bool CItem::IsDirectory() const
|
||||
@@ -47,22 +47,22 @@ bool CItem::IsDirectory() const
|
||||
return (GetDictSize() == NHeader::NFile::kDictDirectoryValue);
|
||||
}
|
||||
|
||||
UINT32 CItem::GetWinAttributes() const
|
||||
UInt32 CItem::GetWinAttributes() const
|
||||
{
|
||||
UINT32 aWinAttributes;
|
||||
UInt32 winAttributes;
|
||||
switch(HostOS)
|
||||
{
|
||||
case NHeader::NFile::kHostMSDOS:
|
||||
case NHeader::NFile::kHostOS2:
|
||||
case NHeader::NFile::kHostWin32:
|
||||
aWinAttributes = Attributes;
|
||||
winAttributes = Attributes;
|
||||
break;
|
||||
default:
|
||||
aWinAttributes = 0; // must be converted from unix value;;
|
||||
winAttributes = 0; // must be converted from unix value;;
|
||||
}
|
||||
if (IsDirectory()) // test it;
|
||||
aWinAttributes |= NHeader::NFile::kWinFileDirectoryAttributeMask;
|
||||
return aWinAttributes;
|
||||
winAttributes |= NHeader::NFile::kWinFileDirectoryAttributeMask;
|
||||
return winAttributes;
|
||||
}
|
||||
|
||||
void CItem::ClearFlags()
|
||||
@@ -70,8 +70,8 @@ void CItem::ClearFlags()
|
||||
|
||||
void CItem::SetFlagBits(int aStartBitNumber, int aNumBits, int aValue)
|
||||
{
|
||||
UINT16 aMask = ((1 << aNumBits) - 1) << aStartBitNumber;
|
||||
Flags &= ~aMask;
|
||||
UInt16 mask = ((1 << aNumBits) - 1) << aStartBitNumber;
|
||||
Flags &= ~mask;
|
||||
Flags |= aValue << aStartBitNumber;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void CItem::SetBitMask(int aBitMask, bool anEnable)
|
||||
Flags &= ~aBitMask;
|
||||
}
|
||||
|
||||
void CItem::SetDictSize(UINT32 aSize)
|
||||
void CItem::SetDictSize(UInt32 aSize)
|
||||
{
|
||||
SetFlagBits(NHeader::NFile::kDictBitStart, NHeader::NFile::kNumDictBits, (aSize & NHeader::NFile::kDictMask));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// RarItem.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __ARCHIVE_RAR_ITEM_H
|
||||
#define __ARCHIVE_RAR_ITEM_H
|
||||
|
||||
@@ -13,19 +11,19 @@ namespace NRar{
|
||||
|
||||
struct CRarTime
|
||||
{
|
||||
UINT32 DosTime;
|
||||
BYTE LowSecond;
|
||||
BYTE SubTime[3];
|
||||
UInt32 DosTime;
|
||||
Byte LowSecond;
|
||||
Byte SubTime[3];
|
||||
};
|
||||
|
||||
class CItem
|
||||
{
|
||||
public:
|
||||
UINT16 Flags;
|
||||
UINT64 PackSize;
|
||||
UINT64 UnPackSize;
|
||||
BYTE HostOS;
|
||||
UINT32 FileCRC;
|
||||
UInt16 Flags;
|
||||
UInt64 PackSize;
|
||||
UInt64 UnPackSize;
|
||||
Byte HostOS;
|
||||
UInt32 FileCRC;
|
||||
|
||||
CRarTime CreationTime;
|
||||
CRarTime LastWriteTime;
|
||||
@@ -34,13 +32,13 @@ public:
|
||||
// bool IsLastWriteTimeDefined;
|
||||
bool IsLastAccessTimeDefined;
|
||||
|
||||
BYTE UnPackVersion;
|
||||
BYTE Method;
|
||||
UINT32 Attributes;
|
||||
Byte UnPackVersion;
|
||||
Byte Method;
|
||||
UInt32 Attributes;
|
||||
AString Name;
|
||||
UString UnicodeName;
|
||||
|
||||
BYTE Salt[8];
|
||||
Byte Salt[8];
|
||||
|
||||
bool IsEncrypted() const;
|
||||
bool IsSolid() const;
|
||||
@@ -53,10 +51,10 @@ public:
|
||||
bool HasUnicodeName() const;
|
||||
bool IsOldVersion() const;
|
||||
|
||||
UINT32 GetDictSize() const;
|
||||
UInt32 GetDictSize() const;
|
||||
bool IsDirectory() const;
|
||||
bool IgnoreItem() const;
|
||||
UINT32 GetWinAttributes() const;
|
||||
UInt32 GetWinAttributes() const;
|
||||
|
||||
CItem(): IsCreationTimeDefined(false), IsLastAccessTimeDefined(false) {}
|
||||
private:
|
||||
@@ -64,7 +62,7 @@ private:
|
||||
void SetBitMask(int aBitMask, bool anEnable);
|
||||
public:
|
||||
void ClearFlags();
|
||||
void SetDictSize(UINT32 aSize);
|
||||
void SetDictSize(UInt32 aSize);
|
||||
void SetAsDirectory(bool aDirectory);
|
||||
void SetEncrypted(bool anEncrypted);
|
||||
void SetSolid(bool aSolid);
|
||||
@@ -76,13 +74,14 @@ public:
|
||||
class CItemEx: public CItem
|
||||
{
|
||||
public:
|
||||
UINT64 Position;
|
||||
UINT16 MainPartSize;
|
||||
UINT16 CommentSize;
|
||||
UINT64 GetFullSize() const { return MainPartSize + CommentSize + PackSize; };
|
||||
UInt64 Position;
|
||||
UInt16 MainPartSize;
|
||||
UInt16 CommentSize;
|
||||
UInt16 AlignSize;
|
||||
UInt64 GetFullSize() const { return MainPartSize + CommentSize + AlignSize + PackSize; };
|
||||
// DWORD GetHeaderWithCommentSize() const { return MainPartSize + CommentSize; };
|
||||
UINT64 GetCommentPosition() const { return Position + MainPartSize; };
|
||||
UINT64 GetDataPosition() const { return GetCommentPosition() + CommentSize; };
|
||||
UInt64 GetCommentPosition() const { return Position + MainPartSize; };
|
||||
UInt64 GetDataPosition() const { return GetCommentPosition() + CommentSize + AlignSize; };
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
// Archive::Rar::ItemInfoEx.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __ARCHIVE_RAR_ITEMINFOEX_H
|
||||
#define __ARCHIVE_RAR_ITEMINFOEX_H
|
||||
|
||||
#include "Archive/Rar/ItemInfo.h"
|
||||
|
||||
namespace NArchive{
|
||||
namespace NRar{
|
||||
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -46,17 +46,17 @@ HRESULT CFolderInStream::CloseStream()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CFolderInStream::Read(void *data, UINT32 size, UINT32 *processedSize)
|
||||
STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
UINT32 realProcessedSize = 0;
|
||||
UInt32 realProcessedSize = 0;
|
||||
while ((_curIndex < _refItem.NumItems || _fileIsOpen) && size > 0)
|
||||
{
|
||||
if (_fileIsOpen)
|
||||
{
|
||||
UINT32 localProcessedSize;
|
||||
UInt32 localProcessedSize;
|
||||
RINOK(_stream->Read(
|
||||
((BYTE *)data) + realProcessedSize, size, &localProcessedSize));
|
||||
_crc.Update(((BYTE *)data) + realProcessedSize, localProcessedSize);
|
||||
((Byte *)data) + realProcessedSize, size, &localProcessedSize));
|
||||
_crc.Update(((Byte *)data) + realProcessedSize, localProcessedSize);
|
||||
if (localProcessedSize == 0)
|
||||
{
|
||||
RINOK(CloseStream());
|
||||
@@ -75,7 +75,7 @@ STDMETHODIMP CFolderInStream::Read(void *data, UINT32 size, UINT32 *processedSiz
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CFolderInStream::ReadPart(void *data, UINT32 size, UINT32 *processedSize)
|
||||
STDMETHODIMP CFolderInStream::ReadPart(void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
return Read(data, size, processedSize);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// RarVolumeInStream.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __RAR_VOLUME_IN_STREAM_H
|
||||
#define __RAR_VOLUME_IN_STREAM_H
|
||||
|
||||
@@ -26,8 +24,8 @@ class CFolderInStream:
|
||||
public:
|
||||
MY_UNKNOWN_IMP
|
||||
|
||||
STDMETHOD(Read)(void *data, UINT32 size, UINT32 *processedSize);
|
||||
STDMETHOD(ReadPart)(void *data, UINT32 size, UINT32 *processedSize);
|
||||
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
|
||||
STDMETHOD(ReadPart)(void *data, UInt32 size, UInt32 *processedSize);
|
||||
|
||||
private:
|
||||
CObjectVector<CInArchive> *_archives;
|
||||
@@ -45,7 +43,7 @@ public:
|
||||
const CObjectVector<CItemEx> *items,
|
||||
const CRefItem &refItem);
|
||||
|
||||
CRecordVector<UINT32> CRCs;
|
||||
CRecordVector<UInt32> CRCs;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
// StdAfx.cpp
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "StdAfx.h"
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// stdafx.h
|
||||
|
||||
// StdAfx.h
|
||||
|
||||
#ifndef __STDAFX_H
|
||||
#define __STDAFX_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <time.h>
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -66,8 +66,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,12,0,0
|
||||
PRODUCTVERSION 3,12,0,0
|
||||
FILEVERSION 4,13,0,0
|
||||
PRODUCTVERSION 4,13,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -85,14 +85,14 @@ BEGIN
|
||||
VALUE "Comments", "\0"
|
||||
VALUE "CompanyName", "Igor Pavlov \0"
|
||||
VALUE "FileDescription", "Rar Plugin for 7-Zip\0"
|
||||
VALUE "FileVersion", "3, 12, 0, 0\0"
|
||||
VALUE "FileVersion", "4, 13, 0, 0\0"
|
||||
VALUE "InternalName", "rar\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 1999-2003 Igor Pavlov\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 1999-2004 Igor Pavlov\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "rar.dll\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "7-Zip\0"
|
||||
VALUE "ProductVersion", "3, 12, 0, 0\0"
|
||||
VALUE "ProductVersion", "4, 13, 0, 0\0"
|
||||
VALUE "SpecialBuild", "\0"
|
||||
END
|
||||
END
|
||||
|
||||
Reference in New Issue
Block a user