4.44 beta

This commit is contained in:
Igor Pavlov
2007-01-20 00:00:00 +00:00
committed by Kornel Lesiński
parent 804edc5756
commit d9666cf046
1331 changed files with 10535 additions and 13791 deletions

View File

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"><assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="7-Zip.7-Zip.7zG" type="win32"/><description>7-Zip GUI.</description><dependency> <dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly></dependency></assembly>

1373
CPP/7zip/UI/GUI/CompressDialog.cpp Executable file
View File

File diff suppressed because it is too large Load Diff

171
CPP/7zip/UI/GUI/CompressDialog.h Executable file
View File

@@ -0,0 +1,171 @@
// CompressDialog.h
#ifndef __COMPRESSDIALOG_H
#define __COMPRESSDIALOG_H
#include "../Common/ZipRegistry.h"
#include "../Common/ArchiverInfo.h"
#include "../Resource/CompressDialog/resource.h"
#include "Windows/Control/Dialog.h"
#include "Windows/Control/Edit.h"
#include "Windows/Control/ComboBox.h"
namespace NCompressDialog
{
namespace NUpdateMode
{
enum EEnum
{
kAdd,
kUpdate,
kFresh,
kSynchronize,
};
}
struct CInfo
{
NUpdateMode::EEnum UpdateMode;
bool SolidIsAllowed;
bool Solid;
bool MultiThreadIsAllowed;
bool MultiThread;
CRecordVector<UInt64> VolumeSizes;
UInt32 Level;
UString Method;
UInt32 Dictionary;
bool OrderMode;
UInt32 Order;
UString Options;
UString EncryptionMethod;
bool SFXMode;
UString ArchiveName; // in: Relative for ; out: abs
UString CurrentDirPrefix;
bool KeepName;
bool GetFullPathName(UString &result) const;
int ArchiverInfoIndex;
UString Password;
bool EncryptHeadersIsAllowed;
bool EncryptHeaders;
void Init()
{
Level = Dictionary = Order = UInt32(-1);
OrderMode = false;
Method.Empty();
Options.Empty();
EncryptionMethod.Empty();
}
CInfo()
{
Init();
}
};
}
class CCompressDialog: public NWindows::NControl::CModalDialog
{
NWindows::NControl::CComboBox m_ArchivePath;
NWindows::NControl::CComboBox m_Format;
NWindows::NControl::CComboBox m_Level;
NWindows::NControl::CComboBox m_Method;
NWindows::NControl::CComboBox m_Dictionary;
NWindows::NControl::CComboBox m_Order;
NWindows::NControl::CComboBox m_UpdateMode;
NWindows::NControl::CComboBox m_Volume;
NWindows::NControl::CDialogChildControl m_Params;
NWindows::NControl::CEdit _password1Control;
NWindows::NControl::CEdit _password2Control;
NWindows::NControl::CComboBox _encryptionMethod;
NCompression::CInfo m_RegistryInfo;
int m_PrevFormat;
void SetArchiveName(const UString &name);
int FindRegistryFormat(const UString &name);
int FindRegistryFormatAlways(const UString &name);
void OnChangeFormat();
void CheckSFXNameChange();
void SetArchiveName2(bool prevWasSFX);
int GetStaticFormatIndex();
void SetNearestSelectComboBox(NWindows::NControl::CComboBox &comboBox, UInt32 value);
void SetLevel();
int GetLevel();
int GetLevelSpec();
int GetLevel2();
bool IsMultiThread();
void SetMethod();
int GetMethodID();
UString GetMethodSpec();
UString GetEncryptionMethodSpec();
bool IsZipFormat();
void SetEncryptionMethod();
int AddDictionarySize(UInt32 size, bool kilo, bool maga);
int AddDictionarySize(UInt32 size);
void SetDictionary();
UInt32 GetDictionary();
UInt32 GetDictionarySpec();
int AddOrder(UInt32 size);
void SetOrder();
bool GetOrderMode();
UInt32 GetOrder();
UInt32 GetOrderSpec();
UInt64 GetMemoryUsage(UInt32 dictionary, bool isMultiThread, UInt64 &decompressMemory);
UInt64 GetMemoryUsage(UInt64 &decompressMemory);
void PrintMemUsage(UINT res, UInt64 value);
void SetMemoryUsage();
void SetParams();
void SaveOptionsInMem();
void UpdatePasswordControl();
bool IsShowPasswordChecked() const
{ return IsButtonChecked(IDC_COMPRESS_CHECK_SHOW_PASSWORD) == BST_CHECKED; }
public:
CObjectVector<CArchiverInfo> m_ArchiverInfoList;
NCompressDialog::CInfo Info;
UString OriginalFileName; // for bzip2, gzip2
INT_PTR Create(HWND wndParent = 0)
{ return CModalDialog::Create(IDD_DIALOG_COMPRESS, wndParent); }
protected:
void CheckSFXControlsEnable();
void CheckVolumeEnable();
void CheckControlsEnable();
void OnButtonSetArchive();
bool IsSFX();
void OnButtonSFX();
virtual bool OnInit();
virtual bool OnCommand(int code, int itemID, LPARAM lParam);
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
virtual void OnOK();
virtual void OnHelp();
};
#endif

371
CPP/7zip/UI/GUI/ExtractDialog.cpp Executable file
View File

