Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/CPP/7zip/UI
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2007-05-25 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:51 +0300
commitc574fc0f4bba94e693b0e22f730d355b75d4f4ce (patch)
treeda4ebd90c776d508ac679d50492f29461db80be0 /CPP/7zip/UI
parenta145bfc7cf17f7bbcfae8f0064333c8ea75b455c (diff)
4.46 beta
Diffstat (limited to 'CPP/7zip/UI')
-rwxr-xr-xCPP/7zip/UI/Agent/ArchiveFolderOpen.cpp2
-rwxr-xr-xCPP/7zip/UI/Common/ArchiveCommandLine.cpp34
-rwxr-xr-xCPP/7zip/UI/Common/CompressCall.cpp63
-rwxr-xr-xCPP/7zip/UI/Common/CompressCall.h2
-rwxr-xr-xCPP/7zip/UI/Common/IFileExtractCallback.h2
-rwxr-xr-xCPP/7zip/UI/Common/LoadCodecs.cpp7
-rwxr-xr-xCPP/7zip/UI/Common/OpenArchive.h2
-rwxr-xr-xCPP/7zip/UI/Common/SortUtils.cpp2
-rwxr-xr-xCPP/7zip/UI/Common/SortUtils.h2
-rwxr-xr-xCPP/7zip/UI/Common/Update.cpp6
-rwxr-xr-xCPP/7zip/UI/Common/Update.h5
-rwxr-xr-xCPP/7zip/UI/Common/UpdateCallback.cpp3
-rwxr-xr-xCPP/7zip/UI/Common/UpdateCallback.h1
-rwxr-xr-xCPP/7zip/UI/Common/ZipRegistry.cpp4
-rwxr-xr-xCPP/7zip/UI/Console/Console.dsp9
-rwxr-xr-xCPP/7zip/UI/Console/ConsoleClose.cpp2
-rwxr-xr-xCPP/7zip/UI/Console/List.cpp6
-rwxr-xr-xCPP/7zip/UI/Console/List.h2
-rwxr-xr-xCPP/7zip/UI/Console/Main.cpp20
-rwxr-xr-xCPP/7zip/UI/Console/MainAr.cpp29
-rwxr-xr-xCPP/7zip/UI/Console/UpdateCallbackConsole.cpp2
-rwxr-xr-xCPP/7zip/UI/Console/UserInputUtils.h2
-rwxr-xr-xCPP/7zip/UI/Console/makefile1
-rwxr-xr-xCPP/7zip/UI/Explorer/ContextMenu.cpp2
-rwxr-xr-xCPP/7zip/UI/Explorer/Explorer.dsp9
-rwxr-xr-xCPP/7zip/UI/Explorer/makefile1
-rwxr-xr-xCPP/7zip/UI/Far/ExtractEngine.cpp4
-rwxr-xr-xCPP/7zip/UI/Far/Far.dsp9
-rwxr-xr-xCPP/7zip/UI/Far/Main.cpp2
-rwxr-xr-xCPP/7zip/UI/Far/OverwriteDialog.cpp2
-rwxr-xr-xCPP/7zip/UI/Far/PluginWrite.cpp5
-rwxr-xr-xCPP/7zip/UI/Far/makefile1
-rwxr-xr-xCPP/7zip/UI/GUI/CompressDialog.cpp6
-rwxr-xr-xCPP/7zip/UI/GUI/CompressDialog.h2
-rwxr-xr-xCPP/7zip/UI/GUI/ExtractDialog.cpp5
-rwxr-xr-xCPP/7zip/UI/GUI/ExtractGUI.cpp7
-rwxr-xr-xCPP/7zip/UI/GUI/GUI.cpp9
-rwxr-xr-xCPP/7zip/UI/GUI/GUI.dsp9
-rwxr-xr-xCPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.cpp17
-rwxr-xr-xCPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.h5
-rwxr-xr-xCPP/7zip/UI/GUI/UpdateGUI.cpp11
-rwxr-xr-xCPP/7zip/UI/GUI/makefile1
-rwxr-xr-xCPP/7zip/UI/Resource/CompressDialog/resource.h2
-rwxr-xr-xCPP/7zip/UI/Resource/CompressDialog/resource.rc39
44 files changed, 204 insertions, 152 deletions
diff --git a/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp b/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
index 01eb4fed..5f62dc9c 100755
--- a/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
+++ b/CPP/7zip/UI/Agent/ArchiveFolderOpen.cpp
@@ -8,8 +8,6 @@
#include "../Common/OpenArchive.h"
-static const UInt64 kMaxCheckStartPosition = 1 << 20;
-
static inline UINT GetCurrentFileCodePage()
{ return AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
diff --git a/CPP/7zip/UI/Common/ArchiveCommandLine.cpp b/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
index f9548024..17b04e12 100755
--- a/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
+++ b/CPP/7zip/UI/Common/ArchiveCommandLine.cpp
@@ -2,7 +2,9 @@
#include "StdAfx.h"
+#ifdef _WIN32
#include <io.h>
+#endif
#include <stdio.h>
#include "Common/ListFileUtils.h"
@@ -26,8 +28,6 @@ using namespace NCommandLineParser;
using namespace NWindows;
using namespace NFile;
-static const int kNumSwitches = 28;
-
namespace NKey {
enum Enum
{
@@ -58,7 +58,8 @@ enum Enum
kShowDialog,
kLargePages,
kCharSet,
- kTechMode
+ kTechMode,
+ kShareForWrite
};
}
@@ -92,7 +93,7 @@ NExtract::NOverwriteMode::EEnum k_OverwriteModes[] =
NExtract::NOverwriteMode::kAutoRenameExisting
};
-static const CSwitchForm kSwitchForms[kNumSwitches] =
+static const CSwitchForm kSwitchForms[] =
{
{ L"?", NSwitchType::kSimple, false },
{ L"H", NSwitchType::kSimple, false },
@@ -121,10 +122,10 @@ static const CSwitchForm kSwitchForms[kNumSwitches] =
{ L"AD", NSwitchType::kSimple, false },
{ L"SLP", NSwitchType::kUnLimitedPostString, false, 0},
{ L"SCS", NSwitchType::kUnLimitedPostString, false, 0},
- { L"SLT", NSwitchType::kSimple, false }
+ { L"SLT", NSwitchType::kSimple, false },
+ { L"SSW", NSwitchType::kSimple, false }
};
-
static const CCommandForm g_CommandForms[] =
{
{ L"A", false },
@@ -140,7 +141,6 @@ static const CCommandForm g_CommandForms[] =
static const int kNumCommandForms = sizeof(g_CommandForms) / sizeof(g_CommandForms[0]);
-static const int kMaxCmdLineSize = 1000;
static const wchar_t *kUniversalWildcard = L"*";
static const int kMinNonSwitchWords = 1;
static const int kCommandIndex = 0;
@@ -250,7 +250,7 @@ static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
return true;
}
-static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
+static inline UINT GetCurrentCodePage() { return AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
static void AddToCensorFromListFile(NWildcard::CCensor &wildcardCensor,
LPCWSTR fileName, bool include, NRecursedType::EEnum type, UINT codePage)
@@ -346,9 +346,9 @@ static void ParseMapWithPaths(NWildcard::CCensor &wildcardCensor,
}
{
- NSynchronization::CEvent event;
- event.Open(EVENT_MODIFY_STATE, false, GetSystemString(eventName));
- event.Set();
+ NSynchronization::CManualResetEvent event;
+ if (event.Open(EVENT_MODIFY_STATE, false, GetSystemString(eventName)) == S_OK)
+ event.Set();
}
}
#endif
@@ -666,7 +666,8 @@ static void SetMethodOptions(const CParser &parser, CObjectVector<CProperty> &pr
}
}
-CArchiveCommandLineParser::CArchiveCommandLineParser(): parser(kNumSwitches) {}
+CArchiveCommandLineParser::CArchiveCommandLineParser():
+ parser(sizeof(kSwitchForms) / sizeof(kSwitchForms[0])) {}
void CArchiveCommandLineParser::Parse1(const UStringVector &commandStrings,
CArchiveCommandLineOptions &options)
@@ -680,9 +681,9 @@ void CArchiveCommandLineParser::Parse1(const UStringVector &commandStrings,
ThrowUserErrorException();
}
- options.IsInTerminal = (_isatty(_fileno(stdin)) != 0);
- options.IsStdOutTerminal = (_isatty(_fileno(stdout)) != 0);
- options.IsStdErrTerminal = (_isatty(_fileno(stderr)) != 0);
+ options.IsInTerminal = (isatty(fileno(stdin)) != 0);
+ options.IsStdOutTerminal = (isatty(fileno(stdout)) != 0);
+ options.IsStdErrTerminal = (isatty(fileno(stderr)) != 0);
options.StdOutMode = parser[NKey::kStdOut].ThereIs;
options.EnableHeaders = !parser[NKey::kDisableHeaders].ThereIs;
options.HelpMode = parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs || parser[NKey::kHelp3].ThereIs;
@@ -895,6 +896,9 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
SetMethodOptions(parser, updateOptions.MethodMode.Properties);
+ if (parser[NKey::kShareForWrite].ThereIs)
+ updateOptions.OpenShareForWrite = true;
+
options.EnablePercents = !parser[NKey::kDisablePercents].ThereIs;
if (options.EnablePercents)
diff --git a/CPP/7zip/UI/Common/CompressCall.cpp b/CPP/7zip/UI/Common/CompressCall.cpp
index 8b858bd3..ccf4e287 100755
--- a/CPP/7zip/UI/Common/CompressCall.cpp
+++ b/CPP/7zip/UI/Common/CompressCall.cpp
@@ -39,7 +39,7 @@ static void AddLagePagesSwitch(UString &params)
HRESULT MyCreateProcess(const UString &params,
LPCWSTR curDir, bool waitFinish,
- NWindows::NSynchronization::CEvent *event)
+ NWindows::NSynchronization::CBaseEvent *event)
{
const UString params2 = params;
PROCESS_INFORMATION processInformation;
@@ -114,9 +114,28 @@ static UString Get7zGuiPath()
return GetQuotedString(path);
}
+static HRESULT CreateTempEvent(const wchar_t *name,
+ NSynchronization::CManualResetEvent &event, UString &eventName)
+{
+ CRandom random;
+ random.Init(GetTickCount());
+ for (;;)
+ {
+ int number = random.Generate();
+ wchar_t temp[32];
+ ConvertUInt64ToString((UInt32)number, temp);
+ eventName = name;
+ eventName += temp;
+ RINOK(event.CreateWithName(false, GetSystemString(eventName)));
+ if (::GetLastError() != ERROR_ALREADY_EXISTS)
+ return S_OK;
+ event.Close();
+ }
+}
+
static HRESULT CreateMap(const UStringVector &names,
const UString &id,
- CFileMapping &fileMapping, NSynchronization::CEvent &event,
+ CFileMapping &fileMapping, NSynchronization::CManualResetEvent &event,
UString &params)
{
UInt32 extraSize = 2;
@@ -126,7 +145,6 @@ static HRESULT CreateMap(const UStringVector &names,
UInt32 totalSize = extraSize + dataSize;
UString mappingName;
- UString eventName;
CRandom random;
random.Init(GetTickCount());
@@ -146,20 +164,8 @@ static HRESULT CreateMap(const UStringVector &names,
fileMapping.Close();
}
- for (;;)
- {
- int number = random.Generate();
- wchar_t temp[32];
- ConvertUInt64ToString(UInt32(number), temp);
- eventName = id;
- eventName += L"MappingEndEvent";
- eventName += temp;
- if (!event.Create(true, false, GetSystemString(eventName)))
- return E_FAIL;
- if (::GetLastError() != ERROR_ALREADY_EXISTS)
- break;
- event.Close();
- }
+ UString eventName;
+ RINOK(CreateTempEvent(id + L"MappingEndEvent", event, eventName));
params += mappingName;
params += L":";
@@ -218,7 +224,6 @@ HRESULT CompressFiles(
UInt32 totalSize = extraSize + dataSize;
UString mappingName;
- UString eventName;
CFileMapping fileMapping;
CRandom random;
@@ -241,23 +246,9 @@ HRESULT CompressFiles(
fileMapping.Close();
}
- NSynchronization::CEvent event;
- for (;;)
- {
- int number = random.Generate();
- wchar_t temp[32];
- ConvertUInt64ToString(UInt32(number), temp);
- eventName = L"7zCompressMappingEndEvent";
- eventName += temp;
- if (!event.Create(true, false, GetSystemString(eventName)))
- {
- // MyMessageBox(IDS_ERROR, 0x02000605);
- return E_FAIL;
- }
- if (::GetLastError() != ERROR_ALREADY_EXISTS)
- break;
- event.Close();
- }
+ NSynchronization::CManualResetEvent event;
+ UString eventName;
+ RINOK(CreateTempEvent(L"7zCompressMappingEndEvent", event, eventName));
params += mappingName;
params += L":";
@@ -337,7 +328,7 @@ static HRESULT ExtractGroupCommand(const UStringVector &archivePaths,
params2 += kArchiveNoNameSwitch;
params2 += kArchiveMapSwitch;
CFileMapping fileMapping;
- NSynchronization::CEvent event;
+ NSynchronization::CManualResetEvent event;
RINOK(CreateMap(archivePaths, L"7zExtract", fileMapping, event, params2));
return MyCreateProcess(params2, 0, false, &event);
}
diff --git a/CPP/7zip/UI/Common/CompressCall.h b/CPP/7zip/UI/Common/CompressCall.h
index 23e68838..db7e3647 100755
--- a/CPP/7zip/UI/Common/CompressCall.h
+++ b/CPP/7zip/UI/Common/CompressCall.h
@@ -8,7 +8,7 @@
HRESULT MyCreateProcess(const UString &params,
LPCWSTR lpCurrentDirectory, bool waitFinish,
- NWindows::NSynchronization::CEvent *event);
+ NWindows::NSynchronization::CBaseEvent *event);
HRESULT CompressFiles(
const UString &curDir,
diff --git a/CPP/7zip/UI/Common/IFileExtractCallback.h b/CPP/7zip/UI/Common/IFileExtractCallback.h
index c70d7021..6268f758 100755
--- a/CPP/7zip/UI/Common/IFileExtractCallback.h
+++ b/CPP/7zip/UI/Common/IFileExtractCallback.h
@@ -14,7 +14,7 @@ namespace NOverwriteAnswer
kNo,
kNoToAll,
kAutoRename,
- kCancel,
+ kCancel
};
}
diff --git a/CPP/7zip/UI/Common/LoadCodecs.cpp b/CPP/7zip/UI/Common/LoadCodecs.cpp
index bb6b9696..63b59045 100755
--- a/CPP/7zip/UI/Common/LoadCodecs.cpp
+++ b/CPP/7zip/UI/Common/LoadCodecs.cpp
@@ -58,6 +58,8 @@ static bool ReadPathFromRegistry(HKEY baseKey, CSysString &path)
return false;
}
+#endif
+
CSysString GetBaseFolderPrefixFromRegistry()
{
CSysString moduleFolderPrefix = GetLibraryFolderPrefix();
@@ -71,8 +73,8 @@ CSysString GetBaseFolderPrefixFromRegistry()
if (NFind::FindFile(moduleFolderPrefix + kFormatsFolderName, fileInfo))
if (fileInfo.IsDirectory())
return moduleFolderPrefix;
- CSysString path;
#ifdef _WIN32
+ CSysString path;
if (ReadPathFromRegistry(HKEY_CURRENT_USER, path))
return path;
if (ReadPathFromRegistry(HKEY_LOCAL_MACHINE, path))
@@ -81,9 +83,6 @@ CSysString GetBaseFolderPrefixFromRegistry()
return moduleFolderPrefix;
}
-#endif
-
-
typedef UInt32 (WINAPI *GetNumberOfMethodsFunc)(UInt32 *numMethods);
typedef UInt32 (WINAPI *GetNumberOfFormatsFunc)(UInt32 *numFormats);
typedef UInt32 (WINAPI *GetHandlerPropertyFunc)(PROPID propID, PROPVARIANT *value);
diff --git a/CPP/7zip/UI/Common/OpenArchive.h b/CPP/7zip/UI/Common/OpenArchive.h
index d43c22b3..ebd89ceb 100755
--- a/CPP/7zip/UI/Common/OpenArchive.h
+++ b/CPP/7zip/UI/Common/OpenArchive.h
@@ -97,7 +97,7 @@ struct CArchiveLink
IInArchive *GetArchive() { return Archive1 != 0 ? Archive1: Archive0; }
UString GetDefaultItemName() { return Archive1 != 0 ? DefaultItemName1: DefaultItemName0; }
- const int GetArchiverIndex() const { return Archive1 != 0 ? FormatIndex1: FormatIndex0; }
+ int GetArchiverIndex() const { return Archive1 != 0 ? FormatIndex1: FormatIndex0; }
HRESULT Close();
void Release();
};
diff --git a/CPP/7zip/UI/Common/SortUtils.cpp b/CPP/7zip/UI/Common/SortUtils.cpp
index c0111581..54d88adc 100755
--- a/CPP/7zip/UI/Common/SortUtils.cpp
+++ b/CPP/7zip/UI/Common/SortUtils.cpp
@@ -67,6 +67,7 @@ void SortStringsToIndices(const UStringVector &strings, CIntVector &indices)
// TSort(&indices.Front(), indices.Size(), CompareStrings, (void *)&strings);
}
+/*
void SortStrings(const UStringVector &src, UStringVector &dest)
{
CIntVector indices;
@@ -76,3 +77,4 @@ void SortStrings(const UStringVector &src, UStringVector &dest)
for (int i = 0; i < indices.Size(); i++)
dest.Add(src[indices[i]]);
}
+*/ \ No newline at end of file
diff --git a/CPP/7zip/UI/Common/SortUtils.h b/CPP/7zip/UI/Common/SortUtils.h
index 5b9af264..b30bc6ca 100755
--- a/CPP/7zip/UI/Common/SortUtils.h
+++ b/CPP/7zip/UI/Common/SortUtils.h
@@ -6,6 +6,6 @@
#include "Common/String.h"
void SortStringsToIndices(const UStringVector &strings, CIntVector &indices);
-void SortStrings(const UStringVector &src, UStringVector &dest);
+// void SortStrings(const UStringVector &src, UStringVector &dest);
#endif
diff --git a/CPP/7zip/UI/Common/Update.cpp b/CPP/7zip/UI/Common/Update.cpp
index 3772b676..3c292754 100755
--- a/CPP/7zip/UI/Common/Update.cpp
+++ b/CPP/7zip/UI/Common/Update.cpp
@@ -46,11 +46,8 @@ using namespace NCOM;
using namespace NFile;
using namespace NName;
-static const wchar_t *kTempArchiveFilePrefixString = L"7zi";
static const wchar_t *kTempFolderPrefix = L"7zE";
-static const char *kIllegalFileNameMessage = "Illegal file name for temp archive";
-
using namespace NUpdateArchive;
static HRESULT CopyBlock(ISequentialInStream *inStream, ISequentialOutStream *outStream)
@@ -277,6 +274,7 @@ static HRESULT Compress(
const CCompressionMethodMode &compressionMethod,
CArchivePath &archivePath,
const CObjectVector<CArchiveItem> &archiveItems,
+ bool shareForWrite,
bool stdInMode,
/* const UString & stdInFileName, */
bool stdOutMode,
@@ -338,6 +336,7 @@ static HRESULT Compress(
CArchiveUpdateCallback *updateCallbackSpec = new CArchiveUpdateCallback;
CMyComPtr<IArchiveUpdateCallback> updateCallback(updateCallbackSpec );
+ updateCallbackSpec->ShareForWrite = shareForWrite;
updateCallbackSpec->StdInMode = stdInMode;
updateCallbackSpec->Callback = callback;
updateCallbackSpec->DirItems = &dirItems;
@@ -518,6 +517,7 @@ static HRESULT UpdateWithItemLists(
options.MethodMode,
command.ArchivePath,
archiveItems,
+ options.OpenShareForWrite,
options.StdInMode,
/* options.StdInFileName, */
options.StdOutMode,
diff --git a/CPP/7zip/UI/Common/Update.h b/CPP/7zip/UI/Common/Update.h
index 284f8657..33f4eecd 100755
--- a/CPP/7zip/UI/Common/Update.h
+++ b/CPP/7zip/UI/Common/Update.h
@@ -99,6 +99,8 @@ struct CUpdateOptions
bool SfxMode;
UString SfxModule;
+ bool OpenShareForWrite;
+
bool StdInMode;
UString StdInFileName;
bool StdOutMode;
@@ -117,7 +119,8 @@ struct CUpdateOptions
StdInMode(false),
StdOutMode(false),
EMailMode(false),
- EMailRemoveAfter(false)
+ EMailRemoveAfter(false),
+ OpenShareForWrite(false)
{};
CRecordVector<UInt64> VolumesSizes;
};
diff --git a/CPP/7zip/UI/Common/UpdateCallback.cpp b/CPP/7zip/UI/Common/UpdateCallback.cpp
index db3bf805..6fc4242d 100755
--- a/CPP/7zip/UI/Common/UpdateCallback.cpp
+++ b/CPP/7zip/UI/Common/UpdateCallback.cpp
@@ -17,6 +17,7 @@ using namespace NWindows;
CArchiveUpdateCallback::CArchiveUpdateCallback():
Callback(0),
+ ShareForWrite(false),
StdInMode(false),
DirItems(0),
ArchiveItems(0),
@@ -202,7 +203,7 @@ STDMETHODIMP CArchiveUpdateCallback::GetStream(UInt32 index, ISequentialInStream
CInFileStream *inStreamSpec = new CInFileStream;
CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
UString path = DirPrefix + dirItem.FullPath;
- if(!inStreamSpec->Open(path))
+ if(!inStreamSpec->OpenShared(path, ShareForWrite))
{
return Callback->OpenFileError(path, ::GetLastError());
}
diff --git a/CPP/7zip/UI/Common/UpdateCallback.h b/CPP/7zip/UI/Common/UpdateCallback.h
index 8b14a9dc..cc4e2649 100755
--- a/CPP/7zip/UI/Common/UpdateCallback.h
+++ b/CPP/7zip/UI/Common/UpdateCallback.h
@@ -58,6 +58,7 @@ public:
IUpdateCallbackUI *Callback;
UString DirPrefix;
+ bool ShareForWrite;
bool StdInMode;
const CObjectVector<CDirItem> *DirItems;
const CObjectVector<CArchiveItem> *ArchiveItems;
diff --git a/CPP/7zip/UI/Common/ZipRegistry.cpp b/CPP/7zip/UI/Common/ZipRegistry.cpp
index 8969a4ab..1f076caf 100755
--- a/CPP/7zip/UI/Common/ZipRegistry.cpp
+++ b/CPP/7zip/UI/Common/ZipRegistry.cpp
@@ -126,8 +126,8 @@ static const TCHAR *kCompressionShowPasswordValueName = TEXT("ShowPassword");
static const TCHAR *kCompressionEncryptHeadersValueName = TEXT("EncryptHeaders");
static const TCHAR *kCompressionOptionsKeyName = TEXT("Options");
-static const TCHAR *kSolid = TEXT("Solid");
-static const TCHAR *kMultiThread = TEXT("Multithread");
+// static const TCHAR *kSolid = TEXT("Solid");
+// static const TCHAR *kMultiThread = TEXT("Multithread");
static const WCHAR *kCompressionOptions = L"Options";
static const TCHAR *kCompressionLevel = TEXT("Level");
diff --git a/CPP/7zip/UI/Console/Console.dsp b/CPP/7zip/UI/Console/Console.dsp
index 75c71330..64cac741 100755
--- a/CPP/7zip/UI/Console/Console.dsp
+++ b/CPP/7zip/UI/Console/Console.dsp
@@ -704,6 +704,15 @@ SOURCE=..\..\..\..\C\Alloc.c
SOURCE=..\..\..\..\C\Alloc.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.h
+# End Source File
# End Group
# End Target
# End Project
diff --git a/CPP/7zip/UI/Console/ConsoleClose.cpp b/CPP/7zip/UI/Console/ConsoleClose.cpp
index a514c12a..d18b39e6 100755
--- a/CPP/7zip/UI/Console/ConsoleClose.cpp
+++ b/CPP/7zip/UI/Console/ConsoleClose.cpp
@@ -2,8 +2,6 @@
#include "StdAfx.h"
-#include <stdio.h>
-
#include "ConsoleClose.h"
static int g_BreakCounter = 0;
diff --git a/CPP/7zip/UI/Console/List.cpp b/CPP/7zip/UI/Console/List.cpp
index 3d7001d2..7891d5f3 100755
--- a/CPP/7zip/UI/Console/List.cpp
+++ b/CPP/7zip/UI/Console/List.cpp
@@ -396,15 +396,15 @@ HRESULT ListArchives(
CCodecs *codecs,
UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
- bool enableHeaders, bool techMode, bool &passwordEnabled, UString &password)
+ bool enableHeaders, bool techMode, bool &passwordEnabled, UString &password, UInt64 &numErrors)
{
+ numErrors = 0;
CFieldPrinter fieldPrinter;
if (!techMode)
fieldPrinter.Init(kStandardFieldTable, sizeof(kStandardFieldTable) / sizeof(kStandardFieldTable[0]));
UInt64 numFiles2 = 0, totalPackSize2 = 0, totalUnPackSize2 = 0;
UInt64 *totalPackSizePointer2 = 0, *totalUnPackSizePointer2 = 0;
- int numErrors = 0;
for (int i = 0; i < archivePaths.Size(); i++)
{
const UString &archiveName = archivePaths[i];
@@ -528,7 +528,5 @@ HRESULT ListArchives(
g_StdOut << endl;
g_StdOut << "Archives: " << archivePaths.Size() << endl;
}
- if (numErrors > 0)
- g_StdOut << endl << "Errors: " << numErrors;
return S_OK;
}
diff --git a/CPP/7zip/UI/Console/List.h b/CPP/7zip/UI/Console/List.h
index 2827bceb..6e9fa240 100755
--- a/CPP/7zip/UI/Console/List.h
+++ b/CPP/7zip/UI/Console/List.h
@@ -10,7 +10,7 @@ HRESULT ListArchives(
CCodecs *codecs,
UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
- bool enableHeaders, bool techMode, bool &passwordEnabled, UString &password);
+ bool enableHeaders, bool techMode, bool &passwordEnabled, UString &password, UInt64 &errors);
#endif
diff --git a/CPP/7zip/UI/Console/Main.cpp b/CPP/7zip/UI/Console/Main.cpp
index 392bef03..4f0061b2 100755
--- a/CPP/7zip/UI/Console/Main.cpp
+++ b/CPP/7zip/UI/Console/Main.cpp
@@ -2,8 +2,6 @@
#include "StdAfx.h"
-#include <io.h>
-
#include "Common/MyInitGuid.h"
#include "Common/CommandLineParser.h"
@@ -108,6 +106,7 @@ static const char *kHelpString =
" -si[{name}]: read data from stdin\n"
" -slt: show technical information for l (List) command\n"
" -so: write data to stdout\n"
+ " -ssw: compress shared files\n"
" -t{Type}: Set type of archive\n"
" -v{Size}[b|k|m|g]: Create volumes\n"
" -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options\n"
@@ -118,7 +117,6 @@ static const char *kHelpString =
// ---------------------------
// exception messages
-static const char *kProcessArchiveMessage = " archive: ";
static const char *kEverythingIsOk = "Everything is Ok";
static const char *kUserErrorMessage = "Incorrect command line"; // NExitCode::kUserError
@@ -151,13 +149,7 @@ static void GetArguments(int numArguments, const char *arguments[], UStringVecto
static void ShowCopyrightAndHelp(CStdOutStream &s, bool needHelp)
{
s << kCopyrightString;
- /*
- UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors();
- s << "System configuration: " << (UInt64)numCPUs << " CPU";
- if (numCPUs > 1)
- s << "s";
- s << "\n";
- */
+ // s << "# CPUs: " << (UInt64)NWindows::NSystem::GetNumberOfProcessors() << "\n";
if (needHelp)
s << kHelpString;
}
@@ -439,6 +431,7 @@ int Main2(
}
else
{
+ UInt64 numErrors = 0;
HRESULT result = ListArchives(
codecs,
options.ArchivePathsSorted,
@@ -447,7 +440,12 @@ int Main2(
options.EnableHeaders,
options.TechMode,
options.PasswordEnabled,
- options.Password);
+ options.Password, numErrors);
+ if (numErrors > 0)
+ {
+ g_StdOut << endl << "Errors: " << numErrors;
+ return NExitCode::kFatalError;
+ }
if (result != S_OK)
throw CSystemException(result);
}
diff --git a/CPP/7zip/UI/Console/MainAr.cpp b/CPP/7zip/UI/Console/MainAr.cpp
index 06f602ce..75fae190 100755
--- a/CPP/7zip/UI/Console/MainAr.cpp
+++ b/CPP/7zip/UI/Console/MainAr.cpp
@@ -19,9 +19,21 @@ using namespace NWindows;
CStdOutStream *g_StdStream = 0;
+#ifdef _WIN32
#ifndef _UNICODE
bool g_IsNT = false;
#endif
+#if !defined(_UNICODE) || !defined(_WIN64)
+static inline bool IsItWindowsNT()
+{
+ OSVERSIONINFO versionInfo;
+ versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
+ if (!::GetVersionEx(&versionInfo))
+ return false;
+ return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
+}
+#endif
+#endif
extern int Main2(
#ifndef _WIN32
@@ -36,15 +48,6 @@ 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 #";
-static inline bool IsItWindowsNT()
-{
- OSVERSIONINFO versionInfo;
- versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
- if (!::GetVersionEx(&versionInfo))
- return false;
- return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-}
-
int
#ifdef _MSC_VER
__cdecl
@@ -57,15 +60,21 @@ int numArguments, const char *arguments[]
)
{
g_StdStream = &g_StdOut;
+ #ifdef _WIN32
+
#ifdef _UNICODE
+ #ifndef _WIN64
if (!IsItWindowsNT())
{
- (*g_StdStream) << "This program requires Windows NT/2000/XP/2003";
+ (*g_StdStream) << "This program requires Windows NT/2000/XP/2003/Vista";
return NExitCode::kFatalError;
}
+ #endif
#else
g_IsNT = IsItWindowsNT();
#endif
+
+ #endif
// setlocale(LC_COLLATE, ".OCP");
NConsoleClose::CCtrlHandlerSetter ctrlHandlerSetter;
diff --git a/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp b/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp
index 5cbc11c0..b060b196 100755
--- a/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp
+++ b/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp
@@ -26,8 +26,6 @@ static const wchar_t *kEmptyFileAlias = L"[Content]";
static const char *kCreatingArchiveMessage = "Creating archive ";
static const char *kUpdatingArchiveMessage = "Updating archive ";
static const char *kScanningMessage = "Scanning";
-static const char *kNoFilesScannedMessage = "No files scanned";
-static const char *kTotalFilesAddedMessage = "Total files added to archive: ";
HRESULT CUpdateCallbackConsole::OpenResult(const wchar_t *name, HRESULT result)
diff --git a/CPP/7zip/UI/Console/UserInputUtils.h b/CPP/7zip/UI/Console/UserInputUtils.h
index 75c85ee6..408e93e6 100755
--- a/CPP/7zip/UI/Console/UserInputUtils.h
+++ b/CPP/7zip/UI/Console/UserInputUtils.h
@@ -14,7 +14,7 @@ enum EEnum
kYesAll,
kNoAll,
kAutoRename,
- kQuit,
+ kQuit
};
}
diff --git a/CPP/7zip/UI/Console/makefile b/CPP/7zip/UI/Console/makefile
index 466e5c56..02abe851 100755
--- a/CPP/7zip/UI/Console/makefile
+++ b/CPP/7zip/UI/Console/makefile
@@ -79,6 +79,7 @@ LZMA_BENCH_OBJS = \
C_OBJS = \
$O\Alloc.obj \
+ $O\Threads.obj \
!include "../../Crc2.mak"
diff --git a/CPP/7zip/UI/Explorer/ContextMenu.cpp b/CPP/7zip/UI/Explorer/ContextMenu.cpp
index 01305fba..53f778cc 100755
--- a/CPP/7zip/UI/Explorer/ContextMenu.cpp
+++ b/CPP/7zip/UI/Explorer/ContextMenu.cpp
@@ -42,8 +42,6 @@
using namespace NWindows;
-static LPCTSTR kFileClassIDString = TEXT("SevenZip");
-
///////////////////////////////
// IShellExtInit
diff --git a/CPP/7zip/UI/Explorer/Explorer.dsp b/CPP/7zip/UI/Explorer/Explorer.dsp
index 724ed0d9..3fbf3064 100755
--- a/CPP/7zip/UI/Explorer/Explorer.dsp
+++ b/CPP/7zip/UI/Explorer/Explorer.dsp
@@ -534,6 +534,15 @@ SOURCE=..\..\..\..\C\Sort.c
SOURCE=..\..\..\..\C\Sort.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.h
+# End Source File
# End Group
# Begin Group "Common"
diff --git a/CPP/7zip/UI/Explorer/makefile b/CPP/7zip/UI/Explorer/makefile
index 21ace854..cf6321fa 100755
--- a/CPP/7zip/UI/Explorer/makefile
+++ b/CPP/7zip/UI/Explorer/makefile
@@ -93,6 +93,7 @@ FM_COMMON_OBJS = \
C_OBJS = \
$O\Alloc.obj \
$O\Sort.obj \
+ $O\Threads.obj \
OBJS = \
$O\StdAfx.obj \
diff --git a/CPP/7zip/UI/Far/ExtractEngine.cpp b/CPP/7zip/UI/Far/ExtractEngine.cpp
index 15548949..a71d22b8 100755
--- a/CPP/7zip/UI/Far/ExtractEngine.cpp
+++ b/CPP/7zip/UI/Far/ExtractEngine.cpp
@@ -147,8 +147,8 @@ STDMETHODIMP CExtractCallBackImp::SetOperationResult(INT32 operationResult, bool
return E_FAIL;
}
char buffer[512];
- sprintf(buffer, g_StartupInfo.GetMsgString(idMessage),
- GetSystemString(m_CurrentFilePath, m_CodePage));
+ const AString s = GetSystemString(m_CurrentFilePath, m_CodePage);
+ sprintf(buffer, g_StartupInfo.GetMsgString(idMessage), (const char *)s);
if (g_StartupInfo.ShowMessage(buffer) == -1)
return E_ABORT;
}
diff --git a/CPP/7zip/UI/Far/Far.dsp b/CPP/7zip/UI/Far/Far.dsp
index fa540ed2..327574dd 100755
--- a/CPP/7zip/UI/Far/Far.dsp
+++ b/CPP/7zip/UI/Far/Far.dsp
@@ -570,6 +570,15 @@ SOURCE=..\..\..\..\C\Sort.c
SOURCE=..\..\..\..\C\Sort.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.h
+# End Source File
# End Group
# End Target
# End Project
diff --git a/CPP/7zip/UI/Far/Main.cpp b/CPP/7zip/UI/Far/Main.cpp
index 70d9117c..0409855d 100755
--- a/CPP/7zip/UI/Far/Main.cpp
+++ b/CPP/7zip/UI/Far/Main.cpp
@@ -33,8 +33,6 @@ using namespace NFar;
static const char *kCommandPrefix = "7-zip";
-static const int kDescriptionMaxSize = 256;
-
static const char *kRegisrtryMainKeyName = "";
static const char *kRegisrtryValueNameEnabled = "UsedByDefault3";
diff --git a/CPP/7zip/UI/Far/OverwriteDialog.cpp b/CPP/7zip/UI/Far/OverwriteDialog.cpp
index 028fff4e..1594a350 100755
--- a/CPP/7zip/UI/Far/OverwriteDialog.cpp
+++ b/CPP/7zip/UI/Far/OverwriteDialog.cpp
@@ -21,8 +21,6 @@ using namespace NFar;
namespace NOverwriteDialog {
-static const char *kHelpTopic = "OverwriteDialog";
-
struct CFileInfoStrings
{
CSysString Size;
diff --git a/CPP/7zip/UI/Far/PluginWrite.cpp b/CPP/7zip/UI/Far/PluginWrite.cpp
index a159a476..79fdbf8f 100755
--- a/CPP/7zip/UI/Far/PluginWrite.cpp
+++ b/CPP/7zip/UI/Far/PluginWrite.cpp
@@ -421,8 +421,10 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
const CArcInfoEx &arcInfo = codecs->Formats[archiverIndex];
char updateAddToArchiveString[512];
+ const AString s = GetSystemString(arcInfo.Name, CP_OEMCP);
+
sprintf(updateAddToArchiveString,
- g_StartupInfo.GetMsgString(NMessageID::kUpdateAddToArchive), GetSystemString(arcInfo.Name), CP_OEMCP);
+ g_StartupInfo.GetMsgString(NMessageID::kUpdateAddToArchive), (const char *)s);
int methodIndex = 0;
int i;
@@ -534,7 +536,6 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
if (archiveName.Right(prevExtensionLen).CompareNoCase(prevExtension) == 0)
{
int pos = archiveName.Length() - prevExtensionLen;
- UString temp = archiveName.Left(pos);
if (pos > 1)
{
int dotPos = archiveName.ReverseFind('.');
diff --git a/CPP/7zip/UI/Far/makefile b/CPP/7zip/UI/Far/makefile
index 42c5a0a7..142226a4 100755
--- a/CPP/7zip/UI/Far/makefile
+++ b/CPP/7zip/UI/Far/makefile
@@ -71,6 +71,7 @@ AGENT_OBJS = \
C_OBJS = \
$O\Alloc.obj \
$O\Sort.obj \
+ $O\Threads.obj \
OBJS = \
$O\StdAfx.obj \
diff --git a/CPP/7zip/UI/GUI/CompressDialog.cpp b/CPP/7zip/UI/GUI/CompressDialog.cpp
index de182923..3591b14f 100755
--- a/CPP/7zip/UI/GUI/CompressDialog.cpp
+++ b/CPP/7zip/UI/GUI/CompressDialog.cpp
@@ -53,6 +53,7 @@ static CIDLangPair kIDLangPairs[] =
{ IDC_STATIC_COMPRESS_UPDATE_MODE, 0x02000D02 },
{ IDC_STATIC_COMPRESS_OPTIONS, 0x02000D07 },
{ IDC_COMPRESS_SFX, 0x02000D08 },
+ { IDC_COMPRESS_SHARED, 0x02000D16 },
{ IDC_COMPRESS_ENCRYPTION, 0x02000D10 },
{ IDC_STATIC_COMPRESS_PASSWORD1, 0x02000B01 },
@@ -194,7 +195,7 @@ static const CFormatInfo g_Formats[] =
},
{
L"GZip",
- (1 << 5) | (1 << 7) | (1 << 9),
+ (1 << 1) | (1 << 5) | (1 << 7) | (1 << 9),
g_GZipMethods, MY_SIZE_OF_ARRAY(g_GZipMethods),
false, false, false, false, false, false
},
@@ -301,6 +302,7 @@ bool CCompressDialog::OnInit()
SetItemText(IDC_COMPRESS_HARDWARE_THREADS, s);
CheckButton(IDC_COMPRESS_SFX, Info.SFXMode);
+ CheckButton(IDC_COMPRESS_SHARED, Info.OpenShareForWrite);
CheckControlsEnable();
@@ -539,6 +541,8 @@ void CCompressDialog::OnOK()
Info.EncryptionMethod = GetEncryptionMethodSpec();
Info.ArchiverInfoIndex = m_Format.GetCurSel();
Info.SFXMode = IsSFX();
+ Info.OpenShareForWrite = IsButtonCheckedBool(IDC_COMPRESS_SHARED);
+
m_RegistryInfo.EncryptHeaders = Info.EncryptHeaders = IsButtonCheckedBool(IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES);
m_Params.GetText(Info.Options);
diff --git a/CPP/7zip/UI/GUI/CompressDialog.h b/CPP/7zip/UI/GUI/CompressDialog.h
index 1ff20cd0..cf479f0a 100755
--- a/CPP/7zip/UI/GUI/CompressDialog.h
+++ b/CPP/7zip/UI/GUI/CompressDialog.h
@@ -43,6 +43,8 @@ namespace NCompressDialog
UString EncryptionMethod;
bool SFXMode;
+ bool OpenShareForWrite;
+
UString ArchiveName; // in: Relative for ; out: abs
UString CurrentDirPrefix;
diff --git a/CPP/7zip/UI/GUI/ExtractDialog.cpp b/CPP/7zip/UI/GUI/ExtractDialog.cpp
index 55c871ad..3345b7df 100755
--- a/CPP/7zip/UI/GUI/ExtractDialog.cpp
+++ b/CPP/7zip/UI/GUI/ExtractDialog.cpp
@@ -36,6 +36,8 @@ static const int kPathModeButtons[] =
IDC_EXTRACT_RADIO_NO_PATHNAMES
};
+#ifndef _SFX
+
static const NExtract::NPathMode::EEnum kPathModeButtonsVals[] =
{
NExtract::NPathMode::kFullPathnames,
@@ -74,7 +76,6 @@ static const int kFilesButtons[] =
static const int kNumFilesButtons = sizeof(kFilesButtons) / sizeof(kFilesButtons[0]);
*/
-#ifndef _SFX
void CExtractDialog::GetPathMode()
{
for (int i = 0; i < kNumPathnamesButtons; i++)
@@ -169,7 +170,9 @@ static CIDLangPair kIDLangPairs[] =
// static const int kWildcardsButtonIndex = 2;
+#ifndef NO_REGISTRY
static const int kHistorySize = 8;
+#endif
bool CExtractDialog::OnInit()
{
diff --git a/CPP/7zip/UI/GUI/ExtractGUI.cpp b/CPP/7zip/UI/GUI/ExtractGUI.cpp
index 3edb1229..b73f9870 100755
--- a/CPP/7zip/UI/GUI/ExtractGUI.cpp
+++ b/CPP/7zip/UI/GUI/ExtractGUI.cpp
@@ -72,7 +72,7 @@ struct CThreadExtracting
ExtractCallbackSpec->ProgressDialog.MyClose();
return 0;
}
- static DWORD WINAPI MyThreadFunction(void *param)
+ static THREAD_FUNC_DECL MyThreadFunction(void *param)
{
return ((CThreadExtracting *)param)->Process();
}
@@ -154,9 +154,8 @@ HRESULT ExtractGUI(
extracter.Options = &options;
extracter.OpenCallback = openCallback;
- CThread thread;
- if (!thread.Create(CThreadExtracting::MyThreadFunction, &extracter))
- throw 271824;
+ NWindows::CThread thread;
+ RINOK(thread.Create(CThreadExtracting::MyThreadFunction, &extracter));
extracter.ExtractCallbackSpec->StartProgressDialog(title);
if (extracter.Result == S_OK && options.TestMode &&
extracter.ExtractCallbackSpec->Messages.IsEmpty() &&
diff --git a/CPP/7zip/UI/GUI/GUI.cpp b/CPP/7zip/UI/GUI/GUI.cpp
index ad58a451..2d401fc8 100755
--- a/CPP/7zip/UI/GUI/GUI.cpp
+++ b/CPP/7zip/UI/GUI/GUI.cpp
@@ -46,14 +46,13 @@ HINSTANCE g_hInstance;
bool g_IsNT = false;
#endif
-static const wchar_t *kExceptionErrorMessage = L"Error:";
-static const wchar_t *kUserBreak = L"Break signaled";
+// static const wchar_t *kExceptionErrorMessage = L"Error:";
+// static const wchar_t *kUserBreak = L"Break signaled";
static const wchar_t *kMemoryExceptionMessage = L"ERROR: Can't allocate required memory!";
static const wchar_t *kUnknownExceptionMessage = L"Unknown Error";
-static const wchar_t *kInternalExceptionMessage = L"Internal Error #";
-
-static const wchar_t *kIncorrectCommandMessage = L"Incorrect command";
+// static const wchar_t *kInternalExceptionMessage = L"Internal Error #";
+// static const wchar_t *kIncorrectCommandMessage = L"Incorrect command";
static void ErrorMessage(const wchar_t *message)
{
diff --git a/CPP/7zip/UI/GUI/GUI.dsp b/CPP/7zip/UI/GUI/GUI.dsp
index ccfe98ab..9586eebf 100755
--- a/CPP/7zip/UI/GUI/GUI.dsp
+++ b/CPP/7zip/UI/GUI/GUI.dsp
@@ -684,6 +684,15 @@ SOURCE=..\..\..\..\C\Alloc.c
SOURCE=..\..\..\..\C\Alloc.h
# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\C\Threads.h
+# End Source File
# End Group
# Begin Group "Common"
diff --git a/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.cpp b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.cpp
index 15d6ee39..894faefb 100755
--- a/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.cpp
+++ b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.cpp
@@ -76,8 +76,6 @@ static const UInt32 kMaxDicSize =
(1 << 27);
#endif
-static const int kDefaultDictionary = 22;
-
bool CBenchmarkDialog::OnInit()
{
#ifdef LANG
@@ -423,7 +421,7 @@ struct CThreadBenchmark
HRESULT Process();
HRESULT Result;
- static DWORD WINAPI MyThreadFunction(void *param)
+ static THREAD_FUNC_DECL MyThreadFunction(void *param)
{
((CThreadBenchmark *)param)->Result = ((CThreadBenchmark *)param)->Process();
return 0;
@@ -465,8 +463,9 @@ HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final)
if (info2.NumIterations == 0)
info2.NumIterations = 1;
- info2.GlobalTime /= info2.NumIterations;
- info2.UserTime /= info2.NumIterations;
+ info2.UnpackSize *= info2.NumIterations;
+ info2.PackSize *= info2.NumIterations;
+ info2.NumIterations = 1;
if (final && SyncInfo->DecompressingInfo.GlobalTime == 0)
{
@@ -575,10 +574,8 @@ HRESULT Benchmark(
benchmarkDialog._syncInfo.NumThreads = numThreads;
benchmarker.SyncInfo = &benchmarkDialog._syncInfo;
- CThread thread;
- if (!thread.Create(CThreadBenchmark::MyThreadFunction, &benchmarker))
- return E_FAIL;
+ NWindows::CThread thread;
+ RINOK(thread.Create(CThreadBenchmark::MyThreadFunction, &benchmarker));
benchmarkDialog.Create(0);
- thread.Wait();
- return S_OK;
+ return thread.Wait();
}
diff --git a/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.h b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.h
index 716d0f55..9474c5b8 100755
--- a/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.h
+++ b/CPP/7zip/UI/GUI/Resource/BenchmarkDialog/BenchmarkDialog.h
@@ -39,6 +39,11 @@ public:
CBenchInfo2 DecompressingInfoTemp;
CBenchInfo2 DecompressingInfo;
+ CProgressSyncInfo()
+ {
+ if (_startEvent.Create() != S_OK)
+ throw 3986437;
+ }
void Init()
{
Changed = false;
diff --git a/CPP/7zip/UI/GUI/UpdateGUI.cpp b/CPP/7zip/UI/GUI/UpdateGUI.cpp
index 1150804e..b446b4c5 100755
--- a/CPP/7zip/UI/GUI/UpdateGUI.cpp
+++ b/CPP/7zip/UI/GUI/UpdateGUI.cpp
@@ -30,7 +30,7 @@
using namespace NWindows;
using namespace NFile;
-static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
+// static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
static const wchar_t *kDefaultSfxModule = L"7z.sfx";
static const wchar_t *kSFXExtension = L"exe";
@@ -76,7 +76,7 @@ struct CThreadUpdating
UpdateCallbackGUI->ProgressDialog.MyClose();
return 0;
}
- static DWORD WINAPI MyThreadFunction(void *param)
+ static THREAD_FUNC_DECL MyThreadFunction(void *param)
{
return ((CThreadUpdating *)param)->Process();
}
@@ -273,6 +273,7 @@ static HRESULT ShowDialog(
di.CurrentDirPrefix = currentDirPrefix;
di.SFXMode = options.SfxMode;
+ di.OpenShareForWrite = options.OpenShareForWrite;
if (callback->PasswordIsDefined)
di.Password = callback->Password;
@@ -334,6 +335,7 @@ static HRESULT ShowDialog(
di.EncryptHeadersIsAllowed, di.EncryptHeaders,
di.SFXMode);
+ options.OpenShareForWrite = di.OpenShareForWrite;
ParseAndAddPropertires(options.MethodMode.Properties, di.Options);
if (di.SFXMode)
@@ -388,9 +390,8 @@ HRESULT UpdateGUI(
tu.OpenCallback = openCallback;
tu.ErrorInfo = &errorInfo;
- CThread thread;
- if (!thread.Create(CThreadUpdating::MyThreadFunction, &tu))
- throw 271824;
+ NWindows::CThread thread;
+ RINOK(thread.Create(CThreadUpdating::MyThreadFunction, &tu))
tu.UpdateCallbackGUI->StartProgressDialog(LangString(IDS_PROGRESS_COMPRESSING, 0x02000DC0));
return tu.Result;
}
diff --git a/CPP/7zip/UI/GUI/makefile b/CPP/7zip/UI/GUI/makefile
index cac56df0..cd1536fe 100755
--- a/CPP/7zip/UI/GUI/makefile
+++ b/CPP/7zip/UI/GUI/makefile
@@ -100,6 +100,7 @@ FM_OBJS = \
C_OBJS = \
$O\Alloc.obj \
+ $O\Threads.obj \
!include "../../Crc2.mak"
diff --git a/CPP/7zip/UI/Resource/CompressDialog/resource.h b/CPP/7zip/UI/Resource/CompressDialog/resource.h
index a7401e2f..beedde4e 100755
--- a/CPP/7zip/UI/Resource/CompressDialog/resource.h
+++ b/CPP/7zip/UI/Resource/CompressDialog/resource.h
@@ -48,3 +48,5 @@
#define IDC_COMPRESS_COMBO_ENCRYPTION_METHOD 1121
#define IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES 1122
+
+#define IDC_COMPRESS_SHARED 1130
diff --git a/CPP/7zip/UI/Resource/CompressDialog/resource.rc b/CPP/7zip/UI/Resource/CompressDialog/resource.rc
index 109c7e14..0c31d37d 100755
--- a/CPP/7zip/UI/Resource/CompressDialog/resource.rc
+++ b/CPP/7zip/UI/Resource/CompressDialog/resource.rc
@@ -1,7 +1,7 @@
#include "resource.h"
#include "../../../GuiCommon.rc"
-#define xSize2 380
+#define xSize2 400
#define ySize2 305
#define xSize (xSize2 + marg + marg)
@@ -24,22 +24,25 @@
#undef bXPos3
#undef bYPos
-#define gSize 180
+#define gSize 190
#define gSpace 24
-#define g0XSize 100
+#define g1XSize 90
+#define g0XSize (gSize - g1XSize)
#define g1XPos (marg + g0XSize)
-#define g1XSize (gSize - g0XSize)
-#define g2XSize 122
+#define g3XSize 40
+#define g2XSize (gSize - g3XSize)
#define g3XPos (marg + g2XSize)
-#define g3XSize (gSize - g2XSize)
#define g4XPos (marg + gSize + gSpace)
#define g4XPos2 (g4XPos + 7)
#define g4XSize (xSize2 - gSize - gSpace)
#define g4XSize2 (g4XSize - 14)
+#define OptYPos 73
+#define PswYPos 128
+
#define bXPos1 (xSize - marg - bXSize)
#define bXPos2 (bXPos1 - 10 - bXSize)
#define bXPos3 (bXPos2 - 10 - bXSize)
@@ -93,25 +96,27 @@ BEGIN
LTEXT "&Update mode:",IDC_STATIC_COMPRESS_UPDATE_MODE, g4XPos, 39, g4XSize, 8
COMBOBOX IDC_COMPRESS_COMBO_UPDATE_MODE, g4XPos, 51, g4XSize, 80, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- GROUPBOX "Options",IDC_STATIC_COMPRESS_OPTIONS, g4XPos, 73, g4XSize, 32
+ GROUPBOX "Options",IDC_STATIC_COMPRESS_OPTIONS, g4XPos, OptYPos, g4XSize, 48
CONTROL "Create SF&X archive",IDC_COMPRESS_SFX, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
- g4XPos2, 87, g4XSize2, 10
+ g4XPos2, OptYPos + 14, g4XSize2, 10
+ CONTROL "Compress shared files",IDC_COMPRESS_SHARED, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ g4XPos2, OptYPos + 30, g4XSize2, 10
- GROUPBOX "Encryption",IDC_COMPRESS_ENCRYPTION, g4XPos, 113, g4XSize, 127
+ GROUPBOX "Encryption",IDC_COMPRESS_ENCRYPTION, g4XPos, PswYPos, g4XSize, 127
- LTEXT "Enter password:",IDC_STATIC_COMPRESS_PASSWORD1, g4XPos2, 127, g4XSize2, 8
- EDITTEXT IDC_COMPRESS_EDIT_PASSWORD1, g4XPos2, 139, g4XSize2, 14, ES_PASSWORD | ES_AUTOHSCROLL
- LTEXT "Reenter password:",IDC_STATIC_COMPRESS_PASSWORD2, g4XPos2, 159, g4XSize2, 8
- EDITTEXT IDC_COMPRESS_EDIT_PASSWORD2, g4XPos2, 171, g4XSize2, 14, ES_PASSWORD | ES_AUTOHSCROLL
+ LTEXT "Enter password:",IDC_STATIC_COMPRESS_PASSWORD1, g4XPos2, PswYPos + 14, g4XSize2, 8
+ EDITTEXT IDC_COMPRESS_EDIT_PASSWORD1, g4XPos2, PswYPos + 26, g4XSize2, 14, ES_PASSWORD | ES_AUTOHSCROLL
+ LTEXT "Reenter password:",IDC_STATIC_COMPRESS_PASSWORD2, g4XPos2, PswYPos + 46, g4XSize2, 8
+ EDITTEXT IDC_COMPRESS_EDIT_PASSWORD2, g4XPos2, PswYPos + 58, g4XSize2, 14, ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Show Password",IDC_COMPRESS_CHECK_SHOW_PASSWORD,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,
- g4XPos2, 192, g4XSize2, 10
+ g4XPos2, PswYPos + 79, g4XSize2, 10
- LTEXT "&Encryption method:",IDC_STATIC_COMPRESS_ENCRYPTION_METHOD, g4XPos2, 208, 80, 8
- COMBOBOX IDC_COMPRESS_COMBO_ENCRYPTION_METHOD, g4XPos2 + 90, 206, g4XSize2 - 90, 198, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "&Encryption method:",IDC_STATIC_COMPRESS_ENCRYPTION_METHOD, g4XPos2, PswYPos + 95, 100, 8
+ COMBOBOX IDC_COMPRESS_COMBO_ENCRYPTION_METHOD, g4XPos2 + 100, PswYPos + 93, g4XSize2 - 100, 198, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Encrypt file &names", IDC_COMPRESS_CHECK_ENCRYPT_FILE_NAMES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
- g4XPos2, 224, g4XSize2, 10
+ g4XPos2, PswYPos + 111, g4XSize2, 10
DEFPUSHBUTTON "OK", IDOK, bXPos3, bYPos, bXSize, bYSize, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, bXPos2, bYPos, bXSize, bYSize