Origial James Hoo mod to 16.04

This commit is contained in:
shunf4
2024-04-20 18:55:53 +08:00
parent 603abd5528
commit eaa3e8b48c
86 changed files with 55401 additions and 185 deletions

View File

@@ -17,8 +17,10 @@ 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 const TCHAR *kCuFMPrefix = TEXT("Software") TEXT(STRING_PATH_SEPARATOR) TEXT("7-Zip") TEXT(STRING_PATH_SEPARATOR) TEXT("FM");
static CSysString GetKeyPath(const CSysString &path) { return kCuPrefix + path; }
static CSysString GetFMKeyPath() { return kCuFMPrefix; }
static LONG OpenMainKey(CKey &key, LPCTSTR keyName)
{
@@ -30,6 +32,16 @@ static LONG CreateMainKey(CKey &key, LPCTSTR keyName)
return key.Create(HKEY_CURRENT_USER, GetKeyPath(keyName));
}
static LONG OpenFMKey(CKey &key)
{
return key.Open(HKEY_CURRENT_USER, GetFMKeyPath(), KEY_READ);
}
static LONG CreateFMKey(CKey &key)
{
return key.Create(HKEY_CURRENT_USER, GetFMKeyPath());
}
static void Key_Set_BoolPair(CKey &key, LPCTSTR name, const CBoolPair &b)
{
if (b.Def)
@@ -62,6 +74,8 @@ static const TCHAR *kElimDup = TEXT("ElimDup");
// static const TCHAR *kAltStreams = TEXT("AltStreams");
static const TCHAR *kNtSecur = TEXT("Security");
static const TCHAR *kFMCopyHistoryValueName = TEXT("CopyHistory");
void CInfo::Save() const
{
CS_LOCK
@@ -79,8 +93,15 @@ void CInfo::Save() const
Key_Set_BoolPair(key, kNtSecur, NtSecurity);
Key_Set_BoolPair(key, kShowPassword, ShowPassword);
key.RecurseDeleteKey(kPathHistory);
key.SetValue_Strings(kPathHistory, Paths);
// key.RecurseDeleteKey(kPathHistory);
// key.SetValue_Strings(kPathHistory, Paths);
key.Close();
if (CreateFMKey(key) == ERROR_SUCCESS)
{
key.SetValue_Strings(kFMCopyHistoryValueName, Paths);
key.Close();
}
}
void Save_ShowPassword(bool showPassword)
@@ -104,28 +125,37 @@ void CInfo::Load()
CS_LOCK
CKey key;
if (OpenMainKey(key, kKeyName) != ERROR_SUCCESS)
return;
// if (OpenMainKey(key, kKeyName) != ERROR_SUCCESS)
// return;
key.GetValue_Strings(kPathHistory, Paths);
UInt32 v;
if (key.QueryValue(kExtractMode, v) == ERROR_SUCCESS && v <= NPathMode::kAbsPaths)
if (OpenMainKey(key, kKeyName) == ERROR_SUCCESS)
{
PathMode = (NPathMode::EEnum)v;
PathMode_Force = true;
// key.GetValue_Strings(kPathHistory, Paths);
UInt32 v;
if (key.QueryValue(kExtractMode, v) == ERROR_SUCCESS && v <= NPathMode::kAbsPaths)
{
PathMode = (NPathMode::EEnum)v;
PathMode_Force = true;
}
if (key.QueryValue(kOverwriteMode, v) == ERROR_SUCCESS && v <= NOverwriteMode::kRenameExisting)
{
OverwriteMode = (NOverwriteMode::EEnum)v;
OverwriteMode_Force = true;
}
Key_Get_BoolPair_true(key, kSplitDest, SplitDest);
Key_Get_BoolPair(key, kElimDup, ElimDup);
// Key_Get_BoolPair(key, kAltStreams, AltStreams);
Key_Get_BoolPair(key, kNtSecur, NtSecurity);
Key_Get_BoolPair(key, kShowPassword, ShowPassword);
key.Close();
}
if (key.QueryValue(kOverwriteMode, v) == ERROR_SUCCESS && v <= NOverwriteMode::kRenameExisting)
if (OpenFMKey(key) == ERROR_SUCCESS)
{
OverwriteMode = (NOverwriteMode::EEnum)v;
OverwriteMode_Force = true;
key.GetValue_Strings(kFMCopyHistoryValueName, Paths);
key.Close();
}
Key_Get_BoolPair_true(key, kSplitDest, SplitDest);
Key_Get_BoolPair(key, kElimDup, ElimDup);
// Key_Get_BoolPair(key, kAltStreams, AltStreams);
Key_Get_BoolPair(key, kNtSecur, NtSecurity);
Key_Get_BoolPair(key, kShowPassword, ShowPassword);
}
bool Read_ShowPassword()
@@ -373,11 +403,11 @@ void CContextMenuInfo::Save() const
void CContextMenuInfo::Load()
{
Cascaded.Val = true;
Cascaded.Val = false;
Cascaded.Def = false;
MenuIcons.Val = false;
MenuIcons.Def = false;
MenuIcons.Val = true;
MenuIcons.Def = true;
ElimDup.Val = true;
ElimDup.Def = false;