@@ -0,0 +1,371 @@
// ExtractDialog.cpp
#include "StdAfx.h"
// #include <HtmlHelp.h>
#include "ExtractDialog.h"
#include "Common/StringConvert.h"
#include "Windows/Shell.h"
#include "Windows/FileName.h"
#include "Windows/FileDir.h"
#include "Windows/ResourceString.h"
#ifndef NO_REGISTRY
#include "../../FileManager/HelpUtils.h"
#endif
#include "../Common/ZipRegistry.h"
#include "../../FileManager/LangUtils.h"
#include "../Resource/Extract/resource.h"
#include "../Resource/ExtractDialog/resource.h"
// #include "Help/Context/Extract.h"
using namespace NWindows;
using namespace NFile;
using namespace NName;
static const int kPathModeButtons[] =
{
IDC_EXTRACT_RADIO_FULL_PATHNAMES,
IDC_EXTRACT_RADIO_CURRENT_PATHNAMES,
IDC_EXTRACT_RADIO_NO_PATHNAMES
};
static const NExtract::NPathMode::EEnum kPathModeButtonsVals[] =
{
NExtract::NPathMode::kFullPathnames,
NExtract::NPathMode::kCurrentPathnames,
NExtract::NPathMode::kNoPathnames
};
static const int kNumPathnamesButtons = sizeof(kPathModeButtons) / sizeof(kPathModeButtons[0]);
static const int kOverwriteButtons[] =
{
IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE,
IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT,
IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES,
IDC_EXTRACT_RADIO_AUTO_RENAME,
IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING,
};
static const NExtract::NOverwriteMode::EEnum kOverwriteButtonsVals[] =
{
NExtract::NOverwriteMode::kAskBefore,
NExtract::NOverwriteMode::kWithoutPrompt,
NExtract::NOverwriteMode::kSkipExisting,
NExtract::NOverwriteMode::kAutoRename,
NExtract::NOverwriteMode::kAutoRenameExisting
};
static const int kNumOverwriteButtons = sizeof(kOverwriteButtons) / sizeof(kOverwriteButtons[0]);
/*
static const int kFilesButtons[] =
{
IDC_EXTRACT_RADIO_SELECTED_FILES,
IDC_EXTRACT_RADIO_ALL_FILES
};
static const int kNumFilesButtons = sizeof(kFilesButtons) / sizeof(kFilesButtons[0]);
*/
#ifndef _SFX
void CExtractDialog::GetPathMode()
{
for (int i = 0; i < kNumPathnamesButtons; i++)
if(IsButtonCheckedBool(kPathModeButtons[i]))
{
PathMode = kPathModeButtonsVals[i];
return;
}
throw 1;
}
void CExtractDialog::SetPathMode()
{
for (int j = 0; j < 2; j++)
{
for (int i = 0; i < kNumPathnamesButtons; i++)
if(PathMode == kPathModeButtonsVals[i])
{
CheckRadioButton(kPathModeButtons[0], kPathModeButtons[kNumPathnamesButtons - 1],
kPathModeButtons[i]);
return;
}
PathMode = kPathModeButtonsVals[0];
}
throw 1;
}
void CExtractDialog::GetOverwriteMode()
{
for (int i = 0; i < kNumOverwriteButtons; i++)
if(IsButtonCheckedBool(kOverwriteButtons[i]))
{
OverwriteMode = kOverwriteButtonsVals[i];
return;
}
throw 0;
}
void CExtractDialog::SetOverwriteMode()
{
for (int j = 0; j < 2; j++)
{
for (int i = 0; i < kNumOverwriteButtons; i++)
if(OverwriteMode == kOverwriteButtonsVals[i])
{
CheckRadioButton(kOverwriteButtons[0], kOverwriteButtons[kNumOverwriteButtons - 1],
kOverwriteButtons[i]);
return;
}
OverwriteMode = kOverwriteButtonsVals[0];
}
throw 1;
}
/*
int CExtractDialog::GetFilesMode() const
{
for (int i = 0; i < kNumFilesButtons; i++)
if(IsButtonCheckedBool(kFilesButtons[i]))
return i;
throw 0;
}
*/
#endif
#ifdef LANG
static CIDLangPair kIDLangPairs[] =
{
{ IDC_STATIC_EXTRACT_EXTRACT_TO, 0x02000801 },
{ IDC_EXTRACT_PATH_MODE, 0x02000810 },
{ IDC_EXTRACT_RADIO_FULL_PATHNAMES, 0x02000811 },
{ IDC_EXTRACT_RADIO_CURRENT_PATHNAMES, 0x02000812 },
{ IDC_EXTRACT_RADIO_NO_PATHNAMES, 0x02000813 },
{ IDC_EXTRACT_OVERWRITE_MODE, 0x02000820 },
{ IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE, 0x02000821 },
{ IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT, 0x02000822 },
{ IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES, 0x02000823 },
{ IDC_EXTRACT_RADIO_AUTO_RENAME, 0x02000824 },
{ IDC_EXTRACT_RADIO_AUTO_RENAME_EXISTING, 0x02000825 },
{ IDC_EXTRACT_FILES, 0x02000830 },
{ IDC_EXTRACT_RADIO_SELECTED_FILES, 0x02000831 },
{ IDC_EXTRACT_RADIO_ALL_FILES, 0x02000832 },
{ IDC_EXTRACT_PASSWORD, 0x02000802 },
{ IDC_EXTRACT_CHECK_SHOW_PASSWORD, 0x02000B02 },
{ IDOK, 0x02000702 },
{ IDCANCEL, 0x02000710 },
{ IDHELP, 0x02000720 }
};
#endif
// static const int kWildcardsButtonIndex = 2;
static const int kHistorySize = 8;
bool CExtractDialog::OnInit()
{
#ifdef LANG
LangSetWindowText(HWND(*this), 0x02000800);
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
#endif
#ifndef _SFX
_passwordControl.Attach(GetItem(IDC_EXTRACT_EDIT_PASSWORD));
_passwordControl.SetText(Password);
_passwordControl.SetPasswordChar(TEXT('*'));
#endif
NExtract::CInfo extractionInfo;
#ifdef NO_REGISTRY
PathMode = NExtract::NPathMode::kFullPathnames;
OverwriteMode = NExtract::NOverwriteMode::kAskBefore;
// extractionInfo.Paths = NExtract::NPathMode::kFullPathnames;
#else
ReadExtractionInfo(extractionInfo);
CheckButton(IDC_EXTRACT_CHECK_SHOW_PASSWORD, extractionInfo.ShowPassword);
UpdatePasswordControl();
PathMode = extractionInfo.PathMode;
OverwriteMode = extractionInfo.OverwriteMode;
#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);
else
_path.SetCurSel(-1);
*/
#ifndef _SFX
SetPathMode();
SetOverwriteMode();
/*
CheckRadioButton(kFilesButtons[0], kFilesButtons[kNumFilesButtons - 1],
kFilesButtons[_filesMode]);
*/
// CWindow selectedFilesWindow = GetItem(IDC_EXTRACT_RADIO_SELECTED_FILES);
// selectedFilesWindow.Enable(_enableSelectedFilesButton);
#endif
// CWindow filesWindow = GetItem(IDC_EXTRACT_RADIO_FILES);
// filesWindow.Enable(_enableFilesButton);
// UpdateWildCardState();
return CModalDialog::OnInit();
}
#ifndef _SFX
void CExtractDialog::UpdatePasswordControl()
{
_passwordControl.SetPasswordChar((IsButtonChecked(
IDC_EXTRACT_CHECK_SHOW_PASSWORD) == BST_CHECKED) ? 0: TEXT('*'));
UString password;
_passwordControl.GetText(password);
_passwordControl.SetText(password);
}
#endif
bool CExtractDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
{
/*
for (int i = 0; i < kNumFilesButtons; i++)
if (buttonID == kFilesButtons[i])
{
UpdateWildCardState();
return true;
}
*/
switch(buttonID)
{
case IDC_EXTRACT_BUTTON_SET_PATH:
OnButtonSetPath();
return true;
#ifndef _SFX
case IDC_EXTRACT_CHECK_SHOW_PASSWORD:
{
UpdatePasswordControl();
return true;
}
#endif
}
return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
}
void CExtractDialog::OnButtonSetPath()
{
UString currentPath;
_path.GetText(currentPath);
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);
#endif
_path.SetText(resultPath);
}
void AddUniqueString(UStringVector &list, const UString &s)
{
for(int i = 0; i < list.Size(); i++)
if (s.CompareNoCase(list[i]) == 0)
return;
list.Add(s);
}
void CExtractDialog::OnOK()
{
#ifndef _SFX
GetPathMode();
GetOverwriteMode();
// _filesMode = (NExtractionDialog::NFilesMode::EEnum)GetFilesMode();
_passwordControl.GetText(Password);
#endif
NExtract::CInfo extractionInfo;
extractionInfo.PathMode = PathMode;
extractionInfo.OverwriteMode = OverwriteMode;
extractionInfo.ShowPassword = (IsButtonChecked(
IDC_EXTRACT_CHECK_SHOW_PASSWORD) == BST_CHECKED);
UString s;
#ifdef NO_REGISTRY
_path.GetText(s);
#else
int currentItem = _path.GetCurSel();
if(currentItem == CB_ERR)
{
_path.GetText(s);
if(_path.GetCount() >= kHistorySize)
currentItem = _path.GetCount() - 1;
}
else
_path.GetLBText(currentItem, s);
#endif
s.Trim();
#ifndef _SFX
AddUniqueString(extractionInfo.Paths, s);
#endif
DirectoryPath = s;
#ifndef NO_REGISTRY
for(int i = 0; i < _path.GetCount(); i++)
if(i != currentItem)
{
UString sTemp;
_path.GetLBText(i, sTemp);
sTemp.Trim();
AddUniqueString(extractionInfo.Paths, sTemp);
}
SaveExtractionInfo(extractionInfo);
#endif
CModalDialog::OnOK();
}
/*
void CExtractDialog::UpdateWildCardState()
{
// UpdateData(TRUE);
// m_Wildcards.EnableWindow(BoolToBOOL(m_Files == kWildcardsButtonIndex));
}
*/
#ifndef NO_REGISTRY
static LPCWSTR kHelpTopic = L"fm/plugins/7-zip/extract.htm";
void CExtractDialog::OnHelp()
{
ShowHelpWindow(NULL, kHelpTopic);
CModalDialog::OnHelp();
}
#endif

77
CPP/7zip/UI/GUI/ExtractDialog.h Executable file
View File

@@ -0,0 +1,77 @@
// ExtractDialog.h
#ifndef __EXTRACTDIALOG_H
#define __EXTRACTDIALOG_H
#include "resource.h"
#include "Windows/Control/Dialog.h"
#include "Windows/Control/Edit.h"
#include "Windows/Control/ComboBox.h"
#ifndef NO_REGISTRY
#include "../Common/ZipRegistry.h"
#endif
#include "../Common/ExtractMode.h"
namespace NExtractionDialog
{
/*
namespace NFilesMode
{
enum EEnum
{
kSelected,
kAll,
kSpecified
};
}
*/
}
class CExtractDialog: public NWindows::NControl::CModalDialog
{
#ifdef NO_REGISTRY
NWindows::NControl::CDialogChildControl _path;
#else
NWindows::NControl::CComboBox _path;
#endif
#ifndef _SFX
NWindows::NControl::CEdit _passwordControl;
#endif
#ifndef _SFX
void GetPathMode();
void SetPathMode();
void GetOverwriteMode();
void SetOverwriteMode();
// int GetFilesMode() const;
void UpdatePasswordControl();
#endif
void OnButtonSetPath();
virtual bool OnInit();
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
virtual void OnOK();
#ifndef NO_REGISTRY
virtual void OnHelp();
#endif
public:
// bool _enableSelectedFilesButton;
// bool _enableFilesButton;
// NExtractionDialog::NFilesMode::EEnum FilesMode;
UString DirectoryPath;
#ifndef _SFX
UString Password;
#endif
NExtract::NPathMode::EEnum PathMode;
NExtract::NOverwriteMode::EEnum OverwriteMode;
INT_PTR Create(HWND aWndParent = 0)
{ return CModalDialog::Create(IDD_DIALOG_EXTRACT, aWndParent); }
};
#endif

172
CPP/7zip/UI/GUI/ExtractGUI.cpp Executable file
View File

