bool CheckContextMenuHandler() { return // CheckHandlerCommon(GetFullContextMenuKeyName(kRootKeyNameForFolder)) && CheckHandlerCommon(GetFullContextMenuKeyName(kRootKeyNameForDirectory)) && CheckHandlerCommon(GetFullContextMenuKeyName(kRootKeyNameForFile)) && CheckHandlerCommon(GetFullDragDropMenuKeyName(kRootKeyNameForDirectory)) && CheckHandlerCommon(GetFullDragDropMenuKeyName(kRootKeyNameForDrive)); }
static void DeleteContextMenuHandlerCommon(const CSysString &keyName) { CKey rootKey; rootKey.Attach(HKEY_CLASSES_ROOT); rootKey.RecurseDeleteKey(GetFullContextMenuKeyName(keyName)); rootKey.Detach(); }
static void AddContextMenuHandlerCommon(const CSysString &keyName) { DeleteContextMenuHandlerCommon(keyName); NSynchronization::CCriticalSectionLock lock(g_CS); CKey key; key.Create(HKEY_CLASSES_ROOT, GetFullContextMenuKeyName(keyName)); key.SetValue(NULL, kExtensionCLSID); }
static bool CheckContextMenuHandlerCommon(const CSysString &keyName) { NSynchronization::CCriticalSectionLock lock(g_RegistryOperationsCriticalSection); CKey key; if (key.Open(HKEY_CLASSES_ROOT, GetFullContextMenuKeyName(keyName), KEY_READ) != ERROR_SUCCESS) return false; CSysString value; if (key.QueryValue(NULL, value) != ERROR_SUCCESS) return false; return (value.CompareNoCase(kExtensionCLSID) == 0); }