python实现注册表拦截,我怎样才能关闭注册表重定向Python的?

My program is trying to create an key on the

HKLM\Software\Microsoft\Shared Tools\MSCONFIG\startupreg\test\

but instead the key is created on the

HKLM\Wow6432node\Software\Microsoft\Shared Tools\MSCONFIG\startupreg\test\

and don't work properly... Why? How can I solve it?

解决方案

The docs on reflection-key features in winreg are scarce (and bits and pieces are missing). You really need this patch, but until it's applied and a new micro-release of Python is made with these fixes, at least you can try the DisableReflectionKey etc route according to the docs that patch adds (here's the RST for them):

+.. 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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值