@@ -0,0 +1,172 @@
// ExtractGUI.cpp
#include "StdAfx.h"
#include "ExtractGUI.h"
#include "Common/StringConvert.h"
#include "Windows/FileDir.h"
#include "Windows/Error.h"
#include "Windows/FileFind.h"
#include "Windows/Thread.h"
#include "../../FileManager/FormatUtils.h"
#include "../../FileManager/ExtractCallback.h"
#include "../../FileManager/LangUtils.h"
#include "../Common/ArchiveExtractCallback.h"
#include "../Explorer/MyMessages.h"
#include "../Resource/Extract/resource.h"
#include "OpenCallbackGUI.h"
#include "ExtractDialog.h"
using namespace NWindows;
static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
struct CThreadExtracting
{
CExtractCallbackImp *ExtractCallbackSpec;
UStringVector *ArchivePaths;
UStringVector *ArchivePathsFull;
const NWildcard::CCensorNode *WildcardCensor;
const CExtractOptions *Options;
COpenCallbackGUI *OpenCallback;
CMyComPtr<IExtractCallbackUI> ExtractCallback;
UString ErrorMessage;
HRESULT Result;
DWORD Process()
{
ExtractCallbackSpec->ProgressDialog.WaitCreating();
try
{
Result = DecompressArchives(*ArchivePaths, *ArchivePathsFull,
*WildcardCensor, *Options, OpenCallback, ExtractCallback, ErrorMessage);
}
catch(const UString &s)
{
ErrorMessage = s;
Result = E_FAIL;
}
catch(const wchar_t *s)
{
ErrorMessage = s;
Result = E_FAIL;
}
catch(const char *s)
{
ErrorMessage = GetUnicodeString(s);
Result = E_FAIL;
}
catch(...)
{
Result = E_FAIL;
}
ExtractCallbackSpec->ProgressDialog.MyClose();
return 0;
}
static DWORD WINAPI MyThreadFunction(void *param)
{
return ((CThreadExtracting *)param)->Process();
}
};
HRESULT ExtractGUI(
UStringVector &archivePaths,
UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
CExtractOptions &options,
bool showDialog,
COpenCallbackGUI *openCallback,
CExtractCallbackImp *extractCallback)
{
CThreadExtracting extracter;
if (!options.TestMode)
{
UString outputDir = options.OutputDir;
if (outputDir.IsEmpty())
NFile::NDirectory::MyGetCurrentDirectory(outputDir);
if (showDialog)
{
CExtractDialog dialog;
if (!NFile::NDirectory::MyGetFullPathName(outputDir, dialog.DirectoryPath))
{
MyMessageBox(kIncorrectOutDir);
return E_FAIL;
}
NFile::NName::NormalizeDirPathPrefix(dialog.DirectoryPath);
// dialog.OverwriteMode = options.OverwriteMode;
// dialog.PathMode = options.PathMode;
if(dialog.Create(0) != IDOK)
return E_ABORT;
outputDir = dialog.DirectoryPath;
options.OverwriteMode = dialog.OverwriteMode;
options.PathMode = dialog.PathMode;
#ifndef _SFX
openCallback->Password = dialog.Password;
openCallback->PasswordIsDefined = !dialog.Password.IsEmpty();
#endif
}
if (!NFile::NDirectory::MyGetFullPathName(outputDir, options.OutputDir))
{
MyMessageBox(kIncorrectOutDir);
return E_FAIL;
}
NFile::NName::NormalizeDirPathPrefix(options.OutputDir);
/*
if(!NFile::NDirectory::CreateComplexDirectory(options.OutputDir))
{
UString s = GetUnicodeString(NError::MyFormatMessage(GetLastError()));
UString s2 = MyFormatNew(IDS_CANNOT_CREATE_FOLDER,
#ifdef LANG
0x02000603,
#endif
options.OutputDir);
MyMessageBox(s2 + UString(L"\n") + s);
return E_FAIL;
}
*/
}
UString title = LangStringSpec(options.TestMode ? IDS_PROGRESS_TESTING : IDS_PROGRESS_EXTRACTING,
options.TestMode ? 0x02000F90: 0x02000890);
extracter.ExtractCallbackSpec = extractCallback;
extracter.ExtractCallback = extractCallback;
extracter.ExtractCallbackSpec->Init();
extracter.ArchivePaths = &archivePaths;
extracter.ArchivePathsFull = &archivePathsFull;
extracter.WildcardCensor = &wildcardCensor;
extracter.Options = &options;
extracter.OpenCallback = openCallback;
CThread thread;
if (!thread.Create(CThreadExtracting::MyThreadFunction, &extracter))
throw 271824;
extracter.ExtractCallbackSpec->StartProgressDialog(title);
if (extracter.Result == S_OK && options.TestMode &&
extracter.ExtractCallbackSpec->Messages.IsEmpty() &&
extracter.ExtractCallbackSpec->NumArchiveErrors == 0)
{
#ifndef _SFX
MessageBoxW(0, LangString(IDS_MESSAGE_NO_ERRORS, 0x02000608),
LangString(IDS_PROGRESS_TESTING, 0x02000F90), 0);
#endif
}
if (extracter.Result != S_OK)
if (!extracter.ErrorMessage.IsEmpty())
throw extracter.ErrorMessage;
return extracter.Result;
}

20
CPP/7zip/UI/GUI/ExtractGUI.h Executable file
View File

@@ -0,0 +1,20 @@
// GUI/ExtractGUI.h
#ifndef __EXTRACT_GUI_H
#define __EXTRACT_GUI_H
#include "../Common/Extract.h"
#include "OpenCallbackGUI.h"
#include "../../FileManager/ExtractCallback.h"
HRESULT ExtractGUI(
UStringVector &archivePaths,
UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor,
CExtractOptions &options,
bool showDialog,
COpenCallbackGUI *openCallback,
CExtractCallbackImp *extractCallback);
#endif

BIN
CPP/7zip/UI/GUI/FM.ico Executable file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

260
CPP/7zip/UI/GUI/GUI.cpp Executable file
View File

