mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-07 20:06:59 -06:00
15.09
This commit is contained in:
committed by
Kornel Lesiński
parent
6543c28020
commit
a663a6deb7
@@ -441,7 +441,7 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
|
||||
}
|
||||
}
|
||||
|
||||
if (_outFileStream != NULL)
|
||||
if (_outFileStream)
|
||||
{
|
||||
if (_processedFileInfo.MTimeDefined)
|
||||
_outFileStreamSpec->SetMTime(&_processedFileInfo.MTime);
|
||||
@@ -499,7 +499,6 @@ public:
|
||||
STDMETHOD(SetCompleted)(const UInt64 *completeValue);
|
||||
|
||||
// IUpdateCallback2
|
||||
STDMETHOD(EnumProperties)(IEnumSTATPROPSTG **enumerator);
|
||||
STDMETHOD(GetUpdateItemInfo)(UInt32 index,
|
||||
Int32 *newData, Int32 *newProperties, UInt32 *indexInArchive);
|
||||
STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value);
|
||||
@@ -551,20 +550,14 @@ STDMETHODIMP CArchiveUpdateCallback::SetCompleted(const UInt64 * /* completeValu
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CArchiveUpdateCallback::EnumProperties(IEnumSTATPROPSTG ** /* enumerator */)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
STDMETHODIMP CArchiveUpdateCallback::GetUpdateItemInfo(UInt32 /* index */,
|
||||
Int32 *newData, Int32 *newProperties, UInt32 *indexInArchive)
|
||||
{
|
||||
if (newData != NULL)
|
||||
if (newData)
|
||||
*newData = BoolToInt(true);
|
||||
if (newProperties != NULL)
|
||||
if (newProperties)
|
||||
*newProperties = BoolToInt(true);
|
||||
if (indexInArchive != NULL)
|
||||
if (indexInArchive)
|
||||
*indexInArchive = (UInt32)(Int32)-1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -108,34 +108,52 @@ static const char *kHelpString =
|
||||
" h : Calculate hash values for files\n"
|
||||
" i : Show information about supported formats\n"
|
||||
" l : List contents of archive\n"
|
||||
// " l[a|t][f] : List contents of archive\n"
|
||||
// " a - with Additional fields\n"
|
||||
// " t - with all fields\n"
|
||||
// " f - with Full pathnames\n"
|
||||
" rn : Rename files in archive\n"
|
||||
" t : Test integrity of archive\n"
|
||||
" u : Update files to archive\n"
|
||||
" x : eXtract files with full paths\n"
|
||||
"\n"
|
||||
"<Switches>\n"
|
||||
" -- : Stop switches parsing\n"
|
||||
" -ai[r[-|0]]{@listfile|!wildcard} : Include archives\n"
|
||||
" -ax[r[-|0]]{@listfile|!wildcard} : eXclude archives\n"
|
||||
" -bd : Disable percentage indicator\n"
|
||||
" -ao{a|s|t|u} : set Overwrite mode\n"
|
||||
" -an : disable archive_name field\n"
|
||||
" -bb[0-3] : set output log level\n"
|
||||
" -bd : disable progress indicator\n"
|
||||
" -bs{o|e|p}{0|1|2} : set output stream for output/error/progress line\n"
|
||||
" -bt : show execution time statistics\n"
|
||||
" -i[r[-|0]]{@listfile|!wildcard} : Include filenames\n"
|
||||
" -m{Parameters} : set compression Method\n"
|
||||
" -mmt[N] : set number of CPU threads\n"
|
||||
" -o{Directory} : set Output directory\n"
|
||||
#ifndef _NO_CRYPTO
|
||||
" -p{Password} : set Password\n"
|
||||
#endif
|
||||
" -r[-|0] : Recurse subdirectories\n"
|
||||
" -sa{a|e|s} : set Archive name mode\n"
|
||||
" -scc{UTF-8|WIN|DOS} : set charset for for console input/output\n"
|
||||
" -scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files\n"
|
||||
" -sdel : Delete files after compression\n"
|
||||
" -scrc[CRC32|CRC64|SHA1|SHA256|*] : set hash function for x, e, h commands\n"
|
||||
" -sdel : delete files after compression\n"
|
||||
" -seml[.] : send archive by email\n"
|
||||
" -sfx[{name}] : Create SFX archive\n"
|
||||
" -si[{name}] : read data from stdin\n"
|
||||
" -slp : set Large Pages mode\n"
|
||||
" -slt : show technical information for l (List) command\n"
|
||||
" -snh : store hard links as links\n"
|
||||
" -snl : store symbolic links as links\n"
|
||||
" -sni : store NT security information\n"
|
||||
" -sns[-] : store NTFS alternate streams\n"
|
||||
" -so : write data to stdout\n"
|
||||
" -spd : disable wildcard matching for file names\n"
|
||||
" -spe : eliminate duplication of root folder for extract command\n"
|
||||
" -spf : use fully qualified file paths\n"
|
||||
" -ssc[-] : set sensitive case mode\n"
|
||||
" -ssw : compress shared files\n"
|
||||
" -stl : set archive timestamp from the most recently modified file\n"
|
||||
" -stm{HexMask} : set CPU thread affinity mask (hexadecimal number)\n"
|
||||
" -stx{Type} : exclude archive type\n"
|
||||
" -t{Type} : Set type of archive\n"
|
||||
" -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName] : Update options\n"
|
||||
" -v{Size}[b|k|m|g] : Create volumes\n"
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
CRecordVector<bool> NeedWait;
|
||||
|
||||
~CChildProcesses() { CloseAll(); }
|
||||
void DisableWait(int index) { NeedWait[index] = false; }
|
||||
void DisableWait(unsigned index) { NeedWait[index] = false; }
|
||||
|
||||
void CloseAll()
|
||||
{
|
||||
@@ -491,7 +491,19 @@ typedef BOOL (WINAPI * ShellExecuteExWP)(LPSHELLEXECUTEINFOW lpExecInfo);
|
||||
|
||||
static HRESULT StartApplication(const UString &dir, const UString &path, HWND window, CProcess &process)
|
||||
{
|
||||
UString path2 = path;
|
||||
|
||||
#ifdef _WIN32
|
||||
{
|
||||
int dot = path2.ReverseFind_Dot();
|
||||
int separ = path2.ReverseFind_PathSepar();
|
||||
if (dot < 0 || dot < separ)
|
||||
path2 += L'.';
|
||||
}
|
||||
#endif
|
||||
|
||||
UINT32 result;
|
||||
|
||||
#ifndef _UNICODE
|
||||
if (g_IsNT)
|
||||
{
|
||||
@@ -500,14 +512,14 @@ static HRESULT StartApplication(const UString &dir, const UString &path, HWND wi
|
||||
execInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT;
|
||||
execInfo.hwnd = NULL;
|
||||
execInfo.lpVerb = NULL;
|
||||
execInfo.lpFile = path;
|
||||
execInfo.lpFile = path2;
|
||||
execInfo.lpParameters = NULL;
|
||||
execInfo.lpDirectory = dir.IsEmpty() ? NULL : (LPCWSTR)dir;
|
||||
execInfo.nShow = SW_SHOWNORMAL;
|
||||
execInfo.hProcess = 0;
|
||||
ShellExecuteExWP shellExecuteExW = (ShellExecuteExWP)
|
||||
::GetProcAddress(::GetModuleHandleW(L"shell32.dll"), "ShellExecuteExW");
|
||||
if (shellExecuteExW == 0)
|
||||
if (!shellExecuteExW)
|
||||
return 0;
|
||||
shellExecuteExW(&execInfo);
|
||||
result = (UINT32)(UINT_PTR)execInfo.hInstApp;
|
||||
@@ -525,23 +537,24 @@ static HRESULT StartApplication(const UString &dir, const UString &path, HWND wi
|
||||
;
|
||||
execInfo.hwnd = NULL;
|
||||
execInfo.lpVerb = NULL;
|
||||
const CSysString sysPath = GetSystemString(path);
|
||||
const CSysString sysPath = GetSystemString(path2);
|
||||
const CSysString sysDir = GetSystemString(dir);
|
||||
execInfo.lpFile = sysPath;
|
||||
execInfo.lpParameters = NULL;
|
||||
execInfo.lpDirectory =
|
||||
#ifdef UNDER_CE
|
||||
NULL
|
||||
#else
|
||||
sysDir.IsEmpty() ? NULL : (LPCTSTR)sysDir
|
||||
#endif
|
||||
;
|
||||
#ifdef UNDER_CE
|
||||
NULL
|
||||
#else
|
||||
sysDir.IsEmpty() ? NULL : (LPCTSTR)sysDir
|
||||
#endif
|
||||
;
|
||||
execInfo.nShow = SW_SHOWNORMAL;
|
||||
execInfo.hProcess = 0;
|
||||
::ShellExecuteEx(&execInfo);
|
||||
result = (UINT32)(UINT_PTR)execInfo.hInstApp;
|
||||
process.Attach(execInfo.hProcess);
|
||||
}
|
||||
|
||||
if (result <= 32)
|
||||
{
|
||||
switch (result)
|
||||
@@ -553,6 +566,7 @@ static HRESULT StartApplication(const UString &dir, const UString &path, HWND wi
|
||||
L"7-Zip", MB_OK | MB_ICONSTOP);
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -795,7 +809,7 @@ static THREAD_FUNC_DECL MyThreadFunction(void *param)
|
||||
for (;;)
|
||||
{
|
||||
CRecordVector<HANDLE> handles;
|
||||
CRecordVector<int> indices;
|
||||
CUIntVector indices;
|
||||
|
||||
FOR_VECTOR (i, processes.Handles)
|
||||
{
|
||||
@@ -992,6 +1006,17 @@ static HRESULT GetTime(IFolderFolder *folder, UInt32 index, PROPID propID, FILET
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
tryInternal tryExternal
|
||||
false false : unused
|
||||
false true : external
|
||||
true false : internal
|
||||
true true : smart based on file extension:
|
||||
!alwaysStart(name) : both
|
||||
alwaysStart(name) : external
|
||||
*/
|
||||
|
||||
void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bool editMode, bool useEditor, const wchar_t *type)
|
||||
{
|
||||
const UString name = GetItemName(index);
|
||||
@@ -1008,7 +1033,7 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
|
||||
|
||||
bool tryAsArchive = tryInternal && (!tryExternal || !DoItemAlwaysStart(name));
|
||||
|
||||
UString fullVirtPath = _currentFolderPrefix + relPath;
|
||||
const UString fullVirtPath = _currentFolderPrefix + relPath;
|
||||
|
||||
CTempDir tempDirectory;
|
||||
if (!tempDirectory.Create(kTempDirPrefix))
|
||||
@@ -1058,6 +1083,8 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
|
||||
// probably we must show some message here
|
||||
// return;
|
||||
}
|
||||
if (!tryExternal)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1126,6 +1153,7 @@ void CPanel::OpenItemInArchive(int index, bool tryInternal, bool tryExternal, bo
|
||||
|
||||
options.folder = fs2us(tempDirNorm);
|
||||
options.showErrorMessages = true;
|
||||
|
||||
HRESULT result = CopyTo(options, indices, &messages, usePassword, password);
|
||||
|
||||
if (_parentFolders.Size() > 0)
|
||||
|
||||
@@ -8,13 +8,14 @@
|
||||
#include "../../../Windows/Control/Static.h"
|
||||
#include "../../../Windows/ErrorMsg.h"
|
||||
|
||||
#include "ProgressDialog2.h"
|
||||
#include "DialogSize.h"
|
||||
|
||||
#include "ProgressDialog2Res.h"
|
||||
|
||||
#include "../GUI/ExtractRes.h"
|
||||
|
||||
#include "LangUtils.h"
|
||||
|
||||
#include "DialogSize.h"
|
||||
#include "ProgressDialog2.h"
|
||||
#include "ProgressDialog2Res.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
@@ -42,8 +43,6 @@ static const UINT kCreateDelay =
|
||||
|
||||
static const DWORD kPauseSleepTime = 100;
|
||||
|
||||
#include "LangUtils.h"
|
||||
|
||||
#ifdef LANG
|
||||
|
||||
static const UInt32 kLangIDs[] =
|
||||
@@ -705,10 +704,9 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
|
||||
|
||||
UInt32 curTime = ::GetTickCount();
|
||||
|
||||
const UInt64 progressTotal = bytesProgressMode ? total : totalFiles;
|
||||
const UInt64 progressCompleted = bytesProgressMode ? completed : completedFiles;
|
||||
{
|
||||
UInt64 progressTotal = bytesProgressMode ? total : totalFiles;
|
||||
UInt64 progressCompleted = bytesProgressMode ? completed : completedFiles;
|
||||
|
||||
if (IS_UNDEFINED_VAL(progressTotal))
|
||||
{
|
||||
// SetPos(0);
|
||||
@@ -757,9 +755,9 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
|
||||
}
|
||||
}
|
||||
|
||||
if (completed != 0)
|
||||
if (progressCompleted != 0)
|
||||
{
|
||||
if (IS_UNDEFINED_VAL(total))
|
||||
if (IS_UNDEFINED_VAL(progressTotal))
|
||||
{
|
||||
if (IS_DEFINED_VAL(_prevRemainingSec))
|
||||
{
|
||||
@@ -770,8 +768,8 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
|
||||
else
|
||||
{
|
||||
UInt64 remainingTime = 0;
|
||||
if (completed < total)
|
||||
remainingTime = MyMultAndDiv(_elapsedTime, total - completed, completed);
|
||||
if (progressCompleted < progressTotal)
|
||||
remainingTime = MyMultAndDiv(_elapsedTime, progressTotal - progressCompleted, progressCompleted);
|
||||
UInt64 remainingSec = remainingTime / 1000;
|
||||
if (remainingSec != _prevRemainingSec)
|
||||
{
|
||||
@@ -783,7 +781,7 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
|
||||
}
|
||||
{
|
||||
UInt64 elapsedTime = (_elapsedTime == 0) ? 1 : _elapsedTime;
|
||||
UInt64 v = (completed * 1000) / elapsedTime;
|
||||
UInt64 v = (progressCompleted * 1000) / elapsedTime;
|
||||
Byte c = 0;
|
||||
unsigned moveBits = 0;
|
||||
if (v >= ((UInt64)10000 << 10)) { moveBits = 20; c = 'M'; }
|
||||
@@ -811,11 +809,11 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
|
||||
{
|
||||
UInt64 percent = 0;
|
||||
{
|
||||
if (IS_DEFINED_VAL(total))
|
||||
if (IS_DEFINED_VAL(progressTotal))
|
||||
{
|
||||
percent = completed * 100;
|
||||
if (total != 0)
|
||||
percent /= total;
|
||||
percent = progressCompleted * 100;
|
||||
if (progressTotal != 0)
|
||||
percent /= progressTotal;
|
||||
}
|
||||
}
|
||||
if (percent != _prevPercentValue)
|
||||
|
||||
Reference in New Issue
Block a user