diff options
Diffstat (limited to 'src/libs/7zip/win/CPP/7zip/UI/Common')
-rw-r--r-- | src/libs/7zip/win/CPP/7zip/UI/Common/CompressCall.cpp | 246 | ||||
-rw-r--r-- | src/libs/7zip/win/CPP/7zip/UI/Common/CompressCall.h | 24 | ||||
-rw-r--r-- | src/libs/7zip/win/CPP/7zip/UI/Common/CompressCall2.cpp | 178 | ||||
-rw-r--r-- | src/libs/7zip/win/CPP/7zip/UI/Common/Update.h | 4 | ||||
-rw-r--r-- | src/libs/7zip/win/CPP/7zip/UI/Common/ZipRegistry.cpp | 293 |
5 files changed, 2 insertions, 743 deletions
diff --git a/src/libs/7zip/win/CPP/7zip/UI/Common/CompressCall.cpp b/src/libs/7zip/win/CPP/7zip/UI/Common/CompressCall.cpp deleted file mode 100644 index c2685f798..000000000 --- a/src/libs/7zip/win/CPP/7zip/UI/Common/CompressCall.cpp +++ /dev/null @@ -1,246 +0,0 @@ -// CompressCall.cpp - -#include "StdAfx.h" - -#include "Common/IntToString.h" -#include "Common/MyCom.h" -#include "Common/Random.h" -#include "Common/StringConvert.h" - -#include "Windows/FileDir.h" -#include "Windows/FileMapping.h" -#include "Windows/Process.h" -#include "Windows/Synchronization.h" - -#include "../FileManager/ProgramLocation.h" -#include "../FileManager/RegistryUtils.h" - -#include "CompressCall.h" - -using namespace NWindows; - -#define MY_TRY_BEGIN try { -#define MY_TRY_FINISH } \ - catch(...) { ErrorMessageHRESULT(E_FAIL); return E_FAIL; } - -static LPCWSTR kShowDialogSwitch = L" -ad"; -static LPCWSTR kEmailSwitch = L" -seml."; -static LPCWSTR kIncludeSwitch = L" -i"; -static LPCWSTR kArchiveTypeSwitch = L" -t"; -static LPCWSTR kArcIncludeSwitches = L" -an -ai"; -static LPCWSTR kStopSwitchParsing = L" --"; -static LPCWSTR kLargePagesDisable = L" -slp-"; - -UString GetQuotedString(const UString &s) -{ - return UString(L'\"') + s + UString(L'\"'); -} -static void ErrorMessage(LPCWSTR message) -{ - MessageBoxW(g_HWND, message, L"7-Zip", MB_ICONERROR | MB_OK); -} - -static void ErrorMessageHRESULT(HRESULT res, LPCWSTR s = NULL) -{ - UString s2 = HResultToMessage(res); - if (s) - { - s2 += L'\n'; - s2 += s; - } - ErrorMessage(s2); -} - -static HRESULT MyCreateProcess(LPCWSTR imageName, const UString ¶ms, - LPCWSTR curDir, bool waitFinish, - NSynchronization::CBaseEvent *event) -{ - CProcess process; - WRes res = process.Create(imageName, params, curDir); - if (res != 0) - { - ErrorMessageHRESULT(res, imageName); - return res; - } - if (waitFinish) - process.Wait(); - else if (event != NULL) - { - HANDLE handles[] = { process, *event }; - ::WaitForMultipleObjects(sizeof(handles) / sizeof(handles[0]), handles, FALSE, INFINITE); - } - return S_OK; -} - -static void AddLagePagesSwitch(UString ¶ms) -{ - if (!ReadLockMemoryEnable()) - params += kLargePagesDisable; -} - -static UString Get7zGuiPath() -{ - UString path; - GetProgramFolderPath(path); - return path + L"7zG.exe"; -} - -class CRandNameGenerator -{ - CRandom _random; -public: - CRandNameGenerator() { _random.Init(); } - UString GenerateName() - { - wchar_t temp[16]; - ConvertUInt32ToString((UInt32)_random.Generate(), temp); - return temp; - } -}; - -static HRESULT CreateMap(const UStringVector &names, - CFileMapping &fileMapping, NSynchronization::CManualResetEvent &event, - UString ¶ms) -{ - UInt32 totalSize = 1; - for (int i = 0; i < names.Size(); i++) - totalSize += (names[i].Length() + 1); - totalSize *= sizeof(wchar_t); - - CRandNameGenerator random; - - UString mappingName; - for (;;) - { - mappingName = L"7zMap" + random.GenerateName(); - - WRes res = fileMapping.Create(PAGE_READWRITE, totalSize, GetSystemString(mappingName)); - if (fileMapping.IsCreated() && res == 0) - break; - if (res != ERROR_ALREADY_EXISTS) - return res; - fileMapping.Close(); - } - - UString eventName; - for (;;) - { - eventName = L"7zEvent" + random.GenerateName(); - WRes res = event.CreateWithName(false, GetSystemString(eventName)); - if (event.IsCreated() && res == 0) - break; - if (res != ERROR_ALREADY_EXISTS) - return res; - event.Close(); - } - - params += L'#'; - params += mappingName; - params += L':'; - wchar_t temp[16]; - ConvertUInt32ToString(totalSize, temp); - params += temp; - - params += L':'; - params += eventName; - - LPVOID data = fileMapping.Map(FILE_MAP_WRITE, 0, totalSize); - if (data == NULL) - return E_FAIL; - CFileUnmapper unmapper(data); - { - wchar_t *cur = (wchar_t *)data; - *cur++ = 0; - for (int i = 0; i < names.Size(); i++) - { - const UString &s = names[i]; - int len = s.Length() + 1; - memcpy(cur, (const wchar_t *)s, len * sizeof(wchar_t)); - cur += len; - } - } - return S_OK; -} - -HRESULT CompressFiles( - const UString &arcPathPrefix, - const UString &arcName, - const UString &arcType, - const UStringVector &names, - bool email, bool showDialog, bool waitFinish) -{ - MY_TRY_BEGIN - UString params = L'a'; - - CFileMapping fileMapping; - NSynchronization::CManualResetEvent event; - params += kIncludeSwitch; - RINOK(CreateMap(names, fileMapping, event, params)); - - if (!arcType.IsEmpty()) - { - params += kArchiveTypeSwitch; - params += arcType; - } - - if (email) - params += kEmailSwitch; - - if (showDialog) - params += kShowDialogSwitch; - - AddLagePagesSwitch(params); - - params += kStopSwitchParsing; - params += L' '; - - params += GetQuotedString( - #ifdef UNDER_CE - arcPathPrefix + - #endif - arcName); - - return MyCreateProcess(Get7zGuiPath(), params, - (arcPathPrefix.IsEmpty()? 0: (LPCWSTR)arcPathPrefix), waitFinish, &event); - MY_TRY_FINISH -} - -static HRESULT ExtractGroupCommand(const UStringVector &arcPaths, UString ¶ms) -{ - AddLagePagesSwitch(params); - params += kArcIncludeSwitches; - CFileMapping fileMapping; - NSynchronization::CManualResetEvent event; - RINOK(CreateMap(arcPaths, fileMapping, event, params)); - return MyCreateProcess(Get7zGuiPath(), params, 0, false, &event); -} - -HRESULT ExtractArchives(const UStringVector &arcPaths, const UString &outFolder, bool showDialog) -{ - MY_TRY_BEGIN - UString params = L'x'; - if (!outFolder.IsEmpty()) - { - params += L" -o"; - params += GetQuotedString(outFolder); - } - if (showDialog) - params += kShowDialogSwitch; - return ExtractGroupCommand(arcPaths, params); - MY_TRY_FINISH -} - -HRESULT TestArchives(const UStringVector &arcPaths) -{ - MY_TRY_BEGIN - UString params = L't'; - return ExtractGroupCommand(arcPaths, params); - MY_TRY_FINISH -} - -HRESULT Benchmark() -{ - MY_TRY_BEGIN - return MyCreateProcess(Get7zGuiPath(), L'b', 0, false, NULL); - MY_TRY_FINISH -} diff --git a/src/libs/7zip/win/CPP/7zip/UI/Common/CompressCall.h b/src/libs/7zip/win/CPP/7zip/UI/Common/CompressCall.h deleted file mode 100644 index fc18df57c..000000000 --- a/src/libs/7zip/win/CPP/7zip/UI/Common/CompressCall.h +++ /dev/null @@ -1,24 +0,0 @@ -// CompressCall.h - -#ifndef __COMPRESS_CALL_H -#define __COMPRESS_CALL_H - -#include "Common/MyString.h" - -UString GetQuotedString(const UString &s); - -extern HWND g_HWND; -UString HResultToMessage(HRESULT errorCode); - -HRESULT CompressFiles( - const UString &arcPathPrefix, - const UString &arcName, - const UString &arcType, - const UStringVector &names, - bool email, bool showDialog, bool waitFinish); - -HRESULT ExtractArchives(const UStringVector &arcPaths, const UString &outFolder, bool showDialog); -HRESULT TestArchives(const UStringVector &arcPaths); -HRESULT Benchmark(); - -#endif diff --git a/src/libs/7zip/win/CPP/7zip/UI/Common/CompressCall2.cpp b/src/libs/7zip/win/CPP/7zip/UI/Common/CompressCall2.cpp deleted file mode 100644 index 473f7d933..000000000 --- a/src/libs/7zip/win/CPP/7zip/UI/Common/CompressCall2.cpp +++ /dev/null @@ -1,178 +0,0 @@ -// CompressCall.cpp - -#include "StdAfx.h" - -#include "Common/MyException.h" - -#include "../../UI/common/ArchiveCommandLine.h" - -#include "../../UI/GUI/BenchmarkDialog.h" -#include "../../UI/GUI/ExtractGUI.h" -#include "../../UI/GUI/UpdateGUI.h" - -#include "../../UI/GUI/ExtractRes.h" - -#include "CompressCall.h" - -#define MY_TRY_BEGIN try { -#define MY_TRY_FINISH } \ - catch(CSystemException &e) { result = e.ErrorCode; } \ - catch(...) { result = E_FAIL; } \ - if (result != S_OK && result != E_ABORT) \ - ErrorMessageHRESULT(result); - -#define CREATE_CODECS \ - CCodecs *codecs = new CCodecs; \ - CMyComPtr<IUnknown> compressCodecsInfo = codecs; \ - result = codecs->Load(); \ - if (result != S_OK) \ - throw CSystemException(result); - -UString GetQuotedString(const UString &s) -{ - return UString(L'\"') + s + UString(L'\"'); -} - -static void ErrorMessage(LPCWSTR message) -{ - MessageBoxW(g_HWND, message, L"7-Zip", MB_ICONERROR); -} - -static void ErrorMessageHRESULT(HRESULT res) -{ - ErrorMessage(HResultToMessage(res)); -} - -static void ErrorLangMessage(UINT resourceID, UInt32 langID) -{ - ErrorMessage(LangString(resourceID, langID)); -} - -HRESULT CompressFiles( - const UString &arcPathPrefix, - const UString &arcName, - const UString &arcType, - const UStringVector &names, - bool email, bool showDialog, bool /* waitFinish */) -{ - HRESULT result; - MY_TRY_BEGIN - CREATE_CODECS - - CUpdateCallbackGUI callback; - - callback.Init(); - - CUpdateOptions uo; - uo.EMailMode = email; - uo.SetAddActionCommand(); - - CIntVector formatIndices; - if (!codecs->FindFormatForArchiveType(arcType, formatIndices)) - { - ErrorLangMessage(IDS_UNSUPPORTED_ARCHIVE_TYPE, 0x0200060D); - return E_FAIL; - } - if (!uo.Init(codecs, formatIndices, arcPathPrefix + arcName)) - { - ErrorLangMessage(IDS_UPDATE_NOT_SUPPORTED, 0x02000601); - return E_FAIL; - } - - NWildcard::CCensor censor; - for (int i = 0; i < names.Size(); i++) - censor.AddItem(true, names[i], false); - - bool messageWasDisplayed = false; - result = UpdateGUI(codecs, censor, uo, showDialog, messageWasDisplayed, &callback, g_HWND); - - if (result != S_OK) - { - if (result != E_ABORT && messageWasDisplayed) - return E_FAIL; - throw CSystemException(result); - } - if (callback.FailedFiles.Size() > 0) - { - if (!messageWasDisplayed) - throw CSystemException(E_FAIL); - return E_FAIL; - } - MY_TRY_FINISH - return S_OK; -} - -static HRESULT ExtractGroupCommand(const UStringVector &arcPaths, - bool showDialog, const UString &outFolder, bool testMode) -{ - HRESULT result; - MY_TRY_BEGIN - CREATE_CODECS - - CExtractOptions eo; - eo.OutputDir = outFolder; - eo.TestMode = testMode; - - CExtractCallbackImp *ecs = new CExtractCallbackImp; - CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs; - - ecs->Init(); - - // eo.CalcCrc = options.CalcCrc; - - UStringVector arcPathsSorted; - UStringVector arcFullPathsSorted; - { - NWildcard::CCensor acrCensor; - for (int i = 0; i < arcPaths.Size(); i++) - acrCensor.AddItem(true, arcPaths[i], false); - EnumerateDirItemsAndSort(acrCensor, arcPathsSorted, arcFullPathsSorted); - } - - CIntVector formatIndices; - - NWildcard::CCensor censor; - censor.AddItem(true, L"*", false); - - bool messageWasDisplayed = false; - result = ExtractGUI(codecs, formatIndices, arcPathsSorted, arcFullPathsSorted, - censor.Pairs.Front().Head, eo, showDialog, messageWasDisplayed, ecs, g_HWND); - if (result != S_OK) - { - if (result != E_ABORT && messageWasDisplayed) - return E_FAIL; - throw CSystemException(result); - } - return ecs->IsOK() ? S_OK : E_FAIL; - MY_TRY_FINISH - return result; -} - -HRESULT ExtractArchives(const UStringVector &arcPaths, const UString &outFolder, bool showDialog) -{ - return ExtractGroupCommand(arcPaths, showDialog, outFolder, false); -} - -HRESULT TestArchives(const UStringVector &arcPaths) -{ - return ExtractGroupCommand(arcPaths, true, UString(), true); -} - -HRESULT Benchmark() -{ - HRESULT result; - MY_TRY_BEGIN - CREATE_CODECS - - #ifdef EXTERNAL_CODECS - CObjectVector<CCodecInfoEx> externalCodecs; - RINOK(LoadExternalCodecs(codecs, externalCodecs)); - #endif - result = Benchmark( - #ifdef EXTERNAL_CODECS - codecs, &externalCodecs, - #endif - (UInt32)-1, (UInt32)-1, g_HWND); - MY_TRY_FINISH - return result; -} diff --git a/src/libs/7zip/win/CPP/7zip/UI/Common/Update.h b/src/libs/7zip/win/CPP/7zip/UI/Common/Update.h index 49af0092a..ade001303 100644 --- a/src/libs/7zip/win/CPP/7zip/UI/Common/Update.h +++ b/src/libs/7zip/win/CPP/7zip/UI/Common/Update.h @@ -116,11 +116,11 @@ struct CUpdateOptions CUpdateOptions(): UpdateArchiveItself(true), SfxMode(false), + OpenShareForWrite(false), StdInMode(false), StdOutMode(false), EMailMode(false), - EMailRemoveAfter(false), - OpenShareForWrite(false) + EMailRemoveAfter(false) {}; void SetAddActionCommand() diff --git a/src/libs/7zip/win/CPP/7zip/UI/Common/ZipRegistry.cpp b/src/libs/7zip/win/CPP/7zip/UI/Common/ZipRegistry.cpp deleted file mode 100644 index ac178078a..000000000 --- a/src/libs/7zip/win/CPP/7zip/UI/Common/ZipRegistry.cpp +++ /dev/null @@ -1,293 +0,0 @@ -// ZipRegistry.cpp - -#include "StdAfx.h" - -#include "Common/IntToString.h" -#include "Common/StringConvert.h" - -#include "Windows/FileDir.h" -#include "Windows/Registry.h" -#include "Windows/Synchronization.h" - -#include "ZipRegistry.h" - -using namespace NWindows; -using namespace NRegistry; - -static NSynchronization::CCriticalSection g_CS; -#define CS_LOCK NSynchronization::CCriticalSectionLock lock(g_CS); - -static const TCHAR *kCuPrefix = TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-Zip") TEXT(STRING_PATH_SEPARATOR); - -static CSysString GetKeyPath(const CSysString &path) { return kCuPrefix + path; } - -static LONG OpenMainKey(CKey &key, LPCTSTR keyName) -{ - return key.Open(HKEY_CURRENT_USER, GetKeyPath(keyName), KEY_READ); -} - -static LONG CreateMainKey(CKey &key, LPCTSTR keyName) -{ - return key.Create(HKEY_CURRENT_USER, GetKeyPath(keyName)); -} - -namespace NExtract -{ - -static const TCHAR *kKeyName = TEXT("Extraction"); - -static const TCHAR *kExtractMode = TEXT("ExtractMode"); -static const TCHAR *kOverwriteMode = TEXT("OverwriteMode"); -static const TCHAR *kShowPassword = TEXT("ShowPassword"); -static const TCHAR *kPathHistory = TEXT("PathHistory"); - -void CInfo::Save() const -{ - CS_LOCK - CKey key; - CreateMainKey(key, kKeyName); - key.SetValue(kExtractMode, (UInt32)PathMode); - key.SetValue(kOverwriteMode, (UInt32)OverwriteMode); - key.SetValue(kShowPassword, ShowPassword); - key.RecurseDeleteKey(kPathHistory); - key.SetValue_Strings(kPathHistory, Paths); -} - - -void CInfo::Load() -{ - PathMode = NPathMode::kCurrentPathnames; - OverwriteMode = NOverwriteMode::kAskBefore; - ShowPassword = false; - Paths.Clear(); - - CS_LOCK - CKey key; - if (OpenMainKey(key, kKeyName) != ERROR_SUCCESS) - return; - - key.GetValue_Strings(kPathHistory, Paths); - UInt32 v; - if (key.QueryValue(kExtractMode, v) == ERROR_SUCCESS && v <= NPathMode::kNoPathnames) - PathMode = (NPathMode::EEnum)v; - if (key.QueryValue(kOverwriteMode, v) == ERROR_SUCCESS && v <= NOverwriteMode::kAutoRenameExisting) - OverwriteMode = (NOverwriteMode::EEnum)v; - key.GetValue_IfOk(kShowPassword, ShowPassword); -} - -} - -namespace NCompression -{ - -static const TCHAR *kKeyName = TEXT("Compression"); - -static const TCHAR *kArcHistory = TEXT("ArcHistory"); -static const WCHAR *kArchiver = L"Archiver"; -static const TCHAR *kShowPassword = TEXT("ShowPassword"); -static const TCHAR *kEncryptHeaders = TEXT("EncryptHeaders"); - -static const TCHAR *kOptionsKeyName = TEXT("Options"); - -static const TCHAR *kLevel = TEXT("Level"); -static const TCHAR *kDictionary = TEXT("Dictionary"); -static const TCHAR *kOrder = TEXT("Order"); -static const TCHAR *kBlockSize = TEXT("BlockSize"); -static const TCHAR *kNumThreads = TEXT("NumThreads"); -static const WCHAR *kMethod = L"Method"; -static const WCHAR *kOptions = L"Options"; -static const WCHAR *kEncryptionMethod = L"EncryptionMethod"; - -static void SetRegString(CKey &key, const WCHAR *name, const UString &value) -{ - if (value.IsEmpty()) - key.DeleteValue(name); - else - key.SetValue(name, value); -} - -static void SetRegUInt32(CKey &key, const TCHAR *name, UInt32 value) -{ - if (value == (UInt32)-1) - key.DeleteValue(name); - else - key.SetValue(name, value); -} - -static void GetRegString(CKey &key, const WCHAR *name, UString &value) -{ - if (key.QueryValue(name, value) != ERROR_SUCCESS) - value.Empty(); -} - -static void GetRegUInt32(CKey &key, const TCHAR *name, UInt32 &value) -{ - if (key.QueryValue(name, value) != ERROR_SUCCESS) - value = (UInt32)-1; -} - -void CInfo::Save() const -{ - CS_LOCK - - CKey key; - CreateMainKey(key, kKeyName); - key.SetValue(kLevel, (UInt32)Level); - key.SetValue(kArchiver, ArcType); - key.SetValue(kShowPassword, ShowPassword); - key.SetValue(kEncryptHeaders, EncryptHeaders); - key.RecurseDeleteKey(kArcHistory); - key.SetValue_Strings(kArcHistory, ArcPaths); - - key.RecurseDeleteKey(kOptionsKeyName); - { - CKey optionsKey; - optionsKey.Create(key, kOptionsKeyName); - for (int i = 0; i < Formats.Size(); i++) - { - const CFormatOptions &fo = Formats[i]; - CKey fk; - fk.Create(optionsKey, fo.FormatID); - - SetRegUInt32(fk, kLevel, fo.Level); - SetRegUInt32(fk, kDictionary, fo.Dictionary); - SetRegUInt32(fk, kOrder, fo.Order); - SetRegUInt32(fk, kBlockSize, fo.BlockLogSize); - SetRegUInt32(fk, kNumThreads, fo.NumThreads); - - SetRegString(fk, kMethod, fo.Method); - SetRegString(fk, kOptions, fo.Options); - SetRegString(fk, kEncryptionMethod, fo.EncryptionMethod); - } - } -} - -void CInfo::Load() -{ - ArcPaths.Clear(); - Formats.Clear(); - - Level = 5; - ArcType = L"7z"; - ShowPassword = false; - EncryptHeaders = false; - - CS_LOCK - CKey key; - - if (OpenMainKey(key, kKeyName) != ERROR_SUCCESS) - return; - - key.GetValue_Strings(kArcHistory, ArcPaths); - - { - CKey optionsKey; - if (optionsKey.Open(key, kOptionsKeyName, KEY_READ) == ERROR_SUCCESS) - { - CSysStringVector formatIDs; - optionsKey.EnumKeys(formatIDs); - for (int i = 0; i < formatIDs.Size(); i++) - { - CKey fk; - CFormatOptions fo; - fo.FormatID = formatIDs[i]; - if (fk.Open(optionsKey, fo.FormatID, KEY_READ) == ERROR_SUCCESS) - { - GetRegString(fk, kOptions, fo.Options); - GetRegString(fk, kMethod, fo.Method); - GetRegString(fk, kEncryptionMethod, fo.EncryptionMethod); - - GetRegUInt32(fk, kLevel, fo.Level); - GetRegUInt32(fk, kDictionary, fo.Dictionary); - GetRegUInt32(fk, kOrder, fo.Order); - GetRegUInt32(fk, kBlockSize, fo.BlockLogSize); - GetRegUInt32(fk, kNumThreads, fo.NumThreads); - - Formats.Add(fo); - } - } - } - } - - UString a; - if (key.QueryValue(kArchiver, a) == ERROR_SUCCESS) - ArcType = a; - key.GetValue_IfOk(kLevel, Level); - key.GetValue_IfOk(kShowPassword, ShowPassword); - key.GetValue_IfOk(kEncryptHeaders, EncryptHeaders); -} - -} - -static const TCHAR *kOptionsInfoKeyName = TEXT("Options"); - -namespace NWorkDir -{ -static const TCHAR *kWorkDirType = TEXT("WorkDirType"); -static const WCHAR *kWorkDirPath = L"WorkDirPath"; -static const TCHAR *kTempRemovableOnly = TEXT("TempRemovableOnly"); - - -void CInfo::Save()const -{ - CS_LOCK - CKey key; - CreateMainKey(key, kOptionsInfoKeyName); - key.SetValue(kWorkDirType, (UInt32)Mode); - key.SetValue(kWorkDirPath, Path); - key.SetValue(kTempRemovableOnly, ForRemovableOnly); -} - -void CInfo::Load() -{ - SetDefault(); - - CS_LOCK - CKey key; - if (OpenMainKey(key, kOptionsInfoKeyName) != ERROR_SUCCESS) - return; - - UInt32 dirType; - if (key.QueryValue(kWorkDirType, dirType) != ERROR_SUCCESS) - return; - switch (dirType) - { - case NMode::kSystem: - case NMode::kCurrent: - case NMode::kSpecified: - Mode = (NMode::EEnum)dirType; - } - if (key.QueryValue(kWorkDirPath, Path) != ERROR_SUCCESS) - { - Path.Empty(); - if (Mode == NMode::kSpecified) - Mode = NMode::kSystem; - } - key.GetValue_IfOk(kTempRemovableOnly, ForRemovableOnly); -} - -} - -static const TCHAR *kCascadedMenu = TEXT("CascadedMenu"); -static const TCHAR *kContextMenu = TEXT("ContextMenu"); - -void CContextMenuInfo::Save() const -{ - CS_LOCK - CKey key; - CreateMainKey(key, kOptionsInfoKeyName); - key.SetValue(kCascadedMenu, Cascaded); - key.SetValue(kContextMenu, Flags); -} - -void CContextMenuInfo::Load() -{ - Cascaded = true; - Flags = (UInt32)-1; - CS_LOCK - CKey key; - if (OpenMainKey(key, kOptionsInfoKeyName) != ERROR_SUCCESS) - return; - key.GetValue_IfOk(kCascadedMenu, Cascaded); - key.GetValue_IfOk(kContextMenu, Flags); -} |