mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-09 02:07:06 -06:00
4.58 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
bd1fa36322
commit
3901bf0ab8
@@ -250,7 +250,7 @@ STDMETHODIMP CAgent::DoOperation(
|
||||
UString resultPath;
|
||||
int pos;
|
||||
if(!NFile::NDirectory::MyGetFullPathName(archiveName, resultPath, pos))
|
||||
throw 141716;
|
||||
return E_FAIL;
|
||||
NFile::NDirectory::CreateComplexDirectory(resultPath.Left(pos));
|
||||
}
|
||||
if (!outStreamSpec->Create(archiveName, true))
|
||||
@@ -282,7 +282,7 @@ STDMETHODIMP CAgent::DoOperation(
|
||||
catch(...)
|
||||
{
|
||||
delete []propValues;
|
||||
throw;
|
||||
return E_FAIL;
|
||||
}
|
||||
delete []propValues;
|
||||
}
|
||||
@@ -295,7 +295,8 @@ STDMETHODIMP CAgent::DoOperation(
|
||||
CInFileStream *sfxStreamSpec = new CInFileStream;
|
||||
CMyComPtr<IInStream> sfxStream(sfxStreamSpec);
|
||||
if (!sfxStreamSpec->Open(sfxModule))
|
||||
throw "Can't open sfx module";
|
||||
return E_FAIL;
|
||||
// throw "Can't open sfx module";
|
||||
RINOK(CopyBlock(sfxStream, outStream));
|
||||
}
|
||||
|
||||
|
||||
@@ -228,7 +228,20 @@ HRESULT CProxyArchive::ReadObjects(IInArchive *archive, IProgress *progress)
|
||||
CProxyFolder *currentItem = &RootFolder;
|
||||
UString fileName;
|
||||
if(propVariantPath.vt == VT_EMPTY)
|
||||
{
|
||||
fileName = DefaultName;
|
||||
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(i, kpidExtension, &prop));
|
||||
if (prop.vt == VT_BSTR)
|
||||
{
|
||||
fileName += L'.';
|
||||
fileName += prop.bstrVal;
|
||||
}
|
||||
else if (prop.vt != VT_EMPTY)
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(propVariantPath.vt != VT_BSTR)
|
||||
|
||||
@@ -275,7 +275,7 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(UInt32 index,
|
||||
else
|
||||
{
|
||||
if (propVariant.vt != VT_UI4)
|
||||
throw "incorrect item";
|
||||
return E_FAIL;
|
||||
_processedFileInfo.Attributes = propVariant.ulVal;
|
||||
_processedFileInfo.AttributesAreDefined = true;
|
||||
}
|
||||
@@ -684,11 +684,7 @@ STDMETHODIMP CArchiveUpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDef
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Main function
|
||||
|
||||
int
|
||||
#ifdef _MSC_VER
|
||||
__cdecl
|
||||
#endif
|
||||
main(int argc, char* argv[])
|
||||
int MY_CDECL main(int argc, char* argv[])
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#ifndef _UNICODE
|
||||
|
||||
@@ -95,7 +95,7 @@ private:
|
||||
public:
|
||||
CArchiveExtractCallback():
|
||||
WriteModified(true),
|
||||
WriteCreated(false),
|
||||
WriteCreated(true),
|
||||
WriteAccessed(false),
|
||||
_multiArchives(false)
|
||||
{
|
||||
|
||||
@@ -5,30 +5,31 @@
|
||||
|
||||
#include "Common/MyString.h"
|
||||
#include "Common/Types.h"
|
||||
#include "../../Archive/IArchive.h"
|
||||
|
||||
struct CDirItem
|
||||
{
|
||||
UInt32 Attributes;
|
||||
FILETIME CreationTime;
|
||||
FILETIME LastAccessTime;
|
||||
FILETIME LastWriteTime;
|
||||
UInt64 Size;
|
||||
UString Name;
|
||||
UString FullPath;
|
||||
UInt32 Attributes;
|
||||
bool IsDirectory() const { return (Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 ; }
|
||||
};
|
||||
|
||||
struct CArchiveItem
|
||||
{
|
||||
bool IsDirectory;
|
||||
// DWORD Attributes;
|
||||
// NWindows::NCOM::CPropVariant LastWriteTime;
|
||||
FILETIME LastWriteTime;
|
||||
bool SizeIsDefined;
|
||||
UInt64 Size;
|
||||
UString Name;
|
||||
bool IsDirectory;
|
||||
bool SizeIsDefined;
|
||||
bool Censored;
|
||||
int IndexInServer;
|
||||
UInt32 IndexInServer;
|
||||
int FileTimeType;
|
||||
CArchiveItem(): IsDirectory(false), SizeIsDefined(false), Censored(false), FileTimeType(-1) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -482,10 +482,10 @@ int CCodecs::FindFormatForArchiveType(const UString &arcType) const
|
||||
extern unsigned int g_NumCodecs;
|
||||
STDAPI CreateCoder2(bool encode, UInt32 index, const GUID *iid, void **outObject);
|
||||
STDAPI GetMethodProperty(UInt32 codecIndex, PROPID propID, PROPVARIANT *value);
|
||||
// STDAPI GetNumberOfMethods(UINT32 *numCodecs);
|
||||
// STDAPI GetNumberOfMethods(UInt32 *numCodecs);
|
||||
#endif
|
||||
|
||||
STDMETHODIMP CCodecs::GetNumberOfMethods(UINT32 *numMethods)
|
||||
STDMETHODIMP CCodecs::GetNumberOfMethods(UInt32 *numMethods)
|
||||
{
|
||||
*numMethods =
|
||||
#ifdef EXPORT_CODECS
|
||||
@@ -495,7 +495,7 @@ STDMETHODIMP CCodecs::GetNumberOfMethods(UINT32 *numMethods)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CCodecs::GetProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
|
||||
STDMETHODIMP CCodecs::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
|
||||
{
|
||||
#ifdef EXPORT_CODECS
|
||||
if (index < g_NumCodecs)
|
||||
@@ -525,7 +525,7 @@ STDMETHODIMP CCodecs::GetProperty(UINT32 index, PROPID propID, PROPVARIANT *valu
|
||||
return Libs[ci.LibIndex].GetMethodProperty(ci.CodecIndex, propID, value);
|
||||
}
|
||||
|
||||
STDMETHODIMP CCodecs::CreateDecoder(UINT32 index, const GUID *iid, void **coder)
|
||||
STDMETHODIMP CCodecs::CreateDecoder(UInt32 index, const GUID *iid, void **coder)
|
||||
{
|
||||
#ifdef EXPORT_CODECS
|
||||
if (index < g_NumCodecs)
|
||||
@@ -541,7 +541,7 @@ STDMETHODIMP CCodecs::CreateDecoder(UINT32 index, const GUID *iid, void **coder)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CCodecs::CreateEncoder(UINT32 index, const GUID *iid, void **coder)
|
||||
STDMETHODIMP CCodecs::CreateEncoder(UInt32 index, const GUID *iid, void **coder)
|
||||
{
|
||||
#ifdef EXPORT_CODECS
|
||||
if (index < g_NumCodecs)
|
||||
|
||||
@@ -154,10 +154,10 @@ public:
|
||||
MY_UNKNOWN_IMP
|
||||
|
||||
#ifdef EXTERNAL_CODECS
|
||||
STDMETHOD(GetNumberOfMethods)(UINT32 *numMethods);
|
||||
STDMETHOD(GetProperty)(UINT32 index, PROPID propID, PROPVARIANT *value);
|
||||
STDMETHOD(CreateDecoder)(UINT32 index, const GUID *interfaceID, void **coder);
|
||||
STDMETHOD(CreateEncoder)(UINT32 index, const GUID *interfaceID, void **coder);
|
||||
STDMETHOD(GetNumberOfMethods)(UInt32 *numMethods);
|
||||
STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value);
|
||||
STDMETHOD(CreateDecoder)(UInt32 index, const GUID *interfaceID, void **coder);
|
||||
STDMETHOD(CreateEncoder)(UInt32 index, const GUID *interfaceID, void **coder);
|
||||
#endif
|
||||
|
||||
int GetCodecLibIndex(UInt32 index);
|
||||
|
||||
@@ -37,7 +37,18 @@ HRESULT GetArchiveItemPath(IInArchive *archive, UInt32 index, const UString &def
|
||||
{
|
||||
RINOK(GetArchiveItemPath(archive, index, result));
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
result = defaultName;
|
||||
NCOM::CPropVariant prop;
|
||||
RINOK(archive->GetProperty(index, kpidExtension, &prop));
|
||||
if (prop.vt == VT_BSTR)
|
||||
{
|
||||
result += L'.';
|
||||
result += prop.bstrVal;
|
||||
}
|
||||
else if (prop.vt != VT_EMPTY)
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -129,12 +140,12 @@ HRESULT OpenArchive(
|
||||
{
|
||||
CIntVector orderIndices2;
|
||||
CByteBuffer byteBuffer;
|
||||
const UInt32 kBufferSize = (200 << 10);
|
||||
const size_t kBufferSize = (200 << 10);
|
||||
byteBuffer.SetCapacity(kBufferSize);
|
||||
Byte *buffer = byteBuffer;
|
||||
RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
|
||||
UInt32 processedSize;
|
||||
RINOK(ReadStream(inStream, buffer, kBufferSize, &processedSize));
|
||||
size_t processedSize = kBufferSize;
|
||||
RINOK(ReadStream(inStream, buffer, &processedSize));
|
||||
for (UInt32 pos = 0; pos < processedSize; pos++)
|
||||
{
|
||||
for (int i = 0; i < orderIndices.Size(); i++)
|
||||
@@ -159,16 +170,16 @@ HRESULT OpenArchive(
|
||||
else if (extension == L"000" || extension == L"001")
|
||||
{
|
||||
CByteBuffer byteBuffer;
|
||||
const UInt32 kBufferSize = (1 << 10);
|
||||
const size_t kBufferSize = (1 << 10);
|
||||
byteBuffer.SetCapacity(kBufferSize);
|
||||
Byte *buffer = byteBuffer;
|
||||
RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
|
||||
UInt32 processedSize;
|
||||
RINOK(ReadStream(inStream, buffer, kBufferSize, &processedSize));
|
||||
size_t processedSize = kBufferSize;
|
||||
RINOK(ReadStream(inStream, buffer, &processedSize));
|
||||
if (processedSize >= 16)
|
||||
{
|
||||
Byte kRarHeader[] = {0x52 , 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00};
|
||||
if (TestSignature(buffer, kRarHeader, 7) && buffer[9] == 0x73 && (buffer[10] && 1) != 0)
|
||||
if (TestSignature(buffer, kRarHeader, 7) && buffer[9] == 0x73 && (buffer[10] & 1) != 0)
|
||||
{
|
||||
for (int i = 0; i < orderIndices.Size(); i++)
|
||||
{
|
||||
|
||||
@@ -44,9 +44,23 @@ HRESULT SetProperties(IUnknown *unknown, const CObjectVector<CProperty> &propert
|
||||
{
|
||||
const CProperty &property = properties[i];
|
||||
NCOM::CPropVariant propVariant;
|
||||
if (!property.Value.IsEmpty())
|
||||
UString name = property.Name;
|
||||
if (property.Value.IsEmpty())
|
||||
{
|
||||
if (!name.IsEmpty())
|
||||
{
|
||||
wchar_t c = name[name.Length() - 1];
|
||||
if (c == L'-')
|
||||
propVariant = false;
|
||||
else if (c == L'+')
|
||||
propVariant = true;
|
||||
if (propVariant.vt != VT_EMPTY)
|
||||
name = name.Left(name.Length() - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
ParseNumberString(property.Value, propVariant);
|
||||
realNames.Add(property.Name);
|
||||
realNames.Add(name);
|
||||
values[i] = propVariant;
|
||||
}
|
||||
CRecordVector<const wchar_t *> names;
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <mapi.h>
|
||||
#endif
|
||||
|
||||
#include "Update.h"
|
||||
|
||||
#include "Common/IntToString.h"
|
||||
@@ -338,9 +334,9 @@ static HRESULT Compress(
|
||||
switch(value)
|
||||
{
|
||||
case NFileTimeType::kWindows:
|
||||
case NFileTimeType::kDOS:
|
||||
case NFileTimeType::kUnix:
|
||||
fileTimeType = NFileTimeType::EEnum(value);
|
||||
case NFileTimeType::kDOS:
|
||||
fileTimeType = (NFileTimeType::EEnum)value;
|
||||
break;
|
||||
default:
|
||||
return E_FAIL;
|
||||
@@ -516,11 +512,31 @@ HRESULT EnumerateInArchiveItems(const NWildcard::CCensor &censor,
|
||||
RINOK(GetArchiveItemFileTime(archive, i,
|
||||
archiveFileInfo.LastWriteTime, ai.LastWriteTime));
|
||||
|
||||
CPropVariant propertySize;
|
||||
RINOK(archive->GetProperty(i, kpidSize, &propertySize));
|
||||
ai.SizeIsDefined = (propertySize.vt != VT_EMPTY);
|
||||
if (ai.SizeIsDefined)
|
||||
ai.Size = ConvertPropVariantToUInt64(propertySize);
|
||||
{
|
||||
CPropVariant prop;
|
||||
RINOK(archive->GetProperty(i, kpidSize, &prop));
|
||||
ai.SizeIsDefined = (prop.vt != VT_EMPTY);
|
||||
if (ai.SizeIsDefined)
|
||||
ai.Size = ConvertPropVariantToUInt64(prop);
|
||||
}
|
||||
|
||||
{
|
||||
CPropVariant prop;
|
||||
RINOK(archive->GetProperty(i, kpidTimeType, &prop));
|
||||
if (prop.vt == VT_UI4)
|
||||
{
|
||||
ai.FileTimeType = (int)(NFileTimeType::EEnum)prop.ulVal;
|
||||
switch(ai.FileTimeType)
|
||||
{
|
||||
case NFileTimeType::kWindows:
|
||||
case NFileTimeType::kUnix:
|
||||
case NFileTimeType::kDOS:
|
||||
break;
|
||||
default:
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ai.IndexInServer = i;
|
||||
archiveItems.Add(ai);
|
||||
@@ -593,6 +609,17 @@ struct CEnumDirItemUpdateCallback: public IEnumDirItemCallback
|
||||
HRESULT CheckBreak() { return Callback->CheckBreak(); }
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef ULONG (FAR PASCAL MY_MAPISENDDOCUMENTS)(
|
||||
ULONG_PTR ulUIParam,
|
||||
LPSTR lpszDelimChar,
|
||||
LPSTR lpszFilePaths,
|
||||
LPSTR lpszFileNames,
|
||||
ULONG ulReserved
|
||||
);
|
||||
typedef MY_MAPISENDDOCUMENTS FAR *MY_LPMAPISENDDOCUMENTS;
|
||||
#endif
|
||||
|
||||
HRESULT UpdateArchive(
|
||||
CCodecs *codecs,
|
||||
const NWildcard::CCensor &censor,
|
||||
@@ -814,7 +841,7 @@ HRESULT UpdateArchive(
|
||||
errorInfo.Message = L"can not load Mapi32.dll";
|
||||
return E_FAIL;
|
||||
}
|
||||
LPMAPISENDDOCUMENTS fnSend = (LPMAPISENDDOCUMENTS)
|
||||
MY_LPMAPISENDDOCUMENTS fnSend = (MY_LPMAPISENDDOCUMENTS)
|
||||
mapiLib.GetProcAddress("MAPISendDocuments");
|
||||
if (fnSend == 0)
|
||||
{
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
using namespace NWindows;
|
||||
using namespace NTime;
|
||||
|
||||
static int MyCompareTime(NFileTimeType::EEnum fileTimeType,
|
||||
const FILETIME &time1, const FILETIME &time2)
|
||||
static int MyCompareTime(NFileTimeType::EEnum fileTimeType, const FILETIME &time1, const FILETIME &time2)
|
||||
{
|
||||
switch(fileTimeType)
|
||||
{
|
||||
@@ -24,16 +23,8 @@ static int MyCompareTime(NFileTimeType::EEnum fileTimeType,
|
||||
case NFileTimeType::kUnix:
|
||||
{
|
||||
UInt32 unixTime1, unixTime2;
|
||||
if (!FileTimeToUnixTime(time1, unixTime1))
|
||||
{
|
||||
unixTime1 = 0;
|
||||
// throw 4191614;
|
||||
}
|
||||
if (!FileTimeToUnixTime(time2, unixTime2))
|
||||
{
|
||||
unixTime2 = 0;
|
||||
// throw 4191615;
|
||||
}
|
||||
FileTimeToUnixTime(time1, unixTime1);
|
||||
FileTimeToUnixTime(time2, unixTime2);
|
||||
return MyCompare(unixTime1, unixTime2);
|
||||
}
|
||||
case NFileTimeType::kDOS:
|
||||
@@ -41,12 +32,6 @@ static int MyCompareTime(NFileTimeType::EEnum fileTimeType,
|
||||
UInt32 dosTime1, dosTime2;
|
||||
FileTimeToDosTime(time1, dosTime1);
|
||||
FileTimeToDosTime(time2, dosTime2);
|
||||
/*
|
||||
if (!FileTimeToDosTime(time1, dosTime1))
|
||||
throw 4191616;
|
||||
if (!FileTimeToDosTime(time2, dosTime2))
|
||||
throw 4191617;
|
||||
*/
|
||||
return MyCompare(dosTime1, dosTime2);
|
||||
}
|
||||
}
|
||||
@@ -125,7 +110,8 @@ void GetUpdatePairInfoList(
|
||||
throw 1082022;; // TTString(kNotCensoredCollisionMessaged + dirItem.Name);
|
||||
pair.DirItemIndex = dirItemIndex2;
|
||||
pair.ArchiveItemIndex = archiveItemIndex2;
|
||||
switch (MyCompareTime(fileTimeType, dirItem.LastWriteTime, archiveItem.LastWriteTime))
|
||||
switch (MyCompareTime(archiveItem.FileTimeType != - 1 ?
|
||||
(NFileTimeType::EEnum)archiveItem.FileTimeType : fileTimeType, dirItem.LastWriteTime, archiveItem.LastWriteTime))
|
||||
{
|
||||
case -1:
|
||||
pair.State = NUpdateArchive::NPairState::kNewInArchive;
|
||||
|
||||
@@ -295,7 +295,16 @@ HRESULT CFieldPrinter::PrintItemInfo(IInArchive *archive,
|
||||
PrintSpaces(fieldInfo.PrefixSpacesWidth);
|
||||
|
||||
NCOM::CPropVariant propVariant;
|
||||
RINOK(archive->GetProperty(index, fieldInfo.PropID, &propVariant));
|
||||
if (fieldInfo.PropID == kpidPath)
|
||||
{
|
||||
UString s;
|
||||
RINOK(GetArchiveItemPath(archive, index, defaultItemName, s));
|
||||
propVariant = s;
|
||||
}
|
||||
else
|
||||
{
|
||||
RINOK(archive->GetProperty(index, fieldInfo.PropID, &propVariant));
|
||||
}
|
||||
if (techMode)
|
||||
{
|
||||
g_StdOut << fieldInfo.Name << " = ";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/ Main.cpp
|
||||
// Main.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
@@ -298,7 +298,7 @@ int Main2(
|
||||
stdStream << endl << "Codecs:" << endl;
|
||||
|
||||
#ifdef EXTERNAL_CODECS
|
||||
UINT32 numMethods;
|
||||
UInt32 numMethods;
|
||||
if (codecs->GetNumberOfMethods(&numMethods) == S_OK)
|
||||
for (UInt32 j = 0; j < numMethods; j++)
|
||||
{
|
||||
|
||||
@@ -48,11 +48,7 @@ static const char *kMemoryExceptionMessage = "\n\nERROR: Can't allocate required
|
||||
static const char *kUnknownExceptionMessage = "\n\nUnknown Error\n";
|
||||
static const char *kInternalExceptionMessage = "\n\nInternal Error #";
|
||||
|
||||
int
|
||||
#ifdef _MSC_VER
|
||||
__cdecl
|
||||
#endif
|
||||
main
|
||||
int MY_CDECL main
|
||||
(
|
||||
#ifndef _WIN32
|
||||
int numArguments, const char *arguments[]
|
||||
|
||||
@@ -144,10 +144,8 @@ HRESULT CUpdateCallbackConsole::SetCompleted(const UInt64 *completeValue)
|
||||
|
||||
HRESULT CUpdateCallbackConsole::SetRatioInfo(const UInt64 * /* inSize */, const UInt64 * /* outSize */)
|
||||
{
|
||||
/*
|
||||
if (NConsoleClose::TestBreakSignal())
|
||||
return E_ABORT;
|
||||
*/
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -352,7 +352,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
|
||||
{
|
||||
CCommandMapItem commandMapItem;
|
||||
if(!popupMenu.CreatePopup())
|
||||
throw 210503;
|
||||
return E_FAIL;
|
||||
menuDestroyer.Attach(popupMenu);
|
||||
commandMapItem.CommandInternalID = kCommandNULL;
|
||||
commandMapItem.Verb = kMainVerb;
|
||||
|
||||
@@ -101,13 +101,15 @@ STDMETHODIMP CExtractCallBackImp::AskOverwrite(
|
||||
*answer = NOverwriteAnswer::kAutoRename;
|
||||
break;
|
||||
default:
|
||||
throw 20413;
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CExtractCallBackImp::PrepareOperation(const wchar_t *name, bool /* isFolder */, INT32 /* askExtractMode */, const UINT64 * /* position */)
|
||||
{
|
||||
if(WasEscPressed())
|
||||
return E_ABORT;
|
||||
m_CurrentFilePath = name;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,9 @@ static void MyGetFileTime(IFolderFolder *anArchiveFolder, UInt32 itemIndex,
|
||||
fileTime = propVariant.filetime;
|
||||
}
|
||||
}
|
||||
|
||||
#define kDotsReplaceString "[[..]]"
|
||||
#define kDotsReplaceStringU L"[[..]]"
|
||||
|
||||
void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex)
|
||||
{
|
||||
@@ -83,6 +86,9 @@ void CPlugin::ReadPluginPanelItem(PluginPanelItem &panelItem, UInt32 itemIndex)
|
||||
if (oemString.Length() > kFileNameSizeMax)
|
||||
oemString = oemString.Left(kFileNameSizeMax);
|
||||
|
||||
if (oemString == "..")
|
||||
oemString = kDotsReplaceString;
|
||||
|
||||
MyStringCopy(panelItem.FindData.cFileName, (const char *)oemString);
|
||||
panelItem.FindData.cAlternateFileName[0] = 0;
|
||||
|
||||
@@ -194,12 +200,15 @@ void CPlugin::FreeFindData(struct PluginPanelItem *panelItems,
|
||||
}
|
||||
|
||||
|
||||
void CPlugin::EnterToDirectory(const UString &aDirName)
|
||||
void CPlugin::EnterToDirectory(const UString &dirName)
|
||||
{
|
||||
CMyComPtr<IFolderFolder> newFolder;
|
||||
_folder->BindToFolder(aDirName, &newFolder);
|
||||
UString s = dirName;
|
||||
if (dirName == kDotsReplaceStringU)
|
||||
s = L"..";
|
||||
_folder->BindToFolder(s, &newFolder);
|
||||
if (newFolder == NULL)
|
||||
if (aDirName.IsEmpty())
|
||||
if (dirName.IsEmpty())
|
||||
return;
|
||||
else
|
||||
throw 40325;
|
||||
|
||||
@@ -443,6 +443,12 @@ static void ReducePathToRealFileSystemPath(UString &path)
|
||||
path = path.Left(pos + 1);
|
||||
if (path.Length() == 3 && path[1] == L':')
|
||||
break;
|
||||
if (path.Length() > 2 && path[0] == '\\' && path[1] == '\\')
|
||||
{
|
||||
int nextPos = path.Find('\\', 2); // pos after \\COMPNAME
|
||||
if (nextPos > 0 && path.Find('\\', nextPos + 1) == pos)
|
||||
break;
|
||||
}
|
||||
path = path.Left(pos);
|
||||
}
|
||||
}
|
||||
@@ -524,6 +530,12 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
|
||||
|
||||
destPath = copyDialog.Value;
|
||||
|
||||
if (destPath.IsEmpty())
|
||||
{
|
||||
srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsPathAbsolute(destPath))
|
||||
{
|
||||
if (!srcPanel.IsFSFolder())
|
||||
@@ -534,6 +546,13 @@ void CApp::OnCopy(bool move, bool copyToSame, int srcPanelIndex)
|
||||
destPath = srcPanel._currentFolderPrefix + destPath;
|
||||
}
|
||||
|
||||
if (destPath.Length() > 0 && destPath[0] == '\\')
|
||||
if (destPath.Length() == 1 || destPath[1] != '\\')
|
||||
{
|
||||
srcPanel.MessageBox(LangString(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208));
|
||||
return;
|
||||
}
|
||||
|
||||
if (indices.Size() > 1 || (destPath.Length() > 0 && destPath.ReverseFind('\\') == destPath.Length() - 1) ||
|
||||
IsThereFolderOfPath(destPath))
|
||||
{
|
||||
|
||||
@@ -162,7 +162,7 @@ STDMETHODIMP CExtractCallbackImp::AskOverwrite(
|
||||
*answer = NOverwriteAnswer::kYes;
|
||||
break;
|
||||
default:
|
||||
throw 20413;
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
@@ -408,7 +408,7 @@ STDMETHODIMP CExtractCallbackImp::AskWrite(
|
||||
OverwriteMode = NExtract::NOverwriteMode::kAutoRename;
|
||||
break;
|
||||
default:
|
||||
throw 20413;
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -766,38 +766,40 @@ void OnSize(HWND hWnd)
|
||||
MoveSubWindows(hWnd);
|
||||
}
|
||||
|
||||
int Window_GetRealHeight(NWindows::CWindow &w)
|
||||
{
|
||||
RECT rect;
|
||||
WINDOWPLACEMENT placement;
|
||||
w.GetWindowRect(&rect);
|
||||
int res = rect.bottom - rect.top;
|
||||
if (w.GetPlacement(&placement))
|
||||
res += placement.rcNormalPosition.top;
|
||||
return res;
|
||||
}
|
||||
|
||||
void MoveSubWindows(HWND hWnd)
|
||||
{
|
||||
RECT rect;
|
||||
::GetClientRect(hWnd, &rect);
|
||||
int xSize = rect.right;
|
||||
int kHeaderSize = 0;
|
||||
int ySize = MyMax(int(rect.bottom - kHeaderSize), 0);
|
||||
int headerSize = 0;
|
||||
if (g_App._rebar)
|
||||
{
|
||||
RECT barRect;
|
||||
g_App._rebar.GetWindowRect(&barRect);
|
||||
kHeaderSize = barRect.bottom - barRect.top;
|
||||
ySize = MyMax(int(rect.bottom - kHeaderSize), 0);
|
||||
}
|
||||
headerSize = Window_GetRealHeight(g_App._rebar);
|
||||
int ySize = MyMax((int)(rect.bottom - headerSize), 0);
|
||||
|
||||
// g_App._headerToolBar.Move(0, 2, xSize, kHeaderSize - 2);
|
||||
RECT rect2 = rect;
|
||||
rect2.bottom = 0;
|
||||
// g_App._headerReBar.SizeToRect(&rect2);
|
||||
if (g_App.NumPanels > 1)
|
||||
{
|
||||
g_App.Panels[0].Move(0, kHeaderSize, g_Splitter.GetPos(), ySize);
|
||||
g_App.Panels[0].Move(0, headerSize, g_Splitter.GetPos(), ySize);
|
||||
int xWidth1 = g_Splitter.GetPos() + kSplitterWidth;
|
||||
g_App.Panels[1].Move(xWidth1, kHeaderSize, xSize - xWidth1, ySize);
|
||||
g_App.Panels[1].Move(xWidth1, headerSize, xSize - xWidth1, ySize);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
int otherPanel = 1 - g_App.LastFocusedPanel;
|
||||
if (g_App.PanelsCreated[otherPanel])
|
||||
g_App.Panels[otherPanel].Move(0, kHeaderSize, 0, ySize);
|
||||
g_App.Panels[otherPanel].Move(0, headerSize, 0, ySize);
|
||||
*/
|
||||
g_App.Panels[g_App.LastFocusedPanel].Move(0, kHeaderSize, xSize, ySize);
|
||||
g_App.Panels[g_App.LastFocusedPanel].Move(0, headerSize, xSize, ySize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,7 +515,7 @@ bool CPanel::OnCreate(CREATESTRUCT * /* createStruct */)
|
||||
_statusBar.Create(WS_CHILD | WS_VISIBLE, L"Status", (*this), _statusBarID);
|
||||
// _statusBar2.Create(WS_CHILD | WS_VISIBLE, L"Status", (*this), _statusBarID + 1);
|
||||
|
||||
int sizes[] = {150, 200, 250, -1};
|
||||
int sizes[] = {150, 250, 350, -1};
|
||||
_statusBar.SetParts(4, sizes);
|
||||
// _statusBar2.SetParts(5, sizes);
|
||||
|
||||
|
||||
@@ -145,8 +145,13 @@ static const wchar_t *kStartExtensions[] =
|
||||
{
|
||||
L"exe", L"bat", L"com",
|
||||
L"chm",
|
||||
L"msi", L"doc", L"xls", L"ppt", L"wps", L"wpt", L"wks", L"xlr", L"wdb",
|
||||
L"msi", L"doc", L"xls", L"ppt", L"pps", L"wps", L"wpt", L"wks", L"xlr", L"wdb",
|
||||
|
||||
L"docx", L"docm", L"dotx", L"dotm", L"xlsx", L"xlsm", L"xltx", L"xltm", L"xlsb",
|
||||
L"xlam", L"pptx", L"pptm", L"potx", L"potm", L"ppam", L"ppsx", L"ppsm", L"xsn",
|
||||
|
||||
L"odt", L"ods",
|
||||
L"wb3",
|
||||
L"pdf"
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "Windows/PropVariantConversions.h"
|
||||
// #include "Windows/COM.h"
|
||||
|
||||
#include "../Common/PropIDUtils.h"
|
||||
#include "../../PropID.h"
|
||||
@@ -19,26 +18,56 @@
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
static UString ConvertSizeToString(UINT64 value)
|
||||
static UString ConvertSizeToStringShort(UInt64 value)
|
||||
{
|
||||
wchar_t s[64];
|
||||
if (value < (UINT64(10000) << 0) /*&& ((value & 0x3FF) != 0 || value == 0)*/)
|
||||
wchar_t s[32];
|
||||
wchar_t c, c2 = L'B';
|
||||
if (value < (UInt64)10000)
|
||||
{
|
||||
ConvertUInt64ToString(value, s);
|
||||
return UString(s) + L" B";
|
||||
c = L'B';
|
||||
c2 = L'\0';
|
||||
}
|
||||
if (value < (UINT64(10000) << 10))
|
||||
else if (value < ((UInt64)10000 << 10))
|
||||
{
|
||||
ConvertUInt64ToString((value >> 10), s);
|
||||
return UString(s) + L" K";
|
||||
value >>= 10;
|
||||
c = L'K';
|
||||
}
|
||||
if (value < (UINT64(10000) << 20))
|
||||
else if (value < ((UInt64)10000 << 20))
|
||||
{
|
||||
ConvertUInt64ToString((value >> 20), s);
|
||||
return UString(s) + L" M";
|
||||
value >>= 20;
|
||||
c = L'M';
|
||||
}
|
||||
ConvertUInt64ToString((value >> 30), s);
|
||||
return UString(s) + L" G";
|
||||
else
|
||||
{
|
||||
value >>= 30;
|
||||
c = L'G';
|
||||
}
|
||||
ConvertUInt64ToString(value, s);
|
||||
int p = MyStringLen(s);
|
||||
s[p++] = L' ';
|
||||
s[p++] = c;
|
||||
s[p++] = c2;
|
||||
s[p++] = L'\0';
|
||||
return s;
|
||||
}
|
||||
|
||||
static UString ConvertSizeToString(UInt64 value)
|
||||
{
|
||||
wchar_t s[32];
|
||||
ConvertUInt64ToString(value, s);
|
||||
int i = MyStringLen(s);
|
||||
int pos = sizeof(s) / sizeof(s[0]);
|
||||
s[--pos] = L'\0';
|
||||
while (i > 3)
|
||||
{
|
||||
s[--pos] = s[--i];
|
||||
s[--pos] = s[--i];
|
||||
s[--pos] = s[--i];
|
||||
s[--pos] = L' ';
|
||||
}
|
||||
while (i > 0)
|
||||
s[--pos] = s[--i];
|
||||
return s + pos;
|
||||
}
|
||||
|
||||
LRESULT CPanel::SetItemText(LVITEMW &item)
|
||||
@@ -60,11 +89,11 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
|
||||
}
|
||||
if (!defined)
|
||||
{
|
||||
NCOM::CPropVariant propVariant;
|
||||
_folder->GetProperty(index, kpidAttributes, &propVariant);
|
||||
NCOM::CPropVariant prop;
|
||||
_folder->GetProperty(index, kpidAttributes, &prop);
|
||||
UINT32 attributes = 0;
|
||||
if (propVariant.vt == VT_UI4)
|
||||
attributes = propVariant.ulVal;
|
||||
if (prop.vt == VT_UI4)
|
||||
attributes = prop.ulVal;
|
||||
else
|
||||
{
|
||||
if (IsItemFolder(index))
|
||||
@@ -109,7 +138,7 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
|
||||
*/
|
||||
// const NFind::CFileInfo &aFileInfo = m_Files[index];
|
||||
|
||||
NCOM::CPropVariant propVariant;
|
||||
NCOM::CPropVariant prop;
|
||||
/*
|
||||
bool needRead = true;
|
||||
if (propID == kpidSize)
|
||||
@@ -117,26 +146,26 @@ LRESULT CPanel::SetItemText(LVITEMW &item)
|
||||
CComPtr<IFolderGetItemFullSize> getItemFullSize;
|
||||
if (_folder.QueryInterface(&getItemFullSize) == S_OK)
|
||||
{
|
||||
if (getItemFullSize->GetItemFullSize(index, &propVariant) == S_OK)
|
||||
if (getItemFullSize->GetItemFullSize(index, &prop) == S_OK)
|
||||
needRead = false;
|
||||
}
|
||||
}
|
||||
if (needRead)
|
||||
*/
|
||||
|
||||
if (_folder->GetProperty(realIndex, propID, &propVariant) != S_OK)
|
||||
if (_folder->GetProperty(realIndex, propID, &prop) != S_OK)
|
||||
throw 2723407;
|
||||
|
||||
if ((propID == kpidSize || propID == kpidPackedSize ||
|
||||
propID == kpidTotalSize || propID == kpidFreeSpace ||
|
||||
propID == kpidClusterSize)
|
||||
&&
|
||||
(propVariant.vt == VT_UI8 || propVariant.vt == VT_UI4))
|
||||
s = ConvertSizeToString(ConvertPropVariantToUInt64(propVariant));
|
||||
if ((propID == kpidSize || propID == kpidPackedSize || propID == kpidClusterSize ||
|
||||
propID == kpidNumSubFolders || propID == kpidNumSubFiles) &&
|
||||
(prop.vt == VT_UI8 || prop.vt == VT_UI4))
|
||||
s = ConvertSizeToString(ConvertPropVariantToUInt64(prop));
|
||||
else if ((propID == kpidTotalSize || propID == kpidFreeSpace) &&
|
||||
(prop.vt == VT_UI8 || prop.vt == VT_UI4))
|
||||
s = ConvertSizeToStringShort(ConvertPropVariantToUInt64(prop));
|
||||
else
|
||||
s = ConvertPropertyToString(propVariant, propID, false);
|
||||
|
||||
{
|
||||
s = ConvertPropertyToString(prop, propID, false);
|
||||
s.Replace(wchar_t(0xA), L' ');
|
||||
s.Replace(wchar_t(0xD), L' ');
|
||||
}
|
||||
@@ -364,7 +393,7 @@ void CPanel::OnRefreshStatusBar()
|
||||
|
||||
if (indices.Size() > 0)
|
||||
{
|
||||
UINT64 totalSize = 0;
|
||||
UInt64 totalSize = 0;
|
||||
for (int i = 0; i < indices.Size(); i++)
|
||||
totalSize += GetItemSize(indices[i]);
|
||||
selectSizeString = ConvertSizeToString(totalSize);
|
||||
@@ -380,9 +409,9 @@ void CPanel::OnRefreshStatusBar()
|
||||
if (realIndex != kParentIndex)
|
||||
{
|
||||
sizeString = ConvertSizeToString(GetItemSize(realIndex));
|
||||
NCOM::CPropVariant propVariant;
|
||||
if (_folder->GetProperty(realIndex, kpidLastWriteTime, &propVariant) == S_OK)
|
||||
dateString = ConvertPropertyToString(propVariant, kpidLastWriteTime, false);
|
||||
NCOM::CPropVariant prop;
|
||||
if (_folder->GetProperty(realIndex, kpidLastWriteTime, &prop) == S_OK)
|
||||
dateString = ConvertPropertyToString(prop, kpidLastWriteTime, false);
|
||||
}
|
||||
}
|
||||
_statusBar.SetText(2, sizeString);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#define bYPos (ySize - marg - bYSize)
|
||||
|
||||
#undef bXSize
|
||||
#define bXSize 72
|
||||
#define bXSize 80
|
||||
|
||||
#define bXPos1 (xSize - marg - bXSize)
|
||||
#define bXPos2 (bXPos1 - 10 - bXSize)
|
||||
|
||||
@@ -409,6 +409,8 @@ void CCompressDialog::CheckControlsEnable()
|
||||
EnableItem(IDC_STATIC_COMPRESS_ENCRYPTION_METHOD, fi.Encrypt);
|
||||
EnableItem(IDC_COMPRESS_COMBO_ENCRYPTION_METHOD, fi.Encrypt);
|
||||
EnableItem(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, fi.EncryptFileNames);
|
||||
|
||||
ShowItem(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, fi.EncryptFileNames);
|
||||
}
|
||||
|
||||
bool CCompressDialog::IsSFX()
|
||||
@@ -1022,13 +1024,16 @@ void CCompressDialog::SetDictionary()
|
||||
}
|
||||
case kBZip2:
|
||||
{
|
||||
UInt32 defaultDictionary;
|
||||
if (level >= 5)
|
||||
defaultDictionary = (900 << 10);
|
||||
else if (level >= 3)
|
||||
defaultDictionary = (500 << 10);
|
||||
else
|
||||
defaultDictionary = (100 << 10);
|
||||
// UInt32 defaultDictionary;
|
||||
if (defaultDictionary == UInt32(-1))
|
||||
{
|
||||
if (level >= 5)
|
||||
defaultDictionary = (900 << 10);
|
||||
else if (level >= 3)
|
||||
defaultDictionary = (500 << 10);
|
||||
else
|
||||
defaultDictionary = (100 << 10);
|
||||
}
|
||||
for (int i = 1; i <= 9; i++)
|
||||
{
|
||||
UInt32 dictionary = (i * 100) << 10;
|
||||
|
||||
Reference in New Issue
Block a user