mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-14 22:11:38 -06:00
3.13
This commit is contained in:
1
7zip/UI/GUI/7zG.exe.manifest
Executable file
1
7zip/UI/GUI/7zG.exe.manifest
Executable 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="X86" 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="X86" publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly></dependency></assembly>
|
||||
636
7zip/UI/GUI/Compress.cpp
Executable file
636
7zip/UI/GUI/Compress.cpp
Executable file
@@ -0,0 +1,636 @@
|
||||
// Compress.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <mapi.h>
|
||||
|
||||
#include "Compress.h"
|
||||
#include "CompressDialog.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/IntToString.h"
|
||||
|
||||
#include "Windows/FileName.h"
|
||||
#include "Windows/FileFind.h"
|
||||
#include "Windows/FileDir.h"
|
||||
#include "Windows/Thread.h"
|
||||
#include "Windows/COM.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
|
||||
#include "../../FileManager/ProgramLocation.h"
|
||||
#include "../../FileManager/FormatUtils.h"
|
||||
#include "../../FileManager/UpdateCallback100.h"
|
||||
|
||||
#include "../Agent/Agent.h"
|
||||
#include "../Common/UpdateAction.h"
|
||||
#include "../Common/WorkDir.h"
|
||||
#include "../Common/ZipRegistry.h"
|
||||
#include "../Common/OpenArchive.h"
|
||||
#include "../Resource/Extract/resource.h"
|
||||
#include "../Explorer/MyMessages.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NFile;
|
||||
using namespace NDirectory;
|
||||
using namespace NName;
|
||||
|
||||
static LPCWSTR kTempArchivePrefix = L"7zA";
|
||||
static LPCWSTR kTempFolderPrefix = L"7zE";
|
||||
static LPCWSTR kDefaultSfxModule = L"7zC.sfx";
|
||||
|
||||
static void SplitString(const UString &srcString, UStringVector &destStrings)
|
||||
{
|
||||
destStrings.Clear();
|
||||
for (int pos = 0; pos < srcString.Length();)
|
||||
{
|
||||
int spacePos = srcString.Find(L' ', pos);
|
||||
if (spacePos < 0)
|
||||
{
|
||||
destStrings.Add(srcString.Mid(pos));
|
||||
return;
|
||||
}
|
||||
if (spacePos != pos)
|
||||
destStrings.Add(srcString.Mid(pos, spacePos - pos));
|
||||
pos = spacePos + 1;
|
||||
}
|
||||
}
|
||||
|
||||
static bool ParseNumberString(const UString &string, UINT32 &number)
|
||||
{
|
||||
wchar_t *endPtr;
|
||||
number = wcstoul(string, &endPtr, 10);
|
||||
return (endPtr - string == string.Length());
|
||||
}
|
||||
|
||||
static void SetOptions(const UString &options,
|
||||
CObjectVector<CMyComBSTR> &realNames,
|
||||
std::vector<NCOM::CPropVariant> &values)
|
||||
{
|
||||
UStringVector strings;
|
||||
SplitString(options, strings);
|
||||
for(int i = 0; i < strings.Size(); i++)
|
||||
{
|
||||
const UString &s = strings[i];
|
||||
int index = s.Find(L'=');
|
||||
CMyComBSTR name;
|
||||
NCOM::CPropVariant propVariant;
|
||||
if (index < 0)
|
||||
name = s;
|
||||
else
|
||||
{
|
||||
name = s.Left(index);
|
||||
UString value = s.Mid(index + 1);
|
||||
if (!value.IsEmpty())
|
||||
{
|
||||
UINT32 number;
|
||||
if (ParseNumberString(value, number))
|
||||
propVariant = number;
|
||||
else
|
||||
propVariant = value;
|
||||
}
|
||||
}
|
||||
realNames.Add(name);
|
||||
values.push_back(propVariant);
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT SetOutProperties(IOutFolderArchive * outArchive,
|
||||
bool is7z,
|
||||
UINT32 level,
|
||||
const UString &method,
|
||||
UINT32 dictionary,
|
||||
bool orderMode,
|
||||
UINT32 order,
|
||||
bool solidModeIsAllowed, bool solidMode,
|
||||
bool multiThreadIsAllowed, bool multiThread,
|
||||
bool encryptHeadersIsAllowed, bool encryptHeaders,
|
||||
bool sfxMode,
|
||||
const UString &options)
|
||||
{
|
||||
CMyComPtr<ISetProperties> setProperties;
|
||||
if (outArchive->QueryInterface(&setProperties) == S_OK)
|
||||
{
|
||||
CObjectVector<CMyComBSTR> realNames;
|
||||
std::vector<NCOM::CPropVariant> values;
|
||||
if (level != (UINT32)(INT32)-1)
|
||||
{
|
||||
CMyComBSTR comBSTR = L"x";
|
||||
realNames.Add(comBSTR);
|
||||
values.push_back(NCOM::CPropVariant((UINT32)level));
|
||||
}
|
||||
if (!method.IsEmpty())
|
||||
{
|
||||
CMyComBSTR comBSTR;
|
||||
if (is7z)
|
||||
comBSTR = L"0";
|
||||
else
|
||||
comBSTR = L"m";
|
||||
realNames.Add(comBSTR);
|
||||
values.push_back(NCOM::CPropVariant(method));
|
||||
}
|
||||
if (dictionary != (UINT32)(INT32)-1)
|
||||
{
|
||||
CMyComBSTR comBSTR;
|
||||
if (is7z)
|
||||
if (orderMode)
|
||||
comBSTR = L"0mem";
|
||||
else
|
||||
comBSTR = L"0d";
|
||||
else
|
||||
if (orderMode)
|
||||
comBSTR = L"mem";
|
||||
else
|
||||
comBSTR = L"d";
|
||||
realNames.Add(comBSTR);
|
||||
wchar_t s[32];
|
||||
ConvertUINT64ToString(dictionary, s);
|
||||
wcscat(s, L"B");
|
||||
values.push_back(NCOM::CPropVariant(s));
|
||||
}
|
||||
if (order != (UINT32)(INT32)-1)
|
||||
{
|
||||
CMyComBSTR comBSTR;
|
||||
if (is7z)
|
||||
if (orderMode)
|
||||
comBSTR = L"0o";
|
||||
else
|
||||
comBSTR = L"0fb";
|
||||
else
|
||||
if (orderMode)
|
||||
comBSTR = L"o";
|
||||
else
|
||||
comBSTR = L"fb";
|
||||
realNames.Add(comBSTR);
|
||||
values.push_back(NCOM::CPropVariant((UINT32)order));
|
||||
}
|
||||
|
||||
if (sfxMode)
|
||||
{
|
||||
realNames.Add(L"rsfx");
|
||||
values.push_back(NCOM::CPropVariant(L"on"));
|
||||
}
|
||||
|
||||
if (encryptHeadersIsAllowed)
|
||||
{
|
||||
if (encryptHeaders)
|
||||
{
|
||||
realNames.Add(L"he");
|
||||
values.push_back(NCOM::CPropVariant(L"on"));
|
||||
}
|
||||
}
|
||||
|
||||
// Solid
|
||||
if (solidModeIsAllowed)
|
||||
{
|
||||
realNames.Add(L"s");
|
||||
values.push_back(NCOM::CPropVariant(solidMode ? L"on": L"off"));
|
||||
}
|
||||
if (multiThreadIsAllowed)
|
||||
{
|
||||
realNames.Add(L"mt");
|
||||
values.push_back(NCOM::CPropVariant(multiThread ? L"on": L"off"));
|
||||
}
|
||||
|
||||
// Options
|
||||
SetOptions(options, realNames, values);
|
||||
|
||||
std::vector<BSTR> names;
|
||||
for(int i = 0; i < realNames.Size(); i++)
|
||||
names.push_back(realNames[i]);
|
||||
RINOK(setProperties->SetProperties(&names.front(),
|
||||
&values.front(), names.size()));
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
struct CThreadUpdateCompress
|
||||
{
|
||||
CMyComPtr<IOutFolderArchive> OutArchive;
|
||||
UString LibPath;
|
||||
CLSID ClassID;
|
||||
UString OutArchivePath;
|
||||
BYTE ActionSetByte[NUpdateArchive::NPairState::kNumValues];
|
||||
bool SfxMode;
|
||||
UString SfxModule;
|
||||
|
||||
|
||||
UStringVector FileNames;
|
||||
CRecordVector<const wchar_t *> FileNamePointers;
|
||||
CMyComPtr<IFolderArchiveUpdateCallback> UpdateCallback;
|
||||
CUpdateCallback100Imp *UpdateCallbackSpec;
|
||||
HRESULT Result;
|
||||
|
||||
DWORD Process()
|
||||
{
|
||||
NCOM::CComInitializer comInitializer;
|
||||
UpdateCallbackSpec->ProgressDialog.WaitCreating();
|
||||
try
|
||||
{
|
||||
Result = OutArchive->DoOperation(
|
||||
LibPath, &ClassID,
|
||||
OutArchivePath, ActionSetByte,
|
||||
(SfxMode ? (const wchar_t *)SfxModule: NULL),
|
||||
UpdateCallback);
|
||||
}
|
||||
catch(const UString &s)
|
||||
{
|
||||
MyMessageBox(s);
|
||||
Result = E_FAIL;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
Result = E_FAIL;
|
||||
}
|
||||
UpdateCallbackSpec->ProgressDialog.MyClose();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DWORD WINAPI MyThreadFunction(void *param)
|
||||
{
|
||||
return ((CThreadUpdateCompress *)param)->Process();
|
||||
}
|
||||
};
|
||||
|
||||
static UString MakeFullArchiveName(const UString &name,
|
||||
const UString &extension, bool sfx)
|
||||
{
|
||||
if (sfx)
|
||||
{
|
||||
UString sfxExt = L".exe";
|
||||
if (sfxExt.CollateNoCase(name.Right(sfxExt.Length())) == 0)
|
||||
return name;
|
||||
return name + sfxExt;
|
||||
}
|
||||
|
||||
if (extension.IsEmpty())
|
||||
return name;
|
||||
if (name.IsEmpty())
|
||||
return name;
|
||||
if (name[name.Length() - 1] == '.')
|
||||
return name.Left(name.Length() - 1);
|
||||
int slash1Pos = name.ReverseFind(L'\\');
|
||||
int slash2Pos = name.ReverseFind(L'/');
|
||||
int slashPos = MyMax(slash1Pos, slash2Pos);
|
||||
int dotPos = name.ReverseFind(L'.');
|
||||
if (dotPos >= 0 && (dotPos > slashPos || slashPos < 0))
|
||||
return name;
|
||||
return name + UString(L'.') + extension;
|
||||
}
|
||||
|
||||
HRESULT CompressArchive(
|
||||
const UString &archivePath,
|
||||
const UStringVector &fileNames,
|
||||
const UString &archiveType,
|
||||
bool email,
|
||||
bool showDialog)
|
||||
{
|
||||
if (fileNames.Size() == 0)
|
||||
return S_OK;
|
||||
|
||||
CObjectVector<CArchiverInfo> archivers;
|
||||
ReadArchiverInfoList(archivers);
|
||||
|
||||
CArchiverInfo archiverInfo;
|
||||
UString password;
|
||||
bool encryptHeadersIsAllowed = false;
|
||||
bool encryptHeaders = false;
|
||||
const NUpdateArchive::CActionSet *actionSet;
|
||||
NCompressDialog::CInfo compressInfo;
|
||||
|
||||
UString tempDirPath;
|
||||
UString currentDirPrefix;
|
||||
bool needTempFile = true;
|
||||
NDirectory::CTempDirectoryW tempDirectory;
|
||||
UString archiveName;
|
||||
int pos = archivePath.ReverseFind(L'\\');
|
||||
if (pos < 0)
|
||||
{
|
||||
archiveName = archivePath;
|
||||
MyGetCurrentDirectory(currentDirPrefix);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDirPrefix = archivePath.Left(pos + 1);
|
||||
archiveName = archivePath.Mid(pos + 1);
|
||||
}
|
||||
|
||||
if (email)
|
||||
{
|
||||
tempDirectory.Create(kTempFolderPrefix);
|
||||
currentDirPrefix = tempDirectory.GetPath();
|
||||
NormalizeDirPathPrefix(currentDirPrefix);
|
||||
needTempFile = false;
|
||||
}
|
||||
|
||||
if (showDialog)
|
||||
{
|
||||
bool oneFile = false;
|
||||
NFind::CFileInfoW fileInfo;
|
||||
if (!NFind::FindFile(fileNames.Front(), fileInfo))
|
||||
return ::GetLastError();
|
||||
if (fileNames.Size() == 1)
|
||||
oneFile = !fileInfo.IsDirectory();
|
||||
|
||||
CCompressDialog dialog;
|
||||
for(int i = 0; i < archivers.Size(); i++)
|
||||
{
|
||||
const CArchiverInfo &archiverInfo = archivers[i];
|
||||
if (archiverInfo.UpdateEnabled &&
|
||||
(oneFile || !archiverInfo.KeepName))
|
||||
dialog.m_ArchiverInfoList.Add(archiverInfo);
|
||||
}
|
||||
if(dialog.m_ArchiverInfoList.Size() == 0)
|
||||
{
|
||||
MyMessageBox(L"No Update Engines");
|
||||
return E_FAIL;
|
||||
}
|
||||
dialog.m_Info.ArchiveName = archiveName;
|
||||
dialog.OriginalFileName = fileInfo.Name;
|
||||
|
||||
dialog.m_Info.CurrentDirPrefix = currentDirPrefix;
|
||||
dialog.m_Info.SFXMode = false;
|
||||
dialog.m_Info.Solid = true;
|
||||
dialog.m_Info.MultiThread = false;
|
||||
|
||||
dialog.m_Info.KeepName = !oneFile;
|
||||
|
||||
if(dialog.Create(0) != IDOK)
|
||||
return S_OK;
|
||||
|
||||
if (dialog.m_Info.VolumeSizeIsDefined)
|
||||
{
|
||||
MyMessageBox(L"Splitting to volumes is not supported");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
switch(dialog.m_Info.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[dialog.m_Info.ArchiverInfoIndex];
|
||||
password = GetUnicodeString(dialog.Password);
|
||||
encryptHeadersIsAllowed = dialog.EncryptHeadersIsAllowed;
|
||||
encryptHeaders = dialog.EncryptHeaders;
|
||||
compressInfo = dialog.m_Info;
|
||||
compressInfo.ArchiveName = MakeFullArchiveName(
|
||||
compressInfo.ArchiveName,
|
||||
archiverInfo.GetMainExtension(), compressInfo.SFXMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < archivers.Size(); i++)
|
||||
{
|
||||
if (archivers[i].Name.CollateNoCase(archiveType) == 0)
|
||||
{
|
||||
archiverInfo = archivers[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == archivers.Size())
|
||||
{
|
||||
MyMessageBox(L"No archiver");
|
||||
return E_FAIL;
|
||||
}
|
||||
actionSet = &NUpdateArchive::kAddActionSet;
|
||||
bool is7z = (archiveType.CollateNoCase(L"7z") == 0);
|
||||
compressInfo.SolidIsAllowed = is7z;
|
||||
compressInfo.Solid = true;
|
||||
compressInfo.MultiThreadIsAllowed = is7z;
|
||||
compressInfo.MultiThread = false;
|
||||
compressInfo.SFXMode = false;
|
||||
compressInfo.KeepName = false;
|
||||
compressInfo.ArchiveName = archiveName;
|
||||
compressInfo.CurrentDirPrefix = currentDirPrefix;
|
||||
compressInfo.Level = 5;
|
||||
}
|
||||
UString arcPath;
|
||||
if (!compressInfo.GetFullPathName(arcPath))
|
||||
{
|
||||
MyMessageBox(L"Incorrect archive path");
|
||||
return E_FAIL;
|
||||
}
|
||||
if (compressInfo.ArchiveName.Find('\\') >= 0)
|
||||
{
|
||||
needTempFile = true;
|
||||
}
|
||||
|
||||
// MessageBox(0, arcPath, 0, 0);
|
||||
|
||||
NWorkDir::CInfo workDirInfo;
|
||||
ReadWorkDirInfo(workDirInfo);
|
||||
UString workDir = GetWorkDir(workDirInfo, arcPath);
|
||||
NFile::NDirectory::CreateComplexDirectory(workDir);
|
||||
|
||||
NFile::NDirectory::CTempFileW tempFile;
|
||||
UString tempFileName;
|
||||
if (needTempFile)
|
||||
{
|
||||
if (tempFile.Create(workDir, kTempArchivePrefix, tempFileName) == 0)
|
||||
return E_FAIL;
|
||||
}
|
||||
else
|
||||
tempFileName = arcPath;
|
||||
|
||||
|
||||
/*
|
||||
const CLSID &classID =
|
||||
dialog.m_ArchiverInfoList[dialog.m_Info.ArchiverInfoIndex].ClassID;
|
||||
*/
|
||||
NFind::CFileInfoW fileInfo;
|
||||
|
||||
CMyComPtr<IOutFolderArchive> outArchive;
|
||||
|
||||
CMyComPtr<IInFolderArchive> archiveHandler;
|
||||
if(NFind::FindFile(arcPath, fileInfo))
|
||||
{
|
||||
if (fileInfo.IsDirectory())
|
||||
{
|
||||
MyMessageBox(L"There is a folder with such name");
|
||||
return E_FAIL;
|
||||
}
|
||||
CAgent *agentSpec = new CAgent;
|
||||
archiveHandler = agentSpec;
|
||||
// CLSID realClassID;
|
||||
CMyComBSTR archiveType;
|
||||
HRESULT result = agentSpec->Open(
|
||||
GetUnicodeString(arcPath), &archiveType, NULL);
|
||||
if (result == S_FALSE)
|
||||
{
|
||||
MyMessageBox(IDS_OPEN_IS_NOT_SUPORTED_ARCHIVE, 0x02000604);
|
||||
return E_FAIL;
|
||||
}
|
||||
/*
|
||||
HRESULT result = OpenArchive(arcPath, &archiveHandler,
|
||||
archiverInfoResult, defaultName, NULL);
|
||||
if (result == S_FALSE)
|
||||
{
|
||||
MyMessageBox(IDS_OPEN_IS_NOT_SUPORTED_ARCHIVE, 0x02000604);
|
||||
return E_FAIL;
|
||||
}
|
||||
*/
|
||||
if (result != S_OK)
|
||||
{
|
||||
MyMessageBox(L"Open error");
|
||||
return E_FAIL;
|
||||
}
|
||||
if (archiverInfo.Name.CollateNoCase((const wchar_t *)archiveType) != 0)
|
||||
{
|
||||
MyMessageBox(L"Type of existing archive differs from specified type");
|
||||
return E_FAIL;
|
||||
}
|
||||
result = archiveHandler.QueryInterface(IID_IOutFolderArchive, &outArchive);
|
||||
if(result != S_OK)
|
||||
{
|
||||
MyMessageBox(MyFormatNew(IDS_CANT_UPDATE_ARCHIVE, 0x02000602,
|
||||
GetUnicodeString(arcPath)));
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CAgent *agentSpec = new CAgent;
|
||||
outArchive = agentSpec;
|
||||
}
|
||||
|
||||
CRecordVector<const wchar_t *> fileNamePointers;
|
||||
fileNamePointers.Reserve(fileNames.Size());
|
||||
|
||||
int i;
|
||||
for(i = 0; i < fileNames.Size(); i++)
|
||||
fileNamePointers.Add(fileNames[i]);
|
||||
|
||||
outArchive->SetFolder(NULL);
|
||||
|
||||
// Don't uses CurrentFolder here, since files are absolute paths;
|
||||
// MyGetCurrentDirectory(aCurrentFolder);
|
||||
|
||||
UINT codePage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;
|
||||
outArchive->SetFiles(L"",
|
||||
&fileNamePointers.Front(), fileNamePointers.Size());
|
||||
|
||||
CThreadUpdateCompress updater;
|
||||
for (i = 0; i < NUpdateArchive::NPairState::kNumValues; i++)
|
||||
updater.ActionSetByte[i] = actionSet->StateActions[i];
|
||||
updater.UpdateCallbackSpec = new CUpdateCallback100Imp;
|
||||
updater.UpdateCallback = updater.UpdateCallbackSpec;
|
||||
updater.OutArchive = outArchive;
|
||||
// updater.SrcFolderPrefix = srcPanel._currentFolderPrefix;
|
||||
|
||||
UString title = LangLoadStringW(IDS_PROGRESS_COMPRESSING, 0x02000DC0);
|
||||
updater.UpdateCallbackSpec->Init(0, !password.IsEmpty(), password);
|
||||
|
||||
// UINT32 level = MyMin(compressInfo.Level, UINT32(9));
|
||||
UINT32 level = compressInfo.Level;
|
||||
HRESULT result = SetOutProperties(outArchive,
|
||||
archiverInfo.Name.CompareNoCase(L"7z") == 0,
|
||||
level,
|
||||
compressInfo.Method,
|
||||
compressInfo.Dictionary,
|
||||
compressInfo.OrderMode, compressInfo.Order,
|
||||
compressInfo.SolidIsAllowed, compressInfo.Solid,
|
||||
compressInfo.MultiThreadIsAllowed, compressInfo.MultiThread,
|
||||
encryptHeadersIsAllowed, encryptHeaders,
|
||||
compressInfo.SFXMode,
|
||||
GetUnicodeString(compressInfo.Options));
|
||||
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (result != E_ABORT)
|
||||
ShowErrorMessage(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
UString sfxModule;
|
||||
if (compressInfo.SFXMode)
|
||||
{
|
||||
UString sfxModule2;
|
||||
LPCWSTR path = NULL;
|
||||
UString sfxModule3;
|
||||
if (GetProgramFolderPath(sfxModule3))
|
||||
path = sfxModule3;
|
||||
if (!NDirectory::MySearchPath(path, kDefaultSfxModule, NULL, sfxModule2))
|
||||
{
|
||||
MyMessageBox(L"can't find sfx module");
|
||||
return E_FAIL;
|
||||
}
|
||||
sfxModule = sfxModule2;
|
||||
}
|
||||
|
||||
updater.OutArchivePath = GetUnicodeString(tempFileName, codePage);
|
||||
updater.SfxMode = compressInfo.SFXMode;
|
||||
updater.SfxModule = sfxModule;
|
||||
updater.LibPath = GetUnicodeString(archiverInfo.FilePath);
|
||||
updater.ClassID = archiverInfo.ClassID;
|
||||
|
||||
CThread thread;
|
||||
if (!thread.Create(CThreadUpdateCompress::MyThreadFunction, &updater))
|
||||
throw 271824;
|
||||
updater.UpdateCallbackSpec->StartProgressDialog(title);
|
||||
result = updater.Result;
|
||||
|
||||
updater.UpdateCallback.Release();
|
||||
|
||||
updater.OutArchive.Release();
|
||||
outArchive.Release();
|
||||
|
||||
if (result != S_OK)
|
||||
{
|
||||
if (result != E_ABORT)
|
||||
ShowErrorMessage(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
if(archiveHandler)
|
||||
{
|
||||
archiveHandler->Close();
|
||||
if (!DeleteFileAlways(arcPath))
|
||||
{
|
||||
ShowLastErrorMessage();
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
if (needTempFile)
|
||||
{
|
||||
tempFile.DisableDeleting();
|
||||
if (!NDirectory::MyMoveFile(tempFileName, arcPath))
|
||||
{
|
||||
ShowLastErrorMessage();
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if (email)
|
||||
{
|
||||
NDLL::CLibrary mapiLib;
|
||||
if (!mapiLib.Load(TEXT("Mapi32.dll")))
|
||||
return E_FAIL;
|
||||
LPMAPISENDDOCUMENTS fnSend = (LPMAPISENDDOCUMENTS)
|
||||
mapiLib.GetProcAddress("MAPISendDocuments");
|
||||
if (fnSend == 0)
|
||||
return E_FAIL;
|
||||
|
||||
UString fileName;
|
||||
GetOnlyName(arcPath, fileName);
|
||||
AString path = GetAnsiString(arcPath);
|
||||
AString name = GetAnsiString(fileName);
|
||||
fnSend(0, ";", (LPSTR)(LPCSTR)path, (LPSTR)(LPCSTR)name, 0);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
17
7zip/UI/GUI/Compress.h
Executable file
17
7zip/UI/GUI/Compress.h
Executable file
@@ -0,0 +1,17 @@
|
||||
// GUI/Compress.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __GUI_COMPRESS_H
|
||||
#define __GUI_COMPRESS_H
|
||||
|
||||
#include "Common/String.h"
|
||||
|
||||
HRESULT CompressArchive(
|
||||
const UString &archivePath,
|
||||
const UStringVector &fileNames,
|
||||
const UString &archiveType,
|
||||
bool email,
|
||||
bool showDialog);
|
||||
|
||||
#endif
|
||||
1233
7zip/UI/GUI/CompressDialog.cpp
Executable file
1233
7zip/UI/GUI/CompressDialog.cpp
Executable file
File diff suppressed because it is too large
Load Diff
161
7zip/UI/GUI/CompressDialog.h
Executable file
161
7zip/UI/GUI/CompressDialog.h
Executable file
@@ -0,0 +1,161 @@
|
||||
// CompressDialog.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#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;
|
||||
|
||||
bool VolumeSizeIsDefined;
|
||||
UINT64 VolumeSize;
|
||||
|
||||
UINT32 Level;
|
||||
UString Method;
|
||||
UINT32 Dictionary;
|
||||
bool OrderMode;
|
||||
UINT32 Order;
|
||||
CSysString Options;
|
||||
|
||||
bool SFXMode;
|
||||
|
||||
UString ArchiveName; // in: Relative for ; out: abs
|
||||
UString CurrentDirPrefix;
|
||||
bool KeepName;
|
||||
|
||||
bool GetFullPathName(UString &result) const;
|
||||
|
||||
int ArchiverInfoIndex;
|
||||
|
||||
void Init()
|
||||
{
|
||||
Level = Dictionary = Order = UINT32(-1);
|
||||
OrderMode = false;
|
||||
Method.Empty();
|
||||
Options.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 _passwordControl;
|
||||
|
||||
|
||||
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();
|
||||
|
||||
void SetMethod();
|
||||
int GetMethodID();
|
||||
CSysString GetMethodSpec();
|
||||
|
||||
AddDictionarySize(UINT32 size, bool kilo, bool maga);
|
||||
AddDictionarySize(UINT32 size);
|
||||
|
||||
void SetDictionary();
|
||||
UINT32 GetDictionary();
|
||||
UINT32 GetDictionarySpec();
|
||||
|
||||
int AddOrder(UINT32 size);
|
||||
void SetOrder();
|
||||
bool GetOrderMode();
|
||||
UINT32 GetOrder();
|
||||
UINT32 GetOrderSpec();
|
||||
|
||||
UINT64 GetMemoryUsage(UINT64 &decompressMemory);
|
||||
void PrintMemUsage(UINT res, UINT64 value);
|
||||
void SetMemoryUsage();
|
||||
void SetParams();
|
||||
void SaveOptionsInMem();
|
||||
|
||||
void UpdatePasswordControl();
|
||||
public:
|
||||
CObjectVector<CArchiverInfo> m_ArchiverInfoList;
|
||||
|
||||
NCompressDialog::CInfo m_Info;
|
||||
UString OriginalFileName; // for bzip2, gzip2
|
||||
|
||||
CSysString Password;
|
||||
bool EncryptHeadersIsAllowed;
|
||||
bool EncryptHeaders;
|
||||
|
||||
INT_PTR Create(HWND wndParent = 0)
|
||||
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_COMPRESS ), wndParent); }
|
||||
|
||||
protected:
|
||||
|
||||
void CheckSFXControlsEnable();
|
||||
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
|
||||
225
7zip/UI/GUI/Extract.cpp
Executable file
225
7zip/UI/GUI/Extract.cpp
Executable file
@@ -0,0 +1,225 @@
|
||||
// Extract.h
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Extract.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/FileDir.h"
|
||||
#include "Windows/Error.h"
|
||||
#include "Windows/FileFind.h"
|
||||
#ifndef EXCLUDE_COM
|
||||
#include "Windows/DLL.h"
|
||||
#endif
|
||||
#include "Windows/Thread.h"
|
||||
|
||||
#include "../Common/OpenArchive.h"
|
||||
#include "../Common/DefaultName.h"
|
||||
|
||||
#ifndef EXCLUDE_COM
|
||||
#include "../Common/ZipRegistry.h"
|
||||
#endif
|
||||
|
||||
#include "../Resource/Extract/resource.h"
|
||||
|
||||
#include "../Explorer/MyMessages.h"
|
||||
#include "../../FileManager/FormatUtils.h"
|
||||
|
||||
#include "ExtractDialog.h"
|
||||
#include "../../FileManager/ExtractCallback.h"
|
||||
|
||||
#include "../Agent/ArchiveExtractCallback.h"
|
||||
|
||||
#include "../../FileManager/OpenCallback.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
struct CThreadExtracting
|
||||
{
|
||||
#ifndef EXCLUDE_COM
|
||||
NDLL::CLibrary Library;
|
||||
#endif
|
||||
CMyComPtr<IInArchive> Archive;
|
||||
CExtractCallbackImp *ExtractCallbackSpec;
|
||||
CMyComPtr<IFolderArchiveExtractCallback> ExtractCallback2;
|
||||
CMyComPtr<IArchiveExtractCallback> ArchiveExtractCallback;
|
||||
|
||||
HRESULT Result;
|
||||
|
||||
DWORD Process()
|
||||
{
|
||||
ExtractCallbackSpec->ProgressDialog.WaitCreating();
|
||||
Result = Archive->Extract(0, -1, BoolToInt(false),
|
||||
ArchiveExtractCallback);
|
||||
ExtractCallbackSpec->ProgressDialog.MyClose();
|
||||
return 0;
|
||||
}
|
||||
static DWORD WINAPI MyThreadFunction(void *param)
|
||||
{
|
||||
return ((CThreadExtracting *)param)->Process();
|
||||
}
|
||||
};
|
||||
|
||||
static inline UINT GetCurrentFileCodePage()
|
||||
{ return AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
|
||||
|
||||
HRESULT ExtractArchive(HWND parentWindow, const UString &fileName,
|
||||
bool assumeYes, bool showDialog, const UString &outputFolder)
|
||||
{
|
||||
CThreadExtracting extracter;
|
||||
|
||||
CArchiverInfo archiverInfo;
|
||||
|
||||
COpenArchiveCallback *openCallbackSpec = new COpenArchiveCallback;
|
||||
CMyComPtr<IArchiveOpenCallback> openCallback = openCallbackSpec;
|
||||
openCallbackSpec->_passwordIsDefined = false;
|
||||
openCallbackSpec->_parentWindow = parentWindow;
|
||||
|
||||
UString fullName;
|
||||
int fileNamePartStartIndex;
|
||||
NFile::NDirectory::MyGetFullPathName(fileName, fullName, fileNamePartStartIndex);
|
||||
|
||||
openCallbackSpec->LoadFileInfo(
|
||||
fullName.Left(fileNamePartStartIndex),
|
||||
fullName.Mid(fileNamePartStartIndex));
|
||||
|
||||
int subExtIndex;
|
||||
HRESULT res = OpenArchive(fileName,
|
||||
#ifndef EXCLUDE_COM
|
||||
&extracter.Library,
|
||||
#endif
|
||||
&extracter.Archive, archiverInfo, subExtIndex, openCallback);
|
||||
RINOK(res);
|
||||
|
||||
NFile::NFind::CFileInfoW fileInfo;
|
||||
if (!NFile::NFind::FindFile(fileName, fileInfo))
|
||||
return E_FAIL;
|
||||
UString defaultName = GetDefaultName(fileName,
|
||||
archiverInfo.Extensions[subExtIndex].Extension,
|
||||
archiverInfo.Extensions[subExtIndex].AddExtension);
|
||||
|
||||
UString directoryPath;
|
||||
NExtractionDialog::CModeInfo extractModeInfo;
|
||||
UString password;
|
||||
if (openCallbackSpec->_passwordIsDefined)
|
||||
password = openCallbackSpec->_password;
|
||||
if (showDialog)
|
||||
{
|
||||
CExtractDialog dialog;
|
||||
if (!NFile::NDirectory::MyGetFullPathName(outputFolder, dialog.DirectoryPath))
|
||||
{
|
||||
MyMessageBox(L"Error 32432432");
|
||||
return E_FAIL;
|
||||
}
|
||||
// dialog.DirectoryPath = outputFolder;
|
||||
// dialog.FilesMode = NExtractionDialog::NFilesMode::kAll;
|
||||
// dialog._enableSelectedFilesButton = false;
|
||||
dialog.Password = password;
|
||||
|
||||
if(dialog.Create(parentWindow) != IDOK)
|
||||
return E_ABORT;
|
||||
directoryPath = dialog.DirectoryPath;
|
||||
dialog.GetModeInfo(extractModeInfo);
|
||||
|
||||
password = dialog.Password;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!NFile::NDirectory::MyGetFullPathName(outputFolder, directoryPath))
|
||||
{
|
||||
MyMessageBox(L"Error 98324982");
|
||||
return E_FAIL;
|
||||
}
|
||||
NFile::NName::NormalizeDirPathPrefix(directoryPath);
|
||||
|
||||
extractModeInfo.PathMode = NExtractionDialog::NPathMode::kFullPathnames;
|
||||
extractModeInfo.OverwriteMode = assumeYes ?
|
||||
NExtractionDialog::NOverwriteMode::kWithoutPrompt:
|
||||
NExtractionDialog::NOverwriteMode::kAskBefore;
|
||||
// extractModeInfo.FilesMode = NExtractionDialog::NFilesMode::kAll;
|
||||
}
|
||||
if(!NFile::NDirectory::CreateComplexDirectory(directoryPath))
|
||||
{
|
||||
UString s = GetUnicodeString(NError::MyFormatMessage(GetLastError()));
|
||||
UString s2 = MyFormatNew(IDS_CANNOT_CREATE_FOLDER,
|
||||
#ifdef LANG
|
||||
0x02000603,
|
||||
#endif
|
||||
directoryPath);
|
||||
MyMessageBox(s2 + UString(L"\n") + s);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
extracter.ExtractCallbackSpec = new CExtractCallbackImp;
|
||||
|
||||
extracter.ExtractCallback2 = extracter.ExtractCallbackSpec;
|
||||
|
||||
extracter.ExtractCallbackSpec->_parentWindow = 0;
|
||||
#ifdef LANG
|
||||
const UString title = LangLoadStringW(IDS_PROGRESS_EXTRACTING, 0x02000890);
|
||||
#else
|
||||
const UString title = NWindows::MyLoadStringW(IDS_PROGRESS_EXTRACTING);
|
||||
#endif
|
||||
|
||||
NFile::NFind::CFileInfoW archiveFileInfo;
|
||||
if (!NFile::NFind::FindFile(fileName, archiveFileInfo))
|
||||
throw "there is no archive file";
|
||||
|
||||
extracter.ExtractCallbackSpec->Init(NExtractionMode::NOverwrite::kAskBefore,
|
||||
!password.IsEmpty(), password);
|
||||
|
||||
NExtractionMode::NPath::EEnum pathMode;
|
||||
NExtractionMode::NOverwrite::EEnum overwriteMode;
|
||||
switch (extractModeInfo.OverwriteMode)
|
||||
{
|
||||
case NExtractionDialog::NOverwriteMode::kAskBefore:
|
||||
overwriteMode = NExtractionMode::NOverwrite::kAskBefore;
|
||||
break;
|
||||
case NExtractionDialog::NOverwriteMode::kWithoutPrompt:
|
||||
overwriteMode = NExtractionMode::NOverwrite::kWithoutPrompt;
|
||||
break;
|
||||
case NExtractionDialog::NOverwriteMode::kSkipExisting:
|
||||
overwriteMode = NExtractionMode::NOverwrite::kSkipExisting;
|
||||
break;
|
||||
case NExtractionDialog::NOverwriteMode::kAutoRename:
|
||||
overwriteMode = NExtractionMode::NOverwrite::kAutoRename;
|
||||
break;
|
||||
default:
|
||||
throw 12334454;
|
||||
}
|
||||
switch (extractModeInfo.PathMode)
|
||||
{
|
||||
case NExtractionDialog::NPathMode::kFullPathnames:
|
||||
pathMode = NExtractionMode::NPath::kFullPathnames;
|
||||
break;
|
||||
case NExtractionDialog::NPathMode::kCurrentPathnames:
|
||||
pathMode = NExtractionMode::NPath::kCurrentPathnames;
|
||||
break;
|
||||
case NExtractionDialog::NPathMode::kNoPathnames:
|
||||
pathMode = NExtractionMode::NPath::kNoPathnames;
|
||||
break;
|
||||
default:
|
||||
throw 12334455;
|
||||
}
|
||||
|
||||
CArchiveExtractCallback *extractCallbackSpec = new
|
||||
CArchiveExtractCallback;
|
||||
extracter.ArchiveExtractCallback = extractCallbackSpec;
|
||||
|
||||
extractCallbackSpec->Init(extracter.Archive,
|
||||
extracter.ExtractCallback2,
|
||||
directoryPath, pathMode,
|
||||
overwriteMode, UStringVector(),
|
||||
defaultName,
|
||||
fileInfo.LastWriteTime, fileInfo.Attributes);
|
||||
|
||||
CThread thread;
|
||||
if (!thread.Create(CThreadExtracting::MyThreadFunction, &extracter))
|
||||
throw 271824;
|
||||
extracter.ExtractCallbackSpec->StartProgressDialog(title);
|
||||
return extracter.Result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
12
7zip/UI/GUI/Extract.h
Executable file
12
7zip/UI/GUI/Extract.h
Executable file
@@ -0,0 +1,12 @@
|
||||
// GUI/Extract.h
|
||||
|
||||
#ifndef __GUI_EXTRACT_H
|
||||
#define __GUI_EXTRACT_H
|
||||
|
||||
#include "Common/String.h"
|
||||
|
||||
HRESULT ExtractArchive(HWND parentWindow, const UString &fileName,
|
||||
bool assumeYes, bool showDialog, const UString &outputFolder);
|
||||
|
||||
#endif
|
||||
|
||||
371
7zip/UI/GUI/ExtractDialog.cpp
Executable file
371
7zip/UI/GUI/ExtractDialog.cpp
Executable 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"
|
||||
|
||||
#ifdef LANG
|
||||
#include "../../FileManager/LangUtils.h"
|
||||
#endif
|
||||
|
||||
#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 kPathnamesButtons[] =
|
||||
{
|
||||
IDC_EXTRACT_RADIO_FULL_PATHNAMES,
|
||||
IDC_EXTRACT_RADIO_CURRENT_PATHNAMES,
|
||||
IDC_EXTRACT_RADIO_NO_PATHNAMES
|
||||
};
|
||||
static const int kNumPathnamesButtons = sizeof(kPathnamesButtons) / sizeof(kPathnamesButtons[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
|
||||
};
|
||||
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
|
||||
int CExtractDialog::GetPathNameMode() const
|
||||
{
|
||||
for (int i = 0; i < kNumPathnamesButtons; i++)
|
||||
if(IsButtonCheckedBool(kPathnamesButtons[i]))
|
||||
return i;
|
||||
throw 0;
|
||||
}
|
||||
|
||||
int CExtractDialog::GetOverwriteMode() const
|
||||
{
|
||||
for (int i = 0; i < kNumOverwriteButtons; i++)
|
||||
if(IsButtonCheckedBool(kOverwriteButtons[i]))
|
||||
return i;
|
||||
throw 0;
|
||||
}
|
||||
|
||||
/*
|
||||
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_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
|
||||
|
||||
NExtraction::CInfo extractionInfo;
|
||||
|
||||
#ifdef NO_REGISTRY
|
||||
extractionInfo.PathMode = NExtraction::NPathMode::kFullPathnames;
|
||||
extractionInfo.OverwriteMode = NExtraction::NOverwriteMode::kAskBefore;
|
||||
// extractionInfo.Paths = NExtraction::NPathMode::kFullPathnames;
|
||||
#else
|
||||
ReadExtractionInfo(extractionInfo);
|
||||
CheckButton(IDC_EXTRACT_CHECK_SHOW_PASSWORD, extractionInfo.ShowPassword);
|
||||
UpdatePasswordControl();
|
||||
#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);
|
||||
*/
|
||||
|
||||
|
||||
_pathMode = extractionInfo.PathMode;
|
||||
_overwriteMode = extractionInfo.OverwriteMode;
|
||||
|
||||
#ifndef _SFX
|
||||
CheckRadioButton(kPathnamesButtons[0], kPathnamesButtons[kNumPathnamesButtons - 1],
|
||||
kPathnamesButtons[_pathMode]);
|
||||
|
||||
CheckRadioButton(kOverwriteButtons[0], kOverwriteButtons[kNumOverwriteButtons - 1],
|
||||
kOverwriteButtons[_overwriteMode]);
|
||||
|
||||
/*
|
||||
CheckRadioButton(kFilesButtons[0], kFilesButtons[kNumFilesButtons - 1],
|
||||
kFilesButtons[_filesMode]);
|
||||
*/
|
||||
|
||||
// CWindow selectedFilesWindow = GetItem(IDC_EXTRACT_RADIO_SELECTED_FILES);
|
||||
// selectedFilesWindow.Enable(_enableSelectedFilesButton);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// CWindow aFilesWindow = GetItem(IDC_EXTRACT_RADIO_FILES);
|
||||
// aFilesWindow.Enable(_enableFilesButton);
|
||||
|
||||
// UpdateWildCardState();
|
||||
return CModalDialog::OnInit();
|
||||
}
|
||||
|
||||
#ifndef _SFX
|
||||
void CExtractDialog::UpdatePasswordControl()
|
||||
{
|
||||
_passwordControl.SetPasswordChar((IsButtonChecked(
|
||||
IDC_EXTRACT_CHECK_SHOW_PASSWORD) == BST_CHECKED) ? 0: TEXT('*'));
|
||||
CSysString 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()
|
||||
{
|
||||
CSysString 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))
|
||||
return;
|
||||
#ifndef NO_REGISTRY
|
||||
_path.SetCurSel(-1);
|
||||
#endif
|
||||
_path.SetText(resultPath);
|
||||
}
|
||||
|
||||
void AddUniqueString(CSysStringVector &list, const CSysString &s)
|
||||
{
|
||||
for(int i = 0; i < list.Size(); i++)
|
||||
if (s.CollateNoCase(list[i]) == 0)
|
||||
return;
|
||||
list.Add(s);
|
||||
}
|
||||
|
||||
void CExtractDialog::OnOK()
|
||||
{
|
||||
#ifndef _SFX
|
||||
_pathMode = GetPathNameMode();
|
||||
_overwriteMode = GetOverwriteMode();
|
||||
// _filesMode = (NExtractionDialog::NFilesMode::EEnum)GetFilesMode();
|
||||
|
||||
_passwordControl.GetText(Password);
|
||||
#endif
|
||||
|
||||
NExtraction::CInfo extractionInfo;
|
||||
extractionInfo.PathMode = NExtraction::NPathMode::EEnum(_pathMode);
|
||||
extractionInfo.OverwriteMode = NExtraction::NOverwriteMode::EEnum(_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
|
||||
{
|
||||
CSysString sTemp;
|
||||
_path.GetLBText(currentItem, sTemp);
|
||||
s = GetUnicodeString(sTemp);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
s.Trim();
|
||||
#ifndef _SFX
|
||||
AddUniqueString(extractionInfo.Paths, GetSystemString(s));
|
||||
#endif
|
||||
DirectoryPath = s;
|
||||
#ifndef NO_REGISTRY
|
||||
for(int i = 0; i < _path.GetCount(); i++)
|
||||
if(i != currentItem)
|
||||
{
|
||||
CSysString 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));
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
static DWORD aHelpArray[] =
|
||||
{
|
||||
IDC_EXTRACT_COMBO_PATH, IDH_EXTRACT_COMBO_PATH,
|
||||
IDC_EXTRACT_BUTTON_SET_PATH, IDH_EXTRACT_BUTTON_SET_PATH,
|
||||
|
||||
IDC_EXTRACT_PATH_MODE, IDH_EXTRACT_PATH_MODE,
|
||||
IDC_EXTRACT_RADIO_FULL_PATHNAMES, IDH_EXTRACT_RADIO_FULL_PATHNAMES,
|
||||
IDC_EXTRACT_RADIO_CURRENT_PATHNAMES,IDH_EXTRACT_RADIO_CURRENT_PATHNAMES,
|
||||
IDC_EXTRACT_RADIO_NO_PATHNAMES,IDH_EXTRACT_RADIO_NO_PATHNAMES,
|
||||
|
||||
IDC_EXTRACT_OVERWRITE_MODE, IDH_EXTRACT_OVERWRITE_MODE,
|
||||
IDC_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE, IDH_EXTRACT_RADIO_ASK_BEFORE_OVERWRITE,
|
||||
IDC_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT, IDH_EXTRACT_RADIO_OVERWRITE_WITHOUT_PROMPT,
|
||||
IDC_EXTRACT_RADIO_SKIP_EXISTING_FILES, IDH_EXTRACT_RADIO_SKIP_EXISTING_FILES,
|
||||
|
||||
IDC_EXTRACT_FILES, IDH_EXTRACT_FILES,
|
||||
IDC_EXTRACT_RADIO_SELECTED_FILES, IDH_EXTRACT_RADIO_SELECTED_FILES,
|
||||
IDC_EXTRACT_RADIO_ALL_FILES, IDH_EXTRACT_RADIO_ALL_FILES,
|
||||
IDC_EXTRACT_RADIO_FILES, IDH_EXTRACT_RADIO_FILES,
|
||||
IDC_EXTRACT_EDIT_WILDCARDS, IDH_EXTRACT_EDIT_WILDCARDS,
|
||||
0,0
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
void CExtractDialog::GetModeInfo(NExtractionDialog::CModeInfo &modeInfo)
|
||||
{
|
||||
modeInfo.OverwriteMode = NExtractionDialog::NOverwriteMode::EEnum(_overwriteMode);
|
||||
modeInfo.PathMode = NExtractionDialog::NPathMode::EEnum(_pathMode);
|
||||
// modeInfo.FilesMode = NExtractionDialog::NFilesMode::EEnum(FilesMode);
|
||||
modeInfo.FileList.Clear();
|
||||
}
|
||||
|
||||
#ifndef NO_REGISTRY
|
||||
static LPCWSTR kHelpTopic = L"fm/plugins/7-zip/extract.htm";
|
||||
void CExtractDialog::OnHelp()
|
||||
{
|
||||
ShowHelpWindow(NULL, kHelpTopic);
|
||||
CModalDialog::OnHelp();
|
||||
/*
|
||||
if (pHelpInfo->iContextType == HELPINFO_WINDOW)
|
||||
{
|
||||
return ::HtmlHelp((HWND)pHelpInfo->hItemHandle,
|
||||
TEXT("C:\\SRC\\VC\\ZipView\\Help\\7zip.chm::/Context/Extract.txt"),
|
||||
HH_TP_HELP_WM_HELP, (DWORD)(LPVOID)aHelpArray) != NULL;
|
||||
}
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
99
7zip/UI/GUI/ExtractDialog.h
Executable file
99
7zip/UI/GUI/ExtractDialog.h
Executable file
@@ -0,0 +1,99 @@
|
||||
// ExtractDialog.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#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
|
||||
|
||||
namespace NExtractionDialog
|
||||
{
|
||||
namespace NFilesMode
|
||||
{
|
||||
enum EEnum
|
||||
{
|
||||
kSelected,
|
||||
kAll,
|
||||
kSpecified
|
||||
};
|
||||
}
|
||||
namespace NPathMode
|
||||
{
|
||||
enum EEnum
|
||||
{
|
||||
kFullPathnames,
|
||||
kCurrentPathnames,
|
||||
kNoPathnames,
|
||||
};
|
||||
}
|
||||
namespace NOverwriteMode
|
||||
{
|
||||
enum EEnum
|
||||
{
|
||||
kAskBefore,
|
||||
kWithoutPrompt,
|
||||
kSkipExisting,
|
||||
kAutoRename
|
||||
};
|
||||
}
|
||||
struct CModeInfo
|
||||
{
|
||||
NOverwriteMode::EEnum OverwriteMode;
|
||||
NPathMode::EEnum PathMode;
|
||||
// NFilesMode::EEnum FilesMode;
|
||||
UStringVector FileList;
|
||||
};
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
int _pathMode;
|
||||
int _overwriteMode;
|
||||
|
||||
#ifndef _SFX
|
||||
int GetPathNameMode() const;
|
||||
int GetOverwriteMode() const;
|
||||
// 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;
|
||||
UString DirectoryPath;
|
||||
// NExtractionDialog::NFilesMode::EEnum FilesMode;
|
||||
UString Password;
|
||||
|
||||
INT_PTR Create(HWND aWndParent = 0)
|
||||
{ return CModalDialog::Create(MAKEINTRESOURCE(IDD_DIALOG_EXTRACT), aWndParent); }
|
||||
void GetModeInfo(NExtractionDialog::CModeInfo &modeInfo);
|
||||
};
|
||||
|
||||
#endif
|
||||
BIN
7zip/UI/GUI/FM.ico
Executable file
BIN
7zip/UI/GUI/FM.ico
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
361
7zip/UI/GUI/GUI.cpp
Executable file
361
7zip/UI/GUI/GUI.cpp
Executable file
@@ -0,0 +1,361 @@
|
||||
// GUI.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <initguid.h>
|
||||
|
||||
#include "Common/NewHandler.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/CommandLineParser.h"
|
||||
|
||||
#include "Windows/COM.h"
|
||||
#include "Windows/FileMapping.h"
|
||||
#include "Windows/FileDir.h"
|
||||
#include "Windows/Synchronization.h"
|
||||
#include "Windows/FileName.h"
|
||||
|
||||
#include "../../IStream.h"
|
||||
#include "../../IPassword.h"
|
||||
|
||||
// #include "../../Compress/Interface/CompressInterface.h"
|
||||
// #include "../../FileManager/FolderInterface.h"
|
||||
#include "../../FileManager/StringUtils.h"
|
||||
|
||||
#include "../Resource/Extract/resource.h"
|
||||
#include "../Agent/Agent.h"
|
||||
// #include "../Common/FolderArchiveInterface.h"
|
||||
#include "../Explorer/MyMessages.h"
|
||||
|
||||
#include "Test.h"
|
||||
#include "Extract.h"
|
||||
#include "Compress.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NCommandLineParser;
|
||||
|
||||
HINSTANCE g_hInstance;
|
||||
|
||||
static const int kNumSwitches = 5;
|
||||
|
||||
namespace NKey {
|
||||
enum Enum
|
||||
{
|
||||
// kHelp1 = 0,
|
||||
// kHelp2,
|
||||
// kDisablePercents,
|
||||
kArchiveType,
|
||||
// kYes,
|
||||
// kPassword,
|
||||
// kProperty,
|
||||
kOutputDir,
|
||||
// kWorkingDir,
|
||||
kInclude,
|
||||
// kExclude,
|
||||
// kUpdate,
|
||||
// kRecursed,
|
||||
// kSfx,
|
||||
// kOverwrite,
|
||||
kEmail,
|
||||
kShowDialog
|
||||
// kMap
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
static const int kSomeCludePostStringMinSize = 2; // at least <@|!><N>ame must be
|
||||
static const int kSomeCludeAfterRecursedPostStringMinSize = 2; // at least <@|!><N>ame must be
|
||||
static const wchar_t *kRecursedPostCharSet = L"0-";
|
||||
static const wchar_t *kOverwritePostCharSet = L"asut";
|
||||
|
||||
static const CSwitchForm kSwitchForms[kNumSwitches] =
|
||||
{
|
||||
// { L"?", NSwitchType::kSimple, false },
|
||||
// { L"H", NSwitchType::kSimple, false },
|
||||
// { L"BD", NSwitchType::kSimple, false },
|
||||
{ L"T", NSwitchType::kUnLimitedPostString, false, 1 },
|
||||
// { L"Y", NSwitchType::kSimple, false },
|
||||
// { L"P", NSwitchType::kUnLimitedPostString, false, 0 },
|
||||
// { L"M", NSwitchType::kUnLimitedPostString, true, 1 },
|
||||
{ L"O", NSwitchType::kUnLimitedPostString, false, 1 },
|
||||
// { L"W", NSwitchType::kUnLimitedPostString, false, 0 },
|
||||
{ L"I", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize},
|
||||
// { L"X", NSwitchType::kUnLimitedPostString, true, kSomeCludePostStringMinSize},
|
||||
// { L"U", NSwitchType::kUnLimitedPostString, true, 1},
|
||||
// { L"R", NSwitchType::kPostChar, false, 0, 0, kRecursedPostCharSet },
|
||||
// { L"SFX", NSwitchType::kUnLimitedPostString, false, 0 },
|
||||
// { L"AO", NSwitchType::kPostChar, false, 1, 1, kOverwritePostCharSet},
|
||||
{ L"SEML", NSwitchType::kSimple, false },
|
||||
{ L"AD", NSwitchType::kSimple, false }
|
||||
// { L"MAP=", NSwitchType::kUnLimitedPostString, false, 1 }
|
||||
};
|
||||
|
||||
|
||||
static bool inline IsItWindowsNT()
|
||||
{
|
||||
OSVERSIONINFO versionInfo;
|
||||
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
|
||||
if (!::GetVersionEx(&versionInfo))
|
||||
return false;
|
||||
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
|
||||
}
|
||||
|
||||
static void MyMessageBoxError(const char *message)
|
||||
{
|
||||
::MessageBoxA(0, message, "Error", 0);
|
||||
}
|
||||
|
||||
static wchar_t *kIncorrectCommandMessage = L"Incorrect command";
|
||||
|
||||
static void ErrorMessage(const wchar_t *message)
|
||||
{
|
||||
MessageBoxW(0, message, L"7-Zip GUI", MB_ICONERROR);
|
||||
}
|
||||
|
||||
static bool ParseIncludeMap(const UString &switchParam, UStringVector &fileNames)
|
||||
{
|
||||
int splitPos = switchParam.Find(L':');
|
||||
if (splitPos < 0)
|
||||
{
|
||||
ErrorMessage(L"Bad switch");
|
||||
return false;
|
||||
}
|
||||
UString mappingName = switchParam.Left(splitPos);
|
||||
|
||||
UString switchParam2 = switchParam.Mid(splitPos + 1);
|
||||
splitPos = switchParam2.Find(L':');
|
||||
if (splitPos < 0)
|
||||
{
|
||||
ErrorMessage(L"Bad switch");
|
||||
return false;
|
||||
}
|
||||
|
||||
UString mappingSize = switchParam2.Left(splitPos);
|
||||
UString eventName = switchParam2.Mid(splitPos + 1);
|
||||
|
||||
wchar_t *endptr;
|
||||
UINT32 dataSize = wcstoul(mappingSize, &endptr, 10);
|
||||
|
||||
{
|
||||
CFileMapping fileMapping;
|
||||
if (!fileMapping.Open(FILE_MAP_READ, false,
|
||||
GetSystemString(mappingName)))
|
||||
{
|
||||
// ShowLastErrorMessage(0);
|
||||
ErrorMessage(L"Can not open mapping");
|
||||
return false;
|
||||
}
|
||||
LPVOID data = fileMapping.MapViewOfFile(FILE_MAP_READ, 0, dataSize);
|
||||
if (data == NULL)
|
||||
{
|
||||
ErrorMessage(L"MapViewOfFile error");
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
const wchar_t *curData = (const wchar_t *)data;
|
||||
if (*curData != 0)
|
||||
{
|
||||
ErrorMessage(L"Incorrect mapping data");
|
||||
return false;
|
||||
}
|
||||
UINT32 numChars = dataSize /2;
|
||||
UString name;
|
||||
|
||||
for (int i = 1; i < numChars; i++)
|
||||
{
|
||||
wchar_t c = curData[i];
|
||||
if (c == L'\0')
|
||||
{
|
||||
fileNames.Add(name);
|
||||
name.Empty();
|
||||
}
|
||||
else
|
||||
name += c;
|
||||
}
|
||||
if (!name.IsEmpty())
|
||||
{
|
||||
ErrorMessage(L"data error");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
UnmapViewOfFile(data);
|
||||
throw;
|
||||
}
|
||||
UnmapViewOfFile(data);
|
||||
}
|
||||
|
||||
{
|
||||
NSynchronization::CEvent event;
|
||||
event.Open(EVENT_MODIFY_STATE, false, GetSystemString(eventName));
|
||||
event.Set();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ParseIncludeSwitches(CParser &parser, UStringVector &fileNames)
|
||||
{
|
||||
if (parser[NKey::kInclude].ThereIs)
|
||||
{
|
||||
for (int i = 0; i < parser[NKey::kInclude].PostStrings.Size(); i++)
|
||||
{
|
||||
UString switchParam = parser[NKey::kInclude].PostStrings[i];
|
||||
if (switchParam.Length() < 1)
|
||||
return false;
|
||||
if (switchParam[0] == L'#')
|
||||
{
|
||||
if (!ParseIncludeMap(switchParam.Mid(1), fileNames))
|
||||
return false;
|
||||
}
|
||||
else if (switchParam[0] == L'!')
|
||||
{
|
||||
fileNames.Add(switchParam.Mid(1));
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorMessage(L"Incorrect command");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
|
||||
for (int i = 2; i < nonSwitchStrings.Size(); i++)
|
||||
{
|
||||
// ErrorMessage(nonSwitchStrings[i]);
|
||||
fileNames.Add(nonSwitchStrings[i]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
g_hInstance = hInstance;
|
||||
InitCommonControls();
|
||||
|
||||
#ifdef UNICODE
|
||||
if (!IsItWindowsNT())
|
||||
{
|
||||
// g_StdOut << "This program requires Windows NT/2000/XP";
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
// setlocale(LC_COLLATE, ".ACP");
|
||||
int result = 0;
|
||||
try
|
||||
{
|
||||
UStringVector commandStrings;
|
||||
SplitCommandLine(GetCommandLineW(), commandStrings);
|
||||
if (commandStrings.Size() > 0)
|
||||
commandStrings.Delete(0);
|
||||
CParser parser(kNumSwitches);
|
||||
try
|
||||
{
|
||||
parser.ParseStrings(kSwitchForms, commandStrings);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
MyMessageBox(kIncorrectCommandMessage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
|
||||
int numNonSwitchStrings = nonSwitchStrings.Size();
|
||||
|
||||
if(numNonSwitchStrings < 1)
|
||||
{
|
||||
MyMessageBox(kIncorrectCommandMessage);
|
||||
return 1;
|
||||
}
|
||||
|
||||
UString command = nonSwitchStrings[0];
|
||||
|
||||
if (command == L"t")
|
||||
{
|
||||
if(numNonSwitchStrings < 2)
|
||||
{
|
||||
MyMessageBox(kIncorrectCommandMessage);
|
||||
return 1;
|
||||
}
|
||||
UString archiveName = nonSwitchStrings[1];
|
||||
HRESULT result = TestArchive(0, archiveName);
|
||||
if (result == S_FALSE)
|
||||
MyMessageBox(IDS_OPEN_IS_NOT_SUPORTED_ARCHIVE, 0x02000604);
|
||||
else if (result != S_OK)
|
||||
ShowErrorMessage(0, result);
|
||||
}
|
||||
else if (command == L"x")
|
||||
{
|
||||
if(numNonSwitchStrings < 2)
|
||||
{
|
||||
MyMessageBox(kIncorrectCommandMessage);
|
||||
return 1;
|
||||
}
|
||||
UString archiveName = nonSwitchStrings[1];
|
||||
|
||||
UString outputDir;
|
||||
bool outputDirDefined = parser[NKey::kOutputDir].ThereIs;
|
||||
if(outputDirDefined)
|
||||
outputDir = parser[NKey::kOutputDir].PostStrings[0];
|
||||
else
|
||||
NFile::NDirectory::MyGetCurrentDirectory(outputDir);
|
||||
NFile::NName::NormalizeDirPathPrefix(outputDir);
|
||||
HRESULT result = ExtractArchive(0, archiveName,
|
||||
false, parser[NKey::kShowDialog].ThereIs, outputDir);
|
||||
if (result == S_FALSE)
|
||||
MyMessageBox(IDS_OPEN_IS_NOT_SUPORTED_ARCHIVE, 0x02000604);
|
||||
else if (result != S_OK)
|
||||
ShowErrorMessage(0, result);
|
||||
}
|
||||
else if (command == L"a")
|
||||
{
|
||||
if(numNonSwitchStrings < 2)
|
||||
{
|
||||
MyMessageBox(kIncorrectCommandMessage);
|
||||
return 1;
|
||||
}
|
||||
const UString &archiveName = nonSwitchStrings[1];
|
||||
|
||||
UString mapString, emailString;
|
||||
bool emailMode = parser[NKey::kEmail].ThereIs;
|
||||
UStringVector fileNames;
|
||||
if (!ParseIncludeSwitches(parser, fileNames))
|
||||
return 1;
|
||||
if (fileNames.Size() == 0)
|
||||
{
|
||||
ErrorMessage(L"Incorrect command: No files");
|
||||
return 1;
|
||||
}
|
||||
UString archiveType = L"7z";;
|
||||
if (parser[NKey::kArchiveType].ThereIs)
|
||||
archiveType = parser[NKey::kArchiveType].PostStrings.Front();
|
||||
HRESULT result = CompressArchive(archiveName, fileNames,
|
||||
archiveType, emailMode, parser[NKey::kShowDialog].ThereIs);
|
||||
// if (result != S_OK)
|
||||
// ShowErrorMessage(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorMessage(L"Use correct command");
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch(const CNewException &)
|
||||
{
|
||||
// MyMessageBoxError(kMemoryExceptionMessage);
|
||||
return 1;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
// g_StdOut << kUnknownExceptionMessage;
|
||||
return 2;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
868
7zip/UI/GUI/GUI.dsp
Executable file
868
7zip/UI/GUI/GUI.dsp
Executable file
@@ -0,0 +1,868 @@
|
||||
# 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" /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" /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" /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" /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=.\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\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\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
|
||||
# End Group
|
||||
# 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\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\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\ExtractingFilePath.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\ExtractingFilePath.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\HandlerLoader.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\PropIDUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\PropIDUtils.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\UpdateAction.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\UpdateAction.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 "Console"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# 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
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\Resource\ProgressDialog2\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\Resource\ProgressDialog2\resource.rc
|
||||
# PROP Exclude_From_Build 1
|
||||
# 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
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\Resource\PasswordDialog\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\FileManager\Resource\PasswordDialog\resource.rc
|
||||
# PROP Exclude_From_Build 1
|
||||
# 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
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Resource\CompressDialog\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Resource\CompressDialog\resource.rc
|
||||
# PROP Exclude_From_Build 1
|
||||
# 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
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Resource\ExtractDialog\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Resource\ExtractDialog\resource.rc
|
||||
# PROP Exclude_From_Build 1
|
||||
# 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\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 "Agent"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\Agent.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\Agent.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\AgentOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\AgentProxy.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\AgentProxy.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\ArchiveExtractCallback.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\ArchiveExtractCallback.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\ArchiveUpdateCallback.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\ArchiveUpdateCallback.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Agent\IFolderArchive.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Archive Interfaces"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Format\Common\ArchiveInterface.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Compress\Interface\CompressInterface.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\SDK\Interface\CryptoInterface.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\FolderArchiveInterface.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Engine"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Compress.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Compress.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Extract.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Extract.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Test.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Test.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
|
||||
# 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
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\7zG.exe.manifest
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FM.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\GUI.cpp
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
29
7zip/UI/GUI/GUI.dsw
Executable file
29
7zip/UI/GUI/GUI.dsw
Executable 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>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
8
7zip/UI/GUI/StdAfx.cpp
Executable file
8
7zip/UI/GUI/StdAfx.cpp
Executable file
@@ -0,0 +1,8 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// GUI.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
// TODO: reference any additional headers you need in STDAFX.H
|
||||
// and not in this file
|
||||
38
7zip/UI/GUI/StdAfx.h
Executable file
38
7zip/UI/GUI/StdAfx.h
Executable file
@@ -0,0 +1,38 @@
|
||||
// stdafx.h
|
||||
|
||||
#ifndef __STDAFX_H
|
||||
#define __STDAFX_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <limits.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
/*
|
||||
#define _ATL_APARTMENT_THREADED
|
||||
|
||||
#define _ATL_NO_UUIDOF
|
||||
|
||||
#include <atlbase.h>
|
||||
|
||||
extern CComModule _Module;
|
||||
|
||||
#include <atlcom.h>
|
||||
|
||||
#include <crtdbg.h>
|
||||
#include <string.h>
|
||||
#include <mbstring.h>
|
||||
#include <tchar.h>
|
||||
#include <shlguid.h>
|
||||
#include <regstr.h>
|
||||
|
||||
#include <new.h>
|
||||
|
||||
#pragma warning(disable:4786)
|
||||
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
*/
|
||||
#include <vector>
|
||||
|
||||
#endif
|
||||
122
7zip/UI/GUI/Test.cpp
Executable file
122
7zip/UI/GUI/Test.cpp
Executable file
@@ -0,0 +1,122 @@
|
||||
// Test.h
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Test.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/FileDir.h"
|
||||
#include "Windows/FileFind.h"
|
||||
#include "Windows/DLL.h"
|
||||
#include "Windows/Thread.h"
|
||||
|
||||
#include "../Common/OpenArchive.h"
|
||||
#include "../Common/DefaultName.h"
|
||||
|
||||
#ifndef EXCLUDE_COM
|
||||
#include "../Common/ZipRegistry.h"
|
||||
#endif
|
||||
|
||||
#include "../Explorer/MyMessages.h"
|
||||
#include "../../FileManager/FormatUtils.h"
|
||||
|
||||
#include "../../FileManager/ExtractCallback.h"
|
||||
#include "../../FileManager/LangUtils.h"
|
||||
|
||||
#include "../Agent/ArchiveExtractCallback.h"
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "../../FileManager/OpenCallback.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
struct CThreadTesting
|
||||
{
|
||||
NDLL::CLibrary Library;
|
||||
CMyComPtr<IInArchive> Archive;
|
||||
CExtractCallbackImp *ExtractCallbackSpec;
|
||||
CMyComPtr<IFolderArchiveExtractCallback> ExtractCallback2;
|
||||
CMyComPtr<IArchiveExtractCallback> ExtractCallback;
|
||||
|
||||
HRESULT Result;
|
||||
|
||||
DWORD Process()
|
||||
{
|
||||
ExtractCallbackSpec->ProgressDialog.WaitCreating();
|
||||
Result = Archive->Extract(0, -1, BoolToInt(true), ExtractCallback);
|
||||
ExtractCallbackSpec->ProgressDialog.MyClose();
|
||||
return 0;
|
||||
}
|
||||
static DWORD WINAPI MyThreadFunction(void *param)
|
||||
{
|
||||
return ((CThreadTesting *)param)->Process();
|
||||
}
|
||||
};
|
||||
|
||||
HRESULT TestArchive(HWND parentWindow, const UString &fileName)
|
||||
{
|
||||
CThreadTesting tester;
|
||||
|
||||
COpenArchiveCallback *openCallbackSpec = new COpenArchiveCallback;
|
||||
CMyComPtr<IArchiveOpenCallback> openCallback = openCallbackSpec;
|
||||
openCallbackSpec->_passwordIsDefined = false;
|
||||
openCallbackSpec->_parentWindow = parentWindow;
|
||||
|
||||
UString fullName;
|
||||
int fileNamePartStartIndex;
|
||||
NFile::NDirectory::MyGetFullPathName(fileName, fullName, fileNamePartStartIndex);
|
||||
|
||||
openCallbackSpec->LoadFileInfo(
|
||||
fullName.Left(fileNamePartStartIndex),
|
||||
fullName.Mid(fileNamePartStartIndex));
|
||||
|
||||
CArchiverInfo archiverInfo;
|
||||
int subExtIndex;
|
||||
RINOK(OpenArchive(fileName,
|
||||
&tester.Library, &tester.Archive,
|
||||
archiverInfo, subExtIndex, openCallback));
|
||||
|
||||
UString defaultName = GetDefaultName(fileName,
|
||||
archiverInfo.Extensions[subExtIndex].Extension,
|
||||
archiverInfo.Extensions[subExtIndex].AddExtension);
|
||||
|
||||
tester.ExtractCallbackSpec = new CExtractCallbackImp;
|
||||
tester.ExtractCallback2 = tester.ExtractCallbackSpec;
|
||||
|
||||
tester.ExtractCallbackSpec->_parentWindow = 0;
|
||||
#ifdef LANG
|
||||
const UString title = LangLoadStringW(IDS_PROGRESS_TESTING, 0x02000F90);
|
||||
#else
|
||||
const UString title = NWindows::MyLoadStringW(IDS_PROGRESS_TESTING);
|
||||
#endif
|
||||
|
||||
tester.ExtractCallbackSpec->Init(NExtractionMode::NOverwrite::kAskBefore,
|
||||
openCallbackSpec->_passwordIsDefined, openCallbackSpec->_password);
|
||||
|
||||
CArchiveExtractCallback *extractCallback200Spec = new CArchiveExtractCallback;
|
||||
tester.ExtractCallback = extractCallback200Spec;
|
||||
|
||||
FILETIME fileTomeDefault;
|
||||
extractCallback200Spec->Init(tester.Archive,
|
||||
tester.ExtractCallback2,
|
||||
L"", NExtractionMode::NPath::kFullPathnames,
|
||||
NExtractionMode::NOverwrite::kWithoutPrompt, UStringVector(),
|
||||
defaultName,
|
||||
fileTomeDefault, 0);
|
||||
|
||||
|
||||
CThread thread;
|
||||
if (!thread.Create(CThreadTesting::MyThreadFunction, &tester))
|
||||
throw 271824;
|
||||
tester.ExtractCallbackSpec->StartProgressDialog(title);
|
||||
|
||||
if (tester.Result == S_OK && tester.ExtractCallbackSpec->_messages.IsEmpty())
|
||||
{
|
||||
// extractCallbackSpec->DestroyWindows();
|
||||
MessageBoxW(0, LangLoadStringW(IDS_MESSAGE_NO_ERRORS, 0x02000608),
|
||||
LangLoadStringW(IDS_PROGRESS_TESTING, 0x02000F90), 0);
|
||||
}
|
||||
return tester.Result;
|
||||
}
|
||||
13
7zip/UI/GUI/Test.h
Executable file
13
7zip/UI/GUI/Test.h
Executable file
@@ -0,0 +1,13 @@
|
||||
// GUI/Test.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __GUI_TEST_H
|
||||
#define __GUI_TEST_H
|
||||
|
||||
#include "Common/String.h"
|
||||
|
||||
HRESULT TestArchive(HWND parentWindow, const UString &fileName);
|
||||
|
||||
#endif
|
||||
|
||||
53
7zip/UI/GUI/resource.h
Executable file
53
7zip/UI/GUI/resource.h
Executable file
@@ -0,0 +1,53 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by resource.rc
|
||||
//
|
||||
#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_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 IDD_DIALOG_EXTRACT 137
|
||||
#define IDB_DELETE 149
|
||||
#define IDC_LIST1 1067
|
||||
#define IDC_COLUMN_EDIT_WIDTH 1068
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 157
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1110
|
||||
#define _APS_NEXT_SYMED_VALUE 150
|
||||
#endif
|
||||
#endif
|
||||
203
7zip/UI/GUI/resource.rc
Executable file
203
7zip/UI/GUI/resource.rc
Executable file
@@ -0,0 +1,203 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Russian resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
|
||||
#pragma code_page(1251)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""..\\..\\FileManager\\Resource\\PropertyName\\resource.rc""\r\n"
|
||||
"#include ""..\\..\\FileManager\\Resource\\OverwriteDialog\\resource.rc""\r\n"
|
||||
"#include ""..\\..\\FileManager\\Resource\\PasswordDialog\\resource.rc""\r\n"
|
||||
"#include ""..\\..\\FileManager\\Resource\\MessagesDialog\\resource.rc""\r\n"
|
||||
"#include ""..\\..\\FileManager\\Resource\\ProgressDialog2\\resource.rc""\r\n"
|
||||
"#include ""..\\Resource\\Extract\\resource.rc""\r\n"
|
||||
"#include ""..\\Resource\\ExtractDialog\\resource.rc""\r\n"
|
||||
"#include ""..\\Resource\\CompressDialog\\resource.rc""\r\n"
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // Russian resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,13,0,0
|
||||
PRODUCTVERSION 3,13,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "\0"
|
||||
VALUE "CompanyName", "Igor Pavlov\0"
|
||||
VALUE "FileDescription", "7-Zip GUI Module\0"
|
||||
VALUE "FileVersion", "3, 13, 0, 0\0"
|
||||
VALUE "InternalName", "7zg\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 1999-2003 Igor Pavlov\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "7zg.dll\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "7-Zip\0"
|
||||
VALUE "ProductVersion", "3, 13, 0, 0\0"
|
||||
VALUE "SpecialBuild", "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_ICON1 ICON DISCARDABLE "FM.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 24
|
||||
//
|
||||
|
||||
1 24 MOVEABLE PURE "7zG.exe.manifest"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
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."
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
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"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
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"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_COMPRESS_SET_ARCHIVE_DIALOG_TITLE "Browse"
|
||||
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
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#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"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
Reference in New Issue
Block a user