4.30 beta

This commit is contained in:
Igor Pavlov
2005-11-18 00:00:00 +00:00
committed by Kornel Lesiński
parent bcd1db2f5a
commit e18587ba51
214 changed files with 5385 additions and 2712 deletions

View File

@@ -6,6 +6,7 @@
#include "Common/Defs.h"
#include "Common/StringConvert.h"
#include "Common/IntToString.h"
#include "Windows/CommonDialog.h"
#include "Windows/FileDir.h"
#include "Windows/FileName.h"
#include "Windows/ResourceString.h"
@@ -17,6 +18,10 @@
#include "CompressDialog.h"
#ifndef _UNICODE
extern bool g_IsNT;
#endif
#ifdef LANG
#include "../../FileManager/LangUtils.h"
#endif
@@ -206,31 +211,6 @@ static bool IsMethodSupportedBySfx(int methodID)
return false;
};
class CDoubleZeroStringList
{
CRecordVector<int> m_Indexes;
CSysString m_String;
public:
void Add(LPCTSTR s);
void SetForBuffer(LPTSTR buffer);
};
const TCHAR kDelimiterSymbol = TEXT(' ');
void CDoubleZeroStringList::Add(LPCTSTR s)
{
m_String += s;
m_Indexes.Add(m_String.Length());
m_String += kDelimiterSymbol;
}
void CDoubleZeroStringList::SetForBuffer(LPTSTR buffer)
{
lstrcpy(buffer, m_String);
for (int i = 0; i < m_Indexes.Size(); i++)
buffer[m_Indexes[i]] = TEXT('\0');
}
bool CCompressDialog::OnInit()
{
#ifdef LANG
@@ -264,7 +244,7 @@ bool CCompressDialog::OnInit()
for(i = 0; i < m_ArchiverInfoList.Size(); i++)
{
const CArchiverInfo &ai = m_ArchiverInfoList[i];
m_Format.AddString(GetSystemString(ai.Name));
m_Format.AddString(ai.Name);
if (ai.Name.CompareNoCase(m_RegistryInfo.ArchiveType) == 0)
Info.ArchiverInfoIndex = i;
}
@@ -277,10 +257,10 @@ bool CCompressDialog::OnInit()
for(i = 0; i < m_RegistryInfo.HistoryArchives.Size() && i < kHistorySize; i++)
m_ArchivePath.AddString(m_RegistryInfo.HistoryArchives[i]);
m_UpdateMode.AddString(LangLoadString(IDS_COMPRESS_UPDATE_MODE_ADD, 0x02000DA1));
m_UpdateMode.AddString(LangLoadString(IDS_COMPRESS_UPDATE_MODE_UPDATE, 0x02000DA2));
m_UpdateMode.AddString(LangLoadString(IDS_COMPRESS_UPDATE_MODE_FRESH, 0x02000DA3));
m_UpdateMode.AddString(LangLoadString(IDS_COMPRESS_UPDATE_MODE_SYNCHRONIZE, 0x02000DA4));
m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_ADD, 0x02000DA1));
m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_UPDATE, 0x02000DA2));
m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_FRESH, 0x02000DA3));
m_UpdateMode.AddString(LangString(IDS_COMPRESS_UPDATE_MODE_SYNCHRONIZE, 0x02000DA4));
m_UpdateMode.SetCurSel(0);
@@ -311,7 +291,7 @@ void CCompressDialog::UpdatePasswordControl()
{
_passwordControl.SetPasswordChar((IsButtonChecked(
IDC_COMPRESS_CHECK_SHOW_PASSWORD) == BST_CHECKED) ? 0: TEXT('*'));
CSysString password;
UString password;
_passwordControl.GetText(password);
_passwordControl.SetText(password);
}
@@ -434,73 +414,27 @@ void CCompressDialog::OnButtonSFX()
void CCompressDialog::OnButtonSetArchive()
{
const int kBufferSize = MAX_PATH * 2;
TCHAR buffer[kBufferSize];
UString fileName;
m_ArchivePath.GetText(fileName);
fileName.TrimLeft();
fileName.TrimRight();
fileName.Trim();
Info.ArchiveName = fileName;
UString fullFileName;
if (!Info.GetFullPathName(fullFileName))
{
fullFileName = Info.ArchiveName;
// throw "Incorrect archive path";
return;
}
lstrcpy(buffer, GetSystemString(fullFileName));
OPENFILENAME info;
info.lStructSize = sizeof(info);
info.hwndOwner = HWND(*this);
info.hInstance = 0;
const int kFilterBufferSize = MAX_PATH;
TCHAR filterBuffer[kFilterBufferSize];
CDoubleZeroStringList doubleZeroStringList;
// doubleZeroStringList.Add(TEXT("Zip Files (*.zip)"));
// doubleZeroStringList.Add(TEXT("*.zip"));
UString s = LangLoadStringW(IDS_OPEN_TYPE_ALL_FILES, 0x02000DB1);
UString title = LangString(IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE, 0x02000D90);
UString s = LangString(IDS_OPEN_TYPE_ALL_FILES, 0x02000DB1);
s += L" (*.*)";
doubleZeroStringList.Add(GetSystemString(s));
doubleZeroStringList.Add(TEXT("*.*"));
doubleZeroStringList.SetForBuffer(filterBuffer);
info.lpstrFilter = filterBuffer;
info.lpstrCustomFilter = NULL;
info.nMaxCustFilter = 0;
info.nFilterIndex = 0;
info.lpstrFile = buffer;
info.nMaxFile = kBufferSize;
info.lpstrFileTitle = NULL;
info.nMaxFileTitle = 0;
info.lpstrInitialDir= NULL;
CSysString title = LangLoadString(IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE, 0x02000D90);
info.lpstrTitle = title;
info.Flags = OFN_EXPLORER | OFN_HIDEREADONLY;
info.nFileOffset = 0;
info.nFileExtension = 0;
info.lpstrDefExt = NULL;
info.lCustData = 0;
info.lpfnHook = NULL;
info.lpTemplateName = NULL;
if(!GetOpenFileName(&info))
UString resPath;
if (!MyGetOpenFileName(HWND(*this), title, fullFileName, s, resPath))
return;
m_ArchivePath.SetText(buffer);
m_ArchivePath.SetText(resPath);
}
// in ExtractDialog.cpp
extern void AddUniqueString(CSysStringVector &strings, const CSysString &srcString);
extern void AddUniqueString(UStringVector &strings, const UString &srcString);
void CCompressDialog::OnOK()
@@ -512,7 +446,7 @@ void CCompressDialog::OnOK()
m_ArchivePath.GetText(s);
s.Trim();
m_RegistryInfo.HistoryArchives.Clear();
AddUniqueString(m_RegistryInfo.HistoryArchives, GetSystemString(s));
AddUniqueString(m_RegistryInfo.HistoryArchives, s);
Info.ArchiveName = s;
Info.UpdateMode = NCompressDialog::NUpdateMode::EEnum(m_UpdateMode.GetCurSel());
@@ -520,7 +454,7 @@ void CCompressDialog::OnOK()
Info.Dictionary = GetDictionarySpec();
Info.Order = GetOrderSpec();
Info.OrderMode = GetOrderMode();
Info.Method = GetUnicodeString(GetMethodSpec());
Info.Method = GetMethodSpec();
Info.ArchiverInfoIndex = m_Format.GetCurSel();
@@ -543,7 +477,7 @@ void CCompressDialog::OnOK()
for(int i = 0; i < m_ArchivePath.GetCount(); i++)
{
CSysString sTemp;
UString sTemp;
m_ArchivePath.GetLBText(i, sTemp);
sTemp.Trim();
AddUniqueString(m_RegistryInfo.HistoryArchives, sTemp);
@@ -751,7 +685,7 @@ void CCompressDialog::SetLevel()
if ((fi.LevelsMask & (1 << i)) != 0)
{
const CLevelInfo &levelInfo = g_Levels[i];
int index = m_Level.AddString(LangLoadString(levelInfo.ResourceID, levelInfo.LangID));
int index = m_Level.AddString(LangString(levelInfo.ResourceID, levelInfo.LangID));
m_Level.SetItemData(index, i);
}
}
@@ -817,20 +751,19 @@ void CCompressDialog::SetMethod()
int CCompressDialog::GetMethodID()
{
CSysString methodSpec;
m_Method.GetText(methodSpec);
UString methodName = GetUnicodeString(methodSpec);
UString methodName;
m_Method.GetText(methodName);
for (int i = 0; i < MY_SIZE_OF_ARRAY(kMethodsNames); i++)
if (methodName.CompareNoCase(kMethodsNames[i]) == 0)
return i;
return -1;
}
CSysString CCompressDialog::GetMethodSpec()
UString CCompressDialog::GetMethodSpec()
{
if (m_Method.GetCount() <= 1)
return CSysString();
CSysString result;
return UString();
UString result;
m_Method.GetText(result);
return result;
}
@@ -932,7 +865,7 @@ void CCompressDialog::SetDictionary()
else if (level >= 7)
defaultDictionary = (64 << 20);
else if (level >= 5)
defaultDictionary = (24 << 20);
defaultDictionary = (16 << 20);
else
defaultDictionary = (4 << 20);
}
@@ -1020,21 +953,15 @@ void CCompressDialog::SetOrder()
case kLZMA:
{
if (defaultOrder == UInt32(-1))
{
if (level >= 7)
defaultOrder = 64;
else
defaultOrder = 32;
}
int i;
for (i = 3; i < 8; i++)
defaultOrder = (level >= 7) ? 64 : 32;
for (int i = 3; i <= 8; i++)
for (int j = 0; j < 2; j++)
{
UInt32 order = (1 << i) + (j << (i - 1));
if (order < 255)
if (order <= 256)
AddOrder(order);
}
AddOrder(255);
AddOrder(273);
SetNearestSelectComboBox(m_Order, defaultOrder);
break;
}
@@ -1076,14 +1003,14 @@ void CCompressDialog::SetOrder()
defaultOrder = 32;
}
int i;
for (i = 3; i < 8; i++)
for (i = 3; i <= 8; i++)
for (int j = 0; j < 2; j++)
{
UInt32 order = (1 << i) + (j << (i - 1));
if (order < 255)
if (order <= 256)
AddOrder(order);
}
AddOrder(255);
AddOrder(methodID == kDeflate64 ? 257 : 258);
SetNearestSelectComboBox(m_Order, defaultOrder);
break;
}
@@ -1218,7 +1145,7 @@ void CCompressDialog::SaveOptionsInMem()
m_Params.GetText(Info.Options);
Info.Options.Trim();
NCompression::CFormatOptions &fo = m_RegistryInfo.FormatOptionsVector[index];
fo.Options = GetSystemString(Info.Options);
fo.Options = Info.Options;
fo.Level = GetLevelSpec();
fo.Dictionary = GetDictionarySpec();
fo.Order = GetOrderSpec();

