mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 01:15:00 -06:00
15.06
This commit is contained in:
committed by
Kornel Lesiński
parent
54490d51d5
commit
cba375916f
@@ -380,6 +380,21 @@ STDMETHODIMP CAgent::DoOperation(
|
||||
HRESULT res = outArchive->UpdateItems(outArchiveStream, updatePairs2.Size(), updateCallback);
|
||||
if (res == S_OK && processedPaths)
|
||||
{
|
||||
{
|
||||
/* OutHandler for 7z archives doesn't report compression operation for empty files.
|
||||
So we must include these files manually */
|
||||
FOR_VECTOR(i, updatePairs2)
|
||||
{
|
||||
const CUpdatePair2 &up = updatePairs2[i];
|
||||
if (up.DirIndex >= 0 && up.NewData)
|
||||
{
|
||||
const CDirItem &di = dirItems.Items[up.DirIndex];
|
||||
if (!di.IsDir() && di.Size == 0)
|
||||
processedItems[up.DirIndex] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FOR_VECTOR (i, dirItems.Items)
|
||||
if (processedItems[i] != 0)
|
||||
processedPaths->Add(dirItems.GetPhyPath(i));
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include "../../../Common/Defs.h"
|
||||
#include "../../../Common/MyInitGuid.h"
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#undef sprintf
|
||||
#undef printf
|
||||
|
||||
#include "../../../../C/Alloc.h"
|
||||
|
||||
#include "../../../Common/ComTry.h"
|
||||
#include "../../../Common/IntToString.h"
|
||||
#include "../../../Common/StringConvert.h"
|
||||
@@ -23,6 +25,7 @@
|
||||
#endif
|
||||
|
||||
#include "../../Common/FilePathAutoRename.h"
|
||||
// #include "../../Common/StreamUtils.h"
|
||||
|
||||
#include "../Common/ExtractingFilePath.h"
|
||||
#include "../Common/PropIDUtils.h"
|
||||
@@ -541,11 +544,54 @@ static FString MakePath_from_2_Parts(const FString &prefix, const FString &path)
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
#ifdef SUPPORT_LINKS
|
||||
|
||||
struct CTempMidBuffer
|
||||
{
|
||||
void *Buf;
|
||||
|
||||
CTempMidBuffer(size_t size): Buf(NULL) { Buf = ::MidAlloc(size); }
|
||||
~CTempMidBuffer() { ::MidFree(Buf); }
|
||||
};
|
||||
|
||||
HRESULT CArchiveExtractCallback::MyCopyFile(ISequentialOutStream *outStream)
|
||||
{
|
||||
const size_t kBufSize = 1 << 16;
|
||||
CTempMidBuffer buf(kBufSize);
|
||||
if (!buf.Buf)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
NIO::CInFile inFile;
|
||||
NIO::COutFile outFile;
|
||||
|
||||
if (!inFile.Open(_CopyFile_Path))
|
||||
return SendMessageError_with_LastError("Open error", _CopyFile_Path);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
UInt32 num;
|
||||
|
||||
if (!inFile.Read(buf.Buf, kBufSize, num))
|
||||
return SendMessageError_with_LastError("Read error", _CopyFile_Path);
|
||||
|
||||
if (num == 0)
|
||||
return S_OK;
|
||||
|
||||
|
||||
RINOK(WriteStream(outStream, buf.Buf, num));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStream **outStream, Int32 askExtractMode)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
|
||||
*outStream = 0;
|
||||
*outStream = NULL;
|
||||
|
||||
#ifndef _SFX
|
||||
if (_hashStream)
|
||||
@@ -563,6 +609,11 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
_curSizeDefined = false;
|
||||
_index = index;
|
||||
|
||||
#ifdef SUPPORT_LINKS
|
||||
// _CopyFile_Path.Empty();
|
||||
linkPath.Empty();
|
||||
#endif
|
||||
|
||||
IInArchive *archive = _arc->Archive;
|
||||
|
||||
#ifndef _SFX
|
||||
@@ -596,46 +647,56 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
|
||||
#ifdef SUPPORT_LINKS
|
||||
|
||||
// bool isCopyLink = false;
|
||||
bool isHardLink = false;
|
||||
bool isJunction = false;
|
||||
bool isRelative = false;
|
||||
|
||||
UString linkPath;
|
||||
// RINOK(Archive_GetItemBoolProp(archive, index, kpidIsHardLink, isHardLink));
|
||||
// if (isHardLink)
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, kpidHardLink, &prop));
|
||||
if (prop.vt == VT_BSTR)
|
||||
{
|
||||
isHardLink = true;
|
||||
// isCopyLink = false;
|
||||
isRelative = false; // RAR5, TAR: hard links are from root folder of archive
|
||||
linkPath.SetFromBstr(prop.bstrVal);
|
||||
isRelative = false; // TAR: hard links are from root folder of archive
|
||||
}
|
||||
else if (prop.vt == VT_EMPTY)
|
||||
{
|
||||
// linkPath.Empty();
|
||||
}
|
||||
else
|
||||
else if (prop.vt != VT_EMPTY)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, kpidCopyLink, &prop));
|
||||
if (prop.vt == VT_BSTR)
|
||||
{
|
||||
isHardLink = false;
|
||||
isCopyLink = true;
|
||||
isRelative = false; // RAR5: copy links are from root folder of archive
|
||||
linkPath.SetFromBstr(prop.bstrVal);
|
||||
}
|
||||
else if (prop.vt != VT_EMPTY)
|
||||
return E_FAIL;
|
||||
}
|
||||
*/
|
||||
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, kpidSymLink, &prop));
|
||||
if (prop.vt == VT_BSTR)
|
||||
{
|
||||
isHardLink = false;
|
||||
// isCopyLink = false;
|
||||
isRelative = true; // RAR5, TAR: symbolic links can be relative
|
||||
linkPath.SetFromBstr(prop.bstrVal);
|
||||
isRelative = true; // TAR: symbolic links are relative
|
||||
}
|
||||
else if (prop.vt == VT_EMPTY)
|
||||
{
|
||||
// linkPath.Empty();
|
||||
}
|
||||
else
|
||||
else if (prop.vt != VT_EMPTY)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
bool isOkReparse = false;
|
||||
|
||||
if (linkPath.IsEmpty() && _arc->GetRawProps)
|
||||
@@ -643,7 +704,9 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
const void *data;
|
||||
UInt32 dataSize;
|
||||
UInt32 propType;
|
||||
|
||||
_arc->GetRawProps->GetRawProp(_index, kpidNtReparse, &data, &dataSize, &propType);
|
||||
|
||||
if (dataSize != 0)
|
||||
{
|
||||
if (propType != NPropDataType::kRaw)
|
||||
@@ -654,6 +717,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
if (isOkReparse)
|
||||
{
|
||||
isHardLink = false;
|
||||
// isCopyLink = false;
|
||||
linkPath = reparse.GetPath();
|
||||
isJunction = reparse.IsMountPoint();
|
||||
isRelative = reparse.IsRelative();
|
||||
@@ -669,6 +733,13 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index, ISequentialOutStre
|
||||
#ifdef _WIN32
|
||||
linkPath.Replace(L'/', WCHAR_PATH_SEPARATOR);
|
||||
#endif
|
||||
|
||||
// rar5 uses "\??\" prefix for absolute links
|
||||
if (linkPath.IsPrefixedBy(WSTRING_PATH_SEPARATOR L"??" WSTRING_PATH_SEPARATOR))
|
||||
{
|
||||
isRelative = false;
|
||||
linkPath.DeleteFrontal(4);
|
||||
}
|
||||
|
||||
for (;;)
|
||||
// while (NName::IsAbsolutePath(linkPath))
|
||||
@@ -1108,7 +1179,7 @@ if (askExtractMode == NArchive::NExtract::NAskMode::kExtract && !_testMode)
|
||||
else
|
||||
{
|
||||
FString existPath;
|
||||
if (isHardLink || !isRelative)
|
||||
if (isHardLink /* || isCopyLink */ || !isRelative)
|
||||
{
|
||||
if (!NName::GetFullPath(_dirPathPrefix_Full, us2fs(relatPath), existPath))
|
||||
{
|
||||
@@ -1122,13 +1193,37 @@ if (askExtractMode == NArchive::NExtract::NAskMode::kExtract && !_testMode)
|
||||
|
||||
if (!existPath.IsEmpty())
|
||||
{
|
||||
if (isHardLink)
|
||||
if (isHardLink /* || isCopyLink */)
|
||||
{
|
||||
if (!MyCreateHardLink(fullProcessedPath, existPath))
|
||||
// if (isHardLink)
|
||||
{
|
||||
RINOK(SendMessageError2("Can not create hard link", fullProcessedPath, existPath));
|
||||
// return S_OK;
|
||||
if (!MyCreateHardLink(fullProcessedPath, existPath))
|
||||
{
|
||||
RINOK(SendMessageError2("Can not create hard link", fullProcessedPath, existPath));
|
||||
// return S_OK;
|
||||
}
|
||||
}
|
||||
/*
|
||||
else
|
||||
{
|
||||
NFind::CFileInfo fi;
|
||||
if (!fi.Find(existPath))
|
||||
{
|
||||
RINOK(SendMessageError2("Can not find the file for copying", existPath, fullProcessedPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_curSizeDefined && _curSize == fi.Size)
|
||||
_CopyFile_Path = existPath;
|
||||
else
|
||||
{
|
||||
RINOK(SendMessageError2("File size collision for file copying", existPath, fullProcessedPath));
|
||||
}
|
||||
|
||||
// RINOK(MyCopyFile(existPath, fullProcessedPath));
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
else if (_ntOptions.SymLinks.Val)
|
||||
{
|
||||
@@ -1161,7 +1256,8 @@ if (askExtractMode == NArchive::NExtract::NAskMode::kExtract && !_testMode)
|
||||
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
||||
if (linkPath.IsEmpty() /* || !_CopyFile_Path.IsEmpty() */)
|
||||
#endif // SUPPORT_LINKS
|
||||
{
|
||||
bool needWriteFile = true;
|
||||
@@ -1225,6 +1321,7 @@ if (askExtractMode == NArchive::NExtract::NAskMode::kExtract && !_testMode)
|
||||
{
|
||||
RINOK(_outFileStreamSpec->Seek(_position, STREAM_SEEK_SET, NULL));
|
||||
}
|
||||
|
||||
_outFileStream = outStreamLoc;
|
||||
}
|
||||
}
|
||||
@@ -1250,12 +1347,34 @@ if (askExtractMode == NArchive::NExtract::NAskMode::kExtract && !_testMode)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
if (outStreamLoc)
|
||||
{
|
||||
/*
|
||||
#ifdef SUPPORT_LINKS
|
||||
|
||||
if (!_CopyFile_Path.IsEmpty())
|
||||
{
|
||||
RINOK(PrepareOperation(askExtractMode));
|
||||
RINOK(MyCopyFile(outStreamLoc));
|
||||
return SetOperationResult(NArchive::NExtract::NOperationResult::kOK);
|
||||
}
|
||||
|
||||
if (isCopyLink && _testMode)
|
||||
return S_OK;
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
*outStream = outStreamLoc.Detach();
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
@@ -1266,6 +1385,7 @@ STDMETHODIMP CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
|
||||
#endif
|
||||
|
||||
_extractMode = false;
|
||||
|
||||
switch (askExtractMode)
|
||||
{
|
||||
case NArchive::NExtract::NAskMode::kExtract:
|
||||
@@ -1282,6 +1402,7 @@ STDMETHODIMP CArchiveExtractCallback::PrepareOperation(Int32 askExtractMode)
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 opRes)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
@@ -1346,6 +1467,7 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 opRes)
|
||||
|
||||
if (!_curSizeDefined)
|
||||
GetUnpackSize();
|
||||
|
||||
if (_curSizeDefined)
|
||||
{
|
||||
#ifdef SUPPORT_ALT_STREAMS
|
||||
@@ -1367,8 +1489,11 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 opRes)
|
||||
|
||||
if (_extractMode && _fi.AttribDefined)
|
||||
SetFileAttrib(_diskFilePath, _fi.Attrib);
|
||||
|
||||
RINOK(_extractCallback2->SetOperationResult(opRes, BoolToInt(_encrypted)));
|
||||
|
||||
return S_OK;
|
||||
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
|
||||
@@ -299,14 +299,23 @@ public:
|
||||
const UStringVector &removePathParts, bool removePartsForAltStreams,
|
||||
UInt64 packSize);
|
||||
|
||||
|
||||
#ifdef SUPPORT_LINKS
|
||||
|
||||
private:
|
||||
CHardLinks _hardLinks;
|
||||
UString linkPath;
|
||||
|
||||
// FString _CopyFile_Path;
|
||||
// HRESULT MyCopyFile(ISequentialOutStream *outStream);
|
||||
|
||||
public:
|
||||
// call PrepareHardLinks() after Init()
|
||||
HRESULT PrepareHardLinks(const CRecordVector<UInt32> *realIndices); // NULL means all items
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SUPPORT_ALT_STREAMS
|
||||
CObjectVector<CIndexToPathPair> _renamedFiles;
|
||||
#endif
|
||||
|
||||
@@ -48,18 +48,13 @@ class COpenCallbackImp:
|
||||
public CMyUnknownImp
|
||||
{
|
||||
public:
|
||||
MY_QUERYINTERFACE_BEGIN2(IArchiveOpenVolumeCallback)
|
||||
MY_QUERYINTERFACE_ENTRY(IArchiveOpenSetSubArchiveName)
|
||||
#ifndef _NO_CRYPTO
|
||||
MY_UNKNOWN_IMP3(
|
||||
IArchiveOpenVolumeCallback,
|
||||
ICryptoGetTextPassword,
|
||||
IArchiveOpenSetSubArchiveName
|
||||
)
|
||||
#else
|
||||
MY_UNKNOWN_IMP2(
|
||||
IArchiveOpenVolumeCallback,
|
||||
IArchiveOpenSetSubArchiveName
|
||||
)
|
||||
MY_QUERYINTERFACE_ENTRY(ICryptoGetTextPassword)
|
||||
#endif
|
||||
MY_QUERYINTERFACE_END
|
||||
MY_ADDREF_RELEASE
|
||||
|
||||
INTERFACE_IArchiveOpenCallback(;)
|
||||
INTERFACE_IArchiveOpenVolumeCallback(;)
|
||||
@@ -93,7 +88,8 @@ public:
|
||||
CMyComPtr<IArchiveOpenCallback> ReOpenCallback;
|
||||
// UInt64 TotalSize;
|
||||
|
||||
COpenCallbackImp(): Callback(NULL) {}
|
||||
COpenCallbackImp(): Callback(NULL), _subArchiveMode(false) {}
|
||||
|
||||
void Init(const FString &folderPrefix, const FString &fileName)
|
||||
{
|
||||
_folderPrefix = folderPrefix;
|
||||
@@ -106,6 +102,7 @@ public:
|
||||
// TotalSize = 0;
|
||||
PasswordWasAsked = false;
|
||||
}
|
||||
|
||||
bool SetSecondFileInfo(CFSTR newName)
|
||||
{
|
||||
return _fileInfo.Find(newName) && !_fileInfo.IsDir();
|
||||
|
||||
@@ -1566,7 +1566,8 @@ static const CBenchHash g_Hash[] =
|
||||
{ 10, 339, 0x8F8FEDAB, "CRC32:8" },
|
||||
{ 10, 512, 0xDF1C17CC, "CRC64" },
|
||||
{ 10, 5100, 0x2D79FF2E, "SHA256" },
|
||||
{ 10, 2340, 0x4C25132B, "SHA1" }
|
||||
{ 10, 2340, 0x4C25132B, "SHA1" },
|
||||
{ 2, 5500, 0xE084E913, "BLAKE2sp" }
|
||||
};
|
||||
|
||||
struct CTotalBenchRes
|
||||
|
||||
@@ -865,7 +865,7 @@ STDMETHODIMP CCodecs::CreateDecoder(UInt32 index, const GUID *iid, void **coder)
|
||||
{
|
||||
const CCodecLib &lib = Libs[ci.LibIndex];
|
||||
if (lib.CreateDecoder)
|
||||
return lib.CreateDecoder(index - NUM_EXPORT_CODECS, iid, (void **)coder);
|
||||
return lib.CreateDecoder(ci.CodecIndex, iid, (void **)coder);
|
||||
return lib.CreateObject(&ci.Decoder, iid, (void **)coder);
|
||||
}
|
||||
return S_OK;
|
||||
@@ -887,7 +887,7 @@ STDMETHODIMP CCodecs::CreateEncoder(UInt32 index, const GUID *iid, void **coder)
|
||||
{
|
||||
const CCodecLib &lib = Libs[ci.LibIndex];
|
||||
if (lib.CreateEncoder)
|
||||
return lib.CreateEncoder(index - NUM_EXPORT_CODECS, iid, (void **)coder);
|
||||
return lib.CreateEncoder(ci.CodecIndex, iid, (void **)coder);
|
||||
return lib.CreateObject(&ci.Encoder, iid, (void **)coder);
|
||||
}
|
||||
return S_OK;
|
||||
|
||||
@@ -1083,6 +1083,7 @@ static bool IsNewStyleSignature(const CArcInfoEx &ai)
|
||||
|
||||
class CArchiveOpenCallback_Offset:
|
||||
public IArchiveOpenCallback,
|
||||
public IArchiveOpenVolumeCallback,
|
||||
#ifndef _NO_CRYPTO
|
||||
public ICryptoGetTextPassword,
|
||||
#endif
|
||||
@@ -1090,19 +1091,24 @@ class CArchiveOpenCallback_Offset:
|
||||
{
|
||||
public:
|
||||
CMyComPtr<IArchiveOpenCallback> Callback;
|
||||
CMyComPtr<IArchiveOpenVolumeCallback> OpenVolumeCallback;
|
||||
UInt64 Files;
|
||||
UInt64 Offset;
|
||||
|
||||
#ifndef _NO_CRYPTO
|
||||
CMyComPtr<ICryptoGetTextPassword> GetTextPassword;
|
||||
MY_UNKNOWN_IMP2(
|
||||
IArchiveOpenCallback,
|
||||
ICryptoGetTextPassword)
|
||||
#else
|
||||
MY_UNKNOWN_IMP1(IArchiveOpenCallback)
|
||||
#endif
|
||||
STDMETHOD(SetTotal)(const UInt64 *files, const UInt64 *bytes);
|
||||
STDMETHOD(SetCompleted)(const UInt64 *files, const UInt64 *bytes);
|
||||
|
||||
MY_QUERYINTERFACE_BEGIN2(IArchiveOpenCallback)
|
||||
MY_QUERYINTERFACE_ENTRY(IArchiveOpenVolumeCallback)
|
||||
#ifndef _NO_CRYPTO
|
||||
MY_QUERYINTERFACE_ENTRY(ICryptoGetTextPassword)
|
||||
#endif
|
||||
MY_QUERYINTERFACE_END
|
||||
MY_ADDREF_RELEASE
|
||||
|
||||
INTERFACE_IArchiveOpenCallback(;)
|
||||
INTERFACE_IArchiveOpenVolumeCallback(;)
|
||||
#ifndef _NO_CRYPTO
|
||||
STDMETHOD(CryptoGetTextPassword)(BSTR *password);
|
||||
#endif
|
||||
@@ -1119,12 +1125,12 @@ STDMETHODIMP CArchiveOpenCallback_Offset::CryptoGetTextPassword(BSTR *password)
|
||||
}
|
||||
#endif
|
||||
|
||||
STDMETHODIMP CArchiveOpenCallback_Offset::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
|
||||
STDMETHODIMP CArchiveOpenCallback_Offset::SetTotal(const UInt64 *, const UInt64 *)
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CArchiveOpenCallback_Offset::SetCompleted(const UInt64 * /* files */, const UInt64 *bytes)
|
||||
STDMETHODIMP CArchiveOpenCallback_Offset::SetCompleted(const UInt64 *, const UInt64 *bytes)
|
||||
{
|
||||
if (!Callback)
|
||||
return S_OK;
|
||||
@@ -1134,8 +1140,25 @@ STDMETHODIMP CArchiveOpenCallback_Offset::SetCompleted(const UInt64 * /* files *
|
||||
return Callback->SetCompleted(&Files, &value);
|
||||
}
|
||||
|
||||
STDMETHODIMP CArchiveOpenCallback_Offset::GetProperty(PROPID propID, PROPVARIANT *value)
|
||||
{
|
||||
if (OpenVolumeCallback)
|
||||
return OpenVolumeCallback->GetProperty(propID, value);
|
||||
NCOM::PropVariant_Clear(value);
|
||||
return S_OK;
|
||||
// return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP CArchiveOpenCallback_Offset::GetStream(const wchar_t *name, IInStream **inStream)
|
||||
{
|
||||
if (OpenVolumeCallback)
|
||||
return OpenVolumeCallback->GetStream(name, inStream);
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
UInt32 GetOpenArcErrorFlags(const NCOM::CPropVariant &prop, bool *isDefinedProp)
|
||||
{
|
||||
if (isDefinedProp != NULL)
|
||||
@@ -2208,9 +2231,6 @@ HRESULT CArc::OpenStream2(const COpenOptions &op)
|
||||
}
|
||||
|
||||
{
|
||||
CArchiveOpenCallback_Offset *openCallback_Offset_Spec = new CArchiveOpenCallback_Offset;
|
||||
CMyComPtr<IArchiveOpenCallback> openCallback_Offset = openCallback_Offset_Spec;
|
||||
|
||||
const size_t kBeforeSize = 1 << 16;
|
||||
const size_t kAfterSize = 1 << 20;
|
||||
const size_t kBufSize = 1 << 22; // it must be more than kBeforeSize + kAfterSize
|
||||
@@ -2288,14 +2308,18 @@ HRESULT CArc::OpenStream2(const COpenOptions &op)
|
||||
CMyComPtr<IInStream> limitedStream = limitedStreamSpec;
|
||||
limitedStreamSpec->SetStream(op.stream);
|
||||
|
||||
openCallback_Offset_Spec->Callback = op.callback;
|
||||
|
||||
#ifndef _NO_CRYPTO
|
||||
CArchiveOpenCallback_Offset *openCallback_Offset_Spec = NULL;
|
||||
CMyComPtr<IArchiveOpenCallback> openCallback_Offset;
|
||||
if (op.callback)
|
||||
{
|
||||
openCallback_Offset_Spec = new CArchiveOpenCallback_Offset;
|
||||
openCallback_Offset = openCallback_Offset_Spec;
|
||||
openCallback_Offset_Spec->Callback = op.callback;
|
||||
openCallback_Offset_Spec->Callback.QueryInterface(IID_IArchiveOpenVolumeCallback, &openCallback_Offset_Spec->OpenVolumeCallback);
|
||||
#ifndef _NO_CRYPTO
|
||||
openCallback_Offset_Spec->Callback.QueryInterface(IID_ICryptoGetTextPassword, &openCallback_Offset_Spec->GetTextPassword);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if (op.callback)
|
||||
RINOK(op.callback->SetTotal(NULL, &fileSize));
|
||||
@@ -2382,12 +2406,19 @@ HRESULT CArc::OpenStream2(const COpenOptions &op)
|
||||
}
|
||||
}
|
||||
|
||||
if (pos >= callbackPrev + (1 << 23))
|
||||
bool useOffsetCallback = false;
|
||||
if (openCallback_Offset)
|
||||
{
|
||||
openCallback_Offset_Spec->Files = handlerSpec->_items.Size();
|
||||
openCallback_Offset_Spec->Offset = pos;
|
||||
RINOK(openCallback_Offset->SetCompleted(NULL, NULL));
|
||||
callbackPrev = pos;
|
||||
|
||||
useOffsetCallback = (!op.openType.CanReturnArc || handlerSpec->_items.Size() > 1);
|
||||
|
||||
if (pos >= callbackPrev + (1 << 23))
|
||||
{
|
||||
RINOK(openCallback_Offset_Spec->SetCompleted(NULL, NULL));
|
||||
callbackPrev = pos;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
@@ -2557,14 +2588,21 @@ HRESULT CArc::OpenStream2(const COpenOptions &op)
|
||||
}
|
||||
|
||||
UInt64 maxCheckStartPosition = 0;
|
||||
openCallback_Offset_Spec->Files = handlerSpec->_items.Size();
|
||||
openCallback_Offset_Spec->Offset = startArcPos;
|
||||
|
||||
if (openCallback_Offset)
|
||||
{
|
||||
openCallback_Offset_Spec->Files = handlerSpec->_items.Size();
|
||||
openCallback_Offset_Spec->Offset = startArcPos;
|
||||
}
|
||||
|
||||
// HRESULT result = archive->Open(limitedStream, &maxCheckStartPosition, openCallback_Offset);
|
||||
extractCallback_To_OpenCallback_Spec->Files = 0;
|
||||
extractCallback_To_OpenCallback_Spec->Offset = startArcPos;
|
||||
|
||||
HRESULT result = OpenArchiveSpec(archive, true, limitedStream, &maxCheckStartPosition, openCallback_Offset, extractCallback_To_OpenCallback);
|
||||
|
||||
HRESULT result = OpenArchiveSpec(archive, true, limitedStream, &maxCheckStartPosition,
|
||||
useOffsetCallback ? (IArchiveOpenCallback *)openCallback_Offset : (IArchiveOpenCallback *)op.callback,
|
||||
extractCallback_To_OpenCallback);
|
||||
|
||||
RINOK(ReadBasicProps(archive, ai.Flags_UseGlobalOffset() ? 0 : startArcPos, result));
|
||||
|
||||
bool isOpen = false;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace NUpdateArchive {
|
||||
{
|
||||
NPairAction::EEnum StateActions[NPairState::kNumValues];
|
||||
|
||||
const bool IsEqualTo(const CActionSet &a) const
|
||||
bool IsEqualTo(const CActionSet &a) const
|
||||
{
|
||||
for (unsigned i = 0; i < NPairState::kNumValues; i++)
|
||||
if (StateActions[i] != a.StateActions[i])
|
||||
|
||||
@@ -413,7 +413,7 @@ STDMETHODIMP CArchiveUpdateCallback::GetProperty(UInt32 index, PROPID propID, PR
|
||||
{
|
||||
case kpidPath: prop = DirItems->GetLogPath(up.DirIndex); break;
|
||||
case kpidIsDir: prop = di.IsDir(); break;
|
||||
case kpidSize: prop = di.Size; break;
|
||||
case kpidSize: prop = di.IsDir() ? (UInt64)0 : di.Size; break;
|
||||
case kpidAttrib: prop = di.Attrib; break;
|
||||
case kpidCTime: prop = di.CTime; break;
|
||||
case kpidATime: prop = di.ATime; break;
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
#include "ConsoleClose.h"
|
||||
|
||||
#if !defined(UNDER_CE) && defined(_WIN32)
|
||||
#include "../../../Common/MyWindows.h"
|
||||
#endif
|
||||
|
||||
namespace NConsoleClose {
|
||||
|
||||
unsigned g_BreakCounter = 0;
|
||||
|
||||
@@ -123,6 +123,7 @@ static const char * const kPropIdToName[] =
|
||||
, "Stream ID"
|
||||
, "Read-only"
|
||||
, "Out Name"
|
||||
, "Copy Link"
|
||||
};
|
||||
|
||||
static const char kEmptyAttribChar = '.';
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <Psapi.h>
|
||||
|
||||
#include "../../../../C/CpuArch.h"
|
||||
@@ -230,42 +232,51 @@ static void PrintWarningsPaths(const CErrorPathCodes &pc, CStdOutStream &so)
|
||||
}
|
||||
|
||||
static int WarningsCheck(HRESULT result, const CCallbackConsoleBase &callback,
|
||||
const CUpdateErrorInfo &errorInfo, CStdOutStream &so, bool showHeaders)
|
||||
const CUpdateErrorInfo &errorInfo,
|
||||
CStdOutStream *so,
|
||||
CStdOutStream *se,
|
||||
bool showHeaders)
|
||||
{
|
||||
int exitCode = NExitCode::kSuccess;
|
||||
|
||||
if (callback.ScanErrors.Paths.Size() != 0)
|
||||
{
|
||||
so << endl;
|
||||
so << "Scan WARNINGS for files and folders:" << endl << endl;
|
||||
PrintWarningsPaths(callback.ScanErrors, so);
|
||||
so << "Scan WARNINGS: " << callback.ScanErrors.Paths.Size();
|
||||
so << endl;
|
||||
if (se)
|
||||
{
|
||||
*se << endl;
|
||||
*se << "Scan WARNINGS for files and folders:" << endl << endl;
|
||||
PrintWarningsPaths(callback.ScanErrors, *se);
|
||||
*se << "Scan WARNINGS: " << callback.ScanErrors.Paths.Size();
|
||||
*se << endl;
|
||||
}
|
||||
exitCode = NExitCode::kWarning;
|
||||
}
|
||||
|
||||
if (result != S_OK || errorInfo.ThereIsError())
|
||||
{
|
||||
UString message;
|
||||
if (!errorInfo.Message.IsEmpty())
|
||||
if (se)
|
||||
{
|
||||
message.AddAscii(errorInfo.Message);
|
||||
message.Add_LF();
|
||||
}
|
||||
{
|
||||
FOR_VECTOR(i, errorInfo.FileNames)
|
||||
UString message;
|
||||
if (!errorInfo.Message.IsEmpty())
|
||||
{
|
||||
message += fs2us(errorInfo.FileNames[i]);
|
||||
message.AddAscii(errorInfo.Message);
|
||||
message.Add_LF();
|
||||
}
|
||||
{
|
||||
FOR_VECTOR(i, errorInfo.FileNames)
|
||||
{
|
||||
message += fs2us(errorInfo.FileNames[i]);
|
||||
message.Add_LF();
|
||||
}
|
||||
}
|
||||
if (errorInfo.SystemError != 0)
|
||||
{
|
||||
message += NError::MyFormatMessage(errorInfo.SystemError);
|
||||
message.Add_LF();
|
||||
}
|
||||
if (!message.IsEmpty())
|
||||
*se << L"\nError:\n" << message;
|
||||
}
|
||||
if (errorInfo.SystemError != 0)
|
||||
{
|
||||
message += NError::MyFormatMessage(errorInfo.SystemError);
|
||||
message.Add_LF();
|
||||
}
|
||||
if (!message.IsEmpty())
|
||||
so << L"\nError:\n" << message;
|
||||
|
||||
// we will work with (result) later
|
||||
// throw CSystemException(result);
|
||||
@@ -277,17 +288,25 @@ static int WarningsCheck(HRESULT result, const CCallbackConsoleBase &callback,
|
||||
{
|
||||
if (showHeaders)
|
||||
if (callback.ScanErrors.Paths.Size() == 0)
|
||||
so << kEverythingIsOk << endl;
|
||||
if (so)
|
||||
{
|
||||
if (se)
|
||||
se->Flush();
|
||||
*so << kEverythingIsOk << endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
so << endl;
|
||||
so << "WARNINGS for files:" << endl << endl;
|
||||
PrintWarningsPaths(callback.FailedFiles, so);
|
||||
so << "WARNING: Cannot open " << numErrors << " file";
|
||||
if (numErrors > 1)
|
||||
so << 's';
|
||||
so << endl;
|
||||
if (se)
|
||||
{
|
||||
*se << endl;
|
||||
*se << "WARNINGS for files:" << endl << endl;
|
||||
PrintWarningsPaths(callback.FailedFiles, *se);
|
||||
*se << "WARNING: Cannot open " << numErrors << " file";
|
||||
if (numErrors > 1)
|
||||
*se << 's';
|
||||
*se << endl;
|
||||
}
|
||||
exitCode = NExitCode::kWarning;
|
||||
}
|
||||
|
||||
@@ -473,10 +492,7 @@ int Main2(
|
||||
CStdOutStream *percentsStream = NULL;
|
||||
if (options.Number_for_Percents != k_OutStream_disabled)
|
||||
percentsStream = (options.Number_for_Percents == k_OutStream_stderr) ? &g_StdErr : &g_StdOut;;
|
||||
|
||||
CStdOutStream &so = (g_StdStream ? *g_StdStream : g_StdOut);
|
||||
|
||||
|
||||
if (options.HelpMode)
|
||||
{
|
||||
ShowCopyrightAndHelp(g_StdStream, true);
|
||||
@@ -589,6 +605,7 @@ int Main2(
|
||||
|
||||
if (options.Command.CommandType == NCommandType::kInfo)
|
||||
{
|
||||
CStdOutStream &so = (g_StdStream ? *g_StdStream : g_StdOut);
|
||||
unsigned i;
|
||||
|
||||
#ifdef EXTERNAL_CODECS
|
||||
@@ -754,6 +771,7 @@ int Main2(
|
||||
}
|
||||
else if (options.Command.CommandType == NCommandType::kBenchmark)
|
||||
{
|
||||
CStdOutStream &so = (g_StdStream ? *g_StdStream : g_StdOut);
|
||||
hresultMain = BenchCon(EXTERNAL_CODECS_VARS_L
|
||||
options.Properties, options.NumIterations, (FILE *)so);
|
||||
if (hresultMain == S_FALSE)
|
||||
@@ -890,73 +908,91 @@ int Main2(
|
||||
hresultMain = E_FAIL;
|
||||
}
|
||||
|
||||
so << endl;
|
||||
CStdOutStream *so = g_StdStream;
|
||||
|
||||
if (ecs->NumTryArcs > 1)
|
||||
{
|
||||
so << "Archives: " << ecs->NumTryArcs << endl;
|
||||
so << "OK archives: " << ecs->NumOkArcs << endl;
|
||||
}
|
||||
bool isError = false;
|
||||
|
||||
if (so)
|
||||
{
|
||||
*so << endl;
|
||||
|
||||
if (ecs->NumTryArcs > 1)
|
||||
{
|
||||
*so << "Archives: " << ecs->NumTryArcs << endl;
|
||||
*so << "OK archives: " << ecs->NumOkArcs << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (ecs->NumCantOpenArcs != 0)
|
||||
{
|
||||
isError = true;
|
||||
so << "Can't open as archive: " << ecs->NumCantOpenArcs << endl;
|
||||
if (so)
|
||||
*so << "Can't open as archive: " << ecs->NumCantOpenArcs << endl;
|
||||
}
|
||||
|
||||
if (ecs->NumArcsWithError != 0)
|
||||
{
|
||||
isError = true;
|
||||
so << "Archives with Errors: " << ecs->NumArcsWithError << endl;
|
||||
if (so)
|
||||
*so << "Archives with Errors: " << ecs->NumArcsWithError << endl;
|
||||
}
|
||||
if (ecs->NumArcsWithWarnings != 0)
|
||||
so << "Archives with Warnings: " << ecs->NumArcsWithWarnings << endl;
|
||||
|
||||
if (ecs->NumOpenArcWarnings != 0)
|
||||
if (so)
|
||||
{
|
||||
so << endl;
|
||||
if (ecs->NumArcsWithWarnings != 0)
|
||||
*so << "Archives with Warnings: " << ecs->NumArcsWithWarnings << endl;
|
||||
|
||||
if (ecs->NumOpenArcWarnings != 0)
|
||||
so << "Warnings: " << ecs->NumOpenArcWarnings << endl;
|
||||
{
|
||||
*so << endl;
|
||||
if (ecs->NumOpenArcWarnings != 0)
|
||||
*so << "Warnings: " << ecs->NumOpenArcWarnings << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (ecs->NumOpenArcErrors != 0)
|
||||
{
|
||||
isError = true;
|
||||
so << endl;
|
||||
if (ecs->NumOpenArcErrors != 0)
|
||||
so << "Open Errors: " << ecs->NumOpenArcErrors << endl;
|
||||
if (so)
|
||||
{
|
||||
*so << endl;
|
||||
if (ecs->NumOpenArcErrors != 0)
|
||||
*so << "Open Errors: " << ecs->NumOpenArcErrors << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (isError)
|
||||
retCode = NExitCode::kFatalError;
|
||||
|
||||
if (so)
|
||||
if (ecs->NumArcsWithError != 0 || ecs->NumFileErrors != 0)
|
||||
{
|
||||
// if (ecs->NumArchives > 1)
|
||||
{
|
||||
so << endl;
|
||||
*so << endl;
|
||||
if (ecs->NumFileErrors != 0)
|
||||
so << "Sub items Errors: " << ecs->NumFileErrors << endl;
|
||||
*so << "Sub items Errors: " << ecs->NumFileErrors << endl;
|
||||
}
|
||||
}
|
||||
else if (hresultMain == S_OK)
|
||||
{
|
||||
if (stat.NumFolders != 0)
|
||||
so << "Folders: " << stat.NumFolders << endl;
|
||||
*so << "Folders: " << stat.NumFolders << endl;
|
||||
if (stat.NumFiles != 1 || stat.NumFolders != 0 || stat.NumAltStreams != 0)
|
||||
so << "Files: " << stat.NumFiles << endl;
|
||||
*so << "Files: " << stat.NumFiles << endl;
|
||||
if (stat.NumAltStreams != 0)
|
||||
{
|
||||
so << "Alternate Streams: " << stat.NumAltStreams << endl;
|
||||
so << "Alternate Streams Size: " << stat.AltStreams_UnpackSize << endl;
|
||||
*so << "Alternate Streams: " << stat.NumAltStreams << endl;
|
||||
*so << "Alternate Streams Size: " << stat.AltStreams_UnpackSize << endl;
|
||||
}
|
||||
|
||||
so
|
||||
*so
|
||||
<< "Size: " << stat.UnpackSize << endl
|
||||
<< "Compressed: " << stat.PackSize << endl;
|
||||
if (hashCalc)
|
||||
{
|
||||
so << endl;
|
||||
PrintHashStat(so, hb);
|
||||
*so << endl;
|
||||
PrintHashStat(*so, hb);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1047,9 +1083,14 @@ int Main2(
|
||||
|
||||
callback.ClosePercents2();
|
||||
|
||||
retCode = WarningsCheck(hresultMain, callback, errorInfo, so,
|
||||
// options.EnableHeaders
|
||||
true);
|
||||
CStdOutStream *se = g_StdStream;
|
||||
if (!se)
|
||||
se = g_ErrStream;
|
||||
|
||||
retCode = WarningsCheck(hresultMain, callback, errorInfo,
|
||||
g_StdStream, se,
|
||||
true // options.EnableHeaders
|
||||
);
|
||||
}
|
||||
else if (options.Command.CommandType == NCommandType::kHash)
|
||||
{
|
||||
@@ -1068,7 +1109,10 @@ int Main2(
|
||||
errorInfoString, &callback);
|
||||
CUpdateErrorInfo errorInfo;
|
||||
errorInfo.Message = errorInfoString;
|
||||
retCode = WarningsCheck(hresultMain, callback, errorInfo, so, options.EnableHeaders);
|
||||
CStdOutStream *se = g_StdStream;
|
||||
if (!se)
|
||||
se = g_ErrStream;
|
||||
retCode = WarningsCheck(hresultMain, callback, errorInfo, g_StdStream, se, options.EnableHeaders);
|
||||
}
|
||||
else
|
||||
ShowMessageAndThrowException(kUserErrorMessage, NExitCode::kUserError);
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
#ifndef __CONTEXT_MENU_H
|
||||
#define __CONTEXT_MENU_H
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <ShlObj.h>
|
||||
|
||||
#include "../../../Common/MyString.h"
|
||||
|
||||
#include "../FileManager/MyCom2.h"
|
||||
|
||||
@@ -8,11 +8,13 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyInitGuid.h"
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <ShlGuid.h>
|
||||
#include <OleCtl.h>
|
||||
|
||||
#include "../../../Common/MyInitGuid.h"
|
||||
|
||||
#include "../../../Common/ComTry.h"
|
||||
#include "../../../Common/StringConvert.h"
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include "../../../Common/MyInitGuid.h"
|
||||
|
||||
#include "../../../Common/StringConvert.h"
|
||||
@@ -96,6 +98,7 @@ EXTERN_C void WINAPI SetStartupInfo(const PluginStartupInfo *info)
|
||||
class COpenArchiveCallback:
|
||||
public IArchiveOpenCallback,
|
||||
public IArchiveOpenVolumeCallback,
|
||||
public IArchiveOpenSetSubArchiveName,
|
||||
public IProgress,
|
||||
public ICryptoGetTextPassword,
|
||||
public CMyUnknownImp
|
||||
@@ -109,6 +112,8 @@ class COpenArchiveCallback:
|
||||
bool _numBytesTotalDefined;
|
||||
|
||||
NFind::CFileInfo _fileInfo;
|
||||
bool _subArchiveMode;
|
||||
UString _subArchiveName;
|
||||
public:
|
||||
bool PasswordIsDefined;
|
||||
UString Password;
|
||||
@@ -116,8 +121,9 @@ public:
|
||||
FString _folderPrefix;
|
||||
|
||||
public:
|
||||
MY_UNKNOWN_IMP3(
|
||||
MY_UNKNOWN_IMP4(
|
||||
IArchiveOpenVolumeCallback,
|
||||
IArchiveOpenSetSubArchiveName,
|
||||
IProgress,
|
||||
ICryptoGetTextPassword
|
||||
)
|
||||
@@ -134,13 +140,24 @@ public:
|
||||
STDMETHOD(GetProperty)(PROPID propID, PROPVARIANT *value);
|
||||
STDMETHOD(GetStream)(const wchar_t *name, IInStream **inStream);
|
||||
|
||||
STDMETHOD(SetSubArchiveName(const wchar_t *name))
|
||||
{
|
||||
_subArchiveMode = true;
|
||||
_subArchiveName = name;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// ICryptoGetTextPassword
|
||||
STDMETHOD(CryptoGetTextPassword)(BSTR *password);
|
||||
|
||||
COpenArchiveCallback(): _subArchiveMode(false) {}
|
||||
|
||||
void Init()
|
||||
{
|
||||
PasswordIsDefined = false;
|
||||
|
||||
_subArchiveMode = false;
|
||||
|
||||
_numFilesTotalDefined = false;
|
||||
_numBytesTotalDefined = false;
|
||||
|
||||
@@ -220,6 +237,8 @@ STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name, IInStream **in
|
||||
{
|
||||
if (WasEscPressed())
|
||||
return E_ABORT;
|
||||
if (_subArchiveMode)
|
||||
return S_FALSE;
|
||||
*inStream = NULL;
|
||||
FString fullPath = _folderPrefix + us2fs(name);
|
||||
if (!_fileInfo.Find(fullPath))
|
||||
@@ -238,6 +257,14 @@ STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name, IInStream **in
|
||||
STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value)
|
||||
{
|
||||
NCOM::CPropVariant prop;
|
||||
if (_subArchiveMode)
|
||||
{
|
||||
switch(propID)
|
||||
{
|
||||
case kpidName: prop = _subArchiveName; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
switch(propID)
|
||||
{
|
||||
case kpidName: prop = GetUnicodeString(_fileInfo.Name, CP_OEMCP); break;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace NMessageID {
|
||||
|
||||
const UINT k_Last_PropId_supported_by_plugin = kpidStreamId;
|
||||
const unsigned k_Last_PropId_supported_by_plugin = kpidStreamId;
|
||||
|
||||
enum EEnum
|
||||
{
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
|
||||
#ifndef UNDER_CE
|
||||
#include "../../../Windows/CommonDialog.h"
|
||||
#include "../../../Windows/Shell.h"
|
||||
@@ -106,7 +110,7 @@ class CBrowseDialog: public NControl::CModalDialog
|
||||
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
|
||||
virtual void OnOK();
|
||||
|
||||
void Post_RefreshPathEdit() { PostMessage(k_Message_RefreshPathEdit); }
|
||||
void Post_RefreshPathEdit() { PostMsg(k_Message_RefreshPathEdit); }
|
||||
|
||||
bool GetParentPath(const UString &path, UString &parentPrefix, UString &name);
|
||||
// Reload changes DirPrefix. Don't send DirPrefix in pathPrefix parameter
|
||||
@@ -295,7 +299,7 @@ bool CBrowseDialog::OnInit()
|
||||
#ifndef UNDER_CE
|
||||
/* If we clear UISF_HIDEFOCUS, the focus rectangle in ListView will be visible,
|
||||
even if we use mouse for pressing the button to open this dialog. */
|
||||
PostMessage(MY__WM_UPDATEUISTATE, MAKEWPARAM(MY__UIS_CLEAR, MY__UISF_HIDEFOCUS));
|
||||
PostMsg(MY__WM_UPDATEUISTATE, MAKEWPARAM(MY__UIS_CLEAR, MY__UISF_HIDEFOCUS));
|
||||
#endif
|
||||
|
||||
return CModalDialog::OnInit();
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include "../../../Common/MyInitGuid.h"
|
||||
|
||||
#include "../Agent/Agent.h"
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <shlwapi.h>
|
||||
|
||||
#include "../../../../C/Alloc.h"
|
||||
|
||||
#include "../../../Common/IntToString.h"
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <Winbase.h>
|
||||
|
||||
#include "../../../Common/Defs.h"
|
||||
@@ -585,7 +587,6 @@ STDMETHODIMP CFSFolder::CopyTo(Int32 moveMode, const UInt32 *indices, UInt32 num
|
||||
|
||||
CCopyState state;
|
||||
state.ProgressInfo.TotalSize = stat.Size;
|
||||
state.ProgressInfo.TotalSize = stat.Size;
|
||||
state.ProgressInfo.StartPos = 0;
|
||||
state.ProgressInfo.Progress = callback;
|
||||
state.ProgressInfo.Init();
|
||||
@@ -593,7 +594,6 @@ STDMETHODIMP CFSFolder::CopyTo(Int32 moveMode, const UInt32 *indices, UInt32 num
|
||||
state.MoveMode = IntToBool(moveMode);
|
||||
state.UseReadWriteMode = isAltDest;
|
||||
state.Prepare();
|
||||
state.TotalSize = stat.Size;
|
||||
|
||||
for (UInt32 i = 0; i < numItems; i++)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ static const UInt32 kLangIDs[] =
|
||||
|
||||
static bool GetSymLink(CFSTR path, CReparseAttr &attr)
|
||||
{
|
||||
NFile::NIO::CInFile file;
|
||||
NIO::CInFile file;
|
||||
if (!file.Open(path,
|
||||
FILE_SHARE_READ,
|
||||
OPEN_EXISTING,
|
||||
@@ -88,12 +88,13 @@ bool CLinkDialog::OnInit()
|
||||
LangSetWindowText(*this, IDD_LINK);
|
||||
LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs));
|
||||
#endif
|
||||
|
||||
_pathFromCombo.Attach(GetItem(IDC_LINK_PATH_FROM));
|
||||
_pathToCombo.Attach(GetItem(IDC_LINK_PATH_TO));
|
||||
|
||||
if (!FilePath.IsEmpty())
|
||||
{
|
||||
NFile::NFind::CFileInfo fi;
|
||||
NFind::CFileInfo fi;
|
||||
int linkType = 0;
|
||||
if (!fi.Find(us2fs(FilePath)))
|
||||
linkType = IDR_LINK_TYPE_SYM_FILE;
|
||||
@@ -219,7 +220,7 @@ void CLinkDialog::OnButton_SetPath(bool to)
|
||||
UString resultPath;
|
||||
if (!MyBrowseForFolder(*this, title, currentPath, resultPath))
|
||||
return;
|
||||
NFile::NName::NormalizeDirPathPrefix(resultPath);
|
||||
NName::NormalizeDirPathPrefix(resultPath);
|
||||
combo.SetCurSel(-1);
|
||||
combo.SetText(resultPath);
|
||||
}
|
||||
@@ -239,16 +240,23 @@ void CLinkDialog::OnButton_Link()
|
||||
UString from, to;
|
||||
_pathFromCombo.GetText(from);
|
||||
_pathToCombo.GetText(to);
|
||||
int i;
|
||||
for (i = 0; i < ARRAY_SIZE(k_LinkType_Buttons); i++)
|
||||
if (IsButtonCheckedBool(k_LinkType_Buttons[i]))
|
||||
break;
|
||||
if (i >= ARRAY_SIZE(k_LinkType_Buttons))
|
||||
|
||||
if (from.IsEmpty())
|
||||
return;
|
||||
if (!NName::IsAbsolutePath(from))
|
||||
from.Insert(0, CurDirPrefix);
|
||||
|
||||
int idb = k_LinkType_Buttons[i];
|
||||
int idb = -1;
|
||||
for (unsigned i = 0;; i++)
|
||||
{
|
||||
if (i >= ARRAY_SIZE(k_LinkType_Buttons))
|
||||
return;
|
||||
idb = k_LinkType_Buttons[i];
|
||||
if (IsButtonCheckedBool(idb))
|
||||
break;
|
||||
}
|
||||
|
||||
NFile::NFind::CFileInfo info1, info2;
|
||||
NFind::CFileInfo info1, info2;
|
||||
bool finded1 = info1.Find(us2fs(from));
|
||||
bool finded2 = info2.Find(us2fs(to));
|
||||
|
||||
@@ -259,14 +267,13 @@ void CLinkDialog::OnButton_Link()
|
||||
if (finded1 && info1.IsDir() != isDirLink ||
|
||||
finded2 && info2.IsDir() != isDirLink)
|
||||
{
|
||||
ShowError(L"Incorrect linkType");
|
||||
ShowError(L"Incorrect link type");
|
||||
return;
|
||||
}
|
||||
|
||||
if (idb == IDR_LINK_TYPE_HARD)
|
||||
{
|
||||
bool res = NFile::NDir::MyCreateHardLink(us2fs(from), us2fs(to));
|
||||
if (!res)
|
||||
if (!NDir::MyCreateHardLink(us2fs(from), us2fs(to)))
|
||||
{
|
||||
ShowLastErrorMessage();
|
||||
return;
|
||||
@@ -291,9 +298,10 @@ void CLinkDialog::OnButton_Link()
|
||||
}
|
||||
|
||||
|
||||
if (!NFile::NIO::SetReparseData(us2fs(from), isDirLink, data, (DWORD)data.Size()))
|
||||
if (!NIO::SetReparseData(us2fs(from), isDirLink, data, (DWORD)data.Size()))
|
||||
{
|
||||
ShowLastErrorMessage();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,7 +329,8 @@ void CApp::Link()
|
||||
int index = indices[0];
|
||||
const UString itemName = srcPanel.GetItemName(index);
|
||||
|
||||
UString srcPath = srcPanel.GetFsPath() + srcPanel.GetItemPrefix(index);
|
||||
const UString fsPrefix = srcPanel.GetFsPath();
|
||||
const UString srcPath = fsPrefix + srcPanel.GetItemPrefix(index);
|
||||
UString path = srcPath;
|
||||
{
|
||||
int destPanelIndex = (NumPanels <= 1) ? srcPanelIndex : (1 - srcPanelIndex);
|
||||
@@ -332,6 +341,7 @@ void CApp::Link()
|
||||
}
|
||||
|
||||
CLinkDialog dlg;
|
||||
dlg.CurDirPrefix = fsPrefix;
|
||||
dlg.FilePath = srcPath + itemName;
|
||||
dlg.AnotherPath = path;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ class CLinkDialog: public NWindows::NControl::CModalDialog
|
||||
void ShowError(const wchar_t *s);
|
||||
void Set_LinkType_Radio(int idb);
|
||||
public:
|
||||
UString CurDirPrefix;
|
||||
UString FilePath;
|
||||
UString AnotherPath;
|
||||
|
||||
|
||||
@@ -795,7 +795,7 @@ void CPanel::Change_ShowNtfsStrems_Mode()
|
||||
void CPanel::Post_Refresh_StatusBar()
|
||||
{
|
||||
if (_processStatusBar)
|
||||
PostMessage(kRefresh_StatusBar);
|
||||
PostMsg(kRefresh_StatusBar);
|
||||
}
|
||||
|
||||
void CPanel::AddToArchive()
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
#ifndef __PANEL_H
|
||||
#define __PANEL_H
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <ShlObj.h>
|
||||
|
||||
#include "../../../../C/Alloc.h"
|
||||
|
||||
#include "../../../Common/Defs.h"
|
||||
|
||||
@@ -359,7 +359,7 @@ LRESULT CPanel::OnNotifyComboBoxEnter(const UString &s)
|
||||
{
|
||||
if (BindToPathAndRefresh(GetUnicodeString(s)) == S_OK)
|
||||
{
|
||||
PostMessage(kSetFocusToListView);
|
||||
PostMsg(kSetFocusToListView);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -370,7 +370,7 @@ bool CPanel::OnNotifyComboBoxEndEdit(PNMCBEENDEDITW info, LRESULT &result)
|
||||
if (info->iWhy == CBENF_ESCAPE)
|
||||
{
|
||||
_headerComboBox.SetText(_currentFolderPrefix);
|
||||
PostMessage(kSetFocusToListView);
|
||||
PostMsg(kSetFocusToListView);
|
||||
result = FALSE;
|
||||
return true;
|
||||
}
|
||||
@@ -401,7 +401,7 @@ bool CPanel::OnNotifyComboBoxEndEdit(PNMCBEENDEDIT info, LRESULT &result)
|
||||
if (info->iWhy == CBENF_ESCAPE)
|
||||
{
|
||||
_headerComboBox.SetText(_currentFolderPrefix);
|
||||
PostMessage(kSetFocusToListView);
|
||||
PostMsg(kSetFocusToListView);
|
||||
result = FALSE;
|
||||
return true;
|
||||
}
|
||||
@@ -528,9 +528,9 @@ bool CPanel::OnComboBoxCommand(UINT code, LPARAM /* param */, LRESULT &result)
|
||||
// _headerComboBox.SetText(pass); // it's fix for seclecting by mouse.
|
||||
if (BindToPathAndRefresh(pass) == S_OK)
|
||||
{
|
||||
PostMessage(kSetFocusToListView);
|
||||
PostMsg(kSetFocusToListView);
|
||||
#ifdef UNDER_CE
|
||||
PostMessage(kRefresh_HeaderComboBox);
|
||||
PostMsg(kRefresh_HeaderComboBox);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <tlhelp32.h>
|
||||
|
||||
#include "../../../Common/AutoPtr.h"
|
||||
|
||||
@@ -354,7 +354,7 @@ BOOL CPanel::OnEndLabelEdit(LV_DISPINFOW * lpnmh)
|
||||
|
||||
_dontShowMode = true;
|
||||
|
||||
PostMessage(kReLoadMessage);
|
||||
PostMsg(kReLoadMessage);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ void CPanel::OnArrowWithShift()
|
||||
}
|
||||
|
||||
_prevFocusedItem = focusedItem;
|
||||
PostMessage(kShiftSelectMessage);
|
||||
PostMsg(kShiftSelectMessage);
|
||||
_listView.RedrawItem(focusedItem);
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ void CProgressDialog::CheckNeedClose()
|
||||
{
|
||||
if (_needClose)
|
||||
{
|
||||
PostMessage(kCloseMessage);
|
||||
PostMsg(kCloseMessage);
|
||||
_needClose = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
{
|
||||
WaitCreating();
|
||||
if (_wasCreated)
|
||||
PostMessage(kCloseMessage);
|
||||
PostMsg(kCloseMessage);
|
||||
else
|
||||
_needClose = true;
|
||||
};
|
||||
|
||||
@@ -1229,7 +1229,7 @@ void CProgressDialog::CheckNeedClose()
|
||||
{
|
||||
if (_needClose)
|
||||
{
|
||||
PostMessage(kCloseMessage);
|
||||
PostMsg(kCloseMessage);
|
||||
_needClose = false;
|
||||
}
|
||||
}
|
||||
@@ -1241,7 +1241,7 @@ void CProgressDialog::ProcessWasFinished()
|
||||
WaitCreating();
|
||||
|
||||
if (_wasCreated)
|
||||
PostMessage(kCloseMessage);
|
||||
PostMsg(kCloseMessage);
|
||||
else
|
||||
_needClose = true;
|
||||
}
|
||||
|
||||
@@ -96,4 +96,5 @@ BEGIN
|
||||
IDS_PROP_STREAM_ID "Stream ID"
|
||||
IDS_PROP_READ_ONLY "Read-only"
|
||||
IDS_PROP_OUT_NAME "Out Name"
|
||||
IDS_PROP_COPY_LINK "Copy Link"
|
||||
END
|
||||
|
||||
@@ -92,3 +92,4 @@
|
||||
#define IDS_PROP_STREAM_ID 1092
|
||||
#define IDS_PROP_READ_ONLY 1093
|
||||
#define IDS_PROP_OUT_NAME 1094
|
||||
#define IDS_PROP_COPY_LINK 1095
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <ShlObj.h>
|
||||
|
||||
#include "../../../Common/StringConvert.h"
|
||||
|
||||
#include "../../../Windows/DLL.h"
|
||||
|
||||
@@ -12,8 +12,10 @@
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
#include <ShlObj.h>
|
||||
#include <shlwapi.h>
|
||||
// #include "../../../Common/MyWindows.h"
|
||||
|
||||
// #include <commctrl.h>
|
||||
// #include <ShlObj.h>
|
||||
// #include <shlwapi.h>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include "SysIconUtils.h"
|
||||
|
||||
#include <ShlObj.h>
|
||||
|
||||
#ifndef _UNICODE
|
||||
extern bool g_IsNT;
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
#ifndef __SYS_ICON_UTILS_H
|
||||
#define __SYS_ICON_UTILS_H
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "../../../Common/MyString.h"
|
||||
|
||||
struct CExtIconPair
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <ShlObj.h>
|
||||
|
||||
#include "../../../Common/StringConvert.h"
|
||||
#include "../../../Common/Defs.h"
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ bool CBenchmarkDialog::OnInit()
|
||||
// f.lfFaceName[0] = 0;
|
||||
_font.Create(&f);
|
||||
if (_font._font)
|
||||
_consoleEdit.SendMessage(WM_SETFONT, (WPARAM)_font._font, TRUE);
|
||||
_consoleEdit.SendMsg(WM_SETFONT, (WPARAM)_font._font, TRUE);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#include <shlwapi.h>
|
||||
|
||||
#include "../../../../C/Alloc.h"
|
||||
|
||||
#include "../../../Common/MyInitGuid.h"
|
||||
|
||||
@@ -9,9 +9,11 @@
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
|
||||
// #include "../../../Common/MyWindows.h"
|
||||
|
||||
// #include <commctrl.h>
|
||||
#include <ShlObj.h>
|
||||
#include <shlwapi.h>
|
||||
// #include <ShlObj.h>
|
||||
// #include <shlwapi.h>
|
||||
|
||||
// #define printf(x) NO_PRINTF_(x)
|
||||
// #define sprintf(x) NO_SPRINTF_(x)
|
||||
|
||||
Reference in New Issue
Block a user