本文整理汇总了C++中CKey::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ CKey::Create方法的具体用法?C++ CKey::Create怎么用?C++ CKey::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKey
的用法示例。
在下文中一共展示了CKey::Create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Save
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);
}
}
}
示例2: RegisterHelper
BOOL RegisterHelper(LPCTSTR* rglpszRegister, LPCTSTR* rglpszSymbols,
BOOL bReplace)
{
ASSERT(rglpszRegister != NULL);
ASSERT(rglpszSymbols != NULL);
CString strKey;
CString strValueName;
CString strValue;
// keeping a key open makes this go a bit faster
CKey keyTemp;
VERIFY(keyTemp.Create(HKEY_CLASSES_ROOT, _T("CLSID")));
BOOL bResult = TRUE;
while (*rglpszRegister != NULL)
{
LPCTSTR lpszKey = *rglpszRegister++;
if (*lpszKey == '\0')
continue;
LPCTSTR lpszValueName = lpszKey + lstrlen(lpszKey) + 1;
LPCTSTR lpszValue = lpszValueName + lstrlen(lpszValueName) + 1;
strKey.ReleaseBuffer(
FormatMessage(FORMAT_MESSAGE_FROM_STRING |
FORMAT_MESSAGE_ARGUMENT_ARRAY, lpszKey, NULL, NULL,
strKey.GetBuffer(256), 256, (va_list*) rglpszSymbols));
strValueName = lpszValueName;
strValue.ReleaseBuffer(
FormatMessage(FORMAT_MESSAGE_FROM_STRING |
FORMAT_MESSAGE_ARGUMENT_ARRAY, lpszValue, NULL, NULL,
strValue.GetBuffer(256), 256, (va_list*) rglpszSymbols));
if (strKey.IsEmpty())
{
TRACE1("Warning: skipping empty key '%s'.\n", lpszKey);
continue;
}
CKey key;
VERIFY(key.Create(HKEY_CLASSES_ROOT, strKey));
if (!bReplace)
{
CString str;
if (key.GetStringValue(str, strValueName) && !str.IsEmpty())
continue;
}
if (!key.SetStringValue(strValue, strValueName))
{
TRACE2("Error: failed setting key '%s' to value '%s'.\n",
(LPCTSTR)strKey, (LPCTSTR)strValue);
bResult = FALSE;
break;
}
}
return bResult;
}
示例3: SaveCompressionInfo
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++)
{
wchar_t 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);
SetRegString(formatKey, kCompressionOptions, fo.Options);
SetRegString(formatKey, kCompressionMethod, fo.Method);
SetRegString(formatKey, kEncryptionMethod, fo.EncryptionMethod);
SetRegUInt32(formatKey, kCompressionLevel, fo.Level);
SetRegUInt32(formatKey, kCompressionDictionary, fo.Dictionary);
SetRegUInt32(formatKey, kCompressionOrder, fo.Order);
SetRegUInt32(formatKey, kCompressionBlockSize, fo.BlockLogSize);
SetRegUInt32(formatKey, kCompressionNumThreads, fo.NumThreads);
}
}
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);
}
示例4: SaveStringList
static void SaveStringList(LPCTSTR valueName, const UStringVector &folders)
{
NSynchronization::CCriticalSectionLock lock(g_CS);
CKey key;
key.Create(HKEY_CURRENT_USER, kCUBasePath);
key.SetValue_Strings(valueName, folders);
}
示例5: SavePanelPath
void SavePanelPath(UInt32 panel, const UString &path)
{
NSynchronization::CCriticalSectionLock lock(g_CS);
CKey key;
key.Create(HKEY_CURRENT_USER, kCUBasePath);
key.SetValue(GetPanelPathName(panel), path);
}
示例6: SaveOption
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);
}
示例7: SaveValue
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);
}
示例8: WriteInternalAssociations
void WriteInternalAssociations(const CObjectVector<CExtInfo> &items)
{
NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
CKey mainKey;
mainKey.Create(HKEY_CURRENT_USER, kCUKeyPath);
mainKey.RecurseDeleteKey(kAssociations);
CKey associationsKey;
associationsKey.Create(mainKey, kAssociations);
for(int i = 0; i < items.Size(); i++)
{
const CExtInfo &extInfo = items[i];
CKey key;
key.Create(associationsKey, GetSystemString(extInfo.Ext));
key.SetValue(kExtPlugins, JoinStrings(extInfo.Plugins));
// key.SetValue(kExtEnabled, extInfo.Enabled);
}
}
示例9: AddContextMenuHandlerCommon
static void AddContextMenuHandlerCommon(const CSysString &keyName)
{
DeleteContextMenuHandlerCommon(keyName);
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
CKey key;
key.Create(HKEY_CLASSES_ROOT, GetFullContextMenuKeyName(keyName));
key.SetValue(NULL, kExtensionCLSID);
}
示例10: AddDragDropMenuHandlerCommon
static void AddDragDropMenuHandlerCommon(const CSysString &keyName)
{
DeleteDragDropMenuHandlerCommon(keyName);
NSynchronization::CCriticalSectionLock lock(g_CS);
CKey key;
key.Create(HKEY_CLASSES_ROOT, GetFullDragDropMenuKeyName(keyName));
key.SetValue(NULL, kExtensionCLSID);
}
示例11: SetValue
LONG SetValue(HKEY parentKey, LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value)
{
MYASSERT(value != NULL);
CKey key;
LONG res = key.Create(parentKey, keyName);
if (res == ERROR_SUCCESS)
res = key.SetValue(valueName, value);
return res;
}
示例12: SetKeyValue
LONG CKey::SetKeyValue(LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value) throw()
{
MYASSERT(value != NULL);
CKey key;
LONG res = key.Create(_object, keyName);
if (res == ERROR_SUCCESS)
res = key.SetValue(valueName, value);
return res;
}
示例13: SaveWorkDirInfo
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, info.Path);
optionsKey.SetValue(kTempRemovableOnlyValueName, info.ForRemovableOnly);
}
示例14: SaveExtractionInfo
void SaveExtractionInfo(const NExtract::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++)
{
wchar_t 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);
}
示例15: AddShellExtensionInfo
void AddShellExtensionInfo(const CSysString &extension,
const UString &programTitle,
const UString &programOpenCommand,
const UString &iconPath, int iconIndex,
const void *shellNewData, int shellNewDataSize)
{
DeleteShellExtensionKey(extension);
DeleteShellExtensionProgramKey(extension);
NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
CSysString programKeyName = GetExtProgramKeyName(extension);
{
CKey extKey;
extKey.Create(HKEY_CLASSES_ROOT, GetExtensionKeyName(extension));
extKey.SetValue(NULL, programKeyName);
if (shellNewData != NULL)
{
CKey shellNewKey;
shellNewKey.Create(extKey, kShellNewKeyName);
shellNewKey.SetValue(kShellNewDataValueName, shellNewData, shellNewDataSize);
}
}
CKey programKey;
programKey.Create(HKEY_CLASSES_ROOT, programKeyName);
programKey.SetValue(NULL, programTitle);
{
CKey iconKey;
iconKey.Create(programKey, kDefaultIconKeyName);
UString iconPathFull = iconPath;
if (iconIndex >= 0)
{
iconPathFull += L",";
wchar_t s[32];
ConvertUInt64ToString((UInt64)iconIndex, s);
iconPathFull += s;
}
iconKey.SetValue(NULL, iconPathFull);
}
CKey shellKey;
shellKey.Create(programKey, kShellKeyName);
shellKey.SetValue(NULL, TEXT(""));
CKey openKey;
openKey.Create(shellKey, kOpenKeyName);
openKey.SetValue(NULL, TEXT(""));
CKey commandKey;
commandKey.Create(openKey, kCommandKeyName);
commandKey.SetValue(NULL, programOpenCommand);
}