View File

@@ -107,7 +107,7 @@ class CCompressDialog: public NWindows::NControl::CModalDialog
void SetMethod();
int GetMethodID();
CSysString GetMethodSpec();
UString GetMethodSpec();
int AddDictionarySize(UInt32 size, bool kilo, bool maga);
int AddDictionarySize(UInt32 size);
@@ -136,7 +136,7 @@ public:
UString OriginalFileName; // for bzip2, gzip2
INT_PTR Create(HWND wndParent = 0)
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_COMPRESS ), wndParent); }
{ return CModalDialog::Create(IDD_DIALOG_COMPRESS, wndParent); }
protected:

View File

@@ -18,9 +18,7 @@
#include "../Common/ZipRegistry.h"
#ifdef LANG
#include "../../FileManager/LangUtils.h"
#endif
#include "../Resource/Extract/resource.h"
#include "../Resource/ExtractDialog/resource.h"
@@ -200,12 +198,14 @@ bool CExtractDialog::OnInit()
#endif
_path.Attach(GetItem(IDC_EXTRACT_COMBO_PATH));
_path.SetText(DirectoryPath);
#ifndef NO_REGISTRY
for(int i = 0; i < extractionInfo.Paths.Size() && i < kHistorySize; i++)
_path.AddString(extractionInfo.Paths[i]);
#endif
/*
if(extractionInfo.Paths.Size() > 0)
_path.SetCurSel(0);
@@ -243,7 +243,7 @@ void CExtractDialog::UpdatePasswordControl()
{
_passwordControl.SetPasswordChar((IsButtonChecked(
IDC_EXTRACT_CHECK_SHOW_PASSWORD) == BST_CHECKED) ? 0: TEXT('*'));
CSysString password;
UString password;
_passwordControl.GetText(password);
_passwordControl.SetText(password);
}
@@ -277,19 +277,11 @@ bool CExtractDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
void CExtractDialog::OnButtonSetPath()
{
CSysString currentPath;
UString currentPath;
_path.GetText(currentPath);
#ifdef LANG
UString title = LangLoadStringW(IDS_EXTRACT_SET_FOLDER, 0x02000881);
#else
UString title = MyLoadStringW(IDS_EXTRACT_SET_FOLDER);
#endif
CSysString resultPath;
if (!NShell::BrowseForFolder(HWND(*this), GetSystemString(title),
currentPath, resultPath))
UString title = LangStringSpec(IDS_EXTRACT_SET_FOLDER, 0x02000881);
UString resultPath;
if (!NShell::BrowseForFolder(HWND(*this), title, currentPath, resultPath))
return;
#ifndef NO_REGISTRY
_path.SetCurSel(-1);
@@ -297,7 +289,7 @@ void CExtractDialog::OnButtonSetPath()
_path.SetText(resultPath);
}
void AddUniqueString(CSysStringVector &list, const CSysString &s)
void AddUniqueString(UStringVector &list, const UString &s)
{
for(int i = 0; i < list.Size(); i++)
if (s.CompareNoCase(list[i]) == 0)
@@ -337,24 +329,20 @@ void CExtractDialog::OnOK()
currentItem = _path.GetCount() - 1;
}
else
{
CSysString sTemp;
_path.GetLBText(currentItem, sTemp);
s = GetUnicodeString(sTemp);
}
_path.GetLBText(currentItem, s);
#endif
s.Trim();
#ifndef _SFX
AddUniqueString(extractionInfo.Paths, GetSystemString(s));
AddUniqueString(extractionInfo.Paths, s);
#endif
DirectoryPath = s;
#ifndef NO_REGISTRY
for(int i = 0; i < _path.GetCount(); i++)
if(i != currentItem)
{
CSysString sTemp;
UString sTemp;
_path.GetLBText(i, sTemp);
sTemp.Trim();
AddUniqueString(extractionInfo.Paths, sTemp);

View File

@@ -71,7 +71,7 @@ public:
NExtract::NOverwriteMode::EEnum OverwriteMode;
INT_PTR Create(HWND aWndParent = 0)
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_EXTRACT), aWndParent); }
{ return CModalDialog::Create(IDD_DIALOG_EXTRACT, aWndParent); }
};
#endif

View File

@@ -13,6 +13,7 @@
#include "../../FileManager/FormatUtils.h"
#include "../../FileManager/ExtractCallback.h"
#include "../../FileManager/LangUtils.h"
#include "../Common/ArchiveExtractCallback.h"
#include "../Explorer/MyMessages.h"
@@ -136,13 +137,8 @@ HRESULT ExtractGUI(
*/
}
UString title =
#ifdef LANG
LangLoadStringW(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING,
UString title = LangStringSpec(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING,
options.TestMode ? 0x02000F90: 0x02000890);
#else
NWindows::MyLoadStringW(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING);
#endif
extracter.ExtractCallbackSpec = extractCallback;
extracter.ExtractCallback = extractCallback;
@@ -163,8 +159,8 @@ HRESULT ExtractGUI(
extracter.ExtractCallbackSpec->NumArchiveErrors == 0)
{
#ifndef _SFX
MessageBoxW(0, LangLoadStringW(IDS_MESSAGE_NO_ERRORS, 0x02000608),
LangLoadStringW(IDS_PROGRESS_TESTING, 0x02000F90), 0);
MessageBoxW(0, LangString(IDS_MESSAGE_NO_ERRORS, 0x02000608),
LangString(IDS_PROGRESS_TESTING, 0x02000F90), 0);
#endif
}
if (extracter.Result != S_OK)

View File

@@ -15,6 +15,9 @@
#include "Windows/Synchronization.h"
#include "Windows/Error.h"
#include "Windows/FileName.h"
#ifdef _WIN32
#include "Windows/MemoryLock.h"
#endif
#include "../../IStream.h"
#include "../../IPassword.h"
@@ -33,6 +36,9 @@
using namespace NWindows;
HINSTANCE g_hInstance;
#ifndef _UNICODE
bool g_IsNT = false;
#endif
static const wchar_t *kExceptionErrorMessage = L"Error:";
static const wchar_t *kUserBreak = L"Break signaled";
@@ -71,6 +77,11 @@ int Main2()
parser.Parse1(commandStrings, options);
parser.Parse2(options);
#ifdef _WIN32
if (options.LargePages)
NSecurity::EnableLockMemoryPrivilege();
#endif
bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
@@ -157,18 +168,20 @@ static bool inline IsItWindowsNT()
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
g_hInstance = hInstance;
InitCommonControls();
ReloadLang();
#ifdef UNICODE
#ifdef _UNICODE
if (!IsItWindowsNT())
{
MyMessageBox(L"This program requires Windows NT/2000/XP/2003");
return NExitCode::kFatalError;
}
#else
g_IsNT = IsItWindowsNT();
#endif
InitCommonControls();
ReloadLang();
// setlocale(LC_COLLATE, ".ACP");
try
{

View File

@@ -332,6 +332,14 @@ SOURCE=..\..\..\Windows\Control\ListView.h
# End Group
# Begin Source File
SOURCE=..\..\..\Windows\CommonDialog.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\CommonDialog.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\DLL.cpp
# End Source File
# Begin Source File
@@ -380,6 +388,14 @@ SOURCE=..\..\..\Windows\FileName.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\MemoryLock.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\MemoryLock.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\PropVariant.cpp
# End Source File
# Begin Source File

View File

@@ -30,7 +30,7 @@ using namespace NWindows;
using namespace NFile;
static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
static const wchar_t *kDefaultSfxModule = L"7zC.sfx";
static const wchar_t *kDefaultSfxModule = L"7z.sfx";
static const wchar_t *kSFXExtension = L"exe";
struct CThreadUpdating
@@ -350,8 +350,7 @@ HRESULT UpdateGUI(
CThread thread;
if (!thread.Create(CThreadUpdating::MyThreadFunction, &tu))
throw 271824;
const UString title = LangLoadStringW(IDS_PROGRESS_COMPRESSING, 0x02000DC0);
tu.UpdateCallbackGUI->StartProgressDialog(title);
tu.UpdateCallbackGUI->StartProgressDialog(LangString(IDS_PROGRESS_COMPRESSING, 0x02000DC0));
return tu.Result;
}

View File

@@ -28,12 +28,14 @@ COMMON_OBJS = \
$O\Wildcard.obj \
WIN_OBJS = \
$O\CommonDialog.obj \
$O\DLL.obj \
$O\Error.obj \
$O\FileDir.obj \
$O\FileFind.obj \
$O\FileIO.obj \
$O\FileName.obj \
$O\MemoryLock.obj \
$O\PropVariant.obj \
$O\PropVariantConversions.obj \
$O\Registry.obj \