mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 14:07:11 -06:00
3.13
This commit is contained in:
46
7zip/UI/Common/ArchiveName.cpp
Executable file
46
7zip/UI/Common/ArchiveName.cpp
Executable file
@@ -0,0 +1,46 @@
|
||||
// ArchiveName.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/FileFind.h"
|
||||
#include "Windows/FileDir.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName)
|
||||
{
|
||||
UString resultName = L"Archive";
|
||||
if (fromPrev)
|
||||
{
|
||||
UString dirPrefix;
|
||||
if (NFile::NDirectory::GetOnlyDirPrefix(srcName, dirPrefix))
|
||||
{
|
||||
if (dirPrefix.Length() > 0)
|
||||
if (dirPrefix[dirPrefix.Length() - 1] == '\\')
|
||||
{
|
||||
dirPrefix.Delete(dirPrefix.Length() - 1);
|
||||
NFile::NFind::CFileInfoW fileInfo;
|
||||
if (NFile::NFind::FindFile(dirPrefix, fileInfo))
|
||||
resultName = fileInfo.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NFile::NFind::CFileInfoW fileInfo;
|
||||
if (!NFile::NFind::FindFile(srcName, fileInfo))
|
||||
return ::GetLastError();
|
||||
resultName = fileInfo.Name;
|
||||
if (!fileInfo.IsDirectory() && !keepName)
|
||||
{
|
||||
int dotPos = resultName.ReverseFind('.');
|
||||
if (dotPos >= 0)
|
||||
{
|
||||
UString archiveName2 = resultName.Left(dotPos);
|
||||
if (archiveName2.ReverseFind('.') < 0)
|
||||
resultName = archiveName2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultName;
|
||||
}
|
||||
12
7zip/UI/Common/ArchiveName.h
Executable file
12
7zip/UI/Common/ArchiveName.h
Executable file
@@ -0,0 +1,12 @@
|
||||
// ArchiveName.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __ARCHIVENAME_H
|
||||
#define __ARCHIVENAME_H
|
||||
|
||||
#include "Common/String.h"
|
||||
|
||||
UString CreateArchiveName(const UString &srcName, bool fromPrev, bool keepName);
|
||||
|
||||
#endif
|
||||
308
7zip/UI/Common/ArchiverInfo.cpp
Executable file
308
7zip/UI/Common/ArchiverInfo.cpp
Executable file
@@ -0,0 +1,308 @@
|
||||
// ArchiverInfo.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "ArchiverInfo.h"
|
||||
|
||||
#ifndef EXCLUDE_COM
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Windows/FileFind.h"
|
||||
#include "Windows/FileName.h"
|
||||
#include "Windows/DLL.h"
|
||||
#include "Windows/Registry.h"
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "../../Archive/IArchive.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NFile;
|
||||
|
||||
#endif
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
|
||||
#ifndef EXCLUDE_COM
|
||||
|
||||
static void SplitString(const UString &srcString, UStringVector &destStrings)
|
||||
{
|
||||
destStrings.Clear();
|
||||
UString string;
|
||||
int len = srcString.Length();
|
||||
if (len == 0)
|
||||
return;
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
wchar_t c = srcString[i];
|
||||
if (c == L' ')
|
||||
{
|
||||
if (!string.IsEmpty())
|
||||
{
|
||||
destStrings.Add(string);
|
||||
string.Empty();
|
||||
}
|
||||
}
|
||||
else
|
||||
string += c;
|
||||
}
|
||||
if (!string.IsEmpty())
|
||||
destStrings.Add(string);
|
||||
}
|
||||
|
||||
typedef UINT32 (WINAPI * GetHandlerPropertyFunc)(
|
||||
PROPID propID, PROPVARIANT *value);
|
||||
|
||||
/*
|
||||
UString GetCurrentModulePath()
|
||||
{
|
||||
TCHAR fullPath[MAX_PATH + 1];
|
||||
::GetModuleFileName(g_hInstance, fullPath, MAX_PATH);
|
||||
return fullPath;
|
||||
}
|
||||
*/
|
||||
|
||||
static UString GetModuleFolderPrefix()
|
||||
{
|
||||
UString path;
|
||||
NDLL::MyGetModuleFileName(g_hInstance, path);
|
||||
int pos = path.ReverseFind(L'\\');
|
||||
return path.Left(pos + 1);
|
||||
}
|
||||
|
||||
static wchar_t *kFormatFolderName = L"Formats";
|
||||
static LPCTSTR kRegistryPath = TEXT("Software\\7-zip");
|
||||
static LPCTSTR kProgramPathValue = TEXT("Path");
|
||||
|
||||
UString GetBaseFolderPrefix()
|
||||
{
|
||||
UString moduleFolderPrefix = GetModuleFolderPrefix();
|
||||
NFind::CFileInfoW fileInfo;
|
||||
if (NFind::FindFile(moduleFolderPrefix + kFormatFolderName, fileInfo))
|
||||
if (fileInfo.IsDirectory())
|
||||
return moduleFolderPrefix;
|
||||
CSysString pathSys;
|
||||
{
|
||||
NRegistry::CKey key;
|
||||
if(key.Open(HKEY_CURRENT_USER, kRegistryPath, KEY_READ) == ERROR_SUCCESS)
|
||||
if (key.QueryValue(kProgramPathValue, pathSys) == ERROR_SUCCESS)
|
||||
{
|
||||
UString path = GetUnicodeString(pathSys);
|
||||
NName::NormalizeDirPathPrefix(path);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
{
|
||||
NRegistry::CKey key;
|
||||
if(key.Open(HKEY_LOCAL_MACHINE, kRegistryPath, KEY_READ) == ERROR_SUCCESS)
|
||||
if (key.QueryValue(kProgramPathValue, pathSys) == ERROR_SUCCESS)
|
||||
{
|
||||
UString path = GetUnicodeString(pathSys);
|
||||
NName::NormalizeDirPathPrefix(path);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
return moduleFolderPrefix;
|
||||
}
|
||||
|
||||
typedef UINT32 (WINAPI *CreateObjectPointer)(
|
||||
const GUID *clsID,
|
||||
const GUID *interfaceID,
|
||||
void **outObject);
|
||||
|
||||
#endif
|
||||
|
||||
void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers)
|
||||
{
|
||||
archivers.Clear();
|
||||
|
||||
#ifdef EXCLUDE_COM
|
||||
|
||||
#ifdef FORMAT_7Z
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = true;
|
||||
item.KeepName = false;
|
||||
item.Name = L"7z";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"7z"));
|
||||
archivers.Add(item);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_BZIP2
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = true;
|
||||
item.KeepName = true;
|
||||
item.Name = L"BZip2";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"bz2"));
|
||||
item.Extensions.Add(CArchiverExtInfo(L"tbz2", L".tar"));
|
||||
archivers.Add(item);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_GZIP
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = true;
|
||||
item.KeepName = false;
|
||||
item.Name = L"GZip";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"gz"));
|
||||
item.Extensions.Add(CArchiverExtInfo(L"tgz", L".tar"));
|
||||
archivers.Add(item);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_TAR
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = true;
|
||||
item.KeepName = false;
|
||||
item.Name = L"Tar";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"tar"));
|
||||
archivers.Add(item);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_ZIP
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = true;
|
||||
item.KeepName = false;
|
||||
item.Name = L"Zip";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"zip"));
|
||||
archivers.Add(item);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_CPIO
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = false;
|
||||
item.Name = L"Cpio";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"cpio"));
|
||||
archivers.Add(item);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_RPM
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = false;
|
||||
item.Name = L"Rpm";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"rpm", L".cpio.gz"));
|
||||
archivers.Add(item);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_ARJ
|
||||
{
|
||||
CArchiverInfo item;
|
||||
item.UpdateEnabled = false;
|
||||
item.Name = L"Arj";
|
||||
item.Extensions.Add(CArchiverExtInfo(L"arj"));
|
||||
archivers.Add(item);
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
UString folderPath = GetBaseFolderPrefix() +
|
||||
kFormatFolderName + L"\\";
|
||||
NFind::CEnumeratorW enumerator(folderPath + L"*");
|
||||
NFind::CFileInfoW fileInfo;
|
||||
while (enumerator.Next(fileInfo))
|
||||
{
|
||||
if (fileInfo.IsDirectory())
|
||||
continue;
|
||||
UString filePath = folderPath + fileInfo.Name;
|
||||
{
|
||||
NDLL::CLibrary library;
|
||||
if (!library.LoadEx(filePath, LOAD_LIBRARY_AS_DATAFILE))
|
||||
continue;
|
||||
}
|
||||
|
||||
NDLL::CLibrary library;
|
||||
if (!library.Load(filePath))
|
||||
continue;
|
||||
GetHandlerPropertyFunc getHandlerProperty = (GetHandlerPropertyFunc)
|
||||
library.GetProcAddress("GetHandlerProperty");
|
||||
if (getHandlerProperty == NULL)
|
||||
continue;
|
||||
|
||||
CArchiverInfo item;
|
||||
item.FilePath = filePath;
|
||||
|
||||
NWindows::NCOM::CPropVariant prop;
|
||||
if (getHandlerProperty(NArchive::kName, &prop) != S_OK)
|
||||
continue;
|
||||
if (prop.vt != VT_BSTR)
|
||||
continue;
|
||||
item.Name = prop.bstrVal;
|
||||
prop.Clear();
|
||||
|
||||
if (getHandlerProperty(NArchive::kClassID, &prop) != S_OK)
|
||||
continue;
|
||||
if (prop.vt != VT_BSTR)
|
||||
continue;
|
||||
item.ClassID = *(const GUID *)prop.bstrVal;
|
||||
prop.Clear();
|
||||
|
||||
if (getHandlerProperty(NArchive::kExtension, &prop) != S_OK)
|
||||
continue;
|
||||
if (prop.vt != VT_BSTR)
|
||||
continue;
|
||||
|
||||
UString ext = prop.bstrVal;
|
||||
// item.Extension = prop.bstrVal;
|
||||
|
||||
UString addExt;
|
||||
|
||||
if (getHandlerProperty(NArchive::kAddExtension, &prop) != S_OK)
|
||||
continue;
|
||||
if (prop.vt == VT_BSTR)
|
||||
{
|
||||
addExt = prop.bstrVal;
|
||||
}
|
||||
else if (prop.vt != VT_EMPTY)
|
||||
continue;
|
||||
prop.Clear();
|
||||
|
||||
UStringVector exts, addExts;
|
||||
SplitString(ext, exts);
|
||||
SplitString(addExt, addExts);
|
||||
|
||||
prop.Clear();
|
||||
for (int i = 0; i < exts.Size(); i++)
|
||||
{
|
||||
CArchiverExtInfo extInfo;
|
||||
extInfo.Extension = exts[i];
|
||||
if (addExts.Size() > 0)
|
||||
extInfo.AddExtension = addExts[i];
|
||||
if (extInfo.AddExtension == L"*")
|
||||
extInfo.AddExtension.Empty();
|
||||
item.Extensions.Add(extInfo);
|
||||
}
|
||||
|
||||
if (getHandlerProperty(NArchive::kUpdate, &prop) != S_OK)
|
||||
continue;
|
||||
if (prop.vt != VT_BOOL)
|
||||
continue;
|
||||
item.UpdateEnabled = VARIANT_BOOLToBool(prop.boolVal);
|
||||
prop.Clear();
|
||||
|
||||
if (item.UpdateEnabled)
|
||||
{
|
||||
if (getHandlerProperty(NArchive::kKeepName, &prop) != S_OK)
|
||||
continue;
|
||||
if (prop.vt != VT_BOOL)
|
||||
continue;
|
||||
item.KeepName = VARIANT_BOOLToBool(prop.boolVal);
|
||||
prop.Clear();
|
||||
}
|
||||
|
||||
archivers.Add(item);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
58
7zip/UI/Common/ArchiverInfo.h
Executable file
58
7zip/UI/Common/ArchiverInfo.h
Executable file
@@ -0,0 +1,58 @@
|
||||
// ArchiverInfo.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __ARCHIVERINFO_H
|
||||
#define __ARCHIVERINFO_H
|
||||
|
||||
#include "Common/String.h"
|
||||
#include "Common/Types.h"
|
||||
|
||||
struct CArchiverExtInfo
|
||||
{
|
||||
UString Extension;
|
||||
UString AddExtension;
|
||||
CArchiverExtInfo() {}
|
||||
CArchiverExtInfo(const UString &extension):
|
||||
Extension(extension) {}
|
||||
CArchiverExtInfo(const UString &extension, const UString &addExtension):
|
||||
Extension(extension), AddExtension(addExtension) {}
|
||||
};
|
||||
|
||||
struct CArchiverInfo
|
||||
{
|
||||
#ifndef EXCLUDE_COM
|
||||
UString FilePath;
|
||||
CLSID ClassID;
|
||||
#endif
|
||||
UString Name;
|
||||
CObjectVector<CArchiverExtInfo> Extensions;
|
||||
int FindExtension(const UString &ext) const
|
||||
{
|
||||
for (int i = 0; i < Extensions.Size(); i++)
|
||||
if (ext.CollateNoCase(Extensions[i].Extension) == 0)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
UString GetAllExtensions() const
|
||||
{
|
||||
UString s;
|
||||
for (int i = 0; i < Extensions.Size(); i++)
|
||||
{
|
||||
if (i > 0)
|
||||
s += ' ';
|
||||
s += Extensions[i].Extension;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
const UString &GetMainExtension() const
|
||||
{
|
||||
return Extensions[0].Extension;
|
||||
}
|
||||
bool UpdateEnabled;
|
||||
bool KeepName;
|
||||
};
|
||||
|
||||
void ReadArchiverInfoList(CObjectVector<CArchiverInfo> &archivers);
|
||||
|
||||
#endif
|
||||
229
7zip/UI/Common/CompressCall.cpp
Executable file
229
7zip/UI/Common/CompressCall.cpp
Executable file
@@ -0,0 +1,229 @@
|
||||
// CompressCall.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "CompressCall.h"
|
||||
|
||||
#include "Common/Random.h"
|
||||
#include "Common/IntToString.h"
|
||||
#include "Common/MyCom.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/Synchronization.h"
|
||||
#include "Windows/FileMapping.h"
|
||||
|
||||
#include "../../FileManager/ProgramLocation.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
static LPCWSTR kShowDialogSwitch = L" -ad";
|
||||
static LPCWSTR kEmailSwitch = L" -seml";
|
||||
static LPCWSTR kMapSwitch = L" -i#";
|
||||
|
||||
|
||||
static bool IsItWindowsNT()
|
||||
{
|
||||
OSVERSIONINFO versionInfo;
|
||||
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
|
||||
if (!::GetVersionEx(&versionInfo))
|
||||
return false;
|
||||
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
|
||||
}
|
||||
|
||||
HRESULT MyCreateProcess(const UString ¶ms,
|
||||
NWindows::NSynchronization::CEvent *event)
|
||||
{
|
||||
STARTUPINFO startupInfo;
|
||||
startupInfo.cb = sizeof(startupInfo);
|
||||
startupInfo.lpReserved = 0;
|
||||
startupInfo.lpDesktop = 0;
|
||||
startupInfo.lpTitle = 0;
|
||||
startupInfo.dwFlags = 0;
|
||||
startupInfo.cbReserved2 = 0;
|
||||
startupInfo.lpReserved2 = 0;
|
||||
|
||||
PROCESS_INFORMATION processInformation;
|
||||
BOOL result = ::CreateProcess(NULL, (TCHAR *)(const TCHAR *)
|
||||
GetSystemString(params),
|
||||
NULL, NULL, FALSE, 0, NULL, NULL,
|
||||
&startupInfo, &processInformation);
|
||||
if (result == 0)
|
||||
return ::GetLastError();
|
||||
else
|
||||
{
|
||||
if (event != NULL)
|
||||
{
|
||||
HANDLE handles[] = {processInformation.hProcess, *event };
|
||||
::WaitForMultipleObjects(sizeof(handles) / sizeof(handles[0]),
|
||||
handles, FALSE, INFINITE);
|
||||
}
|
||||
::CloseHandle(processInformation.hThread);
|
||||
::CloseHandle(processInformation.hProcess);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static UString GetQuotedString(const UString &s)
|
||||
{
|
||||
return UString(L"\"") + s + UString(L"\"");
|
||||
}
|
||||
|
||||
static UString Get7zGuiPath()
|
||||
{
|
||||
UString path = L"\"";
|
||||
UString folder;
|
||||
if (GetProgramFolderPath(folder))
|
||||
path += folder;
|
||||
if (IsItWindowsNT())
|
||||
path += L"7zgn.exe";
|
||||
else
|
||||
path += L"7zg.exe";
|
||||
path += L"\"";
|
||||
return path;
|
||||
}
|
||||
|
||||
HRESULT CompressFiles(
|
||||
const UString &archiveName,
|
||||
const UStringVector &names,
|
||||
// const UString &outFolder,
|
||||
bool email,
|
||||
bool showDialog)
|
||||
{
|
||||
UString params;
|
||||
params = Get7zGuiPath();
|
||||
params += L" a";
|
||||
params += kMapSwitch;
|
||||
// params += _fileNames[0];
|
||||
|
||||
UINT32 extraSize = 2;
|
||||
UINT32 dataSize = 0;
|
||||
for (int i = 0; i < names.Size(); i++)
|
||||
dataSize += (names[i].Length() + 1) * sizeof(wchar_t);
|
||||
UINT32 totalSize = extraSize + dataSize;
|
||||
|
||||
UString mappingName;
|
||||
UString eventName;
|
||||
|
||||
CFileMapping fileMapping;
|
||||
CRandom random;
|
||||
random.Init(GetTickCount());
|
||||
while(true)
|
||||
{
|
||||
int number = random.Generate();
|
||||
wchar_t temp[32];
|
||||
ConvertUINT64ToString(UINT32(number), temp);
|
||||
mappingName = L"7zCompressMapping";
|
||||
mappingName += temp;
|
||||
if (!fileMapping.Create(INVALID_HANDLE_VALUE, NULL,
|
||||
PAGE_READWRITE, totalSize, GetSystemString(mappingName)))
|
||||
{
|
||||
// MyMessageBox(IDS_ERROR, 0x02000605);
|
||||
return E_FAIL;
|
||||
}
|
||||
if (::GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
break;
|
||||
fileMapping.Close();
|
||||
}
|
||||
|
||||
NSynchronization::CEvent event;
|
||||
while(true)
|
||||
{
|
||||
int number = random.Generate();
|
||||
wchar_t temp[32];
|
||||
ConvertUINT64ToString(UINT32(number), temp);
|
||||
eventName = L"7zCompressMappingEndEvent";
|
||||
eventName += temp;
|
||||
if (!event.Create(true, false, GetSystemString(eventName)))
|
||||
{
|
||||
// MyMessageBox(IDS_ERROR, 0x02000605);
|
||||
return E_FAIL;
|
||||
}
|
||||
if (::GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
break;
|
||||
event.Close();
|
||||
}
|
||||
|
||||
params += mappingName;
|
||||
params += L":";
|
||||
wchar_t string[10];
|
||||
ConvertUINT64ToString(totalSize, string);
|
||||
params += string;
|
||||
|
||||
params += L":";
|
||||
params += eventName;
|
||||
|
||||
if (email)
|
||||
params += kEmailSwitch;
|
||||
|
||||
if (showDialog)
|
||||
params += kShowDialogSwitch;
|
||||
|
||||
params += L" ";
|
||||
params += GetQuotedString(archiveName);
|
||||
|
||||
LPVOID data = fileMapping.MapViewOfFile(FILE_MAP_WRITE, 0, totalSize);
|
||||
if (data == NULL)
|
||||
{
|
||||
// MyMessageBox(IDS_ERROR, 0x02000605);
|
||||
return E_FAIL;
|
||||
}
|
||||
try
|
||||
{
|
||||
wchar_t *curData = (wchar_t *)data;
|
||||
*curData = 0;
|
||||
curData++;
|
||||
for (int i = 0; i < names.Size(); i++)
|
||||
{
|
||||
const UString &unicodeString = names[i];
|
||||
memcpy(curData, (const wchar_t *)unicodeString ,
|
||||
unicodeString .Length() * sizeof(wchar_t));
|
||||
curData += unicodeString .Length();
|
||||
*curData++ = L'\0';
|
||||
}
|
||||
// MessageBox(0, params, 0, 0);
|
||||
RINOK(MyCreateProcess(params, &event));
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
UnmapViewOfFile(data);
|
||||
throw;
|
||||
}
|
||||
UnmapViewOfFile(data);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
CThreadCompressMain *compressor = new CThreadCompressMain();;
|
||||
compressor->FileNames = _fileNames;
|
||||
CThread thread;
|
||||
if (!thread.Create(CThreadCompressMain::MyThreadFunction, compressor))
|
||||
throw 271824;
|
||||
*/
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT ExtractArchive(const UString &archiveName,
|
||||
const UString &outFolder, bool showDialog)
|
||||
{
|
||||
UString params;
|
||||
params = Get7zGuiPath();
|
||||
params += L" x ";
|
||||
params += GetQuotedString(archiveName);
|
||||
if (!outFolder.IsEmpty())
|
||||
{
|
||||
params += L" -o";
|
||||
params += GetQuotedString(outFolder);
|
||||
}
|
||||
if (showDialog)
|
||||
params += kShowDialogSwitch;
|
||||
return MyCreateProcess(params);
|
||||
}
|
||||
|
||||
HRESULT TestArchive(const UString &archiveName)
|
||||
{
|
||||
UString params;
|
||||
params = Get7zGuiPath();
|
||||
params += L" t ";
|
||||
params += GetQuotedString(archiveName);
|
||||
return MyCreateProcess(params);
|
||||
}
|
||||
22
7zip/UI/Common/CompressCall.h
Executable file
22
7zip/UI/Common/CompressCall.h
Executable file
@@ -0,0 +1,22 @@
|
||||
// CompressCall.h
|
||||
|
||||
#ifndef __COMPRESSCALL_H
|
||||
#define __COMPRESSCALL_H
|
||||
|
||||
#include "Common/String.h"
|
||||
#include "Windows/Synchronization.h"
|
||||
|
||||
HRESULT MyCreateProcess(const UString ¶ms,
|
||||
NWindows::NSynchronization::CEvent *event = NULL);
|
||||
HRESULT CompressFiles(const UString &archiveName,
|
||||
const UStringVector &names,
|
||||
// const UString &outFolder,
|
||||
bool email, bool showDialog);
|
||||
|
||||
HRESULT ExtractArchive(const UString &archiveName,
|
||||
const UString &outFolder, bool showDialog);
|
||||
|
||||
HRESULT TestArchive(const UString &archiveName);
|
||||
|
||||
#endif
|
||||
|
||||
33
7zip/UI/Common/DefaultName.cpp
Executable file
33
7zip/UI/Common/DefaultName.cpp
Executable file
@@ -0,0 +1,33 @@
|
||||
// DefaultName.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/FileDir.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
#include "DefaultName.h"
|
||||
|
||||
const wchar_t *kEmptyFileAlias = L"[Content]";
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NFile;
|
||||
using namespace NDirectory;
|
||||
|
||||
UString GetDefaultName(const UString &fullFileName,
|
||||
const UString &extension, const UString &addSubExtension)
|
||||
{
|
||||
UString fileName;
|
||||
if (!GetOnlyName(fullFileName, fileName))
|
||||
throw 5011749;
|
||||
int extLength = extension.Length();
|
||||
int fileNameLength = fileName.Length();
|
||||
if (fileNameLength <= extLength + 1)
|
||||
return kEmptyFileAlias;
|
||||
int dotPos = fileNameLength - (extLength + 1);
|
||||
if (fileName[dotPos] != '.')
|
||||
return kEmptyFileAlias;
|
||||
if (extension.CollateNoCase(fileName.Mid(dotPos + 1)) == 0)
|
||||
return fileName.Left(dotPos) + addSubExtension;
|
||||
return kEmptyFileAlias;
|
||||
}
|
||||
|
||||
13
7zip/UI/Common/DefaultName.h
Executable file
13
7zip/UI/Common/DefaultName.h
Executable file
@@ -0,0 +1,13 @@
|
||||
// DefaultName.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __DEFAULTNAME_H
|
||||
#define __DEFAULTNAME_H
|
||||
|
||||
#include "Common/String.h"
|
||||
|
||||
UString GetDefaultName(const UString &fullFileName,
|
||||
const UString &extension, const UString &addSubExtension);
|
||||
|
||||
#endif
|
||||
37
7zip/UI/Common/DirItem.h
Executable file
37
7zip/UI/Common/DirItem.h
Executable file
@@ -0,0 +1,37 @@
|
||||
// DirItem.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __DIR_ITEM_H
|
||||
#define __DIR_ITEM_H
|
||||
|
||||
// #include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
// #include "Windows/PropVariant.h"
|
||||
|
||||
struct CDirItem
|
||||
{
|
||||
UINT32 Attributes;
|
||||
FILETIME CreationTime;
|
||||
FILETIME LastAccessTime;
|
||||
FILETIME LastWriteTime;
|
||||
UINT64 Size;
|
||||
UString Name;
|
||||
UString FullPath;
|
||||
bool IsDirectory() const { return (Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0 ; }
|
||||
};
|
||||
|
||||
struct CArchiveItem
|
||||
{
|
||||
bool IsDirectory;
|
||||
// DWORD Attributes;
|
||||
// NWindows::NCOM::CPropVariant LastWriteTime;
|
||||
FILETIME LastWriteTime;
|
||||
bool SizeIsDefined;
|
||||
UINT64 Size;
|
||||
UString Name;
|
||||
bool Censored;
|
||||
int IndexInServer;
|
||||
};
|
||||
|
||||
#endif
|
||||
71
7zip/UI/Common/EnumDirItems.cpp
Executable file
71
7zip/UI/Common/EnumDirItems.cpp
Executable file
@@ -0,0 +1,71 @@
|
||||
// EnumDirItems.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "EnumDirItems.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NFile;
|
||||
using namespace NName;
|
||||
|
||||
// using namespace NUpdateArchive;
|
||||
|
||||
void AddDirFileInfo(
|
||||
const UString &prefix,
|
||||
const UString &fullPathName,
|
||||
NFind::CFileInfoW &fileInfo,
|
||||
CObjectVector<CDirItem> &dirItems)
|
||||
{
|
||||
CDirItem item;
|
||||
item.Attributes = fileInfo.Attributes;
|
||||
item.Size = fileInfo.Size;
|
||||
item.CreationTime = fileInfo.CreationTime;
|
||||
item.LastAccessTime = fileInfo.LastAccessTime;
|
||||
item.LastWriteTime = fileInfo.LastWriteTime;
|
||||
item.Name = prefix + fileInfo.Name;
|
||||
item.FullPath = fullPathName;
|
||||
dirItems.Add(item);
|
||||
}
|
||||
|
||||
static void EnumerateDirectory(
|
||||
const UString &baseFolderPrefix,
|
||||
const UString &directory,
|
||||
const UString &prefix,
|
||||
CObjectVector<CDirItem> &dirItems)
|
||||
{
|
||||
NFind::CEnumeratorW enumerator(baseFolderPrefix + directory + wchar_t(kAnyStringWildcard));
|
||||
NFind::CFileInfoW fileInfo;
|
||||
while (enumerator.Next(fileInfo))
|
||||
{
|
||||
AddDirFileInfo(prefix, directory + fileInfo.Name, fileInfo,
|
||||
dirItems);
|
||||
if (fileInfo.IsDirectory())
|
||||
{
|
||||
EnumerateDirectory(baseFolderPrefix, directory + fileInfo.Name + wchar_t(kDirDelimiter),
|
||||
prefix + fileInfo.Name + wchar_t(kDirDelimiter), dirItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnumerateDirItems(
|
||||
const UString &baseFolderPrefix,
|
||||
const UStringVector &fileNames,
|
||||
const UString &archiveNamePrefix,
|
||||
CObjectVector<CDirItem> &dirItems)
|
||||
{
|
||||
for(int i = 0; i < fileNames.Size(); i++)
|
||||
{
|
||||
const UString &fileName = fileNames[i];
|
||||
NFind::CFileInfoW fileInfo;
|
||||
if (!NFind::FindFile(baseFolderPrefix + fileName, fileInfo))
|
||||
throw 1081736;
|
||||
AddDirFileInfo(archiveNamePrefix, fileName, fileInfo, dirItems);
|
||||
if (fileInfo.IsDirectory())
|
||||
{
|
||||
EnumerateDirectory(baseFolderPrefix, fileName + wchar_t(kDirDelimiter),
|
||||
archiveNamePrefix + fileInfo.Name + wchar_t(kDirDelimiter),
|
||||
dirItems);
|
||||
}
|
||||
}
|
||||
}
|
||||
33
7zip/UI/Common/EnumDirItems.h
Executable file
33
7zip/UI/Common/EnumDirItems.h
Executable file
@@ -0,0 +1,33 @@
|
||||
// EnumDirItems.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __ENUM_DIR_ITEMS_H
|
||||
#define __ENUM_DIR_ITEMS_H
|
||||
|
||||
#include "Common/String.h"
|
||||
#include "Common/Vector.h"
|
||||
#include "DirItem.h"
|
||||
// #include "UpdatePairBasic.h"
|
||||
|
||||
#include "Windows/FileFind.h"
|
||||
|
||||
void AddDirFileInfo(
|
||||
const UString &prefix,
|
||||
const UString &fullPathName,
|
||||
NWindows::NFile::NFind::CFileInfoW &fileInfo,
|
||||
CObjectVector<CDirItem> &dirItems);
|
||||
|
||||
void EnumerateDirItems(
|
||||
const UString &baseFolderPrefix,
|
||||
const UStringVector &fileNames,
|
||||
const UString &archiveNamePrefix,
|
||||
CObjectVector<CDirItem> &dirItems);
|
||||
|
||||
/*
|
||||
void EnumerateItems(const CSysStringVector &filePaths,
|
||||
const UString &archiveNamePrefix,
|
||||
CArchiveStyleDirItemInfoVector &dirFileInfoVector, UINT codePage);
|
||||
*/
|
||||
|
||||
#endif
|
||||
54
7zip/UI/Common/ExtractingFilePath.cpp
Executable file
54
7zip/UI/Common/ExtractingFilePath.cpp
Executable file
@@ -0,0 +1,54 @@
|
||||
// ExtractingFilePath.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "ExtractingFilePath.h"
|
||||
|
||||
UString GetCorrectFileName(const UString &path)
|
||||
{
|
||||
UString result = path;
|
||||
result.Trim();
|
||||
result.Replace(L"..\\", L"");
|
||||
result.Replace(L"../", L"");
|
||||
if (result.Length() > 1)
|
||||
{
|
||||
if (result[1] == L':')
|
||||
{
|
||||
result.Delete(1);
|
||||
// result.Insert(first + 1, L'_');
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
UString GetCorrectPath(const UString &path)
|
||||
{
|
||||
UString result = path;
|
||||
int first;
|
||||
for (first = 0; first < result.Length(); first++)
|
||||
if (result[first] != ' ')
|
||||
break;
|
||||
while(result.Length() > first)
|
||||
{
|
||||
|
||||
if (result[first] == L'\\' || result[first] == L'/')
|
||||
{
|
||||
result.Delete(first);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
result.Replace(L"..\\", L"");
|
||||
result.Replace(L"../", L"");
|
||||
|
||||
if (result.Length() > 1)
|
||||
{
|
||||
if (result[first + 1] == L':')
|
||||
{
|
||||
result.Delete(first + 1);
|
||||
// result.Insert(first + 1, L'_');
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
13
7zip/UI/Common/ExtractingFilePath.h
Executable file
13
7zip/UI/Common/ExtractingFilePath.h
Executable file
@@ -0,0 +1,13 @@
|
||||
// ExtractingFilePath.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __EXTRACTINGFILEPATH_H
|
||||
#define __EXTRACTINGFILEPATH_H
|
||||
|
||||
#include "Common/String.h"
|
||||
|
||||
UString GetCorrectFileName(const UString &path);
|
||||
UString GetCorrectPath(const UString &path);
|
||||
|
||||
#endif
|
||||
42
7zip/UI/Common/HandlerLoader.h
Executable file
42
7zip/UI/Common/HandlerLoader.h
Executable file
@@ -0,0 +1,42 @@
|
||||
// HandlerLoader.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __HANDLERLOADER_H
|
||||
#define __HANDLERLOADER_H
|
||||
|
||||
#include "../../ICoder.h"
|
||||
#include "Windows/DLL.h"
|
||||
|
||||
typedef UINT32 (WINAPI * CreateObjectFunc)(
|
||||
const GUID *clsID,
|
||||
const GUID *interfaceID,
|
||||
void **outObject);
|
||||
|
||||
class CHandlerLoader: public NWindows::NDLL::CLibrary
|
||||
{
|
||||
public:
|
||||
HRESULT CreateHandler(LPCWSTR filepath, REFGUID clsID,
|
||||
void **archive, bool outHandler)
|
||||
{
|
||||
if (!Load(filepath))
|
||||
return GetLastError();
|
||||
CreateObjectFunc createObject = (CreateObjectFunc)
|
||||
GetProcAddress("CreateObject");
|
||||
if (createObject == NULL)
|
||||
{
|
||||
HRESULT res = ::GetLastError();
|
||||
Free();
|
||||
return res;
|
||||
}
|
||||
HRESULT res = createObject(&clsID,
|
||||
outHandler ? &IID_IOutArchive : &IID_IInArchive, (void **)archive);
|
||||
if (res != 0)
|
||||
Free();
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
171
7zip/UI/Common/OpenArchive.cpp
Executable file
171
7zip/UI/Common/OpenArchive.cpp
Executable file
@@ -0,0 +1,171 @@
|
||||
// OpenArchive.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "OpenArchive.h"
|
||||
|
||||
#include "Windows/FileName.h"
|
||||
#include "Windows/FileDir.h"
|
||||
#include "Windows/Defs.h"
|
||||
|
||||
#include "../../Common/FileStreams.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#ifdef FORMAT_7Z
|
||||
#include "../../Archive/7z/7zHandler.h"
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_BZIP2
|
||||
#include "../../Archive/BZip2/BZip2Handler.h"
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_GZIP
|
||||
#include "../../Archive/GZip/GZipHandler.h"
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_TAR
|
||||
#include "../../Archive/Tar/TarHandler.h"
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_ZIP
|
||||
#include "../../Archive/Zip/ZipHandler.h"
|
||||
#endif
|
||||
|
||||
#ifndef EXCLUDE_COM
|
||||
#include "HandlerLoader.h"
|
||||
#endif
|
||||
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
const UINT64 kMaxCheckStartPosition = 1 << 20;
|
||||
|
||||
HRESULT ReOpenArchive(IInArchive *archive,
|
||||
const UString &fileName)
|
||||
{
|
||||
CInFileStream *inStreamSpec = new CInFileStream;
|
||||
CMyComPtr<IInStream> inStream(inStreamSpec);
|
||||
inStreamSpec->Open(fileName);
|
||||
return archive->Open(inStream, &kMaxCheckStartPosition, NULL);
|
||||
}
|
||||
|
||||
HRESULT OpenArchive(const UString &fileName,
|
||||
#ifndef EXCLUDE_COM
|
||||
HMODULE *module,
|
||||
#endif
|
||||
IInArchive **archiveResult,
|
||||
CArchiverInfo &archiverInfoResult,
|
||||
int &subExtIndex,
|
||||
IArchiveOpenCallback *openArchiveCallback)
|
||||
{
|
||||
CInFileStream *inStreamSpec = new CInFileStream;
|
||||
CMyComPtr<IInStream> inStream(inStreamSpec);
|
||||
if (!inStreamSpec->Open(fileName))
|
||||
return GetLastError();
|
||||
|
||||
*archiveResult = NULL;
|
||||
CObjectVector<CArchiverInfo> archiverInfoList;
|
||||
ReadArchiverInfoList(archiverInfoList);
|
||||
UString extension;
|
||||
{
|
||||
UString name, pureName, dot;
|
||||
if(!NFile::NDirectory::GetOnlyName(fileName, name))
|
||||
return E_FAIL;
|
||||
NFile::NName::SplitNameToPureNameAndExtension(name, pureName, dot, extension);
|
||||
}
|
||||
CIntVector orderIndices;
|
||||
int firstArchiverIndex;
|
||||
for(firstArchiverIndex = 0;
|
||||
firstArchiverIndex < archiverInfoList.Size(); firstArchiverIndex++)
|
||||
{
|
||||
int subIndex = archiverInfoList[firstArchiverIndex].FindExtension(extension);
|
||||
if (subIndex >= 0)
|
||||
break;
|
||||
}
|
||||
if(firstArchiverIndex < archiverInfoList.Size())
|
||||
orderIndices.Add(firstArchiverIndex);
|
||||
for(int j = 0; j < archiverInfoList.Size(); j++)
|
||||
if(j != firstArchiverIndex)
|
||||
orderIndices.Add(j);
|
||||
|
||||
HRESULT badResult = S_OK;
|
||||
for(int i = 0; i < orderIndices.Size(); i++)
|
||||
{
|
||||
inStreamSpec->Seek(0, STREAM_SEEK_SET, NULL);
|
||||
const CArchiverInfo &archiverInfo = archiverInfoList[orderIndices[i]];
|
||||
#ifndef EXCLUDE_COM
|
||||
CHandlerLoader loader;
|
||||
#endif
|
||||
CMyComPtr<IInArchive> archive;
|
||||
|
||||
#ifdef FORMAT_7Z
|
||||
if (archiverInfo.Name.CompareNoCase(L"7z") == 0)
|
||||
archive = new NArchive::N7z::CHandler;
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_BZIP2
|
||||
if (archiverInfo.Name.CompareNoCase(L"BZip2") == 0)
|
||||
archive = new NArchive::NBZip2::CHandler;
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_GZIP
|
||||
if (archiverInfo.Name.CompareNoCase(L"GZip") == 0)
|
||||
archive = new NArchive::NGZip::CHandler;
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_TAR
|
||||
if (archiverInfo.Name.CompareNoCase(L"Tar") == 0)
|
||||
archive = new NArchive::NTar::CHandler;
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_ZIP
|
||||
if (archiverInfo.Name.CompareNoCase(L"Zip") == 0)
|
||||
archive = new NArchive::NZip::CHandler;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef EXCLUDE_COM
|
||||
if (!archive)
|
||||
{
|
||||
HRESULT result = loader.CreateHandler(archiverInfo.FilePath,
|
||||
archiverInfo.ClassID, (void **)&archive, false);
|
||||
if (result != S_OK)
|
||||
continue;
|
||||
}
|
||||
#endif EXCLUDE_COM
|
||||
|
||||
if (!archive)
|
||||
return E_FAIL;
|
||||
|
||||
HRESULT result = archive->Open(inStream, &kMaxCheckStartPosition, openArchiveCallback);
|
||||
if(result == S_FALSE)
|
||||
continue;
|
||||
if(result != S_OK)
|
||||
{
|
||||
badResult = result;
|
||||
continue;
|
||||
// return result;
|
||||
}
|
||||
*archiveResult = archive.Detach();
|
||||
#ifndef EXCLUDE_COM
|
||||
*module = loader.Detach();
|
||||
#endif
|
||||
archiverInfoResult = archiverInfo;
|
||||
subExtIndex = archiverInfo.FindExtension(extension);
|
||||
if (subExtIndex < 0)
|
||||
subExtIndex = 0;
|
||||
return S_OK;
|
||||
}
|
||||
if (badResult != S_OK)
|
||||
return badResult;
|
||||
return S_FALSE;
|
||||
|
||||
/*
|
||||
#else
|
||||
return S_FALSE;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
24
7zip/UI/Common/OpenArchive.h
Executable file
24
7zip/UI/Common/OpenArchive.h
Executable file
@@ -0,0 +1,24 @@
|
||||
// OpenArchive.h
|
||||
|
||||
#ifndef __OPENARCHIVE_H
|
||||
#define __OPENARCHIVE_H
|
||||
|
||||
#include "Common/String.h"
|
||||
|
||||
#include "../../Archive/IArchive.h"
|
||||
#include "ArchiverInfo.h"
|
||||
|
||||
HRESULT OpenArchive(const UString &fileName,
|
||||
#ifndef EXCLUDE_COM
|
||||
HMODULE *module,
|
||||
#endif
|
||||
IInArchive **archive,
|
||||
CArchiverInfo &archiverInfoResult,
|
||||
int &subExtIndex,
|
||||
IArchiveOpenCallback *openArchiveCallback);
|
||||
|
||||
HRESULT ReOpenArchive(IInArchive *archive,
|
||||
const UString &fileName);
|
||||
|
||||
|
||||
#endif
|
||||
79
7zip/UI/Common/PropIDUtils.cpp
Executable file
79
7zip/UI/Common/PropIDUtils.cpp
Executable file
@@ -0,0 +1,79 @@
|
||||
// PropIDUtils.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "PropIDUtils.h"
|
||||
|
||||
#include "Common/IntToString.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/FileFind.h"
|
||||
#include "Windows/PropVariantConversions.h"
|
||||
|
||||
#include "../../PropID.h"
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
static UString ConvertUINT32ToString(UINT32 value)
|
||||
{
|
||||
wchar_t buffer[32];
|
||||
ConvertUINT64ToString(value, buffer);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
UString ConvertPropertyToString(const PROPVARIANT &propVariant,
|
||||
PROPID propID, bool full)
|
||||
{
|
||||
switch(propID)
|
||||
{
|
||||
case kpidCreationTime:
|
||||
case kpidLastWriteTime:
|
||||
case kpidLastAccessTime:
|
||||
{
|
||||
if (propVariant.vt != VT_FILETIME)
|
||||
return UString(); // It is error;
|
||||
FILETIME localFileTime;
|
||||
if (propVariant.filetime.dwHighDateTime == 0 &&
|
||||
propVariant.filetime.dwLowDateTime == 0)
|
||||
return UString();
|
||||
if (!::FileTimeToLocalFileTime(&propVariant.filetime, &localFileTime))
|
||||
return UString(); // It is error;
|
||||
return ConvertFileTimeToString2(localFileTime, true, full);
|
||||
}
|
||||
case kpidCRC:
|
||||
{
|
||||
if(propVariant.vt != VT_UI4)
|
||||
break;
|
||||
TCHAR temp[17];
|
||||
wsprintf(temp, TEXT("%08X"), propVariant.ulVal);
|
||||
return GetUnicodeString(temp);
|
||||
}
|
||||
case kpidAttributes:
|
||||
{
|
||||
if(propVariant.vt != VT_UI4)
|
||||
break;
|
||||
UString result;
|
||||
UINT32 attributes = propVariant.ulVal;
|
||||
if (NFile::NFind::NAttributes::IsReadOnly(attributes)) result += L'R';
|
||||
if (NFile::NFind::NAttributes::IsHidden(attributes)) result += L'H';
|
||||
if (NFile::NFind::NAttributes::IsSystem(attributes)) result += L'S';
|
||||
if (NFile::NFind::NAttributes::IsDirectory(attributes)) result += L'D';
|
||||
if (NFile::NFind::NAttributes::IsArchived(attributes)) result += L'A';
|
||||
if (NFile::NFind::NAttributes::IsCompressed(attributes)) result += L'C';
|
||||
if (NFile::NFind::NAttributes::IsEncrypted(attributes)) result += L'E';
|
||||
return result;
|
||||
}
|
||||
case kpidDictionarySize:
|
||||
{
|
||||
if(propVariant.vt != VT_UI4)
|
||||
break;
|
||||
UINT32 size = propVariant.ulVal;
|
||||
if (size % (1 << 20) == 0)
|
||||
return ConvertUINT32ToString(size >> 20) + L"MB";
|
||||
if (size % (1 << 10) == 0)
|
||||
return ConvertUINT32ToString(size >> 10) + L"KB";
|
||||
return ConvertUINT32ToString(size);
|
||||
}
|
||||
}
|
||||
return ConvertPropVariantToString(propVariant);
|
||||
}
|
||||
13
7zip/UI/Common/PropIDUtils.h
Executable file
13
7zip/UI/Common/PropIDUtils.h
Executable file
@@ -0,0 +1,13 @@
|
||||
// PropIDUtils.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __PROPIDUTILS_H
|
||||
#define __PROPIDUTILS_H
|
||||
|
||||
#include "Common/String.h"
|
||||
|
||||
UString ConvertPropertyToString(const PROPVARIANT &aPropVariant,
|
||||
PROPID aPropID, bool aFull = true);
|
||||
|
||||
#endif
|
||||
30
7zip/UI/Common/SortUtils.cpp
Executable file
30
7zip/UI/Common/SortUtils.cpp
Executable file
@@ -0,0 +1,30 @@
|
||||
// SortUtils.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "SortUtils.h"
|
||||
|
||||
static int __cdecl CompareStrings(const void *a1, const void *a2)
|
||||
{
|
||||
const UString &s1 = *(*(*((const UString ***)a1)));
|
||||
const UString &s2 = *(*(*((const UString ***)a2)));
|
||||
return s1.CompareNoCase(s2);
|
||||
}
|
||||
|
||||
void SortStringsToIndices(UStringVector &strings, CIntVector &indices)
|
||||
{
|
||||
indices.Clear();
|
||||
if (strings.IsEmpty())
|
||||
return;
|
||||
int numItems = strings.Size();
|
||||
CPointerVector pointers;
|
||||
pointers.Reserve(numItems);
|
||||
indices.Reserve(numItems);
|
||||
int i;
|
||||
for(i = 0; i < numItems; i++)
|
||||
pointers.Add(&strings.CPointerVector::operator[](i));
|
||||
void **stringsBase = (void **)pointers[0];
|
||||
qsort(&pointers[0], numItems, sizeof(void *), CompareStrings);
|
||||
for(i = 0; i < numItems; i++)
|
||||
indices.Add((void **)pointers[i] - stringsBase);
|
||||
}
|
||||
12
7zip/UI/Common/SortUtils.h
Executable file
12
7zip/UI/Common/SortUtils.h
Executable file
@@ -0,0 +1,12 @@
|
||||
// SortUtils.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __SORTUTLS_H
|
||||
#define __SORTUTLS_H
|
||||
|
||||
#include "Common/String.h"
|
||||
|
||||
void SortStringsToIndices(UStringVector &strings, CIntVector &indices);
|
||||
|
||||
#endif
|
||||
8
7zip/UI/Common/StdAfx.h
Executable file
8
7zip/UI/Common/StdAfx.h
Executable file
@@ -0,0 +1,8 @@
|
||||
// stdafx.h
|
||||
|
||||
#ifndef __STDAFX_H
|
||||
#define __STDAFX_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#endif
|
||||
64
7zip/UI/Common/UpdateAction.cpp
Executable file
64
7zip/UI/Common/UpdateAction.cpp
Executable file
@@ -0,0 +1,64 @@
|
||||
// UpdateAction.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "UpdateAction.h"
|
||||
|
||||
namespace NUpdateArchive {
|
||||
|
||||
const CActionSet kAddActionSet =
|
||||
{
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kCompress,
|
||||
NPairAction::kCompress,
|
||||
NPairAction::kCompress,
|
||||
NPairAction::kCompress,
|
||||
NPairAction::kCompress
|
||||
};
|
||||
|
||||
const CActionSet kUpdateActionSet =
|
||||
{
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kCompress,
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kCompress,
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kCompress
|
||||
};
|
||||
|
||||
const CActionSet kFreshActionSet =
|
||||
{
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kIgnore,
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kCompress,
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kCompress
|
||||
};
|
||||
|
||||
const CActionSet kSynchronizeActionSet =
|
||||
{
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kIgnore,
|
||||
NPairAction::kCompress,
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kCompress,
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kCompress,
|
||||
};
|
||||
|
||||
const CActionSet kDeleteActionSet =
|
||||
{
|
||||
NPairAction::kCopy,
|
||||
NPairAction::kIgnore,
|
||||
NPairAction::kIgnore,
|
||||
NPairAction::kIgnore,
|
||||
NPairAction::kIgnore,
|
||||
NPairAction::kIgnore,
|
||||
NPairAction::kIgnore
|
||||
};
|
||||
|
||||
}
|
||||
48
7zip/UI/Common/UpdateAction.h
Executable file
48
7zip/UI/Common/UpdateAction.h
Executable file
@@ -0,0 +1,48 @@
|
||||
// UpdateAction.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UPDATE_ACTION_H
|
||||
#define __UPDATE_ACTION_H
|
||||
|
||||
namespace NUpdateArchive {
|
||||
|
||||
namespace NPairState
|
||||
{
|
||||
const int kNumValues = 7;
|
||||
enum EEnum
|
||||
{
|
||||
kNotMasked = 0,
|
||||
kOnlyInArchive,
|
||||
kOnlyOnDisk,
|
||||
kNewInArchive,
|
||||
kOldInArchive,
|
||||
kSameFiles,
|
||||
kUnknowNewerFiles
|
||||
};
|
||||
}
|
||||
namespace NPairAction
|
||||
{
|
||||
enum EEnum
|
||||
{
|
||||
kIgnore = 0,
|
||||
kCopy,
|
||||
kCompress,
|
||||
kCompressAsAnti
|
||||
};
|
||||
}
|
||||
struct CActionSet
|
||||
{
|
||||
NPairAction::EEnum StateActions[NPairState::kNumValues];
|
||||
};
|
||||
extern const CActionSet kAddActionSet;
|
||||
extern const CActionSet kUpdateActionSet;
|
||||
extern const CActionSet kFreshActionSet;
|
||||
extern const CActionSet kSynchronizeActionSet;
|
||||
extern const CActionSet kDeleteActionSet;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
157
7zip/UI/Common/UpdatePair.cpp
Executable file
157
7zip/UI/Common/UpdatePair.cpp
Executable file
@@ -0,0 +1,157 @@
|
||||
// UpdatePair.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "Common/Defs.h"
|
||||
#include "Windows/Time.h"
|
||||
|
||||
#include "UpdatePair.h"
|
||||
#include "SortUtils.h"
|
||||
|
||||
using namespace NWindows;
|
||||
// using namespace NCOM;
|
||||
using namespace NTime;
|
||||
|
||||
static int MyCompareTime(NFileTimeType::EEnum fileTimeType,
|
||||
const FILETIME &time1, const FILETIME &time2)
|
||||
{
|
||||
switch(fileTimeType)
|
||||
{
|
||||
case NFileTimeType::kWindows:
|
||||
return ::CompareFileTime(&time1, &time2);
|
||||
case NFileTimeType::kUnix:
|
||||
{
|
||||
time_t unixTime1, unixTime2;
|
||||
if (!FileTimeToUnixTime(time1, unixTime1))
|
||||
throw 4191614;
|
||||
if (!FileTimeToUnixTime(time2, unixTime2))
|
||||
throw 4191615;
|
||||
return MyCompare(unixTime1, unixTime2);
|
||||
}
|
||||
case NFileTimeType::kDOS:
|
||||
{
|
||||
UINT32 dosTime1, dosTime2;
|
||||
if (!FileTimeToDosTime(time1, dosTime1))
|
||||
throw 4191616;
|
||||
if (!FileTimeToDosTime(time2, dosTime2))
|
||||
throw 4191617;
|
||||
return MyCompare(dosTime1, dosTime2);
|
||||
}
|
||||
}
|
||||
throw 4191618;
|
||||
}
|
||||
|
||||
static const wchar_t *kDuplicateFileNameMessage = L"Duplicate filename:";
|
||||
|
||||
/*
|
||||
static const char *kNotCensoredCollisionMessaged = "Internal file name collision:\n";
|
||||
static const char *kSameTimeChangedSizeCollisionMessaged =
|
||||
"Collision between files with same date/time and different sizes:\n";
|
||||
*/
|
||||
|
||||
static void TestDuplicateString(const UStringVector &strings,
|
||||
const CIntVector &indices)
|
||||
{
|
||||
for(int i = 0; i + 1 < indices.Size(); i++)
|
||||
if (strings[indices[i]].CollateNoCase(strings[indices[i + 1]]) == 0)
|
||||
{
|
||||
UString message = kDuplicateFileNameMessage;
|
||||
message += L"\n";
|
||||
message += strings[indices[i]];
|
||||
message += L"\n";
|
||||
message += strings[indices[i+1]];
|
||||
throw message;
|
||||
}
|
||||
}
|
||||
|
||||
void GetUpdatePairInfoList(
|
||||
const CObjectVector<CDirItem> &dirItems,
|
||||
const CObjectVector<CArchiveItem> &archiveItems,
|
||||
NFileTimeType::EEnum fileTimeType,
|
||||
CObjectVector<CUpdatePair> &updatePairs)
|
||||
{
|
||||
CIntVector dirIndices, archiveIndices;
|
||||
UStringVector dirNames, archiveNames;
|
||||
|
||||
int numDirItems = dirItems.Size();
|
||||
int i;
|
||||
for(i = 0; i < numDirItems; i++)
|
||||
dirNames.Add(dirItems[i].Name);
|
||||
SortStringsToIndices(dirNames, dirIndices);
|
||||
TestDuplicateString(dirNames, dirIndices);
|
||||
|
||||
int numArchiveItems = archiveItems.Size();
|
||||
for(i = 0; i < numArchiveItems; i++)
|
||||
archiveNames.Add(archiveItems[i].Name);
|
||||
SortStringsToIndices(archiveNames, archiveIndices);
|
||||
TestDuplicateString(archiveNames, archiveIndices);
|
||||
|
||||
int dirItemIndex = 0, archiveItemIndex = 0;
|
||||
CUpdatePair pair;
|
||||
while(dirItemIndex < numDirItems && archiveItemIndex < numArchiveItems)
|
||||
{
|
||||
int dirItemIndex2 = dirIndices[dirItemIndex],
|
||||
archiveItemIndex2 = archiveIndices[archiveItemIndex];
|
||||
const CDirItem &dirItem = dirItems[dirItemIndex2];
|
||||
const CArchiveItem &archiveItem = archiveItems[archiveItemIndex2];
|
||||
int compareResult = dirItem.Name.CollateNoCase(archiveItem.Name);
|
||||
if (compareResult < 0)
|
||||
{
|
||||
pair.State = NUpdateArchive::NPairState::kOnlyOnDisk;
|
||||
pair.DirItemIndex = dirItemIndex2;
|
||||
dirItemIndex++;
|
||||
}
|
||||
else if (compareResult > 0)
|
||||
{
|
||||
pair.State = archiveItem.Censored ?
|
||||
NUpdateArchive::NPairState::kOnlyInArchive: NUpdateArchive::NPairState::kNotMasked;
|
||||
pair.ArchiveItemIndex = archiveItemIndex2;
|
||||
archiveItemIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!archiveItem.Censored)
|
||||
throw 1082022;; // TTString(kNotCensoredCollisionMessaged + dirItem.Name);
|
||||
pair.DirItemIndex = dirItemIndex2;
|
||||
pair.ArchiveItemIndex = archiveItemIndex2;
|
||||
switch (MyCompareTime(fileTimeType, dirItem.LastWriteTime, archiveItem.LastWriteTime))
|
||||
{
|
||||
case -1:
|
||||
pair.State = NUpdateArchive::NPairState::kNewInArchive;
|
||||
break;
|
||||
case 1:
|
||||
pair.State = NUpdateArchive::NPairState::kOldInArchive;
|
||||
break;
|
||||
default:
|
||||
if (archiveItem.SizeIsDefined)
|
||||
if (dirItem.Size != archiveItem.Size)
|
||||
// throw 1082034; // kSameTimeChangedSizeCollisionMessaged;
|
||||
pair.State = NUpdateArchive::NPairState::kUnknowNewerFiles;
|
||||
else
|
||||
pair.State = NUpdateArchive::NPairState::kSameFiles;
|
||||
else
|
||||
pair.State = NUpdateArchive::NPairState::kUnknowNewerFiles;
|
||||
}
|
||||
dirItemIndex++;
|
||||
archiveItemIndex++;
|
||||
}
|
||||
updatePairs.Add(pair);
|
||||
}
|
||||
for(;dirItemIndex < numDirItems; dirItemIndex++)
|
||||
{
|
||||
pair.State = NUpdateArchive::NPairState::kOnlyOnDisk;
|
||||
pair.DirItemIndex = dirIndices[dirItemIndex];
|
||||
updatePairs.Add(pair);
|
||||
}
|
||||
for(;archiveItemIndex < numArchiveItems; archiveItemIndex++)
|
||||
{
|
||||
int archiveItemIndex2 = archiveIndices[archiveItemIndex];
|
||||
const CArchiveItem &archiveItem = archiveItems[archiveItemIndex2];
|
||||
pair.State = archiveItem.Censored ?
|
||||
NUpdateArchive::NPairState::kOnlyInArchive: NUpdateArchive::NPairState::kNotMasked;
|
||||
pair.ArchiveItemIndex = archiveItemIndex2;
|
||||
updatePairs.Add(pair);
|
||||
}
|
||||
}
|
||||
26
7zip/UI/Common/UpdatePair.h
Executable file
26
7zip/UI/Common/UpdatePair.h
Executable file
@@ -0,0 +1,26 @@
|
||||
// UpdatePair.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UPDATEPAIR_H
|
||||
#define __UPDATEPAIR_H
|
||||
|
||||
#include "DirItem.h"
|
||||
#include "UpdateAction.h"
|
||||
|
||||
#include "../../Archive/IArchive.h"
|
||||
|
||||
struct CUpdatePair
|
||||
{
|
||||
NUpdateArchive::NPairState::EEnum State;
|
||||
int ArchiveItemIndex;
|
||||
int DirItemIndex;
|
||||
};
|
||||
|
||||
void GetUpdatePairInfoList(
|
||||
const CObjectVector<CDirItem> &dirItems,
|
||||
const CObjectVector<CArchiveItem> &archiveItems,
|
||||
NFileTimeType::EEnum fileTimeType,
|
||||
CObjectVector<CUpdatePair> &updatePairs);
|
||||
|
||||
#endif
|
||||
65
7zip/UI/Common/UpdateProduce.cpp
Executable file
65
7zip/UI/Common/UpdateProduce.cpp
Executable file
@@ -0,0 +1,65 @@
|
||||
// UpdateProduce.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "UpdateProduce.h"
|
||||
|
||||
using namespace NUpdateArchive;
|
||||
|
||||
static const char *kUpdateActionSetCollision =
|
||||
"Internal collision in update action set";
|
||||
|
||||
void UpdateProduce(
|
||||
const CObjectVector<CDirItem> &dirItems,
|
||||
const CObjectVector<CArchiveItem> &archiveItems,
|
||||
const CObjectVector<CUpdatePair> &updatePairs,
|
||||
const NUpdateArchive::CActionSet &actionSet,
|
||||
CObjectVector<CUpdatePair2> &operationChain)
|
||||
{
|
||||
for(int i = 0; i < updatePairs.Size(); i++)
|
||||
{
|
||||
// CUpdateArchiveRange aRange;
|
||||
const CUpdatePair &pair = updatePairs[i];
|
||||
|
||||
CUpdatePair2 pair2;
|
||||
pair2.IsAnti = false;
|
||||
pair2.ArchiveItemIndex = pair.ArchiveItemIndex;
|
||||
pair2.DirItemIndex = pair.DirItemIndex;
|
||||
pair2.ExistInArchive = (pair.State != NPairState::kOnlyOnDisk);
|
||||
pair2.ExistOnDisk = (pair.State != NPairState::kOnlyInArchive);
|
||||
switch(actionSet.StateActions[pair.State])
|
||||
{
|
||||
case NPairAction::kIgnore:
|
||||
/*
|
||||
if (pair.State != NPairState::kOnlyOnDisk)
|
||||
IgnoreArchiveItem(m_ArchiveItems[pair.ArchiveItemIndex]);
|
||||
// cout << "deleting";
|
||||
*/
|
||||
break;
|
||||
case NPairAction::kCopy:
|
||||
{
|
||||
if (pair.State == NPairState::kOnlyOnDisk)
|
||||
throw kUpdateActionSetCollision;
|
||||
pair2.NewData = pair2.NewProperties = false;
|
||||
operationChain.Add(pair2);
|
||||
break;
|
||||
}
|
||||
case NPairAction::kCompress:
|
||||
{
|
||||
if (pair.State == NPairState::kOnlyInArchive ||
|
||||
pair.State == NPairState::kNotMasked)
|
||||
throw kUpdateActionSetCollision;
|
||||
pair2.NewData = pair2.NewProperties = true;
|
||||
operationChain.Add(pair2);
|
||||
break;
|
||||
}
|
||||
case NPairAction::kCompressAsAnti:
|
||||
{
|
||||
pair2.IsAnti = true;
|
||||
pair2.NewData = pair2.NewProperties = true;
|
||||
operationChain.Add(pair2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
7zip/UI/Common/UpdateProduce.h
Executable file
35
7zip/UI/Common/UpdateProduce.h
Executable file
@@ -0,0 +1,35 @@
|
||||
// UpdateProduce.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __UPDATEPRODUCE_H
|
||||
#define __UPDATEPRODUCE_H
|
||||
|
||||
#include "UpdatePair.h"
|
||||
|
||||
struct CUpdatePair2
|
||||
{
|
||||
// bool OperationIsCompress;
|
||||
bool NewData;
|
||||
bool NewProperties;
|
||||
|
||||
bool ExistInArchive;
|
||||
bool ExistOnDisk;
|
||||
bool IsAnti;
|
||||
int ArchiveItemIndex;
|
||||
int DirItemIndex;
|
||||
|
||||
bool NewNameIsDefined;
|
||||
UString NewName;
|
||||
|
||||
CUpdatePair2(): NewNameIsDefined(false) {}
|
||||
};
|
||||
|
||||
void UpdateProduce(
|
||||
const CObjectVector<CDirItem> &dirItems,
|
||||
const CObjectVector<CArchiveItem> &archiveItems,
|
||||
const CObjectVector<CUpdatePair> &updatePairs,
|
||||
const NUpdateArchive::CActionSet &actionSet,
|
||||
CObjectVector<CUpdatePair2> &operationChain);
|
||||
|
||||
#endif
|
||||
73
7zip/UI/Common/WorkDir.cpp
Executable file
73
7zip/UI/Common/WorkDir.cpp
Executable file
@@ -0,0 +1,73 @@
|
||||
// WorkDir.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "WorkDir.h"
|
||||
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/FileName.h"
|
||||
#include "Windows/FileDir.h"
|
||||
|
||||
static inline UINT GetCurrentCodePage()
|
||||
{ return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NFile;
|
||||
using namespace NName;
|
||||
|
||||
static UString GetContainingDir(const UString &path)
|
||||
{
|
||||
UString resultPath;
|
||||
int pos;
|
||||
if(!NFile::NDirectory::MyGetFullPathName(path, resultPath, pos))
|
||||
throw 141716;
|
||||
return resultPath.Left(pos);
|
||||
}
|
||||
|
||||
UString GetWorkDir(const NWorkDir::CInfo &workDirInfo,
|
||||
const UString &archiveName)
|
||||
{
|
||||
NWorkDir::NMode::EEnum mode = workDirInfo.Mode;
|
||||
if (workDirInfo.ForRemovableOnly)
|
||||
{
|
||||
mode = NWorkDir::NMode::kCurrent;
|
||||
UString prefix = archiveName.Left(3);
|
||||
if (prefix[1] == L':' && prefix[2] == L'\\')
|
||||
{
|
||||
UINT driveType = GetDriveType(GetSystemString(prefix, GetCurrentCodePage()));
|
||||
if (driveType == DRIVE_CDROM || driveType == DRIVE_REMOVABLE)
|
||||
mode = workDirInfo.Mode;
|
||||
}
|
||||
/*
|
||||
CParsedPath parsedPath;
|
||||
parsedPath.ParsePath(archiveName);
|
||||
UINT driveType = GetDriveType(parsedPath.Prefix);
|
||||
if ((driveType != DRIVE_CDROM) && (driveType != DRIVE_REMOVABLE))
|
||||
mode = NZipSettings::NWorkDir::NMode::kCurrent;
|
||||
*/
|
||||
}
|
||||
switch(mode)
|
||||
{
|
||||
case NWorkDir::NMode::kCurrent:
|
||||
{
|
||||
return GetContainingDir(archiveName);
|
||||
}
|
||||
case NWorkDir::NMode::kSpecified:
|
||||
{
|
||||
UString tempDir = workDirInfo.Path;
|
||||
NormalizeDirPathPrefix(tempDir);
|
||||
return tempDir;
|
||||
}
|
||||
default: // NZipSettings::NWorkDir::NMode::kSystem:
|
||||
{
|
||||
UString tempDir;
|
||||
if(!NFile::NDirectory::MyGetTempPath(tempDir))
|
||||
throw 141717;
|
||||
return tempDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
14
7zip/UI/Common/WorkDir.h
Executable file
14
7zip/UI/Common/WorkDir.h
Executable file
@@ -0,0 +1,14 @@
|
||||
// WorkDir.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WORKDIR_H
|
||||
#define __WORKDIR_H
|
||||
|
||||
#include "../Common/ZipRegistry.h"
|
||||
|
||||
UString GetWorkDir(const NWorkDir::CInfo &workDirInfo,
|
||||
const UString &archiveName);
|
||||
|
||||
#endif
|
||||
|
||||
404
7zip/UI/Common/ZipRegistry.cpp
Executable file
404
7zip/UI/Common/ZipRegistry.cpp
Executable file
@@ -0,0 +1,404 @@
|
||||
// ZipRegistry.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "ZipRegistry.h"
|
||||
|
||||
#include "Common/IntToString.h"
|
||||
#include "Common/StringConvert.h"
|
||||
|
||||
#include "Windows/Synchronization.h"
|
||||
#include "Windows/Registry.h"
|
||||
|
||||
#include "Windows/FileDir.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NRegistry;
|
||||
|
||||
static const TCHAR *kCUBasePath = TEXT("Software\\7-ZIP");
|
||||
|
||||
// static const TCHAR *kArchiversKeyName = TEXT("Archivers");
|
||||
|
||||
static NSynchronization::CCriticalSection g_RegistryOperationsCriticalSection;
|
||||
|
||||
//////////////////////
|
||||
// ExtractionInfo
|
||||
|
||||
static const TCHAR *kExtractionKeyName = TEXT("Extraction");
|
||||
|
||||
static const TCHAR *kExtractionPathHistoryKeyName = TEXT("PathHistory");
|
||||
static const TCHAR *kExtractionExtractModeValueName = TEXT("ExtarctMode");
|
||||
static const TCHAR *kExtractionOverwriteModeValueName = TEXT("OverwriteMode");
|
||||
static const TCHAR *kExtractionShowPasswordValueName = TEXT("ShowPassword");
|
||||
|
||||
static CSysString GetKeyPath(const CSysString &path)
|
||||
{
|
||||
return CSysString(kCUBasePath) + CSysString('\\') + CSysString(path);
|
||||
}
|
||||
|
||||
void SaveExtractionInfo(const NExtraction::CInfo &info)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey extractionKey;
|
||||
extractionKey.Create(HKEY_CURRENT_USER, GetKeyPath(kExtractionKeyName));
|
||||
extractionKey.RecurseDeleteKey(kExtractionPathHistoryKeyName);
|
||||
{
|
||||
CKey pathHistoryKey;
|
||||
pathHistoryKey.Create(extractionKey, kExtractionPathHistoryKeyName);
|
||||
for(int i = 0; i < info.Paths.Size(); i++)
|
||||
{
|
||||
TCHAR numberString[16];
|
||||
ConvertUINT64ToString(i, numberString);
|
||||
pathHistoryKey.SetValue(numberString, info.Paths[i]);
|
||||
}
|
||||
}
|
||||
extractionKey.SetValue(kExtractionExtractModeValueName, UINT32(info.PathMode));
|
||||
extractionKey.SetValue(kExtractionOverwriteModeValueName, UINT32(info.OverwriteMode));
|
||||
extractionKey.SetValue(kExtractionShowPasswordValueName, info.ShowPassword);
|
||||
}
|
||||
|
||||
void ReadExtractionInfo(NExtraction::CInfo &info)
|
||||
{
|
||||
info.Paths.Clear();
|
||||
info.PathMode = NExtraction::NPathMode::kFullPathnames;
|
||||
info.OverwriteMode = NExtraction::NOverwriteMode::kAskBefore;
|
||||
info.ShowPassword = false;
|
||||
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey extractionKey;
|
||||
if(extractionKey.Open(HKEY_CURRENT_USER, GetKeyPath(kExtractionKeyName), KEY_READ) != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
{
|
||||
CKey pathHistoryKey;
|
||||
if(pathHistoryKey.Open(extractionKey, kExtractionPathHistoryKeyName, KEY_READ) ==
|
||||
ERROR_SUCCESS)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
TCHAR numberString[16];
|
||||
ConvertUINT64ToString(info.Paths.Size(), numberString);
|
||||
CSysString path;
|
||||
if (pathHistoryKey.QueryValue(numberString, path) != ERROR_SUCCESS)
|
||||
break;
|
||||
info.Paths.Add(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
UINT32 extractModeIndex;
|
||||
if (extractionKey.QueryValue(kExtractionExtractModeValueName, extractModeIndex) == ERROR_SUCCESS)
|
||||
{
|
||||
switch (extractModeIndex)
|
||||
{
|
||||
case NExtraction::NPathMode::kFullPathnames:
|
||||
case NExtraction::NPathMode::kCurrentPathnames:
|
||||
case NExtraction::NPathMode::kNoPathnames:
|
||||
info.PathMode = NExtraction::NPathMode::EEnum(extractModeIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
UINT32 overwriteModeIndex;
|
||||
if (extractionKey.QueryValue(kExtractionOverwriteModeValueName, overwriteModeIndex) == ERROR_SUCCESS)
|
||||
{
|
||||
switch (overwriteModeIndex)
|
||||
{
|
||||
case NExtraction::NOverwriteMode::kAskBefore:
|
||||
case NExtraction::NOverwriteMode::kWithoutPrompt:
|
||||
case NExtraction::NOverwriteMode::kSkipExisting:
|
||||
case NExtraction::NOverwriteMode::kAutoRename:
|
||||
case NExtraction::NOverwriteMode::kAutoRenameExisting:
|
||||
info.OverwriteMode = NExtraction::NOverwriteMode::EEnum(overwriteModeIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (extractionKey.QueryValue(kExtractionShowPasswordValueName,
|
||||
info.ShowPassword) != ERROR_SUCCESS)
|
||||
info.ShowPassword = false;
|
||||
}
|
||||
|
||||
///////////////////////////////////
|
||||
// CompressionInfo
|
||||
|
||||
static const TCHAR *kCompressionKeyName = TEXT("Compression");
|
||||
|
||||
static const TCHAR *kCompressionHistoryArchivesKeyName = TEXT("ArcHistory");
|
||||
static const TCHAR *kCompressionLevelValueName = TEXT("Level");
|
||||
static const TCHAR *kCompressionLastFormatValueName = TEXT("Archiver");
|
||||
static const TCHAR *kCompressionShowPasswordValueName = TEXT("ShowPassword");
|
||||
static const TCHAR *kCompressionEncryptHeadersValueName = TEXT("EncryptHeaders");
|
||||
// static const TCHAR *kCompressionMaximizeValueName = TEXT("Maximize");
|
||||
|
||||
static const TCHAR *kCompressionOptionsKeyName = TEXT("Options");
|
||||
static const TCHAR *kSolid = TEXT("Solid");
|
||||
static const TCHAR *kMultiThread = TEXT("Multithread");
|
||||
|
||||
static const TCHAR *kCompressionOptions = TEXT("Options");
|
||||
static const TCHAR *kCompressionLevel = TEXT("Level");
|
||||
static const TCHAR *kCompressionMethod = TEXT("Method");
|
||||
static const TCHAR *kCompressionDictionary = TEXT("Dictionary");
|
||||
static const TCHAR *kCompressionOrder = TEXT("Order");
|
||||
|
||||
void SaveCompressionInfo(const NCompression::CInfo &info)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
|
||||
CKey compressionKey;
|
||||
compressionKey.Create(HKEY_CURRENT_USER, GetKeyPath(kCompressionKeyName));
|
||||
compressionKey.RecurseDeleteKey(kCompressionHistoryArchivesKeyName);
|
||||
{
|
||||
CKey historyArchivesKey;
|
||||
historyArchivesKey.Create(compressionKey, kCompressionHistoryArchivesKeyName);
|
||||
for(int i = 0; i < info.HistoryArchives.Size(); i++)
|
||||
{
|
||||
TCHAR numberString[16];
|
||||
ConvertUINT64ToString(i, numberString);
|
||||
historyArchivesKey.SetValue(numberString, info.HistoryArchives[i]);
|
||||
}
|
||||
}
|
||||
|
||||
compressionKey.SetValue(kSolid, info.Solid);
|
||||
compressionKey.SetValue(kMultiThread, info.MultiThread);
|
||||
compressionKey.RecurseDeleteKey(kCompressionOptionsKeyName);
|
||||
{
|
||||
CKey optionsKey;
|
||||
optionsKey.Create(compressionKey, kCompressionOptionsKeyName);
|
||||
for(int i = 0; i < info.FormatOptionsVector.Size(); i++)
|
||||
{
|
||||
const NCompression::CFormatOptions &fo = info.FormatOptionsVector[i];
|
||||
CKey formatKey;
|
||||
formatKey.Create(optionsKey, fo.FormatID);
|
||||
if (fo.Options.IsEmpty())
|
||||
formatKey.DeleteValue(kCompressionOptions);
|
||||
else
|
||||
formatKey.SetValue(kCompressionOptions, fo.Options);
|
||||
if (fo.Level == UINT32(-1))
|
||||
formatKey.DeleteValue(kCompressionLevel);
|
||||
else
|
||||
formatKey.SetValue(kCompressionLevel, fo.Level);
|
||||
if (fo.Method.IsEmpty())
|
||||
formatKey.DeleteValue(kCompressionMethod);
|
||||
else
|
||||
formatKey.SetValue(kCompressionMethod, fo.Method);
|
||||
if (fo.Dictionary == UINT32(-1))
|
||||
formatKey.DeleteValue(kCompressionDictionary);
|
||||
else
|
||||
formatKey.SetValue(kCompressionDictionary, fo.Dictionary);
|
||||
if (fo.Order == UINT32(-1))
|
||||
formatKey.DeleteValue(kCompressionOrder);
|
||||
else
|
||||
formatKey.SetValue(kCompressionOrder, fo.Order);
|
||||
}
|
||||
}
|
||||
|
||||
compressionKey.SetValue(kCompressionLevelValueName, UINT32(info.Level));
|
||||
compressionKey.SetValue(kCompressionLastFormatValueName,
|
||||
GetSystemString(info.ArchiveType));
|
||||
|
||||
compressionKey.SetValue(kCompressionShowPasswordValueName, info.ShowPassword);
|
||||
compressionKey.SetValue(kCompressionEncryptHeadersValueName, info.EncryptHeaders);
|
||||
// compressionKey.SetValue(kCompressionMaximizeValueName, info.Maximize);
|
||||
}
|
||||
|
||||
static bool IsMultiProcessor()
|
||||
{
|
||||
SYSTEM_INFO systemInfo;
|
||||
GetSystemInfo(&systemInfo);
|
||||
return systemInfo.dwNumberOfProcessors > 1;
|
||||
}
|
||||
|
||||
void ReadCompressionInfo(NCompression::CInfo &info)
|
||||
{
|
||||
info.HistoryArchives.Clear();
|
||||
|
||||
info.Solid = true;
|
||||
info.MultiThread = IsMultiProcessor();
|
||||
info.FormatOptionsVector.Clear();
|
||||
|
||||
info.Level = 5;
|
||||
info.ArchiveType = L"7z";
|
||||
// definedStatus.Maximize = false;
|
||||
info.ShowPassword = false;
|
||||
info.EncryptHeaders = false;
|
||||
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey compressionKey;
|
||||
|
||||
if(compressionKey.Open(HKEY_CURRENT_USER,
|
||||
GetKeyPath(kCompressionKeyName), KEY_READ) != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
{
|
||||
CKey historyArchivesKey;
|
||||
if(historyArchivesKey.Open(compressionKey, kCompressionHistoryArchivesKeyName, KEY_READ) ==
|
||||
ERROR_SUCCESS)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
TCHAR numberString[16];
|
||||
ConvertUINT64ToString(info.HistoryArchives.Size(), numberString);
|
||||
CSysString path;
|
||||
if (historyArchivesKey.QueryValue(numberString, path) != ERROR_SUCCESS)
|
||||
break;
|
||||
info.HistoryArchives.Add(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool solid = false;
|
||||
if (compressionKey.QueryValue(kSolid, solid) == ERROR_SUCCESS)
|
||||
info.Solid = solid;
|
||||
bool multiThread = false;
|
||||
if (compressionKey.QueryValue(kMultiThread, multiThread) == ERROR_SUCCESS)
|
||||
info.MultiThread = multiThread;
|
||||
|
||||
{
|
||||
CKey optionsKey;
|
||||
if(optionsKey.Open(compressionKey, kCompressionOptionsKeyName, KEY_READ) ==
|
||||
ERROR_SUCCESS)
|
||||
{
|
||||
CSysStringVector formatIDs;
|
||||
optionsKey.EnumKeys(formatIDs);
|
||||
for(int i = 0; i < formatIDs.Size(); i++)
|
||||
{
|
||||
CKey formatKey;
|
||||
NCompression::CFormatOptions fo;
|
||||
fo.FormatID = formatIDs[i];
|
||||
if(formatKey.Open(optionsKey, fo.FormatID, KEY_READ) == ERROR_SUCCESS)
|
||||
{
|
||||
if (formatKey.QueryValue(kCompressionOptions, fo.Options) != ERROR_SUCCESS)
|
||||
fo.Options.Empty();
|
||||
if (formatKey.QueryValue(kCompressionLevel, fo.Level) != ERROR_SUCCESS)
|
||||
fo.Level = UINT32(-1);
|
||||
if (formatKey.QueryValue(kCompressionMethod, fo.Method) != ERROR_SUCCESS)
|
||||
fo.Method.Empty();;
|
||||
if (formatKey.QueryValue(kCompressionDictionary, fo.Dictionary) != ERROR_SUCCESS)
|
||||
fo.Dictionary = UINT32(-1);
|
||||
if (formatKey.QueryValue(kCompressionOrder, fo.Order) != ERROR_SUCCESS)
|
||||
fo.Order = UINT32(-1);
|
||||
info.FormatOptionsVector.Add(fo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 level;
|
||||
if (compressionKey.QueryValue(kCompressionLevelValueName, level) == ERROR_SUCCESS)
|
||||
info.Level = level;
|
||||
CSysString archiveType;
|
||||
if (compressionKey.QueryValue(kCompressionLastFormatValueName, archiveType) == ERROR_SUCCESS)
|
||||
info.ArchiveType = GetUnicodeString(archiveType);
|
||||
if (compressionKey.QueryValue(kCompressionShowPasswordValueName,
|
||||
info.ShowPassword) != ERROR_SUCCESS)
|
||||
info.ShowPassword = false;
|
||||
if (compressionKey.QueryValue(kCompressionEncryptHeadersValueName,
|
||||
info.EncryptHeaders) != ERROR_SUCCESS)
|
||||
info.EncryptHeaders = false;
|
||||
/*
|
||||
if (compressionKey.QueryValue(kCompressionLevelValueName, info.Maximize) == ERROR_SUCCESS)
|
||||
definedStatus.Maximize = true;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
// WorkDirInfo
|
||||
|
||||
static const TCHAR *kOptionsInfoKeyName = TEXT("Options");
|
||||
|
||||
static const TCHAR *kWorkDirTypeValueName = TEXT("WorkDirType");
|
||||
static const TCHAR *kWorkDirPathValueName = TEXT("WorkDirPath");
|
||||
static const TCHAR *kTempRemovableOnlyValueName = TEXT("TempRemovableOnly");
|
||||
static const TCHAR *kCascadedMenuValueName = TEXT("CascadedMenu");
|
||||
static const TCHAR *kContextMenuValueName = TEXT("ContextMenu");
|
||||
|
||||
void SaveWorkDirInfo(const NWorkDir::CInfo &info)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey optionsKey;
|
||||
optionsKey.Create(HKEY_CURRENT_USER, GetKeyPath(kOptionsInfoKeyName));
|
||||
optionsKey.SetValue(kWorkDirTypeValueName, UINT32(info.Mode));
|
||||
optionsKey.SetValue(kWorkDirPathValueName, GetSystemString(info.Path));
|
||||
optionsKey.SetValue(kTempRemovableOnlyValueName, info.ForRemovableOnly);
|
||||
}
|
||||
|
||||
void ReadWorkDirInfo(NWorkDir::CInfo &info)
|
||||
{
|
||||
info.SetDefault();
|
||||
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey optionsKey;
|
||||
if(optionsKey.Open(HKEY_CURRENT_USER, GetKeyPath(kOptionsInfoKeyName), KEY_READ) != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
UINT32 dirType;
|
||||
if (optionsKey.QueryValue(kWorkDirTypeValueName, dirType) != ERROR_SUCCESS)
|
||||
return;
|
||||
switch (dirType)
|
||||
{
|
||||
case NWorkDir::NMode::kSystem:
|
||||
case NWorkDir::NMode::kCurrent:
|
||||
case NWorkDir::NMode::kSpecified:
|
||||
info.Mode = NWorkDir::NMode::EEnum(dirType);
|
||||
}
|
||||
CSysString sysWorkDir;
|
||||
if (optionsKey.QueryValue(kWorkDirPathValueName, sysWorkDir) != ERROR_SUCCESS)
|
||||
{
|
||||
info.Path.Empty();
|
||||
if (info.Mode == NWorkDir::NMode::kSpecified)
|
||||
info.Mode = NWorkDir::NMode::kSystem;
|
||||
}
|
||||
info.Path = GetUnicodeString(sysWorkDir);
|
||||
if (optionsKey.QueryValue(kTempRemovableOnlyValueName, info.ForRemovableOnly) != ERROR_SUCCESS)
|
||||
info.SetForRemovableOnlyDefault();
|
||||
}
|
||||
|
||||
static void SaveOption(const TCHAR *value, bool enabled)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey optionsKey;
|
||||
optionsKey.Create(HKEY_CURRENT_USER, GetKeyPath(kOptionsInfoKeyName));
|
||||
optionsKey.SetValue(value, enabled);
|
||||
}
|
||||
|
||||
static bool ReadOption(const TCHAR *value, bool defaultValue)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey optionsKey;
|
||||
if(optionsKey.Open(HKEY_CURRENT_USER, GetKeyPath(kOptionsInfoKeyName), KEY_READ) != ERROR_SUCCESS)
|
||||
return defaultValue;
|
||||
bool enabled;
|
||||
if (optionsKey.QueryValue(value, enabled) != ERROR_SUCCESS)
|
||||
return defaultValue;
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void SaveCascadedMenu(bool show)
|
||||
{ SaveOption(kCascadedMenuValueName, show); }
|
||||
bool ReadCascadedMenu()
|
||||
{ return ReadOption(kCascadedMenuValueName, false); }
|
||||
|
||||
|
||||
static void SaveValue(const TCHAR *value, UINT32 valueToWrite)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey optionsKey;
|
||||
optionsKey.Create(HKEY_CURRENT_USER, GetKeyPath(kOptionsInfoKeyName));
|
||||
optionsKey.SetValue(value, valueToWrite);
|
||||
}
|
||||
|
||||
static bool ReadValue(const TCHAR *value, UINT32 &result)
|
||||
{
|
||||
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
|
||||
CKey optionsKey;
|
||||
if(optionsKey.Open(HKEY_CURRENT_USER, GetKeyPath(kOptionsInfoKeyName), KEY_READ) != ERROR_SUCCESS)
|
||||
return false;
|
||||
return (optionsKey.QueryValue(value, result) == ERROR_SUCCESS);
|
||||
}
|
||||
|
||||
void SaveContextMenuStatus(UINT32 value)
|
||||
{ SaveValue(kContextMenuValueName, value); }
|
||||
|
||||
bool ReadContextMenuStatus(UINT32 &value)
|
||||
{ return ReadValue(kContextMenuValueName, value); }
|
||||
119
7zip/UI/Common/ZipRegistry.h
Executable file
119
7zip/UI/Common/ZipRegistry.h
Executable file
@@ -0,0 +1,119 @@
|
||||
// ZipRegistry.h
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __ZIPREGISTRY_H
|
||||
#define __ZIPREGISTRY_H
|
||||
|
||||
#include "Common/String.h"
|
||||
|
||||
namespace NExtraction {
|
||||
|
||||
namespace NPathMode
|
||||
{
|
||||
enum EEnum
|
||||
{
|
||||
kFullPathnames,
|
||||
kCurrentPathnames,
|
||||
kNoPathnames
|
||||
};
|
||||
}
|
||||
|
||||
namespace NOverwriteMode
|
||||
{
|
||||
enum EEnum
|
||||
{
|
||||
kAskBefore,
|
||||
kWithoutPrompt,
|
||||
kSkipExisting,
|
||||
kAutoRename,
|
||||
kAutoRenameExisting
|
||||
};
|
||||
}
|
||||
|
||||
struct CInfo
|
||||
{
|
||||
NPathMode::EEnum PathMode;
|
||||
NOverwriteMode::EEnum OverwriteMode;
|
||||
CSysStringVector Paths;
|
||||
bool ShowPassword;
|
||||
};
|
||||
}
|
||||
|
||||
namespace NCompression {
|
||||
|
||||
struct CFormatOptions
|
||||
{
|
||||
CSysString FormatID;
|
||||
CSysString Options;
|
||||
UINT32 Level;
|
||||
CSysString Method;
|
||||
UINT32 Dictionary;
|
||||
UINT32 Order;
|
||||
void Init()
|
||||
{
|
||||
Level = Dictionary = Order = UINT32(-1);
|
||||
Method.Empty();
|
||||
// Options.Empty();
|
||||
}
|
||||
CFormatOptions() { Init(); }
|
||||
};
|
||||
|
||||
struct CInfo
|
||||
{
|
||||
CSysStringVector HistoryArchives;
|
||||
// bool LevelIsDefined;
|
||||
UINT32 Level;
|
||||
UString ArchiveType;
|
||||
|
||||
bool Solid;
|
||||
bool MultiThread;
|
||||
CObjectVector<CFormatOptions> FormatOptionsVector;
|
||||
|
||||
bool ShowPassword;
|
||||
bool EncryptHeaders;
|
||||
};
|
||||
}
|
||||
|
||||
namespace NWorkDir{
|
||||
|
||||
namespace NMode
|
||||
{
|
||||
enum EEnum
|
||||
{
|
||||
kSystem,
|
||||
kCurrent,
|
||||
kSpecified
|
||||
};
|
||||
}
|
||||
struct CInfo
|
||||
{
|
||||
NMode::EEnum Mode;
|
||||
UString Path;
|
||||
bool ForRemovableOnly;
|
||||
void SetForRemovableOnlyDefault() { ForRemovableOnly = true; }
|
||||
void SetDefault()
|
||||
{
|
||||
Mode = NMode::kSystem;
|
||||
Path.Empty();
|
||||
SetForRemovableOnlyDefault();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void SaveExtractionInfo(const NExtraction::CInfo &info);
|
||||
void ReadExtractionInfo(NExtraction::CInfo &info);
|
||||
|
||||
void SaveCompressionInfo(const NCompression::CInfo &info);
|
||||
void ReadCompressionInfo(NCompression::CInfo &info);
|
||||
|
||||
void SaveWorkDirInfo(const NWorkDir::CInfo &info);
|
||||
void ReadWorkDirInfo(NWorkDir::CInfo &info);
|
||||
|
||||
void SaveCascadedMenu(bool enabled);
|
||||
bool ReadCascadedMenu();
|
||||
|
||||
void SaveContextMenuStatus(UINT32 value);
|
||||
bool ReadContextMenuStatus(UINT32 &value);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user