@@ -0,0 +1,260 @@
// GUI.cpp
#include "StdAfx.h"
#include <initguid.h>
#include "Common/NewHandler.h"
#include "Common/StringConvert.h"
#include "Common/CommandLineParser.h"
#include "Common/Exception.h"
#include "Windows/COM.h"
#include "Windows/FileMapping.h"
#include "Windows/FileDir.h"
#include "Windows/Synchronization.h"
#include "Windows/Error.h"
#include "Windows/FileName.h"
#ifdef _WIN32
#include "Windows/MemoryLock.h"
#include "Common/Alloc.h"
#endif
#include "../../IStream.h"
#include "../../IPassword.h"
#include "../../FileManager/StringUtils.h"
#include "../Common/ExitCode.h"
#include "../Common/ArchiveCommandLine.h"
#include "../Resource/Extract/resource.h"
#include "../Explorer/MyMessages.h"
#include "ExtractGUI.h"
#include "UpdateGUI.h"
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";
static const wchar_t *kMemoryExceptionMessage = L"ERROR: Can't allocate required memory!";
static const wchar_t *kUnknownExceptionMessage = L"Unknown Error";
static const wchar_t *kInternalExceptionMessage = L"Internal Error #";
static const wchar_t *kIncorrectCommandMessage = L"Incorrect command";
static void ErrorMessage(const wchar_t *message)
{
MessageBoxW(0, message, L"7-Zip GUI", MB_ICONERROR);
}
int Main2()
{
/*
TCHAR t[512];
GetCurrentDirectory(512, t);
ErrorMessage(t);
return 0;
*/
UStringVector commandStrings;
NCommandLineParser::SplitCommandLine(GetCommandLineW(), commandStrings);
if(commandStrings.Size() <= 1)
{
MessageBoxW(0, L"Specify command", L"7-Zip", 0);
return 0;
}
commandStrings.Delete(0);
CArchiveCommandLineOptions options;
CArchiveCommandLineParser parser;
parser.Parse1(commandStrings, options);
parser.Parse2(options);
#ifdef _WIN32
if (options.LargePages)
NSecurity::EnableLockMemoryPrivilege();
#endif
bool isExtractGroupCommand = options.Command.IsFromExtractGroup();
if (isExtractGroupCommand)
{
CExtractCallbackImp *ecs = new CExtractCallbackImp;
CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
ecs->PasswordIsDefined = options.PasswordEnabled;
ecs->Password = options.Password;
ecs->Init();
COpenCallbackGUI openCallback;
openCallback.PasswordIsDefined = options.PasswordEnabled;
openCallback.Password = options.Password;
CExtractOptions eo;
eo.StdOutMode = options.StdOutMode;
eo.OutputDir = options.OutputDir;
eo.YesToAll = options.YesToAll;
eo.OverwriteMode = options.OverwriteMode;
eo.PathMode = options.Command.GetPathMode();
eo.TestMode = options.Command.IsTestMode();
#ifdef COMPRESS_MT
eo.Properties = options.ExtractProperties;
#endif
HRESULT result = ExtractGUI(
options.ArchivePathsSorted,
options.ArchivePathsFullSorted,
options.WildcardCensor.Pairs.Front().Head,
eo, options.ShowDialog, &openCallback, ecs);
if (result != S_OK)
throw CSystemException(result);
if (ecs->Messages.Size() > 0 || ecs->NumArchiveErrors != 0)
return NExitCode::kFatalError;
}
else if (options.Command.IsFromUpdateGroup())
{
bool passwordIsDefined =
options.PasswordEnabled && !options.Password.IsEmpty();
COpenCallbackGUI openCallback;
openCallback.PasswordIsDefined = passwordIsDefined;
openCallback.Password = options.Password;
CUpdateCallbackGUI callback;
// callback.EnablePercents = options.EnablePercents;
callback.PasswordIsDefined = passwordIsDefined;
callback.AskPassword = options.PasswordEnabled && options.Password.IsEmpty();
callback.Password = options.Password;
// callback.StdOutMode = options.UpdateOptions.StdOutMode;
callback.Init();
CUpdateErrorInfo errorInfo;
HRESULT result = UpdateGUI(
options.WildcardCensor, options.UpdateOptions,
options.ShowDialog,
errorInfo, &openCallback, &callback);
if (result != S_OK)
{
if (!errorInfo.Message.IsEmpty())
ErrorMessage(errorInfo.Message);
throw CSystemException(result);
}
if (callback.FailedFiles.Size() > 0)
return NExitCode::kWarning;
}
else
{
ErrorMessage(L"Use correct command");
return 0;
}
return 0;
}
static bool inline IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */, LPSTR /* lpCmdLine */, int /* nCmdShow */)
{
g_hInstance = hInstance;
#ifdef _UNICODE
if (!IsItWindowsNT())
{
MyMessageBox(L"This program requires Windows NT/2000/XP/2003");
return NExitCode::kFatalError;
}
#else
g_IsNT = IsItWindowsNT();
#endif
#ifdef _WIN32
SetLargePageSize();
#endif
InitCommonControls();
ReloadLang();
// setlocale(LC_COLLATE, ".ACP");
try
{
return Main2();
}
catch(const CNewException &)
{
MyMessageBox(kMemoryExceptionMessage);
return (NExitCode::kMemoryError);
}
catch(const CArchiveCommandLineException &e)
{
MyMessageBox(GetUnicodeString(e));
return (NExitCode::kUserError);
}
catch(const CSystemException &systemError)
{
if (systemError.ErrorCode == E_OUTOFMEMORY)
{
MyMessageBox(kMemoryExceptionMessage);
return (NExitCode::kMemoryError);
}
if (systemError.ErrorCode == E_ABORT)
{
// MyMessageBox(kUserBreak);
return (NExitCode::kUserBreak);
}
UString message;
NError::MyFormatMessage(systemError.ErrorCode, message);
MyMessageBox(message);
return (NExitCode::kFatalError);
}
/*
catch(NExitCode::EEnum &exitCode)
{
g_StdErr << kInternalExceptionMessage << exitCode << endl;
return (exitCode);
}
*/
catch(const UString &s)
{
MyMessageBox(s);
return (NExitCode::kFatalError);
}
catch(const AString &s)
{
MyMessageBox(GetUnicodeString(s));
return (NExitCode::kFatalError);
}
catch(const char *s)
{
MyMessageBox(GetUnicodeString(s));
return (NExitCode::kFatalError);
}
/*
catch(int t)
{
g_StdErr << kInternalExceptionMessage << t << endl;
return (NExitCode::kFatalError);
}
*/
catch(...)
{
MyMessageBox(kUnknownExceptionMessage);
return (NExitCode::kFatalError);
}
}

904
CPP/7zip/UI/GUI/GUI.dsp Executable file
View File

@@ -0,0 +1,904 @@
# Microsoft Developer Studio Project File - Name="GUI" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=GUI - Win32 DebugU
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "GUI.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "GUI.mak" CFG="GUI - Win32 DebugU"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "GUI - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "GUI - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE "GUI - Win32 ReleaseU" (based on "Win32 (x86) Application")
!MESSAGE "GUI - Win32 DebugU" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "GUI - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /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"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib htmlhelp.lib /nologo /subsystem:windows /machine:I386 /out:"C:\Program Files\7-Zip\7zg.exe" /opt:NOWIN98
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "GUI - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /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"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib htmlhelp.lib /nologo /subsystem:windows /debug /machine:I386 /out:"C:\Program Files\7-Zip\7zg.exe" /pdbtype:sept
!ELSEIF "$(CFG)" == "GUI - Win32 ReleaseU"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseU"
# PROP BASE Intermediate_Dir "ReleaseU"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseU"
# PROP Intermediate_Dir "ReleaseU"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /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"
# ADD RSC /l 0x419 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"C:\UTIL\7zg.exe"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib htmlhelp.lib /nologo /subsystem:windows /machine:I386 /out:"C:\Program Files\7-Zip\7zgn.exe" /opt:NOWIN98
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "GUI - Win32 DebugU"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "DebugU"
# PROP BASE Intermediate_Dir "DebugU"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "DebugU"
# PROP Intermediate_Dir "DebugU"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /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"
# ADD RSC /l 0x419 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /out:"C:\UTIL\7zg.exe" /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib htmlhelp.lib /nologo /subsystem:windows /debug /machine:I386 /out:"C:\Program Files\7-Zip\7zgn.exe" /pdbtype:sept
!ENDIF
# Begin Target
# Name "GUI - Win32 Release"
# Name "GUI - Win32 Debug"
# Name "GUI - Win32 ReleaseU"
# Name "GUI - Win32 DebugU"
# Begin Group "Spec"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\7zG.exe.manifest
# End Source File
# Begin Source File
SOURCE=.\FM.ico
# End Source File
# Begin Source File
SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\resource.rc
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# End Group
# Begin Group "SDK"
# PROP Default_Filter ""
# Begin Group "Common"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\Common\Alloc.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Alloc.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\CommandLineParser.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\CommandLineParser.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\IntToString.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\IntToString.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Lang.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Lang.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\ListFileUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\ListFileUtils.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\NewHandler.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\NewHandler.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StdInStream.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StdInStream.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\String.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\String.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StringConvert.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StringConvert.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StringToInt.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\StringToInt.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\TextConfig.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\TextConfig.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\UTFConvert.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\UTFConvert.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Vector.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Vector.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Wildcard.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Common\Wildcard.h
# End Source File
# End Group
# Begin Group "Windows"
# PROP Default_Filter ""
# Begin Group "Control"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\Windows\Control\ComboBox.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Control\ComboBox.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Control\Dialog.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Control\Dialog.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Control\Edit.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Control\ListView.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Control\ListView.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Control\ProgressBar.h
# End Source File
# 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
SOURCE=..\..\..\Windows\DLL.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Error.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Error.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\FileDir.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\FileDir.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\FileFind.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\FileFind.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\FileIO.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\FileIO.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\FileName.cpp
# End Source File
# Begin Source File
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
SOURCE=..\..\..\Windows\PropVariant.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\PropVariantConversions.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\PropVariantConversions.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Registry.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Registry.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\ResourceString.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\ResourceString.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Shell.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Shell.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Synchronization.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Synchronization.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Window.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\Windows\Window.h
# End Source File
# End Group
# End Group
# Begin Group "UI Common"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\Common\ArchiveCommandLine.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\ArchiveCommandLine.h
# End Source File
# Begin Source File
SOURCE=..\Common\ArchiveExtractCallback.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\ArchiveExtractCallback.h
# End Source File
# Begin Source File
SOURCE=..\Common\ArchiveOpenCallback.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\ArchiveOpenCallback.h
# End Source File
# Begin Source File
SOURCE=..\Common\ArchiverInfo.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\ArchiverInfo.h
# End Source File
# Begin Source File
SOURCE=..\Common\DefaultName.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\DefaultName.h
# End Source File
# Begin Source File
SOURCE=..\Common\DirItem.h
# End Source File
# Begin Source File
SOURCE=..\Common\EnumDirItems.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\EnumDirItems.h
# End Source File
# Begin Source File
SOURCE=..\Common\ExitCode.h
# End Source File
# Begin Source File
SOURCE=..\Common\Extract.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\Extract.h
# End Source File
# Begin Source File
SOURCE=..\Common\ExtractingFilePath.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\ExtractingFilePath.h
# End Source File
# Begin Source File
SOURCE=..\Common\ExtractMode.h
# End Source File
# Begin Source File
SOURCE=..\Common\HandlerLoader.h
# End Source File
# Begin Source File
SOURCE=..\Common\IFileExtractCallback.h
# End Source File
# Begin Source File
SOURCE=..\Common\OpenArchive.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\OpenArchive.h
# End Source File
# Begin Source File
SOURCE=..\Common\Property.h
# End Source File
# Begin Source File
SOURCE=..\Common\PropIDUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\PropIDUtils.h
# End Source File
# Begin Source File
SOURCE=..\Common\SetProperties.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\SetProperties.h
# End Source File
# Begin Source File
SOURCE=..\Common\SortUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\SortUtils.h
# End Source File
# Begin Source File
SOURCE=..\Common\TempFiles.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\TempFiles.h
# End Source File
# Begin Source File
SOURCE=..\Common\Update.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\Update.h
# End Source File
# Begin Source File
SOURCE=..\Common\UpdateAction.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\UpdateAction.h
# End Source File
# Begin Source File
SOURCE=..\Common\UpdateCallback.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\UpdateCallback.h
# End Source File
# Begin Source File
SOURCE=..\Common\UpdatePair.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\UpdatePair.h
# End Source File
# Begin Source File
SOURCE=..\Common\UpdateProduce.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\UpdateProduce.h
# End Source File
# Begin Source File
SOURCE=..\Common\WorkDir.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\WorkDir.h
# End Source File
# Begin Source File
SOURCE=..\Common\ZipRegistry.cpp
# End Source File
# Begin Source File
SOURCE=..\Common\ZipRegistry.h
# End Source File
# End Group
# Begin Group "Explorer"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\Explorer\MyMessages.cpp
# End Source File
# Begin Source File
SOURCE=..\Explorer\MyMessages.h
# End Source File
# End Group
# Begin Group "Dialogs"
# PROP Default_Filter ""
# Begin Group "Progress"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\FileManager\Resource\ProgressDialog2\ProgressDialog.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\Resource\ProgressDialog2\ProgressDialog.h
# End Source File
# End Group
# Begin Group "Messages"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\FileManager\Resource\MessagesDialog\MessagesDialog.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\Resource\MessagesDialog\MessagesDialog.h
# End Source File
# End Group
# Begin Group "Overwtite"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\FileManager\Resource\OverwriteDialog\OverwriteDialog.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\Resource\OverwriteDialog\OverwriteDialog.h
# End Source File
# End Group
# Begin Group "Password"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\FileManager\Resource\PasswordDialog\PasswordDialog.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\Resource\PasswordDialog\PasswordDialog.h
# End Source File
# End Group
# Begin Group "Compress Dialog"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\CompressDialog.cpp
# End Source File
# Begin Source File
SOURCE=.\CompressDialog.h
# End Source File
# End Group
# Begin Group "Extract Dialog"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\ExtractDialog.cpp
# End Source File
# Begin Source File
SOURCE=.\ExtractDialog.h
# End Source File
# End Group
# End Group
# Begin Group "FM Common"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\FileManager\ExtractCallback.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\ExtractCallback.h
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\FolderInterface.h
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\FormatUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\FormatUtils.h
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\HelpUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\HelpUtils.h
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\LangUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\LangUtils.h
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\OpenCallback.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\OpenCallback.h
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\ProgramLocation.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\ProgramLocation.h
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\RegistryUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\RegistryUtils.h
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\SplitUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\SplitUtils.h
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\StringUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\StringUtils.h
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\UpdateCallback100.cpp
# End Source File
# Begin Source File
SOURCE=..\..\FileManager\UpdateCallback100.h
# End Source File
# End Group
# Begin Group "Engine"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\ExtractGUI.cpp
# End Source File
# Begin Source File
SOURCE=.\ExtractGUI.h
# End Source File
# Begin Source File
SOURCE=.\GUI.cpp
# End Source File
# Begin Source File
SOURCE=.\OpenCallbackGUI.cpp
# End Source File
# Begin Source File
SOURCE=.\OpenCallbackGUI.h
# End Source File
# Begin Source File
SOURCE=.\UpdateCallbackGUI.cpp
# End Source File
# Begin Source File
SOURCE=.\UpdateCallbackGUI.h
# End Source File
# Begin Source File
SOURCE=.\UpdateGUI.cpp
# End Source File
# Begin Source File
SOURCE=.\UpdateGUI.h
# End Source File
# End Group
# Begin Group "7-zip Common"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Common\FilePathAutoRename.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\FilePathAutoRename.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\FileStreams.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\FileStreams.h
# End Source File
# Begin Source File
SOURCE=..\..\Common\StreamUtils.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Common\StreamUtils.h
# End Source File
# End Group
# Begin Group "Compress"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\Compress\Copy\CopyCoder.cpp
# End Source File
# Begin Source File
SOURCE=..\..\Compress\Copy\CopyCoder.h
# End Source File
# End Group
# End Target
# End Project

