@@ -420,6 +420,42 @@ This module offers the following functions:
420420 .. audit-event :: winreg.QueryValue key,sub_key,value_name winreg.QueryValueEx
421421
422422
423+ .. function :: GetValue(key, sub_key, value_name, flags=RRF_RT_ANY)
424+
425+ Retrieves the type and data for a specified registry value without requiring
426+ the key to be opened first.
427+
428+ *key * is an already open key, or one of the predefined
429+ :ref: `HKEY_* constants <hkey-constants >`.
430+
431+ *sub_key * is a string that holds the name of the subkey with which the value
432+ is associated. If this parameter is ``None `` or empty, the value will be read
433+ from the key specified by *key *.
434+
435+ *value_name * is a string indicating the value to query, or ``None `` for the
436+ default value of the subkey.
437+
438+ *flags * is an integer that specifies the restrictions on the value type to
439+ be queried (see :ref: `RRF_* constants <rrf-constants >`). Default is
440+ ``RRF_RT_ANY ``.
441+
442+ The result is a tuple of 2 items:
443+
444+ +-------+-----------------------------------------+
445+ | Index | Meaning |
446+ +=======+=========================================+
447+ | ``0 `` | The value of the registry item. |
448+ +-------+-----------------------------------------+
449+ | ``1 `` | An integer giving the registry type for |
450+ | | this value (see table in docs for |
451+ | | :meth: `SetValueEx `) |
452+ +-------+-----------------------------------------+
453+
454+ .. audit-event :: winreg.GetValue key,sub_key,value_name,flags winreg.GetValue
455+
456+ .. versionadded :: next
457+
458+
423459.. function :: SaveKey(key, file_name)
424460
425461 Saves the specified key, and all its subkeys to the specified file.
@@ -751,6 +787,83 @@ For more information, see `Registry Value Types
751787 A null-terminated string.
752788
753789
790+ .. _rrf-constants :
791+
792+ RRF_* Constants
793+ +++++++++++++++
794+
795+ Registry value retrieval flags used with :func: `GetValue `.
796+
797+ .. data :: RRF_RT_ANY
798+
799+ No type restriction. All registry value types will be returned.
800+
801+
802+ .. data :: RRF_RT_DWORD
803+
804+ Restrict query to 32-bit values.
805+
806+
807+ .. data :: RRF_RT_QWORD
808+
809+ Restrict query to 64-bit values.
810+
811+
812+ .. data :: RRF_RT_REG_BINARY
813+
814+ Restrict query to binary data (REG_BINARY).
815+
816+
817+ .. data :: RRF_RT_REG_DWORD
818+
819+ Restrict query to REG_DWORD values.
820+
821+
822+ .. data :: RRF_RT_REG_QWORD
823+
824+ Restrict query to REG_QWORD values.
825+
826+
827+ .. data :: RRF_RT_REG_EXPAND_SZ
828+
829+ Restrict query to expandable strings (REG_EXPAND_SZ).
830+
831+
832+ .. data :: RRF_RT_REG_MULTI_SZ
833+
834+ Restrict query to multi-strings (REG_MULTI_SZ).
835+
836+
837+ .. data :: RRF_RT_REG_NONE
838+
839+ Restrict query to null values (REG_NONE).
840+
841+
842+ .. data :: RRF_RT_REG_SZ
843+
844+ Restrict query to null-terminated strings (REG_SZ).
845+
846+
847+ .. data :: RRF_NOEXPAND
848+
849+ Do not automatically expand environment variables in REG_EXPAND_SZ values.
850+
851+
852+ .. data :: RRF_ZEROONFAILURE
853+
854+ Set buffer contents to zeroes on failure.
855+
856+
857+ .. data :: RRF_SUBKEY_WOW6464KEY
858+
859+ Query the 64-bit registry view on 64-bit Windows.
860+
861+
862+ .. data :: RRF_SUBKEY_WOW6432KEY
863+
864+ Query the 32-bit registry view on 64-bit Windows.
865+
866+
754867.. _handle-object :
755868
756869Registry Handle Objects
0 commit comments