def __init__(self, key_path):
    """Initializes a Windows Registry key filter.

    Args:
      key_path (str): key path.
    """
    super(WindowsRegistryKeyPathFilter, self).__init__()

    key_path.rstrip('\\')
    self._key_path = key_path

    key_path = key_path.upper()
    self._key_path_upper = key_path

    self._wow64_key_path = None
    self._wow64_key_path_upper = None

    if key_path.startswith(self._CONTROL_SET_PREFIX.upper()):
      self._key_path_prefix, _, self._key_path_suffix = key_path.partition(
          'CurrentControlSet'.upper())

    else:
      self._key_path_prefix = None
      self._key_path_suffix = None

      # Handle WoW64 Windows Registry key redirection.
      # Also see:
      # https://msdn.microsoft.com/en-us/library/windows/desktop/
      # ms724072%28v=vs.85%29.aspx
      # https://msdn.microsoft.com/en-us/library/windows/desktop/
      # aa384253(v=vs.85).aspx
      wow64_prefix = None
      for key_path_prefix in self._WOW64_PREFIXES:
        if key_path.startswith(key_path_prefix.upper()):
          wow64_prefix = key_path_prefix
          break

      if wow64_prefix:
        key_path_suffix = self._key_path[len(wow64_prefix):]
        if key_path_suffix.startswith('\\'):
          key_path_suffix = key_path_suffix[1:]
        self._wow64_key_path = '\\'.join([
            wow64_prefix, 'Wow6432Node', key_path_suffix])
        self._wow64_key_path_upper = self._wow64_key_path.upper()
def __init__ ( self , key_path ) : super ( WindowsRegistryKeyPathFilter , self ) . __init__ ( ) key_path . rstrip ( '\\' ) self . _key_path = key_path key_path = key_path . upper ( ) self . _key_path_upper = key_path self . _wow64_key_path = None self . _wow64_key_path_upper = None if key_path . startswith ( self . _CONTROL_SET_PREFIX . upper ( ) ) : self . _key_path_prefix , _ , self . _key_path_suffix = key_path . partition ( 'CurrentControlSet' . upper ( ) ) else : self . _key_path_prefix = None self . _key_path_suffix = None wow64_prefix = None for key_path_prefix in self . _WOW64_PREFIXES : if key_path . startswith ( key_path_prefix . upper ( ) ) : wow64_prefix = key_path_prefix break if wow64_prefix : key_path_suffix = self . _key_path [ len ( wow64_prefix ) : ] if key_path_suffix . startswith ( '\\' ) : key_path_suffix = key_path_suffix [ 1 : ] self . _wow64_key_path = '\\' . join ( [ wow64_prefix , 'Wow6432Node' , key_path_suffix ] ) self . _wow64_key_path_upper = self . _wow64_key_path . upper ( )
Initializes a Windows Registry key filter.

    Args:
      key_path (str): key path.