29
CPP/7zip/UI/GUI/GUI.dsw Executable file
View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "GUI"=.\GUI.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@@ -0,0 +1,65 @@
// OpenCallbackGUI.cpp
#include "StdAfx.h"
#include "OpenCallbackGUI.h"
#include "Common/StdOutStream.h"
#include "Common/StdInStream.h"
#include "Common/StringConvert.h"
#ifndef _NO_CRYPTO
#include "../../FileManager/Resource/PasswordDialog/PasswordDialog.h"
#endif
HRESULT COpenCallbackGUI::CheckBreak()
{
return S_OK;
}
HRESULT COpenCallbackGUI::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
{
return S_OK;
}
HRESULT COpenCallbackGUI::SetCompleted(const UInt64 * /* files */, const UInt64 * /* bytes */)
{
return S_OK;
}
#ifndef _NO_CRYPTO
HRESULT COpenCallbackGUI::CryptoGetTextPassword(BSTR *password)
{
PasswordWasAsked = true;
if (!PasswordIsDefined)
{
CPasswordDialog dialog;
if (dialog.Create(ParentWindow) == IDCANCEL)
return E_ABORT;
Password = dialog.Password;
PasswordIsDefined = true;
}
CMyComBSTR tempName(Password);
*password = tempName.Detach();
return S_OK;
}
HRESULT COpenCallbackGUI::GetPasswordIfAny(UString &password)
{
if (PasswordIsDefined)
password = Password;
return S_OK;
}
bool COpenCallbackGUI::WasPasswordAsked()
{
return PasswordWasAsked;
}
void COpenCallbackGUI::ClearPasswordWasAskedFlag()
{
PasswordWasAsked = false;
}
#endif

View File

@@ -0,0 +1,35 @@
// OpenCallbackGUI.h
#ifndef __OPEN_CALLBACK_GUI_H
#define __OPEN_CALLBACK_GUI_H
#include "../Common/ArchiveOpenCallback.h"
class COpenCallbackGUI: public IOpenCallbackUI
{
public:
HRESULT CheckBreak();
HRESULT SetTotal(const UInt64 *files, const UInt64 *bytes);
HRESULT SetCompleted(const UInt64 *files, const UInt64 *bytes);
#ifndef _NO_CRYPTO
HRESULT CryptoGetTextPassword(BSTR *password);
HRESULT GetPasswordIfAny(UString &password);
bool WasPasswordAsked();
void ClearPasswordWasAskedFlag();
bool PasswordIsDefined;
UString Password;
bool PasswordWasAsked;
#endif
HWND ParentWindow;
COpenCallbackGUI():
#ifndef _NO_CRYPTO
PasswordIsDefined(false),
PasswordWasAsked(false),
#endif
ParentWindow(0) {}
};
#endif

3
CPP/7zip/UI/GUI/StdAfx.cpp Executable file
View File

@@ -0,0 +1,3 @@
// StdAfx.cpp
#include "StdAfx.h"

13
CPP/7zip/UI/GUI/StdAfx.h Executable file
View File

@@ -0,0 +1,13 @@
// StdAfx.h
#ifndef __STDAFX_H
#define __STDAFX_H
#include <windows.h>
#include <commctrl.h>
#include <shlobj.h>
#include <stdio.h>
#include "Common/NewHandler.h"
#endif

View File

