winreg.SetValue()

winreg.SetValue(key, sub_key, type, value) Associates a value with a specified key. key is an already open key, or one of the predefined HKEY_* constants. sub_key is a string that names the subkey with which the value is associated. type is an integer that specifies the type of the data. Currently this must be REG_SZ, meaning only strings are supported. Use the SetValueEx() function for support for other data types. value is a string that specifies the new value. If the key specified by the

winreg.SaveKey()

winreg.SaveKey(key, file_name) Saves the specified key, and all its subkeys to the specified file. key is an already open key, or one of the predefined HKEY_* constants. file_name is the name of the file to save registry data to. This file cannot already exist. If this filename includes an extension, it cannot be used on file allocation table (FAT) file systems by the LoadKey() method. If key represents a key on a remote computer, the path described by file_name is relative to the remote com

winreg.QueryValueEx()

winreg.QueryValueEx(key, value_name) Retrieves the type and data for a specified value name associated with an open registry key. key is an already open key, or one of the predefined HKEY_* constants. value_name is a string indicating the value to query. The result is a tuple of 2 items: Index Meaning 0 The value of the registry item. 1 An integer giving the registry type for this value (see table in docs for SetValueEx())

winreg.QueryValue()

winreg.QueryValue(key, sub_key) Retrieves the unnamed value for a key, as a string. key is an already open key, or one of the predefined HKEY_* constants. sub_key is a string that holds the name of the subkey with which the value is associated. If this parameter is None or empty, the function retrieves the value set by the SetValue() method for the key identified by key. Values in the registry have name, type, and data components. This method retrieves the data for a key’s first value that h

winreg.QueryReflectionKey()

winreg.QueryReflectionKey(key) Determines the reflection state for the specified key. key is an already open key, or one of the predefined HKEY_* constants. Returns True if reflection is disabled. Will generally raise NotImplemented if executed on a 32-bit operating system.

winreg.QueryInfoKey()

winreg.QueryInfoKey(key) Returns information about a key, as a tuple. key is an already open key, or one of the predefined HKEY_* constants. The result is a tuple of 3 items: Index Meaning 0 An integer giving the number of sub keys this key has. 1 An integer giving the number of values this key has. 2 An integer giving when the key was last modified (if available) as 100’s of nanoseconds since Jan 1, 1601.

winreg.PyHKEY.__exit__()

PyHKEY.__exit__(*exc_info) The HKEY object implements __enter__() and __exit__() and thus supports the context protocol for the with statement: with OpenKey(HKEY_LOCAL_MACHINE, "foo") as key: ... # work with key will automatically close key when control leaves the with block.

winreg.PyHKEY.__enter__()

PyHKEY.__enter__() PyHKEY.__exit__(*exc_info) The HKEY object implements __enter__() and __exit__() and thus supports the context protocol for the with statement: with OpenKey(HKEY_LOCAL_MACHINE, "foo") as key: ... # work with key will automatically close key when control leaves the with block.

winreg.PyHKEY.Detach()

PyHKEY.Detach() Detaches the Windows handle from the handle object. The result is an integer that holds the value of the handle before it is detached. If the handle is already detached or closed, this will return zero. After calling this function, the handle is effectively invalidated, but the handle is not closed. You would call this function when you need the underlying Win32 handle to exist beyond the lifetime of the handle object.

winreg.PyHKEY.Close()

PyHKEY.Close() Closes the underlying Windows handle. If the handle is already closed, no error is raised.