我的程序正在尝试创建一个 key
HKLM\Software\Microsoft\Shared Tools\MSCONFIG\startupreg\test\
而是在上创建 key
HKLM\Wow6432node\Software\Microsoft\Shared Tools\MSCONFIG\startupreg\test\
并且无法正常工作...为什么?怎么解决呢?
最佳答案
有关 winreg 中的反射关键功能的文档很少(并且缺少一些零散的内容)。您确实需要this patch ,但在应用它并使用这些修复程序制作新的 Python 微版本之前,至少您可以根据补丁添加的文档尝试 DisableReflectionKey
等路由(这是它们的 RST):
+.. function:: DisableReflectionKey(key)
+
+ Disables registry reflection for 32-bit processes running on a 64-bit
+ Operating System.
+
+ *key* is an already open key, or one of the predefined :const:`HKEY_\*`
+ constants.
+
+ Will generally raise :exc:`NotImplemented` if executed on a 32-bit
+ Operating System.
+ If the key is not on the reflection list, the function succeeds but has no
+ effect. Disabling reflection for a key does not affect reflection of any
+ subkeys.
+
+.. function:: EnableReflectionKey(key)
+
+ Restores registry reflection for the specified disabled key.
+
+ *key* is an already open key, or one of the predefined :const:`HKEY_\*`
+ constants.
+
+ Will generally raise :exc:`NotImplemented` if executed on a 32-bit
+ Operating System.
+
+ Restoring reflection for a key does not affect reflection of any subkeys.
+
+
+.. function:: QueryReflectionKey(key)
+
+ Determines the reflection state for the specified key.
+
+ *key* is an already open key, or one of the predefined :const:`HKEY_\*`
+ constants.
+
+ Returns ``True`` if reflection is disabled.
+
+ Will generally raise :exc:`NotImplemented` if executed on a 32-bit
+ Operating System.
关于python - 如何在 Python 上关闭注册表重定向?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2404595/