@@ -0,0 +1,167 @@
// UpdateCallbackGUI.cpp
#include "StdAfx.h"
#include "UpdateCallbackGUI.h"
#include "Common/StringConvert.h"
#include "Common/IntToString.h"
#include "Common/Defs.h"
#include "Windows/PropVariant.h"
#include "Windows/Error.h"
#include "../../FileManager/Resource/MessagesDialog/MessagesDialog.h"
#include "../../FileManager/Resource/PasswordDialog/PasswordDialog.h"
using namespace NWindows;
CUpdateCallbackGUI::~CUpdateCallbackGUI()
{
if (!Messages.IsEmpty())
{
CMessagesDialog messagesDialog;
messagesDialog.Messages = &Messages;
messagesDialog.Create(ParentWindow);
}
}
void CUpdateCallbackGUI::Init()
{
FailedFiles.Clear();
Messages.Clear();
NumArchiveErrors = 0;
}
void CUpdateCallbackGUI::AddErrorMessage(LPCWSTR message)
{
Messages.Add(message);
}
void CUpdateCallbackGUI::AddErrorMessage(const wchar_t *name, DWORD systemError)
{
AddErrorMessage(
UString(L"WARNING: ") +
NError::MyFormatMessageW(systemError) +
UString(L": ") +
UString(name));
}
HRESULT CUpdateCallbackGUI::OpenResult(const wchar_t *name, HRESULT result)
{
if (result != S_OK)
{
AddErrorMessage (UString(L"Error: ") + name +
UString(L" is not supported archive"));
}
return S_OK;
}
HRESULT CUpdateCallbackGUI::StartScanning()
{
return S_OK;
}
HRESULT CUpdateCallbackGUI::CanNotFindError(const wchar_t *name, DWORD systemError)
{
FailedFiles.Add(name);
AddErrorMessage(name, systemError);
return S_OK;
}
HRESULT CUpdateCallbackGUI::FinishScanning()
{
return S_OK;
}
HRESULT CUpdateCallbackGUI::StartArchive(const wchar_t *name, bool /* updating */)
{
ProgressDialog.ProgressSynch.SetTitleFileName(name);
return S_OK;
}
HRESULT CUpdateCallbackGUI::FinishArchive()
{
return S_OK;
}
HRESULT CUpdateCallbackGUI::CheckBreak()
{
for (;;)
{
if(ProgressDialog.ProgressSynch.GetStopped())
return E_ABORT;
if(!ProgressDialog.ProgressSynch.GetPaused())
break;
::Sleep(100);
}
return S_OK;
}
HRESULT CUpdateCallbackGUI::Finilize()
{
return S_OK;
}
HRESULT CUpdateCallbackGUI::SetTotal(UInt64 total)
{
ProgressDialog.ProgressSynch.SetProgress(total, 0);
return S_OK;
}
HRESULT CUpdateCallbackGUI::SetCompleted(const UInt64 *completeValue)
{
RINOK(CheckBreak());
if (completeValue != NULL)
ProgressDialog.ProgressSynch.SetPos(*completeValue);
return S_OK;
}
HRESULT CUpdateCallbackGUI::GetStream(const wchar_t *name, bool /* isAnti */)
{
ProgressDialog.ProgressSynch.SetCurrentFileName(name);
return S_OK;
}
HRESULT CUpdateCallbackGUI::OpenFileError(const wchar_t *name, DWORD systemError)
{
FailedFiles.Add(name);
// if (systemError == ERROR_SHARING_VIOLATION)
{
AddErrorMessage(name, systemError);
return S_FALSE;
}
// return systemError;
}
HRESULT CUpdateCallbackGUI::SetOperationResult(Int32 /* operationResult */)
{
return S_OK;
}
HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{
if (!PasswordIsDefined)
{
if (AskPassword)
{
CPasswordDialog dialog;
if (dialog.Create(ParentWindow) == IDCANCEL)
return E_ABORT;
Password = dialog.Password;
PasswordIsDefined = true;
}
}
*passwordIsDefined = BoolToInt(PasswordIsDefined);
CMyComBSTR tempName(Password);
*password = tempName.Detach();
return S_OK;
}
/*
It doesn't work, since main stream waits Dialog
HRESULT CUpdateCallbackGUI::CloseProgress()
{
ProgressDialog.MyClose();
return S_OK;
};
*/

View File

@@ -0,0 +1,63 @@
// UpdateCallbackGUI.h
#ifndef __UPDATE_CALLBACK_GUI_H
#define __UPDATE_CALLBACK_GUI_H
#include "../Common/Update.h"
#include "../../FileManager/Resource/ProgressDialog2/ProgressDialog.h"
class CUpdateCallbackGUI: public IUpdateCallbackUI2
{
public:
// bool StdOutMode;
bool PasswordIsDefined;
UString Password;
bool AskPassword;
CUpdateCallbackGUI():
PasswordIsDefined(false),
AskPassword(false),
// StdOutMode(false)
ParentWindow(0)
{}
~CUpdateCallbackGUI();
void Init();
HRESULT OpenResult(const wchar_t *name, HRESULT result);
HRESULT StartScanning();
HRESULT CanNotFindError(const wchar_t *name, DWORD systemError);
HRESULT FinishScanning();
HRESULT StartArchive(const wchar_t *name, bool updating);
HRESULT FinishArchive();
HRESULT CheckBreak();
HRESULT Finilize();
HRESULT SetTotal(UInt64 total);
HRESULT SetCompleted(const UInt64 *completeValue);
HRESULT GetStream(const wchar_t *name, bool isAnti);
HRESULT OpenFileError(const wchar_t *name, DWORD systemError);
HRESULT SetOperationResult(Int32 operationResult);
HRESULT CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password);
// HRESULT CloseProgress();
UStringVector FailedFiles;
CProgressDialog ProgressDialog;
HWND ParentWindow;
void StartProgressDialog(const UString &title)
{
ProgressDialog.Create(title, ParentWindow);
}
UStringVector Messages;
int NumArchiveErrors;
void AddErrorMessage(LPCWSTR message);
void AddErrorMessage(const wchar_t *name, DWORD systemError);
};
#endif

397
CPP/7zip/UI/GUI/UpdateGUI.cpp Executable file
View File

