diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2009-06-02 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:59 +0300 |
commit | 829409452d85cd6dd9dfc9151f109d6e13a2bb1c (patch) | |
tree | e0acaea47044d167f35fa197584dee1bde41c329 /CPP/7zip/UI/FileManager/RegistryUtils.cpp | |
parent | 8874e4fbc9faabdcff719b9b2ac8ebad4f282bbe (diff) |
9.04 beta
Diffstat (limited to 'CPP/7zip/UI/FileManager/RegistryUtils.cpp')
-rwxr-xr-x | CPP/7zip/UI/FileManager/RegistryUtils.cpp | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/CPP/7zip/UI/FileManager/RegistryUtils.cpp b/CPP/7zip/UI/FileManager/RegistryUtils.cpp index ed118457..bd1248a2 100755 --- a/CPP/7zip/UI/FileManager/RegistryUtils.cpp +++ b/CPP/7zip/UI/FileManager/RegistryUtils.cpp @@ -2,10 +2,12 @@ #include "StdAfx.h" -#include "RegistryUtils.h" #include "Common/IntToString.h" + #include "Windows/Registry.h" +#include "RegistryUtils.h" + using namespace NWindows; using namespace NRegistry; @@ -17,6 +19,7 @@ static const TCHAR *kCU_FMPath = REG_PATH_7Z TEXT(STRING_PATH_SEPARATOR) TEXT("F static const WCHAR *kLangValueName = L"Lang"; static const WCHAR *kEditor = L"Editor"; +static const WCHAR *kDiff = L"Diff"; static const TCHAR *kShowDots = TEXT("ShowDots"); static const TCHAR *kShowRealFileIcons = TEXT("ShowRealFileIcons"); static const TCHAR *kShowSystemMenu = TEXT("ShowSystemMenu"); @@ -31,35 +34,29 @@ static const TCHAR *kLargePagesEnable = TEXT("LargePages"); static const TCHAR *kFlatViewName = TEXT("FlatViewArc"); -void SaveRegLang(const UString &langFile) +static void SaveCuString(LPCTSTR keyPath, LPCWSTR valuePath, LPCWSTR value) { CKey key; - key.Create(HKEY_CURRENT_USER, kCUBasePath); - key.SetValue(kLangValueName, langFile); + key.Create(HKEY_CURRENT_USER, keyPath); + key.SetValue(valuePath, value); } -void ReadRegLang(UString &langFile) +static void ReadCuString(LPCTSTR keyPath, LPCWSTR valuePath, UString &res) { - langFile.Empty(); + res.Empty(); CKey key; - if (key.Open(HKEY_CURRENT_USER, kCUBasePath, KEY_READ) == ERROR_SUCCESS) - key.QueryValue(kLangValueName, langFile); + if (key.Open(HKEY_CURRENT_USER, keyPath, KEY_READ) == ERROR_SUCCESS) + key.QueryValue(valuePath, res); } -void SaveRegEditor(const UString &editorPath) -{ - CKey key; - key.Create(HKEY_CURRENT_USER, kCU_FMPath); - key.SetValue(kEditor, editorPath); -} +void SaveRegLang(const UString &path) { SaveCuString(kCUBasePath, kLangValueName, path); } +void ReadRegLang(UString &path) { ReadCuString(kCUBasePath, kLangValueName, path); } -void ReadRegEditor(UString &editorPath) -{ - editorPath.Empty(); - CKey key; - if (key.Open(HKEY_CURRENT_USER, kCU_FMPath, KEY_READ) == ERROR_SUCCESS) - key.QueryValue(kEditor, editorPath); -} +void SaveRegEditor(const UString &path) { SaveCuString(kCU_FMPath, kEditor, path); } +void ReadRegEditor(UString &path) { ReadCuString(kCU_FMPath, kEditor, path); } + +void SaveRegDiff(const UString &path) { SaveCuString(kCU_FMPath, kDiff, path); } +void ReadRegDiff(UString &path) { ReadCuString(kCU_FMPath, kDiff, path); } static void Save7ZipOption(const TCHAR *value, bool enabled) { @@ -154,8 +151,8 @@ bool ReadLockMemoryEnable() { return Read7ZipOption(kLargePagesEnable, false); } static CSysString GetFlatViewName(UInt32 panelIndex) { - TCHAR panelString[32]; - ConvertUInt64ToString(panelIndex, panelString); + TCHAR panelString[16]; + ConvertUInt32ToString(panelIndex, panelString); return (CSysString)kFlatViewName + panelString; } |