4.25 beta

This commit is contained in:
Igor Pavlov
2005-08-01 00:00:00 +00:00
committed by Kornel Lesiński
parent 47f4915611
commit af1fe52701
359 changed files with 5969 additions and 9853 deletions

View File

@@ -19,16 +19,22 @@ static NSynchronization::CCriticalSection g_RegistryOperationsCriticalSection;
///////////////////////////
// ContextMenu
static const TCHAR *kContextMenuKeyName = TEXT("\\shellex\\ContextMenuHandlers\\7-ZIP");
static const TCHAR *kContextMenuHandlerCLASSIDValue =
TEXT("{23170F69-40C1-278A-1000-000100020000}");
static const TCHAR *kContextMenuKeyName = TEXT("\\shellex\\ContextMenuHandlers\\7-ZIP");
static const TCHAR *kDragDropMenuKeyName = TEXT("\\shellex\\DragDropHandlers\\7-ZIP");
static const TCHAR *kExtensionCLSID = TEXT("{23170F69-40C1-278A-1000-000100020000}");
static const TCHAR *kRootKeyNameForFile = TEXT("*");
static const TCHAR *kRootKeyNameForFolder = TEXT("Folder");
static const TCHAR *kRootKeyNameForDirectory = TEXT("Directory");
static const TCHAR *kRootKeyNameForDrive = TEXT("Drive");
static CSysString GetFullContextMenuKeyName(const CSysString &keyName)
{ return (keyName + kContextMenuKeyName); }
static CSysString GetFullDragDropMenuKeyName(const CSysString &keyName)
{ return (keyName + kDragDropMenuKeyName); }
static bool CheckContextMenuHandlerCommon(const CSysString &keyName)
{
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
@@ -39,14 +45,28 @@ static bool CheckContextMenuHandlerCommon(const CSysString &keyName)
CSysString value;
if (key.QueryValue(NULL, value) != ERROR_SUCCESS)
return false;
return (value.CollateNoCase(kContextMenuHandlerCLASSIDValue) == 0);
return (value.CollateNoCase(kExtensionCLSID) == 0);
}
static bool CheckDragDropMenuHandlerCommon(const CSysString &keyName)
{
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
CKey key;
if (key.Open(HKEY_CLASSES_ROOT, GetFullDragDropMenuKeyName(keyName), KEY_READ) != ERROR_SUCCESS)
return false;
CSysString value;
if (key.QueryValue(NULL, value) != ERROR_SUCCESS)
return false;
return (value.CollateNoCase(kExtensionCLSID) == 0);
}
bool CheckContextMenuHandler()
{
return CheckContextMenuHandlerCommon(kRootKeyNameForFile) &&
CheckContextMenuHandlerCommon(kRootKeyNameForFolder) &&
CheckContextMenuHandlerCommon(kRootKeyNameForDirectory);
// CheckContextMenuHandlerCommon(kRootKeyNameForFolder) &&
CheckContextMenuHandlerCommon(kRootKeyNameForDirectory) &&
CheckDragDropMenuHandlerCommon(kRootKeyNameForDirectory) &&
CheckDragDropMenuHandlerCommon(kRootKeyNameForDrive);
}
static void DeleteContextMenuHandlerCommon(const CSysString &keyName)
@@ -57,11 +77,24 @@ static void DeleteContextMenuHandlerCommon(const CSysString &keyName)
rootKey.Detach();
}
static void DeleteDragDropMenuHandlerCommon(const CSysString &keyName)
{
CKey rootKey;
rootKey.Attach(HKEY_CLASSES_ROOT);
rootKey.RecurseDeleteKey(GetFullDragDropMenuKeyName(keyName));
rootKey.Detach();
}
void DeleteContextMenuHandler()
{
DeleteContextMenuHandlerCommon(kRootKeyNameForFile);
DeleteContextMenuHandlerCommon(kRootKeyNameForFolder);
DeleteContextMenuHandlerCommon(kRootKeyNameForDirectory);
DeleteContextMenuHandlerCommon(kRootKeyNameForDrive);
DeleteDragDropMenuHandlerCommon(kRootKeyNameForFile);
DeleteDragDropMenuHandlerCommon(kRootKeyNameForFolder);
DeleteDragDropMenuHandlerCommon(kRootKeyNameForDirectory);
DeleteDragDropMenuHandlerCommon(kRootKeyNameForDrive);
}
static void AddContextMenuHandlerCommon(const CSysString &keyName)
@@ -70,14 +103,26 @@ static void AddContextMenuHandlerCommon(const CSysString &keyName)
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
CKey key;
key.Create(HKEY_CLASSES_ROOT, GetFullContextMenuKeyName(keyName));
key.SetValue(NULL, kContextMenuHandlerCLASSIDValue);
key.SetValue(NULL, kExtensionCLSID);
}
static void AddDragDropMenuHandlerCommon(const CSysString &keyName)
{
DeleteDragDropMenuHandlerCommon(keyName);
NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection);
CKey key;
key.Create(HKEY_CLASSES_ROOT, GetFullDragDropMenuKeyName(keyName));
key.SetValue(NULL, kExtensionCLSID);
}
void AddContextMenuHandler()
{
AddContextMenuHandlerCommon(kRootKeyNameForFile);
AddContextMenuHandlerCommon(kRootKeyNameForFolder);
// AddContextMenuHandlerCommon(kRootKeyNameForFolder);
AddContextMenuHandlerCommon(kRootKeyNameForDirectory);
AddDragDropMenuHandlerCommon(kRootKeyNameForDirectory);
AddDragDropMenuHandlerCommon(kRootKeyNameForDrive);
}
}