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
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2006-04-13 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:47 +0300
commit83911c8529146922f2d32b04d8d6107aaf338fb8 (patch)
tree5cef47b652cf2659635a6631bf8eb1a27abd5c93
parentcb9eea7264409202d974b41b08d976ddbca6d203 (diff)
4.38 beta
-rwxr-xr-x7zip/Archive/7z/7zUpdate.cpp18
-rwxr-xr-x7zip/Archive/Cab/CabHandler.cpp4
-rwxr-xr-x7zip/Archive/Common/CodecsPath.cpp6
-rwxr-xr-x7zip/Archive/Common/FilterCoder.cpp8
-rwxr-xr-x7zip/Archive/Common/ItemNameUtils.cpp13
-rwxr-xr-x7zip/Archive/Common/ItemNameUtils.h6
-rwxr-xr-x7zip/Archive/GZip/GZipHandlerOut.cpp2
-rwxr-xr-x7zip/Archive/Iso/IsoHandler.cpp2
-rwxr-xr-x7zip/Archive/Iso/IsoHeader.h2
-rwxr-xr-x7zip/Archive/Iso/IsoIn.h4
-rwxr-xr-x7zip/Archive/Lzh/LzhHandler.cpp2
-rwxr-xr-x7zip/Archive/Lzh/LzhItem.h2
-rwxr-xr-x7zip/Archive/Rar/RarHandler.cpp9
-rwxr-xr-x7zip/Bundles/SFXCon/Main.cpp11
-rwxr-xr-x7zip/Bundles/SFXSetup/ExtractCallback.cpp43
-rwxr-xr-x7zip/Bundles/SFXSetup/ExtractCallback.h9
-rwxr-xr-x7zip/Bundles/SFXSetup/ExtractEngine.cpp99
-rwxr-xr-x7zip/Bundles/SFXSetup/ExtractEngine.h10
-rwxr-xr-x7zip/Bundles/SFXSetup/Main.cpp133
-rwxr-xr-x7zip/Bundles/SFXSetup/resource.h2
-rwxr-xr-x7zip/Bundles/SFXSetup/resource.rc2
-rwxr-xr-x7zip/Common/FilePathAutoRename.cpp12
-rwxr-xr-x7zip/Compress/Deflate/Deflate.dsp4
-rwxr-xr-x7zip/Compress/Deflate/DeflateDecoder.cpp7
-rwxr-xr-x7zip/Compress/Deflate/DeflateDecoder.h15
-rwxr-xr-x7zip/Compress/Deflate/DllExports.cpp25
-rwxr-xr-x7zip/Compress/Deflate/makefile2
-rwxr-xr-x7zip/Compress/LZMA/LZMA.dsp4
-rwxr-xr-x7zip/Compress/LZMA/makefile2
-rwxr-xr-x7zip/Guid.txt1
-rwxr-xr-x7zip/MyVersion.h9
-rwxr-xr-x7zip/MyVersionInfo.rc2
-rwxr-xr-x7zip/UI/Common/ArchiveCommandLine.cpp13
-rwxr-xr-x7zip/UI/Common/ArchiveName.cpp2
-rwxr-xr-x7zip/UI/Common/ArchiverInfo.cpp8
-rwxr-xr-x7zip/UI/Common/ExtractingFilePath.cpp8
-rwxr-xr-x7zip/UI/Common/Update.h2
-rwxr-xr-x7zip/UI/Console/Main.cpp34
-rwxr-xr-x7zip/UI/Console/UserInputUtils.cpp1
-rwxr-xr-x7zip/UI/Explorer/ContextMenu.cpp77
-rwxr-xr-x7zip/UI/Explorer/ContextMenu.h2
-rwxr-xr-x7zip/UI/GUI/CompressDialog.cpp2
-rwxr-xr-xCommon/MyWindows.h10
-rwxr-xr-xCommon/StdOutStream.cpp7
-rwxr-xr-xCommon/StdOutStream.h1
-rwxr-xr-xCommon/TextConfig.cpp4
-rwxr-xr-xCommon/Vector.h17
-rwxr-xr-xCommon/Wildcard.cpp10
-rwxr-xr-xDOC/7zip.nsi11
-rwxr-xr-xDOC/7zip.wxs385
-rwxr-xr-xDOC/Methods.txt26
-rwxr-xr-xDOC/readme.txt2
-rwxr-xr-xWindows/FileDir.cpp12
-rwxr-xr-xWindows/FileName.h2
54 files changed, 798 insertions, 308 deletions
diff --git a/7zip/Archive/7z/7zUpdate.cpp b/7zip/Archive/7z/7zUpdate.cpp
index c45c85f3..b75219a3 100755
--- a/7zip/Archive/7z/7zUpdate.cpp
+++ b/7zip/Archive/7z/7zUpdate.cpp
@@ -73,11 +73,19 @@ static HRESULT WriteRange(IInStream *inStream,
size, progress, currentComplexity);
}
+static int GetReverseSlashPos(const UString &name)
+{
+ int slashPos = name.ReverseFind(L'/');
+ #ifdef _WIN32
+ int slash1Pos = name.ReverseFind(L'\\');
+ slashPos = MyMax(slashPos, slash1Pos);
+ #endif
+ return slashPos;
+}
+
int CUpdateItem::GetExtensionPos() const
{
- int slash1Pos = Name.ReverseFind(L'\\');
- int slash2Pos = Name.ReverseFind(L'/');
- int slashPos = MyMax(slash1Pos, slash2Pos);
+ int slashPos = GetReverseSlashPos(Name);
int dotPos = Name.ReverseFind(L'.');
if (dotPos < 0 || (dotPos < slashPos && slashPos >= 0))
return Name.Length();
@@ -220,9 +228,7 @@ struct CRefItem
{
if (sortByType)
{
- int slash1Pos = updateItem.Name.ReverseFind(L'\\');
- int slash2Pos = updateItem.Name.ReverseFind(L'/');
- int slashPos = MyMax(slash1Pos, slash2Pos);
+ int slashPos = GetReverseSlashPos(updateItem.Name);
if (slashPos >= 0)
NamePos = slashPos + 1;
else
diff --git a/7zip/Archive/Cab/CabHandler.cpp b/7zip/Archive/Cab/CabHandler.cpp
index c3dd061f..bf97fc0f 100755
--- a/7zip/Archive/Cab/CabHandler.cpp
+++ b/7zip/Archive/Cab/CabHandler.cpp
@@ -20,6 +20,8 @@
#include "../../Compress/Lzx/LzxDecoder.h"
#include "../../Compress/Quantum/QuantumDecoder.h"
+#include "../Common/ItemNameUtils.h"
+
using namespace NWindows;
namespace NArchive {
@@ -123,7 +125,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
if (!ConvertUTF8ToUnicode(item.Name, unicodeName))
propVariant = L"";
else
- propVariant = unicodeName;
+ propVariant = (const wchar_t *)NItemName::WinNameToOSName(unicodeName);
}
else
propVariant = MultiByteToUnicodeString(item.Name, CP_ACP);
diff --git a/7zip/Archive/Common/CodecsPath.cpp b/7zip/Archive/Common/CodecsPath.cpp
index d2d27ed3..7ee89875 100755
--- a/7zip/Archive/Common/CodecsPath.cpp
+++ b/7zip/Archive/Common/CodecsPath.cpp
@@ -15,7 +15,7 @@ static CSysString GetLibraryPath()
static CSysString GetLibraryFolderPrefix()
{
CSysString path = GetLibraryPath();
- int pos = path.ReverseFind(TEXT('\\'));
+ int pos = path.ReverseFind(TEXT(CHAR_PATH_SEPARATOR));
return path.Left(pos + 1);
}
@@ -24,11 +24,11 @@ CSysString GetBaseFolderPrefix()
CSysString libPrefix = GetLibraryFolderPrefix();
CSysString temp = libPrefix;
temp.Delete(temp.Length() - 1);
- int pos = temp.ReverseFind(TEXT('\\'));
+ int pos = temp.ReverseFind(TEXT(CHAR_PATH_SEPARATOR));
return temp.Left(pos + 1);
}
CSysString GetCodecsFolderPrefix()
{
- return GetBaseFolderPrefix() + TEXT("Codecs\\");
+ return GetBaseFolderPrefix() + (CSysString)(TEXT("Codecs")) + (CSysString)(TEXT(STRING_PATH_SEPARATOR));
}
diff --git a/7zip/Archive/Common/FilterCoder.cpp b/7zip/Archive/Common/FilterCoder.cpp
index 19ba8b81..4dce89bf 100755
--- a/7zip/Archive/Common/FilterCoder.cpp
+++ b/7zip/Archive/Common/FilterCoder.cpp
@@ -200,7 +200,13 @@ STDMETHODIMP CFilterCoder::Read(void *data, UInt32 size, UInt32 *processedSize)
_convertedPosEnd = Filter->Filter(_buffer, _bufferPos);
if (_convertedPosEnd == 0)
{
- break;
+ if (_bufferPos == 0)
+ break;
+ else
+ {
+ _convertedPosEnd = _bufferPos; // check it
+ continue;
+ }
}
if (_convertedPosEnd > _bufferPos)
{
diff --git a/7zip/Archive/Common/ItemNameUtils.cpp b/7zip/Archive/Common/ItemNameUtils.cpp
index 4cfecd41..fcb8f544 100755
--- a/7zip/Archive/Common/ItemNameUtils.cpp
+++ b/7zip/Archive/Common/ItemNameUtils.cpp
@@ -7,8 +7,8 @@
namespace NArchive {
namespace NItemName {
-static const wchar_t kOSDirDelimiter = '\\';
-static const wchar_t kDirDelimiter = '/';
+static const wchar_t kOSDirDelimiter = WCHAR_PATH_SEPARATOR;
+static const wchar_t kDirDelimiter = L'/';
UString MakeLegalName(const UString &name)
{
@@ -47,4 +47,13 @@ bool HasTailSlash(const AString &name, UINT codePage)
return (*prev == '/');
}
+#ifndef _WIN32
+UString WinNameToOSName(const UString &name)
+{
+ UString newName = name;
+ newName.Replace(L'\\', kOSDirDelimiter);
+ return newName;
+}
+#endif
+
}}
diff --git a/7zip/Archive/Common/ItemNameUtils.h b/7zip/Archive/Common/ItemNameUtils.h
index 90dcba5b..63a01563 100755
--- a/7zip/Archive/Common/ItemNameUtils.h
+++ b/7zip/Archive/Common/ItemNameUtils.h
@@ -13,6 +13,12 @@ namespace NItemName {
UString GetOSName2(const UString &name);
bool HasTailSlash(const AString &name, UINT codePage);
+ #ifdef _WIN32
+ inline UString WinNameToOSName(const UString &name) { return name; }
+ #else
+ UString WinNameToOSName(const UString &name);
+ #endif
+
}}
#endif
diff --git a/7zip/Archive/GZip/GZipHandlerOut.cpp b/7zip/Archive/GZip/GZipHandlerOut.cpp
index c58fcb52..be71a0f5 100755
--- a/7zip/Archive/GZip/GZipHandlerOut.cpp
+++ b/7zip/Archive/GZip/GZipHandlerOut.cpp
@@ -110,7 +110,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
if(!FileTimeToUnixTime(utcTime, newItem.Time))
return E_INVALIDARG;
newItem.Name = UnicodeStringToMultiByte(name, CP_ACP);
- int dirDelimiterPos = newItem.Name.ReverseFind('\\');
+ int dirDelimiterPos = newItem.Name.ReverseFind(CHAR_PATH_SEPARATOR);
if (dirDelimiterPos >= 0)
newItem.Name = newItem.Name.Mid(dirDelimiterPos + 1);
diff --git a/7zip/Archive/Iso/IsoHandler.cpp b/7zip/Archive/Iso/IsoHandler.cpp
index 18bb2ddf..793ddc48 100755
--- a/7zip/Archive/Iso/IsoHandler.cpp
+++ b/7zip/Archive/Iso/IsoHandler.cpp
@@ -115,7 +115,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
{
// wchar_t name[32];
// ConvertUInt64ToString(index + 1, name);
- UString s = L"[BOOT]\\";
+ UString s = L"[BOOT]" WSTRING_PATH_SEPARATOR;
// s += name;
// s += L"-";
s += be.GetName();
diff --git a/7zip/Archive/Iso/IsoHeader.h b/7zip/Archive/Iso/IsoHeader.h
index db070c1b..9702d70a 100755
--- a/7zip/Archive/Iso/IsoHeader.h
+++ b/7zip/Archive/Iso/IsoHeader.h
@@ -33,7 +33,7 @@ namespace NBootEntryId
const Byte kValidationEntry = 1;
const Byte kInitialEntryNotBootable = 0;
const Byte kInitialEntryBootable = 0x88;
-};
+}
namespace NBootPlatformId
{
diff --git a/7zip/Archive/Iso/IsoIn.h b/7zip/Archive/Iso/IsoIn.h
index fe85343f..f1d33aaa 100755
--- a/7zip/Archive/Iso/IsoIn.h
+++ b/7zip/Archive/Iso/IsoIn.h
@@ -62,7 +62,7 @@ struct CDir: public CDirRecord
if (cur->Parent == 0)
break;
p--;
- *p = '\\';
+ *p = CHAR_PATH_SEPARATOR;
}
s.ReleaseBuffer();
return s;
@@ -92,7 +92,7 @@ struct CDir: public CDirRecord
if (cur->Parent == 0)
break;
p--;
- *p = L'\\';
+ *p = WCHAR_PATH_SEPARATOR;
}
s.ReleaseBuffer();
return s;
diff --git a/7zip/Archive/Lzh/LzhHandler.cpp b/7zip/Archive/Lzh/LzhHandler.cpp
index f66cf352..fd420c3f 100755
--- a/7zip/Archive/Lzh/LzhHandler.cpp
+++ b/7zip/Archive/Lzh/LzhHandler.cpp
@@ -140,7 +140,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
{
case kpidPath:
{
- const UString s = NItemName::GetOSName2(MultiByteToUnicodeString(item.GetName(), CP_OEMCP));
+ const UString s = NItemName::WinNameToOSName(MultiByteToUnicodeString(item.GetName(), CP_OEMCP));
if (!s.IsEmpty())
propVariant = s;
break;
diff --git a/7zip/Archive/Lzh/LzhItem.h b/7zip/Archive/Lzh/LzhItem.h
index b9b5f914..448d8b33 100755
--- a/7zip/Archive/Lzh/LzhItem.h
+++ b/7zip/Archive/Lzh/LzhItem.h
@@ -154,7 +154,7 @@ public:
if (!dirName.IsEmpty())
{
char c = dirName[dirName.Length() - 1];
- if (c != '\\' && c != '/')
+ if (c != '\\')
dirName += '\\';
}
return dirName + GetFileName();
diff --git a/7zip/Archive/Rar/RarHandler.cpp b/7zip/Archive/Rar/RarHandler.cpp
index 56187156..cd654ec2 100755
--- a/7zip/Archive/Rar/RarHandler.cpp
+++ b/7zip/Archive/Rar/RarHandler.cpp
@@ -23,6 +23,7 @@
#include "../Common/CoderLoader.h"
#include "../Common/CodecsPath.h"
#include "../Common/FilterCoder.h"
+#include "../Common/ItemNameUtils.h"
#include "../7z/7zMethods.h"
@@ -186,11 +187,15 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
switch(propID)
{
case kpidPath:
+ {
+ UString u;
if (item.HasUnicodeName() && !item.UnicodeName.IsEmpty())
- propVariant = item.UnicodeName;
+ u = item.UnicodeName;
else
- propVariant = (const wchar_t *)MultiByteToUnicodeString(item.Name, CP_OEMCP);
+ u = MultiByteToUnicodeString(item.Name, CP_OEMCP);
+ propVariant = (const wchar_t *)NItemName::WinNameToOSName(u);
break;
+ }
case kpidIsFolder:
propVariant = item.IsDirectory();
break;
diff --git a/7zip/Bundles/SFXCon/Main.cpp b/7zip/Bundles/SFXCon/Main.cpp
index d707a37a..12599e87 100755
--- a/7zip/Bundles/SFXCon/Main.cpp
+++ b/7zip/Bundles/SFXCon/Main.cpp
@@ -40,7 +40,10 @@ static const char *kCopyrightString =
static const int kNumSwitches = 6;
-const wchar_t *defaultExt = L".exe";
+#ifdef _WIN32
+static const wchar_t *kDefaultExt = L".exe";
+static const int kDefaultExtLength = 4;
+#endif
namespace NKey {
enum Enum
@@ -383,8 +386,10 @@ int Main2(
bool yesToAll = parser[NKey::kYes].ThereIs;
- if (archiveName.Right(4).CompareNoCase(defaultExt) != 0)
- archiveName += defaultExt;
+ #ifdef _WIN32
+ if (archiveName.Right(kDefaultExtLength).CompareNoCase(kDefaultExt) != 0)
+ archiveName += kDefaultExt;
+ #endif
// NExtractMode::EEnum extractMode;
// bool isExtractGroupCommand = command.IsFromExtractGroup(extractMode);
diff --git a/7zip/Bundles/SFXSetup/ExtractCallback.cpp b/7zip/Bundles/SFXSetup/ExtractCallback.cpp
index ea4cc9bb..dfa66e43 100755
--- a/7zip/Bundles/SFXSetup/ExtractCallback.cpp
+++ b/7zip/Bundles/SFXSetup/ExtractCallback.cpp
@@ -23,9 +23,9 @@ static LPCWSTR kErrorTitle = L"7-Zip";
static LPCWSTR kCantDeleteFile = L"Can not delete output file";
static LPCWSTR kCantOpenFile = L"Can not open output file";
static LPCWSTR kUnsupportedMethod = L"Unsupported Method";
-static LPCWSTR kCRCFailed = L"CRC Failed";
-static LPCWSTR kDataError = L"Data Error";
-// static LPCTSTR kUnknownError = TEXT("Unknown Error");
+// static LPCWSTR kCRCFailed = L"CRC Failed";
+// static LPCWSTR kDataError = L"Data Error";
+// static LPCWSTR kUnknownError = L""Unknown Error";
void CExtractCallbackImp::Init(IInArchive *archiveHandler,
const UString &directoryPath,
@@ -33,7 +33,8 @@ void CExtractCallbackImp::Init(IInArchive *archiveHandler,
const FILETIME &utcLastWriteTimeDefault,
UInt32 attributesDefault)
{
- _numErrors = 0;
+ _message.Empty();
+ _isCorrupt = false;
_itemDefaultName = itemDefaultName;
_utcLastWriteTimeDefault = utcLastWriteTimeDefault;
_attributesDefault = attributesDefault;
@@ -170,14 +171,8 @@ STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index,
{
if (!NDirectory::DeleteFileAlways(fullProcessedPath))
{
- #ifdef _SILENT
_message = kCantDeleteFile;
- #else
- MessageBoxW(0, kCantDeleteFile, kErrorTitle, 0);
- #endif
- // g_StdOut << GetOemString(fullProcessedPath);
- // return E_ABORT;
- return E_ABORT;
+ return E_FAIL;
}
}
@@ -187,12 +182,8 @@ STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index,
CMyComPtr<ISequentialOutStream> outStreamLoc(_outFileStreamSpec);
if (!_outFileStreamSpec->Create(fullProcessedPath, true))
{
- #ifdef _SILENT
_message = kCantOpenFile;
- #else
- MessageBoxW(0, kCantOpenFile, kErrorTitle, 0);
- #endif
- return E_ABORT;
+ return E_FAIL;
}
_outFileStream = outStreamLoc;
*outStream = outStreamLoc.Detach();
@@ -228,30 +219,23 @@ STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 resultEOperationResul
}
default:
{
- _numErrors++;
- UString errorMessage;
_outFileStream.Release();
switch(resultEOperationResult)
{
case NArchive::NExtract::NOperationResult::kUnSupportedMethod:
- errorMessage = kUnsupportedMethod;
+ _message = kUnsupportedMethod;
break;
case NArchive::NExtract::NOperationResult::kCRCError:
- errorMessage = kCRCFailed;
+ _isCorrupt = true;
+ // _message = kCRCFailed;
break;
case NArchive::NExtract::NOperationResult::kDataError:
- errorMessage = kDataError;
+ _isCorrupt = true;
+ // _message = kDataError;
break;
- /*
default:
- errorMessage = kUnknownError;
- */
+ _isCorrupt = true;
}
- #ifdef _SILENT
- _message = errorMessage;
- #else
- MessageBoxW(0, errorMessage, kErrorTitle, 0);
- #endif
return E_FAIL;
}
}
@@ -263,4 +247,3 @@ STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 resultEOperationResul
return S_OK;
}
-
diff --git a/7zip/Bundles/SFXSetup/ExtractCallback.h b/7zip/Bundles/SFXSetup/ExtractCallback.h
index b983e90b..f3880890 100755
--- a/7zip/Bundles/SFXSetup/ExtractCallback.h
+++ b/7zip/Bundles/SFXSetup/ExtractCallback.h
@@ -11,15 +11,12 @@
#include "../../Archive/IArchive.h"
#include "../../Common/FileStreams.h"
-// #include "../../Common/ZipSettings.h"
#include "../../ICoder.h"
#ifndef _NO_PROGRESS
#include "../../FileManager/Resource/ProgressDialog/ProgressDialog.h"
#endif
-// #include "../../Explorer/MyMessages.h"
-
class CExtractCallbackImp:
public IArchiveExtractCallback,
public CMyUnknownImp
@@ -67,9 +64,8 @@ public:
CProgressDialog ProgressDialog;
#endif
- #ifdef _SILENT
+ bool _isCorrupt;
UString _message;
- #endif
void Init(IInArchive *archiveHandler,
const UString &directoryPath,
@@ -77,8 +73,6 @@ public:
const FILETIME &utcLastWriteTimeDefault,
UInt32 attributesDefault);
- UInt64 _numErrors;
-
#ifndef _NO_PROGRESS
HRESULT StartProgressDialog(const UString &title)
{
@@ -92,7 +86,6 @@ public:
}
ProgressDialog.Show(SW_SHOWNORMAL);
- // _progressDialog.Start(m_ParentWindow, PROGDLG_MODAL | PROGDLG_AUTOTIME);
return S_OK;
}
virtual ~CExtractCallbackImp() { ProgressDialog.Destroy(); }
diff --git a/7zip/Bundles/SFXSetup/ExtractEngine.cpp b/7zip/Bundles/SFXSetup/ExtractEngine.cpp
index b98de9f3..19fcb0d2 100755
--- a/7zip/Bundles/SFXSetup/ExtractEngine.cpp
+++ b/7zip/Bundles/SFXSetup/ExtractEngine.cpp
@@ -1,4 +1,4 @@
-// ExtractEngine.h
+// ExtractEngine.cpp
#include "StdAfx.h"
@@ -21,7 +21,6 @@ using namespace NWindows;
struct CThreadExtracting
{
- // CMyComPtr<IInArchive> ArchiveHandler;
CArchiveLink ArchiveLink;
CExtractCallbackImp *ExtractCallbackSpec;
@@ -29,12 +28,15 @@ struct CThreadExtracting
#ifndef _NO_PROGRESS
HRESULT Result;
-
+
+ HRESULT Extract()
+ {
+ return ArchiveLink.GetArchive()->Extract(0, (UInt32)-1 , BoolToInt(false), ExtractCallback);
+ }
DWORD Process()
{
ExtractCallbackSpec->ProgressDialog.WaitCreating();
- Result = ArchiveLink.GetArchive()->Extract(0, (UInt32)-1 , BoolToInt(false),
- ExtractCallback);
+ Result = Extract();
ExtractCallbackSpec->ProgressDialog.MyClose();
return 0;
}
@@ -45,26 +47,22 @@ struct CThreadExtracting
#endif
};
-static const LPCTSTR kCantFindArchive = TEXT("Can not find archive file");
-static const LPCTSTR kCantOpenArchive = TEXT("File is not correct archive");
+static const LPCWSTR kCantFindArchive = L"Can not find archive file";
+static const LPCWSTR kCantOpenArchive = L"File is not correct archive";
HRESULT ExtractArchive(
const UString &fileName,
const UString &folderName,
- COpenCallbackGUI *openCallback
- #ifdef _SILENT
- , UString &resultMessage
- #endif
- )
+ COpenCallbackGUI *openCallback,
+ bool showProgress,
+ bool &isCorrupt,
+ UString &errorMessage)
{
+ isCorrupt = false;
NFile::NFind::CFileInfoW archiveFileInfo;
if (!NFile::NFind::FindFile(fileName, archiveFileInfo))
{
- #ifndef _SILENT
- MessageBox(0, kCantFindArchive, TEXT("7-Zip"), 0);
- #else
- resultMessage = kCantFindArchive;
- #endif
+ errorMessage = kCantFindArchive;
return E_FAIL;
}
@@ -72,18 +70,10 @@ HRESULT ExtractArchive(
HRESULT result = MyOpenArchive(fileName, extracter.ArchiveLink, openCallback);
- /*
- CArchiverInfo archiverInfoResult;
- int subExtIndex;
- HRESULT result = OpenArchive(fileName, &extracter.ArchiveHandler,
- archiverInfoResult, subExtIndex, NULL);
- */
if (result != S_OK)
{
- #ifdef _SILENT
- resultMessage = kCantOpenArchive;
- #endif
- return E_FAIL;
+ errorMessage = kCantOpenArchive;
+ return result;
}
UString directoryPath = folderName;
@@ -105,54 +95,45 @@ HRESULT ExtractArchive(
if(!NFile::NDirectory::CreateComplexDirectory(directoryPath))
{
- #ifndef _SILENT
- MyMessageBox(MyFormatNew(IDS_CANNOT_CREATE_FOLDER,
+ errorMessage = MyFormatNew(IDS_CANNOT_CREATE_FOLDER,
#ifdef LANG
0x02000603,
#endif
- directoryPath));
- #else
- resultMessage = TEXT("Can not create output folder");
- #endif
+ directoryPath);
return E_FAIL;
}
extracter.ExtractCallbackSpec = new CExtractCallbackImp;
extracter.ExtractCallback = extracter.ExtractCallbackSpec;
- // anExtractCallBackSpec->StartProgressDialog();
-
- // anExtractCallBackSpec->m_ProgressDialog.ShowWindow(SW_SHOWNORMAL);
-
extracter.ExtractCallbackSpec->Init(
extracter.ArchiveLink.GetArchive(),
directoryPath, L"Default", archiveFileInfo.LastWriteTime, 0);
#ifndef _NO_PROGRESS
- CThread thread;
- if (!thread.Create(CThreadExtracting::MyThreadFunction, &extracter))
- throw 271824;
-
- UString title;
- #ifdef LANG
- title = LangLoadString(IDS_PROGRESS_EXTRACTING, 0x02000890);
- #else
- title = NWindows::MyLoadStringW(IDS_PROGRESS_EXTRACTING);
- #endif
- extracter.ExtractCallbackSpec->StartProgressDialog(title);
- return extracter.Result;
-
- #else
+ if (showProgress)
+ {
+ CThread thread;
+ if (!thread.Create(CThreadExtracting::MyThreadFunction, &extracter))
+ throw 271824;
+
+ UString title;
+ #ifdef LANG
+ title = LangLoadString(IDS_PROGRESS_EXTRACTING, 0x02000890);
+ #else
+ title = NWindows::MyLoadStringW(IDS_PROGRESS_EXTRACTING);
+ #endif
+ extracter.ExtractCallbackSpec->StartProgressDialog(title);
+ result = extracter.Result;
+ }
+ else
- result = extracter.ArchiveHandler->Extract(0, (UInt32)-1,
- BoolToInt(false), extracter.ExtractCallback);
- #ifdef _SILENT
- resultMessage = extracter.ExtractCallbackSpec->_message;
#endif
+ {
+ result = extracter.Extract();
+ }
+ errorMessage = extracter.ExtractCallbackSpec->_message;
+ isCorrupt = extracter.ExtractCallbackSpec->_isCorrupt;
return result;
- #endif
}
-
-
-
diff --git a/7zip/Bundles/SFXSetup/ExtractEngine.h b/7zip/Bundles/SFXSetup/ExtractEngine.h
index c1b670e2..595d2b29 100755
--- a/7zip/Bundles/SFXSetup/ExtractEngine.h
+++ b/7zip/Bundles/SFXSetup/ExtractEngine.h
@@ -9,11 +9,9 @@
HRESULT ExtractArchive(
const UString &fileName,
const UString &folderName,
- COpenCallbackGUI *openCallback
- #ifdef _SILENT
- , UString &resultMessage
- #endif
- );
+ COpenCallbackGUI *openCallback,
+ bool showProgress,
+ bool &isCorrupt,
+ UString &errorMessage);
#endif
-
diff --git a/7zip/Bundles/SFXSetup/Main.cpp b/7zip/Bundles/SFXSetup/Main.cpp
index 72cae080..abc34506 100755
--- a/7zip/Bundles/SFXSetup/Main.cpp
+++ b/7zip/Bundles/SFXSetup/Main.cpp
@@ -14,6 +14,7 @@
#include "Windows/FileFind.h"
#include "Windows/FileName.h"
#include "Windows/DLL.h"
+#include "Windows/ResourceString.h"
#include "../../IPassword.h"
#include "../../ICoder.h"
@@ -24,13 +25,16 @@
#include "ExtractEngine.h"
-
-HINSTANCE g_hInstance;
+#include "resource.h"
using namespace NWindows;
+HINSTANCE g_hInstance;
+
static LPCTSTR kTempDirPrefix = TEXT("7zS");
+#define _SHELL_EXECUTE
+
static bool ReadDataString(LPCWSTR fileName, LPCSTR startID,
LPCSTR endID, AString &stringResult)
{
@@ -143,17 +147,14 @@ int APIENTRY WinMain(
InitCommonControls();
UString archiveName, switches;
+ #ifdef _SHELL_EXECUTE
+ UString executeFile, executeParameters;
+ #endif
NCommandLineParser::SplitCommandLine(GetCommandLineW(), archiveName, switches);
UString fullPath;
NDLL::MyGetModuleFileName(g_hInstance, fullPath);
- AString config;
- if (!ReadDataString(fullPath, kStartID, kEndID, config))
- {
- MyMessageBox(L"Can't load config info");
- return 1;
- }
switches.Trim();
bool assumeYes = false;
if (switches.Left(2).CompareNoCase(UString(L"-y")) == 0)
@@ -163,21 +164,34 @@ int APIENTRY WinMain(
switches.Trim();
}
-#ifdef _SHELL_EXECUTE
- bool executeMode = false;
-#endif
+ AString config;
+ if (!ReadDataString(fullPath, kStartID, kEndID, config))
+ {
+ if (!assumeYes)
+ MyMessageBox(L"Can't load config info");
+ return 1;
+ }
+
+ UString dirPrefix = L".\\";
UString appLaunched;
+ bool showProgress = true;
if (!config.IsEmpty())
{
CObjectVector<CTextConfigPair> pairs;
if (!GetTextConfig(config, pairs))
{
- MyMessageBox(L"Config failed");
+ if (!assumeYes)
+ MyMessageBox(L"Config failed");
return 1;
}
UString friendlyName = GetTextConfigValue(pairs, L"Title");
UString installPrompt = GetTextConfigValue(pairs, L"BeginPrompt");
-
+ UString progress = GetTextConfigValue(pairs, L"Progress");
+ if (progress.CompareNoCase(L"no") == 0)
+ showProgress = false;
+ int index = FindTextConfigItem(pairs, L"Directory");
+ if (index >= 0)
+ dirPrefix = pairs[index].String;
if (!installPrompt.IsEmpty() && !assumeYes)
{
if (MessageBoxW(0, installPrompt, friendlyName, MB_YESNO |
@@ -185,33 +199,41 @@ int APIENTRY WinMain(
return 0;
}
appLaunched = GetTextConfigValue(pairs, L"RunProgram");
-#ifdef _SHELL_EXECUTE
- if (appLaunched.IsEmpty())
- {
- executeMode = true;
- appLaunched = GetTextConfigValue(pairs, L"Execute");
- }
-#endif
+
+ #ifdef _SHELL_EXECUTE
+ executeFile = GetTextConfigValue(pairs, L"ExecuteFile");
+ executeParameters = GetTextConfigValue(pairs, L"ExecuteParameters") + switches;
+ #endif
}
NFile::NDirectory::CTempDirectory tempDir;
if (!tempDir.Create(kTempDirPrefix))
{
- MyMessageBox(L"Can not create temp folder archive");
+ if (!assumeYes)
+ MyMessageBox(L"Can not create temp folder archive");
return 1;
}
COpenCallbackGUI openCallback;
UString tempDirPath = GetUnicodeString(tempDir.GetPath());
- HRESULT result = ExtractArchive(fullPath, tempDirPath, &openCallback);
+ bool isCorrupt = false;
+ UString errorMessage;
+ HRESULT result = ExtractArchive(fullPath, tempDirPath, &openCallback, showProgress,
+ isCorrupt, errorMessage);
if (result != S_OK)
{
- if (result == S_FALSE)
- MyMessageBox(L"Can not open archive");
- else if (result != E_ABORT)
- ShowErrorMessage(result);
+ if (!assumeYes)
+ {
+ if (result == S_FALSE || isCorrupt)
+ {
+ errorMessage = NWindows::MyLoadStringW(IDS_EXTRACTION_ERROR_MESSAGE);
+ result = E_FAIL;
+ }
+ if (result != E_ABORT && !errorMessage.IsEmpty())
+ ::MessageBoxW(0, errorMessage, NWindows::MyLoadStringW(IDS_EXTRACTION_ERROR_TITLE), MB_ICONERROR);
+ }
return 1;
}
@@ -220,30 +242,11 @@ int APIENTRY WinMain(
if (!SetCurrentDirectory(tempDir.GetPath()))
return 1;
- if (appLaunched.IsEmpty())
- {
- appLaunched = L"setup.exe";
- if (!NFile::NFind::DoesFileExist(GetSystemString(appLaunched)))
- {
- MyMessageBox(L"Can not find setup.exe");
- return 1;
- }
- }
-
- {
- UString s2 = tempDirPath;
- NFile::NName::NormalizeDirPathPrefix(s2);
- appLaunched.Replace(L"%%T\\", s2);
- }
-
- appLaunched.Replace(L"%%T", tempDirPath);
-
-
HANDLE hProcess = 0;
#ifdef _SHELL_EXECUTE
- if (executeMode)
+ if (!executeFile.IsEmpty())
{
- CSysString filePath = GetSystemString(appLaunched);
+ CSysString filePath = GetSystemString(executeFile);
SHELLEXECUTEINFO execInfo;
execInfo.cbSize = sizeof(execInfo);
execInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT;
@@ -251,11 +254,14 @@ int APIENTRY WinMain(
execInfo.lpVerb = NULL;
execInfo.lpFile = filePath;
- CSysString switchesSys = GetSystemString(switches);
- if (switchesSys.IsEmpty())
+ if (!switches.IsEmpty())
+ executeParameters += switches;
+
+ CSysString parametersSys = GetSystemString(executeParameters);
+ if (parametersSys.IsEmpty())
execInfo.lpParameters = NULL;
else
- execInfo.lpParameters = switchesSys;
+ execInfo.lpParameters = parametersSys;
execInfo.lpDirectory = NULL;
execInfo.nShow = SW_SHOWNORMAL;
@@ -264,7 +270,8 @@ int APIENTRY WinMain(
result = (UINT32)execInfo.hInstApp;
if(result <= 32)
{
- MyMessageBox(L"Can not open file");
+ if (!assumeYes)
+ MyMessageBox(L"Can not open file");
return 1;
}
hProcess = execInfo.hProcess;
@@ -272,6 +279,25 @@ int APIENTRY WinMain(
else
#endif
{
+ if (appLaunched.IsEmpty())
+ {
+ appLaunched = L"setup.exe";
+ if (!NFile::NFind::DoesFileExist(GetSystemString(appLaunched)))
+ {
+ if (!assumeYes)
+ MyMessageBox(L"Can not find setup.exe");
+ return 1;
+ }
+ }
+
+ {
+ UString s2 = tempDirPath;
+ NFile::NName::NormalizeDirPathPrefix(s2);
+ appLaunched.Replace(L"%%T\\", s2);
+ }
+
+ appLaunched.Replace(L"%%T", tempDirPath);
+
if (!switches.IsEmpty())
{
appLaunched += L' ';
@@ -288,14 +314,15 @@ int APIENTRY WinMain(
PROCESS_INFORMATION processInformation;
- CSysString appLaunchedSys = CSysString(TEXT(".\\")) + GetSystemString(appLaunched);
+ CSysString appLaunchedSys = GetSystemString(dirPrefix + appLaunched);
BOOL createResult = CreateProcess(NULL, (LPTSTR)(LPCTSTR)appLaunchedSys,
NULL, NULL, FALSE, 0, NULL, NULL /*tempDir.GetPath() */,
&startupInfo, &processInformation);
if (createResult == 0)
{
- ShowLastErrorMessage();
+ if (!assumeYes)
+ ShowLastErrorMessage();
return 1;
}
::CloseHandle(processInformation.hThread);
diff --git a/7zip/Bundles/SFXSetup/resource.h b/7zip/Bundles/SFXSetup/resource.h
index 94102b5d..2c7e5a22 100755
--- a/7zip/Bundles/SFXSetup/resource.h
+++ b/7zip/Bundles/SFXSetup/resource.h
@@ -1,4 +1,6 @@
#define IDI_ICON3 159
+#define IDS_EXTRACTION_ERROR_TITLE 7
+#define IDS_EXTRACTION_ERROR_MESSAGE 8
#define IDS_CANNOT_CREATE_FOLDER 9
#define IDS_PROGRESS_EXTRACTING 69
diff --git a/7zip/Bundles/SFXSetup/resource.rc b/7zip/Bundles/SFXSetup/resource.rc
index 5dfa9d0c..4bf6a585 100755
--- a/7zip/Bundles/SFXSetup/resource.rc
+++ b/7zip/Bundles/SFXSetup/resource.rc
@@ -7,6 +7,8 @@ IDI_ICON3 ICON "setup.ico"
STRINGTABLE
BEGIN
+ IDS_EXTRACTION_ERROR_TITLE "Extraction Failed"
+ IDS_EXTRACTION_ERROR_MESSAGE "File is corrupt"
IDS_CANNOT_CREATE_FOLDER "Cannot create folder '{0}'"
IDS_PROGRESS_EXTRACTING "Extracting"
END
diff --git a/7zip/Common/FilePathAutoRename.cpp b/7zip/Common/FilePathAutoRename.cpp
index 3283aa45..3c5b910f 100755
--- a/7zip/Common/FilePathAutoRename.cpp
+++ b/7zip/Common/FilePathAutoRename.cpp
@@ -26,11 +26,15 @@ bool AutoRenamePath(UString &fullProcessedPath)
{
UString path;
int dotPos = fullProcessedPath.ReverseFind(L'.');
- int slashDot1 = fullProcessedPath.ReverseFind(L'\\');
- int slashDot2 = fullProcessedPath.ReverseFind(L'/');
- int slashDot = MyMin(slashDot1, slashDot2);
+
+ int slashPos = fullProcessedPath.ReverseFind(L'/');
+ #ifdef _WIN32
+ int slash1Pos = fullProcessedPath.ReverseFind(L'\\');
+ slashPos = MyMax(slashPos, slash1Pos);
+ #endif
+
UString name, extension;
- if (dotPos > slashDot && dotPos > 0)
+ if (dotPos > slashPos && dotPos > 0)
{
name = fullProcessedPath.Left(dotPos);
extension = fullProcessedPath.Mid(dotPos);
diff --git a/7zip/Compress/Deflate/Deflate.dsp b/7zip/Compress/Deflate/Deflate.dsp
index 965c39a4..ef33fb8c 100755
--- a/7zip/Compress/Deflate/Deflate.dsp
+++ b/7zip/Compress/Deflate/Deflate.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEFLATE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEFLATE_EXPORTS" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEFLATE_EXPORTS" /D "_ST_MODE" /Yu"StdAfx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
@@ -70,7 +70,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEFLATE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEFLATE_EXPORTS" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DEFLATE_EXPORTS" /D "_ST_MODE" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "_DEBUG"
diff --git a/7zip/Compress/Deflate/DeflateDecoder.cpp b/7zip/Compress/Deflate/DeflateDecoder.cpp
index 629d9981..78a4e47f 100755
--- a/7zip/Compress/Deflate/DeflateDecoder.cpp
+++ b/7zip/Compress/Deflate/DeflateDecoder.cpp
@@ -11,7 +11,10 @@ namespace NDecoder {
static const int kLenIdFinished = -1;
static const int kLenIdNeedInit = -2;
-CCoder::CCoder(bool deflate64Mode): _deflate64Mode(deflate64Mode), _keepHistory(false) {}
+CCoder::CCoder(bool deflate64Mode, bool deflateNSIS):
+ _deflate64Mode(deflate64Mode),
+ _deflateNSIS(deflateNSIS),
+ _keepHistory(false) {}
UInt32 CCoder::ReadBits(int numBits)
{
@@ -70,6 +73,8 @@ bool CCoder::ReadTables(void)
int numBitsForAlign = (int)(currentBitPosition > 0 ? (8 - currentBitPosition): 0);
ReadBits(numBitsForAlign);
m_StoredBlockSize = ReadBits(kStoredBlockLengthFieldSize);
+ if (_deflateNSIS)
+ return true;
return (m_StoredBlockSize == (UInt16)~ReadBits(kStoredBlockLengthFieldSize));
}
diff --git a/7zip/Compress/Deflate/DeflateDecoder.h b/7zip/Compress/Deflate/DeflateDecoder.h
index a44833ad..99928b72 100755
--- a/7zip/Compress/Deflate/DeflateDecoder.h
+++ b/7zip/Compress/Deflate/DeflateDecoder.h
@@ -40,6 +40,7 @@ class CCoder:
UInt32 _numDistLevels;
+ bool _deflateNSIS;
bool _deflate64Mode;
bool _keepHistory;
Int32 _remainLen;
@@ -75,7 +76,7 @@ class CCoder:
HRESULT CodeSpec(UInt32 curSize);
public:
- CCoder(bool deflate64Mode);
+ CCoder(bool deflate64Mode, bool deflateNSIS = false);
void SetKeepHistory(bool keepHistory) { _keepHistory = keepHistory; }
HRESULT CodeReal(ISequentialInStream *inStream,
@@ -110,15 +111,19 @@ public:
STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
};
-class CCOMCoder :
- public CCoder
+class CCOMCoder : public CCoder
{
public:
CCOMCoder(): CCoder(false) {}
};
-class CCOMCoder64 :
- public CCoder
+class CNsisCOMCoder : public CCoder
+{
+public:
+ CNsisCOMCoder(): CCoder(false, true) {}
+};
+
+class CCOMCoder64 : public CCoder
{
public:
CCOMCoder64(): CCoder(true) {}
diff --git a/7zip/Compress/Deflate/DllExports.cpp b/7zip/Compress/Deflate/DllExports.cpp
index 9cac0523..cbfc8f44 100755
--- a/7zip/Compress/Deflate/DllExports.cpp
+++ b/7zip/Compress/Deflate/DllExports.cpp
@@ -25,6 +25,11 @@ DEFINE_GUID(CLSID_CCompressDeflateEncoder,
DEFINE_GUID(CLSID_CCompressDeflate64Encoder,
0x23170F69, 0x40C1, 0x278B, 0x04, 0x01, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00);
+
+// {23170F69-40C1-278B-0409-010000000000}
+DEFINE_GUID(CLSID_CCompressDeflateNsisDecoder,
+0x23170F69, 0x40C1, 0x278B, 0x04, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00);
+
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
@@ -43,6 +48,12 @@ STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
return E_NOINTERFACE;
coder = (ICompressCoder *)new NCompress::NDeflate::NDecoder::CCOMCoder();
}
+ else if (*clsid == CLSID_CCompressDeflateNsisDecoder)
+ {
+ if (!correctInterface)
+ return E_NOINTERFACE;
+ coder = (ICompressCoder *)new NCompress::NDeflate::NDecoder::CNsisCOMCoder();
+ }
else if (*clsid == CLSID_CCompressDeflateEncoder)
{
if (!correctInterface)
@@ -81,11 +92,16 @@ struct CDeflateMethodItem
&CLSID_CCompress ## Name ## Decoder, \
&CLSID_CCompress ## Name ## Encoder }
+#define METHOD_ITEM_DE(Name, id1, id2, UserName) \
+ { { 0x04, id1, id2 }, UserName, \
+ &CLSID_CCompress ## Name ## Decoder, NULL }
+
static CDeflateMethodItem g_Methods[] =
{
- METHOD_ITEM(Deflate, 0x08, L"Deflate"),
- METHOD_ITEM(Deflate64, 0x09, L"Deflate64")
+ METHOD_ITEM(Deflate, 0x08, L"Deflate"),
+ METHOD_ITEM(Deflate64, 0x09, L"Deflate64"),
+ METHOD_ITEM_DE(DeflateNsis, 0x09, 0x01, L"DeflateNSIS")
};
STDAPI GetNumberOfMethods(UINT32 *numMethods)
@@ -117,9 +133,12 @@ STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
value->vt = VT_BSTR;
return S_OK;
case NMethodPropID::kEncoder:
- if ((value->bstrVal = ::SysAllocStringByteLen(
+ if (method.Encoder)
+ {
+ if ((value->bstrVal = ::SysAllocStringByteLen(
(const char *)method.Encoder, sizeof(GUID))) != 0)
value->vt = VT_BSTR;
+ }
return S_OK;
}
return S_OK;
diff --git a/7zip/Compress/Deflate/makefile b/7zip/Compress/Deflate/makefile
index e0d3a309..74e243d6 100755
--- a/7zip/Compress/Deflate/makefile
+++ b/7zip/Compress/Deflate/makefile
@@ -1,6 +1,6 @@
PROG = Deflate.dll
DEF_FILE = ../Codec.def
-CFLAGS = $(CFLAGS) -I ../../../
+CFLAGS = $(CFLAGS) -I ../../../ -D_ST_MODE
LIBS = $(LIBS) oleaut32.lib
DEFLATE_OBJS = \
diff --git a/7zip/Compress/LZMA/LZMA.dsp b/7zip/Compress/LZMA/LZMA.dsp
index af3418aa..12842272 100755
--- a/7zip/Compress/LZMA/LZMA.dsp
+++ b/7zip/Compress/LZMA/LZMA.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /Yu"StdAfx.h" /FD /c
+# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /D "_ST_MODE" /Yu"StdAfx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
@@ -70,7 +70,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /Yu"StdAfx.h" /FD /GZ /c
+# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /D "_ST_MODE" /Yu"StdAfx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "_DEBUG"
diff --git a/7zip/Compress/LZMA/makefile b/7zip/Compress/LZMA/makefile
index 14672b6a..aae16966 100755
--- a/7zip/Compress/LZMA/makefile
+++ b/7zip/Compress/LZMA/makefile
@@ -1,6 +1,6 @@
PROG = LZMA.dll
DEF_FILE = ../Codec.def
-CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MF_MT
+CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MF_MT -D_ST_MODE
LIBS = $(LIBS) oleaut32.lib
LZMA_OBJS = \
diff --git a/7zip/Guid.txt b/7zip/Guid.txt
index 4acc9147..664c37f7 100755
--- a/7zip/Guid.txt
+++ b/7zip/Guid.txt
@@ -114,6 +114,7 @@ Handler GUIDs:
06 Lzh
07 7z
08 Cab
+09 Nsis
E7 Iso
E8 Bkf
diff --git a/7zip/MyVersion.h b/7zip/MyVersion.h
index 72af8bae..bffb59bc 100755
--- a/7zip/MyVersion.h
+++ b/7zip/MyVersion.h
@@ -1,7 +1,8 @@
#define MY_VER_MAJOR 4
-#define MY_VER_MINOR 37
-#define MY_VERSION "4.37 beta"
-#define MY_7ZIP_VERSION "7-Zip 4.37 beta"
-#define MY_DATE "2006-03-18"
+#define MY_VER_MINOR 38
+#define MY_VER_BUILD 2
+#define MY_VERSION "4.38 beta"
+#define MY_7ZIP_VERSION "7-Zip 4.38 beta"
+#define MY_DATE "2006-04-13"
#define MY_COPYRIGHT "Copyright (c) 1999-2006 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
diff --git a/7zip/MyVersionInfo.rc b/7zip/MyVersionInfo.rc
index 26d74e9a..fd52d6aa 100755
--- a/7zip/MyVersionInfo.rc
+++ b/7zip/MyVersionInfo.rc
@@ -1,7 +1,7 @@
#include <WinVer.h>
#include "MyVersion.h"
-#define MY_VER MY_VER_MAJOR,MY_VER_MINOR,0,0
+#define MY_VER MY_VER_MAJOR,MY_VER_MINOR,MY_VER_BUILD,0
#ifdef DEBUG
#define DBG_FL VS_FF_DEBUG
diff --git a/7zip/UI/Common/ArchiveCommandLine.cpp b/7zip/UI/Common/ArchiveCommandLine.cpp
index 68937e89..f05abff1 100755
--- a/7zip/UI/Common/ArchiveCommandLine.cpp
+++ b/7zip/UI/Common/ArchiveCommandLine.cpp
@@ -27,13 +27,14 @@ using namespace NCommandLineParser;
using namespace NWindows;
using namespace NFile;
-static const int kNumSwitches = 27;
+static const int kNumSwitches = 28;
namespace NKey {
enum Enum
{
kHelp1 = 0,
kHelp2,
+ kHelp3,
kDisableHeaders,
kDisablePercents,
kArchiveType,
@@ -68,7 +69,12 @@ static const wchar_t kRecursedIDChar = 'R';
static const wchar_t *kRecursedPostCharSet = L"0-";
static const wchar_t *kDefaultArchiveType = L"7z";
-static const wchar_t *kSFXExtension = L"exe";
+static const wchar_t *kSFXExtension =
+ #ifdef _WIN32
+ L"exe";
+ #else
+ L"";
+ #endif
namespace NRecursedPostCharIndex {
enum EEnum
@@ -99,6 +105,7 @@ static const CSwitchForm kSwitchForms[kNumSwitches] =
{
{ L"?", NSwitchType::kSimple, false },
{ L"H", NSwitchType::kSimple, false },
+ { L"-HELP", NSwitchType::kSimple, false },
{ L"BA", NSwitchType::kSimple, false },
{ L"BD", NSwitchType::kSimple, false },
{ L"T", NSwitchType::kUnLimitedPostString, false, 1 },
@@ -711,7 +718,7 @@ void CArchiveCommandLineParser::Parse1(const UStringVector &commandStrings,
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;
+ options.HelpMode = parser[NKey::kHelp1].ThereIs || parser[NKey::kHelp2].ThereIs || parser[NKey::kHelp3].ThereIs;
#ifdef _WIN32
options.LargePages = false;
diff --git a/7zip/UI/Common/ArchiveName.cpp b/7zip/UI/Common/ArchiveName.cpp
index 22fa9ecb..2d50ede1 100755
--- a/7zip/UI/Common/ArchiveName.cpp
+++ b/7zip/UI/Common/ArchiveName.cpp
@@ -34,7 +34,7 @@ UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName)
if (!fileInfo.IsDirectory() && !keepName)
{
int dotPos = resultName.ReverseFind('.');
- if (dotPos >= 0)
+ if (dotPos > 0)
{
UString archiveName2 = resultName.Left(dotPos);
if (archiveName2.ReverseFind('.') < 0)
diff --git a/7zip/UI/Common/ArchiverInfo.cpp b/7zip/UI/Common/ArchiverInfo.cpp
index 428aa405..ac3c8351 100755
--- a/7zip/UI/Common/ArchiverInfo.cpp
+++ b/7zip/UI/Common/ArchiverInfo.cpp
@@ -57,15 +57,15 @@ static UString GetModuleFolderPrefix()
{
UString path;
NDLL::MyGetModuleFileName(g_hInstance, path);
- int pos = path.ReverseFind(L'\\');
+ int pos = path.ReverseFind(WCHAR_PATH_SEPARATOR);
return path.Left(pos + 1);
}
static wchar_t *kFormatFolderName = L"Formats";
-static LPCTSTR kRegistryPath = TEXT("Software\\7-zip");
-static LPCWSTR kProgramPathValue = L"Path";
#ifdef _WIN32
+static LPCTSTR kRegistryPath = TEXT("Software\\7-zip");
+static LPCWSTR kProgramPathValue = L"Path";
static bool ReadPathFromRegistry(HKEY baseKey, UString &path)
{
NRegistry::CKey key;
@@ -244,7 +244,7 @@ void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
#else
UString folderPath = GetBaseFolderPrefixFromRegistry() +
- kFormatFolderName + L"\\";
+ (UString)kFormatFolderName + (UString)WSTRING_PATH_SEPARATOR;
NFind::CEnumeratorW enumerator(folderPath + L"*");
NFind::CFileInfoW fileInfo;
while (enumerator.Next(fileInfo))
diff --git a/7zip/UI/Common/ExtractingFilePath.cpp b/7zip/UI/Common/ExtractingFilePath.cpp
index b1a6d876..a0b17282 100755
--- a/7zip/UI/Common/ExtractingFilePath.cpp
+++ b/7zip/UI/Common/ExtractingFilePath.cpp
@@ -41,14 +41,20 @@ UString GetCorrectPath(const UString &path)
break;
while(result.Length() > first)
{
- if (result[first] == L'\\' || result[first] == L'/')
+ if (
+ #ifdef _WIN32
+ result[first] == L'\\' ||
+ #endif
+ result[first] == L'/')
{
result.Delete(first);
continue;
}
break;
}
+ #ifdef _WIN32
result.Replace(L"..\\", L"");
+ #endif
result.Replace(L"../", L"");
ReplaceDisk(result);
diff --git a/7zip/UI/Common/Update.h b/7zip/UI/Common/Update.h
index ed7e8885..d94ffcc9 100755
--- a/7zip/UI/Common/Update.h
+++ b/7zip/UI/Common/Update.h
@@ -31,7 +31,7 @@ struct CArchivePath
if (Name.IsEmpty())
return;
int dotPos = Name.ReverseFind(L'.');
- if (dotPos < 0)
+ if (dotPos <= 0)
return;
if (dotPos == Name.Length() - 1)
{
diff --git a/7zip/UI/Console/Main.cpp b/7zip/UI/Console/Main.cpp
index 7259a2a6..8322db4f 100755
--- a/7zip/UI/Console/Main.cpp
+++ b/7zip/UI/Console/Main.cpp
@@ -18,6 +18,7 @@
#include "Windows/FileName.h"
#include "Windows/Defs.h"
#include "Windows/Error.h"
+// #include "Windows/System.h"
#ifdef _WIN32
#include "Windows/MemoryLock.h"
#endif
@@ -63,7 +64,9 @@ static const char *kCopyrightString = "\n7-Zip"
static const char *kHelpString =
"\nUsage: 7z"
-#ifdef EXCLUDE_COM
+#ifdef _NO_CRYPTO
+ "r"
+#elif EXCLUDE_COM
"a"
#endif
" <command> [<switches>...] <archive_name> [<file_names>...]\n"
@@ -109,11 +112,6 @@ static const char *kUserErrorMessage = "Incorrect command line"; // NExitCode::
static const wchar_t *kDefaultSfxModule = L"7zCon.sfx";
-static void PrintHelp(CStdOutStream &s)
-{
- s << kHelpString;
-}
-
static void ShowMessageAndThrowException(CStdOutStream &s, LPCSTR message, NExitCode::EEnum code)
{
s << message << endl;
@@ -122,7 +120,7 @@ static void ShowMessageAndThrowException(CStdOutStream &s, LPCSTR message, NExit
static void PrintHelpAndExit(CStdOutStream &s) // yyy
{
- PrintHelp(s);
+ s << kHelpString;
ShowMessageAndThrowException(s, kUserErrorMessage, NExitCode::kUserError);
}
@@ -143,6 +141,20 @@ static void GetArguments(int numArguments, const char *arguments[], UStringVecto
}
#endif
+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";
+ */
+ if (needHelp)
+ s << kHelpString;
+}
+
int Main2(
#ifndef _WIN32
int numArguments, const char *arguments[]
@@ -162,8 +174,7 @@ int Main2(
if(commandStrings.Size() == 1)
{
- g_StdOut << kCopyrightString;
- g_StdOut << kHelpString;
+ ShowCopyrightAndHelp(g_StdOut, true);
return 0;
}
commandStrings.Delete(0);
@@ -176,8 +187,7 @@ int Main2(
if(options.HelpMode)
{
- g_StdOut << kCopyrightString;
- PrintHelp(g_StdOut);
+ ShowCopyrightAndHelp(g_StdOut, true);
return 0;
}
@@ -190,7 +200,7 @@ int Main2(
g_StdStream = &stdStream;
if (options.EnableHeaders)
- stdStream << kCopyrightString;
+ ShowCopyrightAndHelp(stdStream, false);
parser.Parse2(options);
diff --git a/7zip/UI/Console/UserInputUtils.cpp b/7zip/UI/Console/UserInputUtils.cpp
index e8904a75..1ec64dd1 100755
--- a/7zip/UI/Console/UserInputUtils.cpp
+++ b/7zip/UI/Console/UserInputUtils.cpp
@@ -53,6 +53,7 @@ NUserAnswerMode::EEnum ScanUserYesNoAllQuit(CStdOutStream *outStream)
UString GetPassword(CStdOutStream *outStream)
{
(*outStream) << "\nEnter password:";
+ outStream->Flush();
AString oemPassword = g_StdIn.ScanStringUntilNewLine();
return MultiByteToUnicodeString(oemPassword, CP_OEMCP);
}
diff --git a/7zip/UI/Explorer/ContextMenu.cpp b/7zip/UI/Explorer/ContextMenu.cpp
index ca3fd030..7af6e138 100755
--- a/7zip/UI/Explorer/ContextMenu.cpp
+++ b/7zip/UI/Explorer/ContextMenu.cpp
@@ -229,25 +229,11 @@ void CZipContextMenu::FillCommand(ECommandInternalID id,
return;
const CContextMenuCommand &command = g_Commands[i];
commandMapItem.CommandInternalID = command.CommandInternalID;
- commandMapItem.Verb = command.Verb;
+ commandMapItem.Verb = (UString)kMainVerb + (UString)command.Verb;
commandMapItem.HelpString = LangString(command.ResourceHelpID, command.LangID + 1);
mainString = LangString(command.ResourceID, command.LangID);
}
-void CZipContextMenu::FillCommand2(ECommandInternalID id,
- UString &mainString, CCommandMapItem &commandMapItem)
-{
- int i = FindCommand(id);
- if (i < 0)
- return;
- const CContextMenuCommand &command = g_Commands[i];
- commandMapItem.CommandInternalID = command.CommandInternalID;
- commandMapItem.Verb = command.Verb;
- commandMapItem.HelpString = LangString(command.ResourceHelpID, command.LangID + 1);
- mainString = LangString(command.ResourceID, command.LangID);
-}
-
-
static bool MyInsertMenu(CMenu &menu, int pos, UINT id, const UString &s)
{
CMenuItem menuItem;
@@ -397,7 +383,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
{
CCommandMapItem commandMapItem;
UString s;
- FillCommand2(kExtractTo, s, commandMapItem);
+ FillCommand(kExtractTo, s, commandMapItem);
UString folder;
if (_fileNames.Size() == 1)
folder = GetSubFolderNameForExtract(fileInfo.Name);
@@ -446,7 +432,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
{
CCommandMapItem commandMapItem;
UString s;
- FillCommand2(kCompressTo, s, commandMapItem);
+ FillCommand(kCompressTo, s, commandMapItem);
if (_dropMode)
commandMapItem.Folder = _dropPath;
else
@@ -473,7 +459,7 @@ STDMETHODIMP CZipContextMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu,
{
CCommandMapItem commandMapItem;
UString s;
- FillCommand2(kCompressToEmail, s, commandMapItem);
+ FillCommand(kCompressToEmail, s, commandMapItem);
commandMapItem.Archive = archiveName7z;
UString t = UString(L"\"") + GetReducedString(archiveName7z) + UString(L"\"");
s = MyFormatNew(s, t);
@@ -528,55 +514,25 @@ static UString GetProgramCommand()
STDMETHODIMP CZipContextMenu::InvokeCommand(LPCMINVOKECOMMANDINFO commandInfo)
{
+ // ::OutputDebugStringA("1");
int commandOffset;
-
- if(HIWORD(commandInfo->lpVerb) == 0)
- commandOffset = LOWORD(commandInfo->lpVerb);
- else
- commandOffset = FindVerb(GetUnicodeString(commandInfo->lpVerb));
- /*
- #ifdef _UNICODE
- if(commandInfo->cbSize == sizeof(CMINVOKECOMMANDINFOEX))
- {
- if ((commandInfo->fMask & CMIC_MASK_UNICODE) != 0)
- {
- LPCMINVOKECOMMANDINFOEX aCommandInfoEx = (LPCMINVOKECOMMANDINFOEX)commandInfo;
- if(HIWORD(aCommandInfoEx->lpVerb) == 0)
- commandOffset = LOWORD(aCommandInfoEx->lpVerb);
- else
- {
- MessageBox(0, TEXT("1"), TEXT("1"), 0);
- return E_FAIL;
- }
- }
- else
- {
- if(HIWORD(commandInfo->lpVerb) == 0)
- commandOffset = LOWORD(commandInfo->lpVerb);
- else
- commandOffset = FindVerb(commandInfo->lpVerb);
- }
- // return E_FAIL;
- }
- else
+
+ // It's fix for bug: crashing in XP. See example in MSDN: "Creating Context Menu Handlers".
+
+ if (commandInfo->cbSize == sizeof(CMINVOKECOMMANDINFOEX) &&
+ (commandInfo->fMask & CMIC_MASK_UNICODE) != 0)
{
- if(HIWORD(commandInfo->lpVerb) == 0)
+ LPCMINVOKECOMMANDINFOEX commandInfoEx = (LPCMINVOKECOMMANDINFOEX)commandInfo;
+ if(HIWORD(commandInfoEx->lpVerbW) == 0)
commandOffset = LOWORD(commandInfo->lpVerb);
else
- commandOffset = FindVerb(commandInfo->lpVerb);
+ commandOffset = FindVerb(commandInfoEx->lpVerbW);
}
-
- #else
-
- {
+ else
if(HIWORD(commandInfo->lpVerb) == 0)
commandOffset = LOWORD(commandInfo->lpVerb);
else
- commandOffset = FindVerb(commandInfo->lpVerb);
- }
-
- #endif
- */
+ commandOffset = FindVerb(GetUnicodeString(commandInfo->lpVerb));
if(commandOffset < 0 || commandOffset >= _commandMap.Size())
return E_FAIL;
@@ -666,8 +622,7 @@ STDMETHODIMP CZipContextMenu::GetCommandString(UINT_PTR commandOffset, UINT uTyp
}
if(uType == GCS_VERBA || uType == GCS_VERBW)
{
- MyCopyString(pszName, _commandMap[commandOffset].Verb,
- uType == GCS_VERBW);
+ MyCopyString(pszName, _commandMap[commandOffset].Verb, uType == GCS_VERBW);
return NO_ERROR;
}
return E_FAIL;
diff --git a/7zip/UI/Explorer/ContextMenu.h b/7zip/UI/Explorer/ContextMenu.h
index a5a96c07..f3693ca2 100755
--- a/7zip/UI/Explorer/ContextMenu.h
+++ b/7zip/UI/Explorer/ContextMenu.h
@@ -75,8 +75,6 @@ private:
void FillCommand(ECommandInternalID id, UString &mainString,
CCommandMapItem &commandMapItem);
- void FillCommand2(ECommandInternalID id, UString &mainString,
- CCommandMapItem &commandMapItem);
public:
CZipContextMenu();
~CZipContextMenu();
diff --git a/7zip/UI/GUI/CompressDialog.cpp b/7zip/UI/GUI/CompressDialog.cpp
index f25fc51b..211e8cf6 100755
--- a/7zip/UI/GUI/CompressDialog.cpp
+++ b/7zip/UI/GUI/CompressDialog.cpp
@@ -650,7 +650,7 @@ void CCompressDialog::SetArchiveName(const UString &name)
{
int dotPos = fileName.ReverseFind('.');
int slashPos = MyMax(fileName.ReverseFind('\\'), fileName.ReverseFind('/'));
- if (dotPos > slashPos)
+ if (dotPos >= 0 && dotPos > slashPos + 1)
fileName = fileName.Left(dotPos);
}
}
diff --git a/Common/MyWindows.h b/Common/MyWindows.h
index 6df08d6f..9cc0394d 100755
--- a/Common/MyWindows.h
+++ b/Common/MyWindows.h
@@ -7,8 +7,18 @@
#include <windows.h>
+#define CHAR_PATH_SEPARATOR '\\'
+#define WCHAR_PATH_SEPARATOR L'\\'
+#define STRING_PATH_SEPARATOR "\\"
+#define WSTRING_PATH_SEPARATOR L"\\"
+
#else
+#define CHAR_PATH_SEPARATOR '/'
+#define WCHAR_PATH_SEPARATOR L'/'
+#define STRING_PATH_SEPARATOR "/"
+#define WSTRING_PATH_SEPARATOR L"/"
+
#include <stddef.h> // for wchar_t
#include <string.h>
diff --git a/Common/StdOutStream.cpp b/Common/StdOutStream.cpp
index b00fc399..5ab0f10b 100755
--- a/Common/StdOutStream.cpp
+++ b/Common/StdOutStream.cpp
@@ -31,6 +31,13 @@ bool CStdOutStream::Close()
return !_streamIsOpen;
}
+bool CStdOutStream::Flush()
+{
+ if(!_streamIsOpen)
+ return false;
+ return (fflush(_stream) == 0);
+}
+
CStdOutStream::~CStdOutStream ()
{
Close();
diff --git a/Common/StdOutStream.h b/Common/StdOutStream.h
index bf63bb3a..e8aba74a 100755
--- a/Common/StdOutStream.h
+++ b/Common/StdOutStream.h
@@ -17,6 +17,7 @@ public:
~CStdOutStream ();
bool Open(const char *fileName);
bool Close();
+ bool Flush();
CStdOutStream & operator<<(CStdOutStream & (* aFunction)(CStdOutStream &));
CStdOutStream & operator<<(const char *string);
diff --git a/Common/TextConfig.cpp b/Common/TextConfig.cpp
index 8e3a8c49..1d355e8a 100755
--- a/Common/TextConfig.cpp
+++ b/Common/TextConfig.cpp
@@ -120,7 +120,7 @@ bool GetTextConfig(const AString &string, CObjectVector<CTextConfigPair> &pairs)
return true;
}
-int FindItem(const CObjectVector<CTextConfigPair> &pairs, const UString &id)
+int FindTextConfigItem(const CObjectVector<CTextConfigPair> &pairs, const UString &id)
{
for (int i = 0; i < pairs.Size(); i++)
if (pairs[i].ID.Compare(id) == 0)
@@ -130,7 +130,7 @@ int FindItem(const CObjectVector<CTextConfigPair> &pairs, const UString &id)
UString GetTextConfigValue(const CObjectVector<CTextConfigPair> &pairs, const UString &id)
{
- int index = FindItem(pairs, id);
+ int index = FindTextConfigItem(pairs, id);
if (index < 0)
return UString();
return pairs[index].String;
diff --git a/Common/Vector.h b/Common/Vector.h
index 984fddc1..210c385e 100755
--- a/Common/Vector.h
+++ b/Common/Vector.h
@@ -78,6 +78,23 @@ public:
operator[](j) = temp;
}
+ int FindInSorted(const T& item) const
+ {
+ int left = 0, right = Size();
+ while (left != right)
+ {
+ int mid = (left + right) / 2;
+ const T& midValue = (*this)[mid];
+ if (item == midValue)
+ return mid;
+ if (item < midValue)
+ right = mid;
+ else
+ left = mid + 1;
+ }
+ return -1;
+ }
+
void Sort(int left, int right)
{
if (right - left < 2)
diff --git a/Common/Wildcard.cpp b/Common/Wildcard.cpp
index 1923a339..c9fd73f2 100755
--- a/Common/Wildcard.cpp
+++ b/Common/Wildcard.cpp
@@ -8,7 +8,9 @@ static const wchar_t kPeriodChar = L'.';
static const wchar_t kAnyCharsChar = L'*';
static const wchar_t kAnyCharChar = L'?';
+#ifdef _WIN32
static const wchar_t kDirDelimiter1 = L'\\';
+#endif
static const wchar_t kDirDelimiter2 = L'/';
static const UString kWildCardCharSet = L"?*";
@@ -23,7 +25,11 @@ static const UString kIllegalFileNameChars = kIllegalWildCardFileNameChars +
static inline bool IsCharDirLimiter(wchar_t c)
{
- return (c == kDirDelimiter1 || c == kDirDelimiter2);
+ return (
+ #ifdef _WIN32
+ c == kDirDelimiter1 ||
+ #endif
+ c == kDirDelimiter2);
}
// -----------------------------------------
@@ -408,7 +414,7 @@ void CCensor::AddItem(bool include, const UString &path, bool recursive)
if (DoesNameContainWildCard(front))
break;
prefix += front;
- prefix += L'\\';
+ prefix += WCHAR_PATH_SEPARATOR;
pathParts.Delete(0);
}
int index = FindPrefix(prefix);
diff --git a/DOC/7zip.nsi b/DOC/7zip.nsi
index 5a92a48f..8841b64f 100755
--- a/DOC/7zip.nsi
+++ b/DOC/7zip.nsi
@@ -2,7 +2,7 @@
;Defines
!define VERSION_MAJOR 4
-!define VERSION_MINOR 37
+!define VERSION_MINOR 38
!define VERSION_POSTFIX_FULL " beta"
!ifdef WIN64
!ifdef IA64
@@ -53,7 +53,8 @@
;Compressor
!ifndef NO_COMPRESSION
- SetCompressor /SOLID lzma
+ SetCompressor /solid lzma
+ SetCompressorFilter 1
!ifdef IA64
SetCompressorDictSize 8
!else
@@ -67,8 +68,6 @@
;--------------------------------
;Variables
- Var "MyDllPath"
-
;--------------------------------
;Interface Settings
@@ -228,6 +227,8 @@ Section
File sl.txt
File sq.txt
File sr.txt
+ File sr-spc.txt
+ File sr-spl.txt
File sv.txt
File ta.txt
File th.txt
@@ -433,6 +434,8 @@ Section "Uninstall"
Delete $INSTDIR\Lang\sl.txt
Delete $INSTDIR\Lang\sq.txt
Delete $INSTDIR\Lang\sr.txt
+ Delete $INSTDIR\Lang\sr-spc.txt
+ Delete $INSTDIR\Lang\sr-spl.txt
Delete $INSTDIR\Lang\sv.txt
Delete $INSTDIR\Lang\ta.txt
Delete $INSTDIR\Lang\th.txt
diff --git a/DOC/7zip.wxs b/DOC/7zip.wxs
new file mode 100755
index 00000000..2ff6a48e
--- /dev/null
+++ b/DOC/7zip.wxs
@@ -0,0 +1,385 @@
+<?xml version="1.0"?>
+
+<?define VerMajor = "4" ?>
+<?define VerMinor = "38" ?>
+<?define VerBuild = "02" ?>
+<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
+<?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?>
+<?define MmmmVer = "$(var.MmVer).$(var.VerBuild).0" ?>
+<?define UpgradeMinVer = "4.38" ?>
+
+<?define ProductName = "7-Zip" ?>
+
+<?ifndef MyCPU?>
+ <?define MyCPU = "Intel" ?>
+<?endif?>
+
+<?if $(var.MyCPU) = "x64" ?>
+ <?define CpuId = "2" ?>
+ <?define PFilesFolder = "ProgramFiles64Folder" ?>
+ <?define Platforms = "x64" ?>
+ <?define CpuPostfix = " (x64 edition)" ?>
+ <?define Is64 = "yes" ?>
+<?elseif $(var.MyCPU) = "ia64" ?>
+ <?define CpuId = "3" ?>
+ <?define PFilesFolder = "ProgramFiles64Folder" ?>
+ <?define Platforms = "Intel64" ?>
+ <?define CpuPostfix = " (ia64 edition)" ?>
+ <?define Is64 = "yes" ?>
+<?else ?>
+ <?define CpuId = "1" ?>
+ <?define PFilesFolder = "ProgramFilesFolder" ?>
+ <?define Platforms = "Intel" ?>
+ <?define CpuPostfix = "" ?>
+ <?define Is64 = "no" ?>
+<?endif ?>
+
+
+<?define ShellExtId = "{23170F69-40C1-278A-1000-000100020000}" ?>
+
+<?define BaseId = "23170F69-40C1-270$(var.CpuId)" ?>
+<?define BaseIdVer = "$(var.BaseId)-$(var.MmHex)-$(var.VerBuild)00" ?>
+<?define ProductId = "$(var.BaseIdVer)01000000" ?>
+<?define PackageId = "$(var.BaseIdVer)02000000" ?>
+<?define CompId = "$(var.BaseIdVer)030000" ?>
+<?define UpgradeCode = "$(var.BaseId)-0000-000004000000" ?>
+
+<?define CompFm = "$(var.CompId)01" ?>
+<?define CompShellExt = "$(var.CompId)02" ?>
+<?define CompCmdLine = "$(var.CompId)03" ?>
+<?define CompCmdLineA = "$(var.CompId)04" ?>
+<?define CompGui = "$(var.CompId)05" ?>
+<?define CompGuiSfx = "$(var.CompId)06" ?>
+<?define CompConSfx = "$(var.CompId)07" ?>
+<?define CompHelp = "$(var.CompId)08" ?>
+<?define CompDocs = "$(var.CompId)09" ?>
+<?define CompFormats = "$(var.CompId)10" ?>
+<?define CompCodecs = "$(var.CompId)11" ?>
+<?define CompLang = "$(var.CompId)12" ?>
+<?define CompInstallRegCU = "$(var.CompId)80" ?>
+<?define CompInstallRegLM = "$(var.CompId)81" ?>
+<?define CompInstallRegWild = "$(var.CompId)82" ?>
+<?define CompInstallRegDirectory = "$(var.CompId)83" ?>
+<?define CompInstallRegDirDD = "$(var.CompId)84" ?>
+<?define CompInstallRegDriveDD = "$(var.CompId)85" ?>
+<?define CompInstallRegApproved = "$(var.CompId)86" ?>
+<?define CompInstallRegAppPath = "$(var.CompId)87" ?>
+
+
+<?define Manufacturer = "Igor Pavlov" ?>
+<?define HomePage = "http://www.7-zip.org/" ?>
+<?define AboutURL = "$(var.HomePage)" ?>
+<?define UpdatesURL = "$(var.HomePage)download.html" ?>
+<?define SupportURL = "$(var.HomePage)support.html" ?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi">
+ <Product
+ Id="$(var.ProductId)"
+ UpgradeCode="$(var.UpgradeCode)"
+ Name="$(var.ProductName) $(var.MmVer)$(var.CpuPostfix)"
+ Language="1033"
+ Version="$(var.MmmmVer)"
+ Manufacturer="$(var.Manufacturer)">
+
+ <Package
+ Id="$(var.PackageId)"
+ Description="$(var.ProductName)$(var.CpuPostfix) Package"
+ Comments="$(var.ProductName)$(var.CpuPostfix) Package"
+ Manufacturer="$(var.Manufacturer)"
+ InstallerVersion="200"
+ Compressed="yes"
+ Platforms="$(var.Platforms)"
+ />
+
+ <!-- Major upgrade -->
+ <Upgrade Id="$(var.UpgradeCode)">
+ <UpgradeVersion Minimum="$(var.UpgradeMinVer)" IncludeMinimum="yes"
+ Maximum="$(var.MmmmVer)" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED" />
+ </Upgrade>
+
+ <Media Id="1" Cabinet="product.cab" EmbedCab="yes" CompressionLevel="high" />
+
+ <Property Id="INSTALLDIR">
+ <RegistrySearch Id="My7zipPath" Type="raw" Root="HKCU" Key="Software\7-Zip" Name="Path" />
+ </Property>
+
+ <Property Id="ALLUSERS">2</Property>
+
+
+ <Property Id="ARPURLINFOABOUT" Value="$(var.AboutURL)" />
+ <Property Id="ARPHELPLINK" Value="$(var.SupportURL)" />
+ <Property Id="ARPURLUPDATEINFO" Value="$(var.UpdatesURL)" />
+
+
+ <Directory Id="TARGETDIR" Name="SourceDir">
+ <Directory Id="$(var.PFilesFolder)" Name="Files">
+ <Directory Id="INSTALLDIR" Name="7-Zip">
+
+ <Component Id="InstallRegCU" Guid="$(var.CompInstallRegCU)" DiskId="1" Win64="$(var.Is64)">
+ <Registry Id="MyInstallRegCU" Root="HKCU" Key="Software\7-Zip" Name="Path"
+ Action="write" Type="string" Value="[INSTALLDIR]" />
+ </Component>
+ <Component Id="InstallRegLM" Guid="$(var.CompInstallRegLM)" DiskId="1" Win64="$(var.Is64)">
+ <Condition>Privileged</Condition>
+ <Registry Id="MyInstallRegLM" Root="HKLM" Key="Software\7-Zip" Name="Path"
+ Action="write" Type="string" Value="[INSTALLDIR]" />
+ </Component>
+
+
+ <Component Id="InstallRegWild" Guid="$(var.CompInstallRegWild)" DiskId="1" Win64="$(var.Is64)">
+ <Registry Id="MyInstallRegWild" Action="write" Type="string"
+ Root="HKCR" Key="*\shellex\ContextMenuHandlers\7-Zip"
+ Value="$(var.ShellExtId)" />
+ </Component>
+
+ <Component Id="InstallRegDirectory" Guid="$(var.CompInstallRegDirectory)" DiskId="1" Win64="$(var.Is64)">
+ <Registry Id="MyInstallRegDirectory" Action="write" Type="string"
+ Root="HKCR" Key="Directory\shellex\ContextMenuHandlers\7-Zip"
+ Value="$(var.ShellExtId)" />
+ </Component>
+
+ <Component Id="InstallRegDirDD" Guid="$(var.CompInstallRegDirDD)" DiskId="1" Win64="$(var.Is64)">
+ <Registry Id="MyInstallRegDirDD" Action="write" Type="string"
+ Root="HKCR" Key="Directory\shellex\DragDropHandlers\7-Zip"
+ Value="$(var.ShellExtId)" />
+ </Component>
+
+ <Component Id="InstallRegDriveDD" Guid="$(var.CompInstallRegDriveDD)" DiskId="1" Win64="$(var.Is64)">
+ <Registry Id="MyInstallRegDriveDD" Action="write" Type="string"
+ Root="HKCR" Key="Drive\shellex\DragDropHandlers\7-Zip"
+ Value="$(var.ShellExtId)" />
+ </Component>
+
+ <Component Id="InstallRegApproved" Guid="$(var.CompInstallRegApproved)" DiskId="1" Win64="$(var.Is64)">
+ <Condition>Privileged</Condition>
+ <Registry Id="MyInstallRegApproved" Action="write" Type="string"
+ Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved"
+ Name="$(var.ShellExtId)" Value="7-Zip Shell Extension" />
+ </Component>
+
+
+ <Component Id="InstallRegAppPath" Guid="$(var.CompInstallRegAppPath)" DiskId="1" Win64="$(var.Is64)">
+ <Condition>Privileged</Condition>
+ <Registry Id="MyInstallRegAppPath" Action="write" Type="string"
+ Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe"
+ Value="[INSTALLDIR]7zFM.exe" />
+ <Registry Id="MyInstallRegAppPath2" Action="write" Type="string"
+ Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe" Name="Path"
+ Value="[INSTALLDIR]" />
+ </Component>
+
+ <Component Id="Fm" Guid="$(var.CompFm)" DiskId="1" Win64="$(var.Is64)">
+ <File Id="_7zFM.exe" Name="7zFM.exe">
+ <Shortcut Id="startmenuFmShortcut" Directory="PMenu" Name="7zipFM" LongName="7-Zip File Manager" />
+ </File>
+ </Component>
+
+ <Component Id="ShellExt" Guid="$(var.CompShellExt)" DiskId="1" Win64="$(var.Is64)">
+ <File Id="_7zip.dll" Name="7-zip.dll" />
+ <Registry Id="shellReg0" Action="write" Type="string" Root="HKCR"
+ Key="CLSID\$(var.ShellExtId)\InprocServer32"
+ Value="[INSTALLDIR]7-zip.dll" />
+ <Registry Id="shellReg1" Action="write" Type="string" Root="HKCR"
+ Key="CLSID\$(var.ShellExtId)\InprocServer32"
+ Name="ThreadingModel"
+ Value="Apartment" />
+ </Component>
+
+ <Component Id="CmdLine" Guid="$(var.CompCmdLine)" DiskId="1" Win64="$(var.Is64)">
+ <File Id="_7z.exe" Name="7z.exe" />
+ </Component>
+
+
+ <?if $(var.Is64) = "yes" ?>
+
+ <Component Id="CmdLineA" Guid="$(var.CompCmdLineA)" DiskId="1" Win64="$(var.Is64)">
+ <File Id="_7za.exe" Name="7za.exe" />
+ </Component>
+
+ <?endif ?>
+
+
+ <Component Id="Gui" Guid="$(var.CompGui)" DiskId="1" Win64="$(var.Is64)">
+ <File Id="_7zG.exe" Name="7zG.exe" />
+ </Component>
+
+ <Component Id="GuiSfx" Guid="$(var.CompGuiSfx)" DiskId="1" Win64="$(var.Is64)">
+ <File Id="_7z.sfx" Name="7z.sfx" />
+ </Component>
+
+ <Component Id="ConSfx" Guid="$(var.CompConSfx)" DiskId="1" Win64="$(var.Is64)">
+ <File Id="_7zCon.sfx" Name="7zCon.sfx" />
+ </Component>
+
+ <Component Id="Docs" Guid="$(var.CompDocs)" DiskId="1" Win64="$(var.Is64)">
+ <File Id="copying.txt" Name="copying.txt" />
+ <File Id="descript.ion" Name="descript.ion" />
+ <File Id="file_id.diz" Name="file_id.diz" />
+ <File Id="History.txt" Name="History.txt" />
+ <File Id="License.txt" Name="License.txt" />
+ <File Id="readme.txt" Name="readme.txt" />
+ </Component>
+
+
+ <Component Id="Help" Guid="$(var.CompHelp)">
+ <File Id="_7zip.chm" Name="7-zip.chm" DiskId="1" >
+ <Shortcut Id="startmenuHelpShortcut" Directory="PMenu" Name="7zipHelp" LongName="7-Zip Help" />
+ </File>
+ </Component>
+
+ <Directory Id="Formats" Name="Formats">
+ <Component Id="Formats" Guid="$(var.CompFormats)" DiskId="1" Win64="$(var.Is64)">
+ <File Id="_7z.dll" Name="7z.dll" />
+ <File Id="arj.dll" Name="arj.dll" />
+ <File Id="bz2.dll" Name="bz2.dll" />
+ <File Id="cab.dll" Name="cab.dll" />
+ <File Id="chm.dll" Name="chm.dll" />
+ <File Id="cpio.dll" Name="cpio.dll" />
+ <File Id="deb.dll" Name="deb.dll" />
+ <File Id="gz.dll" Name="gz.dll" />
+ <File Id="iso.dll" Name="iso.dll" />
+ <File Id="lzh.dll" Name="lzh.dll" />
+ <File Id="rar.dll" Name="rar.dll" />
+ <File Id="rpm.dll" Name="rpm.dll" />
+ <File Id="split.dll" Name="split.dll" />
+ <File Id="tar.dll" Name="tar.dll" />
+ <File Id="z.dll" Name="z.dll" />
+ <File Id="zip.dll" Name="zip.dll" />
+ </Component>
+ </Directory>
+
+ <Directory Id="Codecs" Name="Codecs">
+ <Component Id="Codecs" Guid="$(var.CompCodecs)" DiskId="1" Win64="$(var.Is64)">
+ <File Id="_7zAES.dll" Name="7zAES.dll" />
+ <File Id="AES.dll" Name="AES.dll" />
+ <File Id="Branch.dll" Name="Branch.dll" />
+ <File Id="BZip2.dll" Name="BZip2.dll" />
+ <File Id="Copy.dll" Name="Copy.dll" />
+ <File Id="Deflate.dll" Name="Deflate.dll" />
+ <File Id="LZMA.dll" Name="LZMA.dll" />
+ <File Id="PPMd.dll" Name="PPMd.dll" />
+ <File Id="Rar29.dll" Name="Rar29.dll" />
+ <File Id="Swap.dll" Name="Swap.dll" />
+ </Component>
+ </Directory>
+
+ <Directory Id="MyLang" Name="Lang">
+ <Component Id="Lang" Guid="$(var.CompLang)" DiskId="1" Win64="$(var.Is64)">
+ <File Id="en.ttt" Name="en.ttt" />
+ <File Id="af.txt" Name="af.txt" />
+ <File Id="ar.txt" Name="ar.txt" />
+ <File Id="ast.txt" Name="ast.txt" />
+ <File Id="az.txt" Name="az.txt" />
+ <File Id="be.txt" Name="be.txt" />
+ <File Id="bg.txt" Name="bg.txt" />
+ <File Id="br.txt" Name="br.txt" />
+ <File Id="ca.txt" Name="ca.txt" />
+ <File Id="cs.txt" Name="cs.txt" />
+ <File Id="da.txt" Name="da.txt" />
+ <File Id="de.txt" Name="de.txt" />
+ <File Id="el.txt" Name="el.txt" />
+ <File Id="eo.txt" Name="eo.txt" />
+ <File Id="es.txt" Name="es.txt" />
+ <File Id="et.txt" Name="et.txt" />
+ <File Id="eu.txt" Name="eu.txt" />
+ <File Id="ext.txt" Name="ext.txt" />
+ <File Id="fa.txt" Name="fa.txt" />
+ <File Id="fi.txt" Name="fi.txt" />
+ <File Id="fr.txt" Name="fr.txt" />
+ <File Id="fur.txt" Name="fur.txt" />
+ <File Id="fy.txt" Name="fy.txt" />
+ <File Id="gl.txt" Name="gl.txt" />
+ <File Id="he.txt" Name="he.txt" />
+ <File Id="hr.txt" Name="hr.txt" />
+ <File Id="hu.txt" Name="hu.txt" />
+ <File Id="id.txt" Name="id.txt" />
+ <File Id="io.txt" Name="io.txt" />
+ <File Id="it.txt" Name="it.txt" />
+ <File Id="ja.txt" Name="ja.txt" />
+ <File Id="ka.txt" Name="ka.txt" />
+ <File Id="ko.txt" Name="ko.txt" />
+ <File Id="lt.txt" Name="lt.txt" />
+ <File Id="lv.txt" Name="lv.txt" />
+ <File Id="mk.txt" Name="mk.txt" />
+ <File Id="mn.txt" Name="mn.txt" />
+ <File Id="ms.txt" Name="ms.txt" />
+ <File Id="nl.txt" Name="nl.txt" />
+ <File Id="no.txt" Name="no.txt" />
+ <File Id="pl.txt" Name="pl.txt" />
+ <File Id="pt.txt" Name="pt.txt" />
+ <File Id="pt_br.txt" Name="pt-br.txt" />
+ <File Id="ro.txt" Name="ro.txt" />
+ <File Id="ru.txt" Name="ru.txt" />
+ <File Id="sk.txt" Name="sk.txt" />
+ <File Id="sl.txt" Name="sl.txt" />
+ <File Id="sq.txt" Name="sq.txt" />
+ <File Id="sr.txt" Name="sr.txt" />
+ <File Id="sr_spl.txt" Name="sr-spl.txt" />
+ <File Id="sr_spc.txt" Name="sr-spc.txt" />
+ <File Id="sv.txt" Name="sv.txt" />
+ <File Id="ta.txt" Name="ta.txt" />
+ <File Id="th.txt" Name="th.txt" />
+ <File Id="tr.txt" Name="tr.txt" />
+ <File Id="tt.txt" Name="tt.txt" />
+ <File Id="uk.txt" Name="uk.txt" />
+ <File Id="uz.txt" Name="uz.txt" />
+ <File Id="va.txt" Name="va.txt" />
+ <File Id="vi.txt" Name="vi.txt" />
+ <File Id="vr.txt" Name="vr.txt" />
+ <File Id="zh_cn.txt" Name="zh-cn.txt" />
+ <File Id="zh_tw.txt" Name="zh-tw.txt" />
+ </Component>
+ </Directory>
+
+
+ </Directory>
+ </Directory>
+
+ <Directory Id="ProgramMenuFolder" Name="PMenu" LongName="Programs">
+ <Directory Id="PMenu" Name="7zip" LongName="7-Zip" />
+ </Directory>
+ </Directory>
+
+ <Feature Id="Complete" Title="7-Zip" Description="The complete package."
+ Display="expand" Level="1" ConfigurableDirectory="INSTALLDIR"
+ Absent="disallow" AllowAdvertise="no" >
+ <Feature Id="Program" Title="Program files" Description="Program files." Level="1"
+ Absent="disallow" AllowAdvertise="no">
+ <ComponentRef Id="Fm" />
+ <ComponentRef Id="ShellExt" />
+ <ComponentRef Id="CmdLine" />
+ <?if $(var.Is64) = "yes" ?>
+ <ComponentRef Id="CmdLineA" />
+ <?endif ?>
+ <ComponentRef Id="Gui" />
+ <ComponentRef Id="GuiSfx" />
+ <ComponentRef Id="ConSfx" />
+ <ComponentRef Id="Codecs" />
+ <ComponentRef Id="Formats" />
+ <ComponentRef Id="Docs" />
+ <ComponentRef Id="Help" />
+ <ComponentRef Id="InstallRegCU" />
+ <ComponentRef Id="InstallRegLM" />
+ <ComponentRef Id="InstallRegWild" />
+ <ComponentRef Id="InstallRegDirectory" />
+ <ComponentRef Id="InstallRegDirDD" />
+ <ComponentRef Id="InstallRegDriveDD" />
+ <ComponentRef Id="InstallRegApproved" />
+ <ComponentRef Id="InstallRegAppPath" />
+
+ </Feature>
+ <Feature Id="LanguageFiles" Title="Localization files" Description="Localization files for 62 languages."
+ Level="1" AllowAdvertise="no">
+ <ComponentRef Id="Lang" />
+ </Feature>
+ </Feature>
+
+ <UIRef Id="WixUI" />
+
+ <!-- Install Sequences -->
+ <InstallExecuteSequence>
+ <RemoveExistingProducts After="InstallValidate" />
+ </InstallExecuteSequence>
+
+ </Product>
+</Wix>
diff --git a/DOC/Methods.txt b/DOC/Methods.txt
index 34e1a5a9..393e1b0c 100755
--- a/DOC/Methods.txt
+++ b/DOC/Methods.txt
@@ -1,9 +1,26 @@
-Compression method IDs (4.27)
+Compression method IDs (4.38)
-----------------------------
Each compression method in 7z has unique binary value (ID).
The length of ID in bytes is arbitrary but it can not exceed 15 bytes.
+If you want to add some new ID, you have two ways:
+1) Write request for allocating IDs to 7-zip developers.
+2) Use such random ID:
+ 03 E0 ZZ ... ZZ MM ... MM VV ... VV
+
+ ZZ != 0, MM != 0, VV != 0
+
+ 03 E0 - Prefix for random IDs
+ ZZ ... ZZ - Developer ID. (length >= 4). Use real random bytes.
+ You can notify 7-Zip developers about your Developer ID.
+ MM ... MM - Method ID (length >= 1)
+ VV ... VV - Version (length >= 1)
+
+ Note: Use new ID (MM ... MM VV .. VV) only if old codec can not decode
+ data encoded with new version.
+
+
List of defined IDs
-------------------
@@ -41,6 +58,10 @@ List of defined IDs
04 - PPMD
01 - Version
+ 80 - reserved for independent developers
+
+ E0 - Random IDs
+
04 - Misc
00 - Reserved
01 - Zip
@@ -63,6 +84,9 @@ List of defined IDs
06 - Lzh
07 - Reserved for 7z
08 - Cab
+ 09 - NSIS
+ 01 - DeflateNSIS
+ 02 - BZip2NSIS
06 - Crypto
diff --git a/DOC/readme.txt b/DOC/readme.txt
index 105b35a0..ec4f8a57 100755
--- a/DOC/readme.txt
+++ b/DOC/readme.txt
@@ -1,4 +1,4 @@
-7-Zip 4.37 Sources
+7-Zip 4.38 Sources
------------------
7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP.
diff --git a/Windows/FileDir.cpp b/Windows/FileDir.cpp
index 3d0430c6..2c8ace90 100755
--- a/Windows/FileDir.cpp
+++ b/Windows/FileDir.cpp
@@ -138,7 +138,7 @@ bool CreateComplexDirectory(LPCTSTR pathName)
bool CreateComplexDirectory(LPCTSTR _aPathName)
{
CSysString pathName = _aPathName;
- int pos = pathName.ReverseFind(TEXT('\\'));
+ int pos = pathName.ReverseFind(TEXT(CHAR_PATH_SEPARATOR));
if (pos > 0 && pos == pathName.Length() - 1)
{
if (pathName.Length() == 3 && pathName[1] == ':')
@@ -160,7 +160,7 @@ bool CreateComplexDirectory(LPCTSTR _aPathName)
return false;
break;
}
- pos = pathName.ReverseFind(TEXT('\\'));
+ pos = pathName.ReverseFind(TEXT(CHAR_PATH_SEPARATOR));
if (pos < 0 || pos == 0)
return false;
if (pathName[pos - 1] == ':')
@@ -170,7 +170,7 @@ bool CreateComplexDirectory(LPCTSTR _aPathName)
pathName = pathName2;
while(pos < pathName.Length())
{
- pos = pathName.Find(TEXT('\\'), pos + 1);
+ pos = pathName.Find(TEXT(CHAR_PATH_SEPARATOR), pos + 1);
if (pos < 0)
pos = pathName.Length();
if(!MyCreateDirectory(pathName.Left(pos)))
@@ -184,7 +184,7 @@ bool CreateComplexDirectory(LPCTSTR _aPathName)
bool CreateComplexDirectory(LPCWSTR _aPathName)
{
UString pathName = _aPathName;
- int pos = pathName.ReverseFind(L'\\');
+ int pos = pathName.ReverseFind(WCHAR_PATH_SEPARATOR);
if (pos > 0 && pos == pathName.Length() - 1)
{
if (pathName.Length() == 3 && pathName[1] == L':')
@@ -206,7 +206,7 @@ bool CreateComplexDirectory(LPCWSTR _aPathName)
return false;
break;
}
- pos = pathName.ReverseFind(L'\\');
+ pos = pathName.ReverseFind(WCHAR_PATH_SEPARATOR);
if (pos < 0 || pos == 0)
return false;
if (pathName[pos - 1] == L':')
@@ -216,7 +216,7 @@ bool CreateComplexDirectory(LPCWSTR _aPathName)
pathName = pathName2;
while(pos < pathName.Length())
{
- pos = pathName.Find(L'\\', pos + 1);
+ pos = pathName.Find(WCHAR_PATH_SEPARATOR, pos + 1);
if (pos < 0)
pos = pathName.Length();
if(!MyCreateDirectory(pathName.Left(pos)))
diff --git a/Windows/FileName.h b/Windows/FileName.h
index 255c06c0..f8567652 100755
--- a/Windows/FileName.h
+++ b/Windows/FileName.h
@@ -9,7 +9,7 @@ namespace NWindows {
namespace NFile {
namespace NName {
-const TCHAR kDirDelimiter = '\\';
+const TCHAR kDirDelimiter = CHAR_PATH_SEPARATOR;
const TCHAR kAnyStringWildcard = '*';
void NormalizeDirPathPrefix(CSysString &dirPath); // ensures that it ended with '\\'