@@ -0,0 +1,397 @@
// UpdateGUI.cpp
#include "StdAfx.h"
#include "UpdateGUI.h"
#include "resource.h"
#include "Common/StringConvert.h"
#include "Common/IntToString.h"
#include "Common/StringToInt.h"
#include "Windows/FileDir.h"
#include "Windows/Error.h"
#include "Windows/FileFind.h"
#include "Windows/Thread.h"
#include "../../FileManager/FormatUtils.h"
#include "../../FileManager/ExtractCallback.h"
#include "../../FileManager/StringUtils.h"
#include "../Common/ArchiveExtractCallback.h"
#include "../Common/WorkDir.h"
#include "../Explorer/MyMessages.h"
#include "../Resource/Extract/resource.h"
#include "OpenCallbackGUI.h"
#include "CompressDialog.h"
#include "UpdateGUI.h"
using namespace NWindows;
using namespace NFile;
static const wchar_t *kIncorrectOutDir = L"Incorrect output directory path";
static const wchar_t *kDefaultSfxModule = L"7z.sfx";
static const wchar_t *kSFXExtension = L"exe";
struct CThreadUpdating
{
CUpdateCallbackGUI *UpdateCallbackGUI;
const NWildcard::CCensor *WildcardCensor;
CUpdateOptions *Options;
COpenCallbackGUI *OpenCallback;
CUpdateErrorInfo *ErrorInfo;
HRESULT Result;
DWORD Process()
{
UpdateCallbackGUI->ProgressDialog.WaitCreating();
try
{
Result = UpdateArchive(*WildcardCensor, *Options,
*ErrorInfo, OpenCallback, UpdateCallbackGUI);
}
catch(const UString &s)
{
ErrorInfo->Message = s;
Result = E_FAIL;
}
catch(const wchar_t *s)
{
ErrorInfo->Message = s;
Result = E_FAIL;
}
catch(const char *s)
{
ErrorInfo->Message = GetUnicodeString(s);
Result = E_FAIL;
}
catch(...)
{
Result = E_FAIL;
}
UpdateCallbackGUI->ProgressDialog.MyClose();
return 0;
}
static DWORD WINAPI MyThreadFunction(void *param)
{
return ((CThreadUpdating *)param)->Process();
}
};
static void AddProp(CObjectVector<CProperty> &properties,
const UString &name, const UString &value)
{
CProperty prop;
prop.Name = name;
prop.Value = value;
properties.Add(prop);
}
static void AddProp(CObjectVector<CProperty> &properties,
const UString &name, UInt32 value)
{
wchar_t tmp[32];
ConvertUInt64ToString(value, tmp);
AddProp(properties, name, tmp);
}
static void AddProp(CObjectVector<CProperty> &properties,
const UString &name, bool value)
{
AddProp(properties, name, value ? UString(L"on"): UString(L"off"));
}
static bool IsThereMethodOverride(bool is7z, const UString &propertiesString)
{
UStringVector strings;
SplitString(propertiesString, strings);
for (int i = 0; i < strings.Size(); i++)
{
const UString &s = strings[i];
if (is7z)
{
const wchar_t *end;
UInt64 n = ConvertStringToUInt64(s, &end);
if (n == 0 && *end == L'=')
return true;
}
else
{
if (s.Length() > 0)
if (s[0] == L'm' && s[1] == L'=')
return true;
}
}
return false;
}
static void ParseAndAddPropertires(CObjectVector<CProperty> &properties,
const UString &propertiesString)
{
UStringVector strings;
SplitString(propertiesString, strings);
for (int i = 0; i < strings.Size(); i++)
{
const UString &s = strings[i];
CProperty property;
int index = s.Find(L'=');
if (index < 0)
property.Name = s;
else
{
property.Name = s.Left(index);
property.Value = s.Mid(index + 1);
}
properties.Add(property);
}
}
static void SetOutProperties(
CObjectVector<CProperty> &properties,
bool is7z,
UInt32 level,
bool setMethod,
const UString &method,
UInt32 dictionary,
bool orderMode,
UInt32 order,
bool solidModeIsAllowed, bool solidMode,
bool multiThreadIsAllowed, bool multiThread,
const UString &encryptionMethod,
bool encryptHeadersIsAllowed, bool encryptHeaders,
bool /* sfxMode */)
{
if (level != (UInt32)(Int32)-1)
AddProp(properties, L"x", (UInt32)level);
if (setMethod)
{
if (!method.IsEmpty())
AddProp(properties, is7z ? L"0": L"m", method);
if (dictionary != (UInt32)(Int32)-1)
{
UString name;
if (is7z)
name = L"0";
if (orderMode)
name += L"mem";
else
name += L"d";
wchar_t s[32];
ConvertUInt64ToString(dictionary, s);
size_t len = wcslen(s);
s[len++] = L'B';
s[len] = L'\0';
AddProp(properties, name, UString(s));
}
if (order != (UInt32)(Int32)-1)
{
UString name;
if (is7z)
name = L"0";
if (orderMode)
name += L"o";
else
name += L"fb";
AddProp(properties, name, (UInt32)order);
}
}
if (!encryptionMethod.IsEmpty())
AddProp(properties, L"em", encryptionMethod);
if (encryptHeadersIsAllowed)
AddProp(properties, L"he", encryptHeaders);
if (solidModeIsAllowed)
AddProp(properties, L"s", solidMode);
if (multiThreadIsAllowed)
AddProp(properties, L"mt", multiThread);
}
static HRESULT ShowDialog(const NWildcard::CCensor &censor,
CUpdateOptions &options, CUpdateCallbackGUI *callback)
{
if (options.Commands.Size() != 1)
throw "It must be one command";
CObjectVector<CArchiverInfo> archivers;
CArchiverInfo archiverInfo;
ReadArchiverInfoList(archivers);
UString currentDirPrefix;
{
if (!NDirectory::MyGetCurrentDirectory(currentDirPrefix))
return E_FAIL;
NName::NormalizeDirPathPrefix(currentDirPrefix);
}
bool oneFile = false;
NFind::CFileInfoW fileInfo;
if (censor.Pairs.Size() > 0)
{
const NWildcard::CPair &pair = censor.Pairs[0];
if (pair.Head.IncludeItems.Size() > 0)
{
const NWildcard::CItem &item = pair.Head.IncludeItems[0];
if (item.ForFile)
{
UString name = pair.Prefix;
for (int i = 0; i < item.PathParts.Size(); i++)
{
if (i > 0)
name += L'\\';
name += item.PathParts[i];
}
if (NFind::FindFile(name, fileInfo))
{
if (censor.Pairs.Size() == 1 && pair.Head.IncludeItems.Size() == 1)
oneFile = !fileInfo.IsDirectory();
}
}
}
}
CCompressDialog dialog;
NCompressDialog::CInfo &di = dialog.Info;
for(int i = 0; i < archivers.Size(); i++)
{
const CArchiverInfo &ai = archivers[i];
if (ai.UpdateEnabled && (oneFile || !ai.KeepName))
dialog.m_ArchiverInfoList.Add(ai);
}
if(dialog.m_ArchiverInfoList.Size() == 0)
{
MyMessageBox(L"No Update Engines");
return E_FAIL;
}
// di.ArchiveName = options.ArchivePath.GetFinalPath();
di.ArchiveName = options.ArchivePath.GetPathWithoutExt();
dialog.OriginalFileName = fileInfo.Name;
di.CurrentDirPrefix = currentDirPrefix;
di.SFXMode = options.SfxMode;
di.Solid = true;
di.MultiThread = false;
if (callback->PasswordIsDefined)
di.Password = callback->Password;
di.KeepName = !oneFile;
if(dialog.Create(0) != IDOK)
return E_ABORT;
options.VolumesSizes = di.VolumeSizes;
/*
if (di.VolumeSizeIsDefined)
{
MyMessageBox(L"Splitting to volumes is not supported");
return E_FAIL;
}
*/
NUpdateArchive::CActionSet &actionSet = options.Commands.Front().ActionSet;
switch(di.UpdateMode)
{
case NCompressDialog::NUpdateMode::kAdd:
actionSet = NUpdateArchive::kAddActionSet;
break;
case NCompressDialog::NUpdateMode::kUpdate:
actionSet = NUpdateArchive::kUpdateActionSet;
break;
case NCompressDialog::NUpdateMode::kFresh:
actionSet = NUpdateArchive::kFreshActionSet;
break;
case NCompressDialog::NUpdateMode::kSynchronize:
actionSet = NUpdateArchive::kSynchronizeActionSet;
break;
default:
throw 1091756;
}
archiverInfo = dialog.m_ArchiverInfoList[di.ArchiverInfoIndex];
callback->PasswordIsDefined = (!di.Password.IsEmpty());
if (callback->PasswordIsDefined)
callback->Password = di.Password;
options.MethodMode.Properties.Clear();
bool is7z = archiverInfo.Name.CompareNoCase(L"7z") == 0;
bool methodOverride = IsThereMethodOverride(is7z, di.Options);
SetOutProperties(
options.MethodMode.Properties,
is7z,
di.Level,
!methodOverride,
di.Method,
di.Dictionary,
di.OrderMode, di.Order,
di.SolidIsAllowed, di.Solid,
di.MultiThreadIsAllowed, di.MultiThread,
di.EncryptionMethod,
di.EncryptHeadersIsAllowed, di.EncryptHeaders,
di.SFXMode);
ParseAndAddPropertires(options.MethodMode.Properties, di.Options);
if (di.SFXMode)
options.SfxMode = true;
options.MethodMode.FilePath = archiverInfo.FilePath;
options.MethodMode.ClassID = archiverInfo.ClassID;
options.ArchivePath.VolExtension = archiverInfo.GetMainExtension();
if(di.SFXMode)
options.ArchivePath.BaseExtension = kSFXExtension;
else
options.ArchivePath.BaseExtension = options.ArchivePath.VolExtension;
options.ArchivePath.ParseFromPath(di.ArchiveName);
NWorkDir::CInfo workDirInfo;
ReadWorkDirInfo(workDirInfo);
options.WorkingDir.Empty();
if (workDirInfo.Mode != NWorkDir::NMode::kCurrent)
{
UString fullPath;
NDirectory::MyGetFullPathName(di.ArchiveName, fullPath);
options.WorkingDir = GetWorkDir(workDirInfo, fullPath);
NFile::NDirectory::CreateComplexDirectory(options.WorkingDir);
}
return S_OK;
}
HRESULT UpdateGUI(
const NWildcard::CCensor &censor,
CUpdateOptions &options,
bool showDialog,
CUpdateErrorInfo &errorInfo,
COpenCallbackGUI *openCallback,
CUpdateCallbackGUI *callback)
{
if (showDialog)
{
RINOK(ShowDialog(censor, options, callback));
}
if (options.SfxMode && options.SfxModule.IsEmpty())
options.SfxModule = kDefaultSfxModule;
CThreadUpdating tu;
tu.UpdateCallbackGUI = callback;
tu.UpdateCallbackGUI->Init();
tu.WildcardCensor = &censor;
tu.Options = &options;
tu.OpenCallback = openCallback;
tu.ErrorInfo = &errorInfo;
CThread thread;
if (!thread.Create(CThreadUpdating::MyThreadFunction, &tu))
throw 271824;
tu.UpdateCallbackGUI->StartProgressDialog(LangString(IDS_PROGRESS_COMPRESSING, 0x02000DC0));
return tu.Result;
}

20
CPP/7zip/UI/GUI/UpdateGUI.h Executable file
View File

@@ -0,0 +1,20 @@
// GUI/UpdateGUI.h
#ifndef __UPDATE_GUI_H
#define __UPDATE_GUI_H
#include "../Common/Update.h"
#include "OpenCallbackGUI.h"
#include "UpdateCallbackGUI.h"
#include "../../FileManager/UpdateCallback100.h"
HRESULT UpdateGUI(
const NWildcard::CCensor &censor,
CUpdateOptions &options,
bool showDialog,
CUpdateErrorInfo &errorInfo,
COpenCallbackGUI *openCallback,
CUpdateCallbackGUI *callback);
#endif

135
CPP/7zip/UI/GUI/makefile Executable file
View File

