@@ -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.
@@ -766,6 +802,83 @@ For more information, see `Registry Value Types
766802 You should pass a :class: `str ` or :const: `None ` in Python for this type.
767803
768804
805+ .. _rrf-constants :
806+
807+ RRF_* Constants
808+ +++++++++++++++
809+
810+ Registry value retrieval flags used with :func: `GetValue `.
811+
812+ .. data :: RRF_RT_ANY
813+
814+ No type restriction. All registry value types will be returned.
815+
816+
817+ .. data :: RRF_RT_DWORD
818+
819+ Restrict query to 32-bit values.
820+
821+
822+ .. data :: RRF_RT_QWORD
823+
824+ Restrict query to 64-bit values.
825+
826+
827+ .. data :: RRF_RT_REG_BINARY
828+
829+ Restrict query to binary data (REG_BINARY).
830+
831+
832+ .. data :: RRF_RT_REG_DWORD
833+
834+ Restrict query to REG_DWORD values.
835+
836+
837+ .. data :: RRF_RT_REG_QWORD
838+
839+ Restrict query to REG_QWORD values.
840+
841+
842+ .. data :: RRF_RT_REG_EXPAND_SZ
843+
844+ Restrict query to expandable strings (REG_EXPAND_SZ).
845+
846+
847+ .. data :: RRF_RT_REG_MULTI_SZ
848+
849+ Restrict query to multi-strings (REG_MULTI_SZ).
850+
851+
852+ .. data :: RRF_RT_REG_NONE
853+
854+ Restrict query to null values (REG_NONE).
855+
856+
857+ .. data :: RRF_RT_REG_SZ
858+
859+ Restrict query to null-terminated strings (REG_SZ).
860+
861+
862+ .. data :: RRF_NOEXPAND
863+
864+ Do not automatically expand environment variables in REG_EXPAND_SZ values.
865+
866+
867+ .. data :: RRF_ZEROONFAILURE
868+
869+ Set buffer contents to zeroes on failure.
870+
871+
872+ .. data :: RRF_SUBKEY_WOW6464KEY
873+
874+ Query the 64-bit registry view on 64-bit Windows.
875+
876+
877+ .. data :: RRF_SUBKEY_WOW6432KEY
878+
879+ Query the 32-bit registry view on 64-bit Windows.
880+
881+
769882.. _handle-object :
770883
771884Registry Handle Objects
0 commit comments