# 2.6. Registry — PythonForWindows 1.0.4 documentation

# 2.6. Registry

The `Registry` instance is accessible via `windows.system.registry`

Note

See sample Registry

## 2.6.1. Registry

class windows.winobject.registry.Registry(sam=KEY_READ(0x20019))

  The `Windows` registry

  __call__(name, sam=None)

    Get a registry key:

        registry(r"HKEY_LOCAL_MACHINE\Software")
        registry("HKEY_LOCAL_MACHINE")("Software")

    Return type:

      `PyHKey`

  classmethod reopen(sam)

    Return a new `Registry` using `sam` as the new default

    Return type:

      `Registry`

## 2.6.2. PyHKey

class windows.winobject.registry.PyHKey(surkey, name, sam=KEY_READ(0x20019))

  A windows registry key

  __call__(name)

    Alias for `open_subkey()`

  __getitem__(name)

    Alias for `get()`

  __setitem__(name)

    Wrapper for `set()`, accept `value` or `(value, type)`

  __delitem__(name)

    Alias for `delete_value()`

  create()

    Create the registry key

  delete()

    Delete the registry key

  delete_value(name)

    Delete the value with `name`

  get(value_name)

    Retrieves the value `value_name`

    Return type:

      `KeyValue`

  open_subkey(name, sam=None)

    Open the subkey `name`

    Return type:

      `PyHKey`

  reopen(sam)

    Reopen the registry key with a new `sam`

    Return type:

      `PyHKey`

  set(name, value, type=None)

    Set the value for `name` to `value`. if `type` is None try to guess items

  property subkeys

    The subkeys of the registry key

    Type:

      [`PyHKey`] - A list of keys

  update_security_descriptor(owner=<object object>, dacl=<object object>, sacl=<object object>, group=<object object>)

    [WIP] Api for simple SD update may change

  property values

    The values of the registry key

    Type:

      [`KeyValue`] - A list of values

## 2.6.3. KeyValue

class windows.winobject.registry.KeyValue(name, value, type)

  A registry value (name, value, type)

  name

    Alias for field number 0

  type

    Alias for field number 2

  value

    Alias for field number 1