2010-03-05 6 views
3

Je suis en train de créer une clé comme celui-ci_winreg.CreateKey problème en Python

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

et la clé est beeing créé ici

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

pourquoi?

Oui, Windows 7 64x ici

Répondre

1

Vous pouvez lire l'article Glenn appelé, mais il ne sera pas beaucoup d'aide.

Ce que vous avez probablement besoin est des droits d'accès appropriés combinés avec 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") 

S'il vous plaît noter que la combinaison de ces _winreg.KEY_WOW64_64KEY | _winreg.KEY_ALL_ACCESS.