Beispiel #1
0
def IsContextMenuHandlerEqualsToOurPath():
    """ Check if the ContextMenuHandler that is registered for SubiT is 
        refering to our Dll path, or some other path.
    """
    sub_key = 'CLSID\\%s\\InprocServer32' % SUBIT_GUID
    # We query for the (default value) value
    value = None

    WriteDebug('Getting the dll path under SubiT\'s ContextMenuHandler.')
    reg_dll_path = WinAssociatorHelper.get_hkcr_key_value_data(sub_key, value)
    WriteDebug('The Dll path is: %s' % reg_dll_path)
    WriteDebug('The real path to our Dll is: %s' % WinAssociatorHelper.CONTEXT_MENU_HANDLER_FULL_PATH)

    return reg_dll_path == WinAssociatorHelper.CONTEXT_MENU_HANDLER_FULL_PATH
Beispiel #2
0
def UnregsiterSubiTContextMenuHandler():
    """ Unregister the ContextMenuHandler. """
    WriteDebug('UnregsiterSubiTContextMenuHandler() called.')

    sub_key = 'CLSID\\%s' % SUBIT_GUID

    WriteDebug('Removing the root key: %s' % sub_key)
    succeeded = WinAssociatorHelper.delete_hkcr_registry_key_tree(sub_key)

    WriteDebug('succeeded: %s' % succeeded)

    if succeeded:
        WriteDebug('The root_key deleted.')
    else:
        WriteDebug('The current session failed deleting the root_key.')

    return succeeded
Beispiel #3
0
def IsSubiTContextMenuHandlerAssociatedWithExtension(file_extension):
    """ Check if the ContextMenuHandler is associated with that extension. """
    WriteDebug('IsSubiTContextMenuHandlerAssociatedWithExtension(%s) called.' % file_extension) 

    ext_key = WinAssociatorHelper\
        .get_relevant_key_handle_for_extension_association(file_extension)

    if ext_key is None:
        WriteDebug('The current session failed getting the relevant key, returning False.')
        return False
    
    if WinAssociatorHelper.is_key_exists(ext_key, SUBIT_REG_PATH_EXT):
        WriteDebug('The key exists.')
        guid_value = WinAssociatorHelper.get_key_value_data\
            (ext_key, SUBIT_REG_PATH_EXT, None)
        if guid_value == SUBIT_GUID:
            WriteDebug('The guid are equals, we are registered.')
            return True

    WriteDebug('We are not registered.')
    return False
Beispiel #4
0
def IsSubiTContextMenuHandlerRegistered():
    """ Check if the ContextMenuHandler is registered. """
    WriteDebug('IsSubiTContextMenuHandlerRegistered() called.')
    registered = WinAssociatorHelper.is_clsid_registered_in_hkcr(SUBIT_GUID)
    WriteDebug('IsSubiTContextMenuHandlerRegistered? %s' % registered)
    return registered