mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 02:07:07 -06:00
4.38 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
cb9eea7264
commit
83911c8529
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
}}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace NBootEntryId
|
||||
const Byte kValidationEntry = 1;
|
||||
const Byte kInitialEntryNotBootable = 0;
|
||||
const Byte kInitialEntryBootable = 0x88;
|
||||
};
|
||||
}
|
||||
|
||||
namespace NBootPlatformId
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
if (!dirName.IsEmpty())
|
||||
{
|
||||
char c = dirName[dirName.Length() - 1];
|
||||
if (c != '\\' && c != '/')
|
||||
if (c != '\\')
|
||||
dirName += '\\';
|
||||
}
|
||||
return dirName + GetFileName();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
@@ -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;
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 = \
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 = \
|
||||
|
||||
@@ -114,6 +114,7 @@ Handler GUIDs:
|
||||
06 Lzh
|
||||
07 7z
|
||||
08 Cab
|
||||
09 Nsis
|
||||
|
||||
E7 Iso
|
||||
E8 Bkf
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
|
||||
// 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 ((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;
|
||||
}
|
||||
}
|
||||
LPCMINVOKECOMMANDINFOEX commandInfoEx = (LPCMINVOKECOMMANDINFOEX)commandInfo;
|
||||
if(HIWORD(commandInfoEx->lpVerbW) == 0)
|
||||
commandOffset = LOWORD(commandInfo->lpVerb);
|
||||
else
|
||||
{
|
||||
if(HIWORD(commandInfo->lpVerb) == 0)
|
||||
commandOffset = LOWORD(commandInfo->lpVerb);
|
||||
else
|
||||
commandOffset = FindVerb(commandInfo->lpVerb);
|
||||
}
|
||||
// return E_FAIL;
|
||||
commandOffset = FindVerb(commandInfoEx->lpVerbW);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(HIWORD(commandInfo->lpVerb) == 0)
|
||||
commandOffset = LOWORD(commandInfo->lpVerb);
|
||||
else
|
||||
commandOffset = FindVerb(commandInfo->lpVerb);
|
||||
}
|
||||
|
||||
#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;
|
||||
|
||||
@@ -75,8 +75,6 @@ private:
|
||||
|
||||
void FillCommand(ECommandInternalID id, UString &mainString,
|
||||
CCommandMapItem &commandMapItem);
|
||||
void FillCommand2(ECommandInternalID id, UString &mainString,
|
||||
CCommandMapItem &commandMapItem);
|
||||
public:
|
||||
CZipContextMenu();
|
||||
~CZipContextMenu();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -31,6 +31,13 @@ bool CStdOutStream::Close()
|
||||
return !_streamIsOpen;
|
||||
}
|
||||
|
||||
bool CStdOutStream::Flush()
|
||||
{
|
||||
if(!_streamIsOpen)
|
||||
return false;
|
||||
return (fflush(_stream) == 0);
|
||||
}
|
||||
|
||||
CStdOutStream::~CStdOutStream ()
|
||||
{
|
||||
Close();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
11
DOC/7zip.nsi
11
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
|
||||
|
||||
385
DOC/7zip.wxs
Executable file
385
DOC/7zip.wxs
Executable file
@@ -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>
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)))
|
||||
|
||||
@@ -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 '\\'
|
||||
|
||||
Reference in New Issue
Block a user