@@ -0,0 +1,135 @@
PROG = 7zG.exe
LIBS = $(LIBS) user32.lib advapi32.lib oleaut32.lib shell32.lib comctl32.lib htmlhelp.lib ole32.lib comdlg32.lib
CFLAGS = $(CFLAGS) -I ../../../ -DLANG -DCOMPRESS_MT -DWIN_LONG_PATH
GUI_OBJS = \
$O\CompressDialog.obj \
$O\ExtractDialog.obj \
$O\ExtractGUI.obj \
$O\GUI.obj \
$O\OpenCallbackGUI.obj \
$O\UpdateCallbackGUI.obj \
$O\UpdateGUI.obj \
COMMON_OBJS = \
$O\Alloc.obj \
$O\CommandLineParser.obj \
$O\IntToString.obj \
$O\Lang.obj \
$O\ListFileUtils.obj \
$O\NewHandler.obj \
$O\StdInStream.obj \
$O\String.obj \
$O\StringConvert.obj \
$O\StringToInt.obj \
$O\TextConfig.obj \
$O\UTFConvert.obj \
$O\Vector.obj \
$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 \
$O\ResourceString.obj \
$O\Shell.obj \
$O\Synchronization.obj \
$O\Window.obj \
WIN_CTRL_OBJS = \
$O\ComboBox.obj \
$O\Dialog.obj \
$O\ListView.obj \
7ZIP_COMMON_OBJS = \
$O\FilePathAutoRename.obj \
$O\FileStreams.obj \
$O\StreamUtils.obj \
UI_COMMON_OBJS = \
$O\ArchiveCommandLine.obj \
$O\ArchiveExtractCallback.obj \
$O\ArchiveOpenCallback.obj \
$O\ArchiverInfo.obj \
$O\DefaultName.obj \
$O\EnumDirItems.obj \
$O\Extract.obj \
$O\ExtractingFilePath.obj \
$O\OpenArchive.obj \
$O\PropIDUtils.obj \
$O\SetProperties.obj \
$O\SortUtils.obj \
$O\TempFiles.obj \
$O\Update.obj \
$O\UpdateAction.obj \
$O\UpdateCallback.obj \
$O\UpdatePair.obj \
$O\UpdateProduce.obj \
$O\WorkDir.obj \
$O\ZipRegistry.obj \
FM_OBJS = \
$O\ExtractCallback.obj \
$O\FormatUtils.obj \
$O\HelpUtils.obj \
$O\LangUtils.obj \
$O\OpenCallback.obj \
$O\ProgramLocation.obj \
$O\RegistryUtils.obj \
$O\SplitUtils.obj \
$O\StringUtils.obj \
$O\UpdateCallback100.obj \
OBJS = \
$O\StdAfx.obj \
$(GUI_OBJS) \
$(COMMON_OBJS) \
$(WIN_OBJS) \
$(WIN_CTRL_OBJS) \
$(7ZIP_COMMON_OBJS) \
$(UI_COMMON_OBJS) \
$(FM_OBJS)\
$O\MyMessages.obj \
$O\MessagesDialog.obj \
$O\OverwriteDialog.obj \
$O\PasswordDialog.obj \
$O\ProgressDialog.obj \
$O\CopyCoder.obj \
$O\resource.res
!include "../../../Build.mak"
$(GUI_OBJS): $(*B).cpp
$(COMPL)
$(COMMON_OBJS): ../../../Common/$(*B).cpp
$(COMPL)
$(WIN_OBJS): ../../../Windows/$(*B).cpp
$(COMPL)
$(WIN_CTRL_OBJS): ../../../Windows/Control/$(*B).cpp
$(COMPL)
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
$(COMPL)
$(UI_COMMON_OBJS): ../Common/$(*B).cpp
$(COMPL)
$(FM_OBJS): ../../FileManager/$(*B).cpp
$(COMPL)
$O\MyMessages.obj: ../Explorer/MyMessages.cpp
$(COMPL)
$O\MessagesDialog.obj: ../../FileManager/Resource/MessagesDialog/$(*B).cpp
$(COMPL)
$O\OverwriteDialog.obj: ../../FileManager/Resource/OverwriteDialog./$(*B).cpp
$(COMPL)
$O\PasswordDialog.obj: ../../FileManager/Resource/PasswordDialog/$(*B).cpp
$(COMPL)
$O\ProgressDialog.obj: ../../FileManager/Resource/ProgressDialog2/$(*B).cpp
$(COMPL)
$O\CopyCoder.obj: ../../Compress/Copy/$(*B).cpp
$(COMPL)

45
CPP/7zip/UI/GUI/resource.h Executable file
View File

@@ -0,0 +1,45 @@
#define IDS_CONTEXT_EXTRACT 42
#define IDS_CONTEXT_EXTRACT_HELP 43
#define IDS_CONTEXT_COMPRESS 44
#define IDS_CONTEXT_COMPRESS_HELP 45
#define IDS_CONTEXT_OPEN 46
#define IDS_CONTEXT_OPEN_HELP 47
#define IDS_CONTEXT_TEST 48
#define IDS_CONTEXT_TEST_HELP 49
#define IDS_CONTEXT_CAPTION_HELP 50
#define IDS_CONTEXT_POPUP_CAPTION 51
#define IDS_OPEN_TYPE_ALL_FILES 80
#define IDS_METHOD_STORE 81
#define IDS_METHOD_NORMAL 82
#define IDS_METHOD_MAXIMUM 83
#define IDS_METHOD_FAST 84
#define IDS_METHOD_FASTEST 85
#define IDS_METHOD_ULTRA 86
#define IDS_COMPRESS_UPDATE_MODE_ADD 90
#define IDS_COMPRESS_UPDATE_MODE_UPDATE 91
#define IDS_COMPRESS_UPDATE_MODE_FRESH 92
#define IDS_COMPRESS_UPDATE_MODE_SYNCHRONIZE 93
#define IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE 94
#define IDS_COMPRESS_INCORRECT_VOLUME_SIZE 95
#define IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE 96
#define IDS_CANT_UPDATE_ARCHIVE 97
#define IDS_PROGRESS_COMPRESSING 98
#define IDS_PROGRESS_TESTING 99
#define IDS_ERROR 100
#define IDS_MESSAGE_NO_ERRORS 101
#define IDS_CONFIG_DIALOG_CAPTION 102
#define IDS_PASSWORD_USE_ASCII 110
#define IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH 111
#define IDS_PASSWORD_IS_TOO_LONG 112
#define IDD_DIALOG_EXTRACT 137
#define IDB_DELETE 149
#define IDC_LIST1 1067
#define IDC_COLUMN_EDIT_WIDTH 1068

57
CPP/7zip/UI/GUI/resource.rc Executable file
View File

@@ -0,0 +1,57 @@
#include "../../MyVersionInfo.rc"
#include <winnt.h>
#include "resource.h"
MY_VERSION_INFO_APP("7-Zip GUI", "7zg")
IDI_ICON1 ICON "FM.ico"
1 24 MOVEABLE PURE "7zG.exe.manifest"
STRINGTABLE
BEGIN
IDS_CONTEXT_EXTRACT "Extract files..."
IDS_CONTEXT_EXTRACT_HELP "Extracts files from the selected archive."
IDS_CONTEXT_COMPRESS "Add to archive..."
IDS_CONTEXT_COMPRESS_HELP "Adds the selected items to archive."
IDS_CONTEXT_OPEN "Open"
IDS_CONTEXT_OPEN_HELP "Opens the selected archive."
IDS_CONTEXT_TEST "Test archive"
IDS_CONTEXT_TEST_HELP "Tests integrity of the selected archive."
IDS_CONTEXT_CAPTION_HELP "7-Zip commands"
IDS_CONTEXT_POPUP_CAPTION "7-Zip"
IDS_OPEN_TYPE_ALL_FILES "All Files"
IDS_METHOD_STORE "Store"
IDS_METHOD_NORMAL "Normal"
IDS_METHOD_MAXIMUM "Maximum"
IDS_METHOD_FAST "Fast"
IDS_METHOD_FASTEST "Fastest"
IDS_METHOD_ULTRA "Ultra"
IDS_COMPRESS_UPDATE_MODE_ADD "Add and replace files"
IDS_COMPRESS_UPDATE_MODE_UPDATE "Update and add files"
IDS_COMPRESS_UPDATE_MODE_FRESH "Freshen existing files"
IDS_COMPRESS_UPDATE_MODE_SYNCHRONIZE "Synchronize files"
IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE "Browse"
IDS_COMPRESS_INCORRECT_VOLUME_SIZE "Incorrect volume size"
IDS_COMPRESS_SPLIT_CONFIRM_MESSAGE "Specified volume size: {0} bytes.\nAre you sure you want to split archive into such volumes?"
IDS_PASSWORD_USE_ASCII "Use only English letters, numbers and special characters (!, #, $, ...) for password."
IDS_PASSWORD_PASSWORDS_DO_NOT_MATCH "Passwords do not match"
IDS_PASSWORD_IS_TOO_LONG "Password is too long"
IDS_CANT_UPDATE_ARCHIVE "Can not update archive '{0}'"
IDS_PROGRESS_COMPRESSING "Compressing"
IDS_PROGRESS_TESTING "Testing"
IDS_ERROR "Error"
IDS_MESSAGE_NO_ERRORS "There are no errors"
IDS_CONFIG_DIALOG_CAPTION "7-Zip Options"
END
#include "../../FileManager/Resource/PropertyName/resource.rc"
#include "../../FileManager/Resource/OverwriteDialog/resource.rc"
#include "../../FileManager/Resource/PasswordDialog/resource.rc"
#include "../../FileManager/Resource/MessagesDialog/resource.rc"
#include "../../FileManager/Resource/ProgressDialog2/resource.rc"
#include "../Resource/Extract/resource.rc"
#include "../Resource/ExtractDialog/resource.rc"
#include "../Resource/CompressDialog/resource.rc"