开发者

_winreg.CreateKey problem in Python

I开发者_开发百科'm trying to create a key like this

_winreg.CreateKey(_winreg.HKEY_LOCAL_MACHINE, 'Software\\Microsoft\\Shared Tools\\MSCONFIG\\startupreg\\test\\')

and the key is beeing created here

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

why?

Yes, Windows 7 64x here


You can read the article Glenn referred to, but it will not be much help.

What you probably need is proper access rights combined with access to the 64-bit registry view:

with _winreg.CreateKeyEx(_winreg.HKEY_LOCAL_MACHINE, 
                             r"Software\Microsoft\Shared Tools\MSCONFIG\startupreg\test\", 
                             0, 
                             _winreg.KEY_WOW64_64KEY | _winreg.KEY_ALL_ACCESS) as key:

    _winreg.SetValueEx(key, "testValueName", 0, _winreg.REG_SZ, "value")

Please note the combination of those _winreg.KEY_WOW64_64KEY | _winreg.KEY_ALL_ACCESS.


http://msdn.microsoft.com/en-us/library/aa384253%28VS.85%29.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