Python20 win32api RegSetValueEx in Win2k
David LeBlanc
whisper at oz.nospamnet
Sat May 5 14:07:41 EDT 2001
[This followup was posted to comp.lang.python and a copy was sent to the
cited author.]
In article <3af136f3$1 at netnews.web.de>, huene at web.de says...
> I'm a newbie and tried to add some values to the Windows2000 registry database
> using the RegSetValueEx command:
>
>
> subkey=win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE,'Software')
> subkey=win32api.RegOpenKeyEx(subkey, 'Dummy')
> self.registry_key=subkey
> win32api.RegSetValueEx(self.registry_key, "7000", 0, win32con.REG_SZ,
> "742890210")
>
>
> With Win9x there was no problem, whereas with W2k and NT I always get the error:
> pywintypes.api_error: (5, 'RegSetValueEx', 'Zugriff verweigert') (the last is
> 'access denied' in german).
>
>
> Using win32api.RegSetValue(self.registry_eaw_key, "7000", win32con.REG_SZ,
> "742890210") I succeeded, but the result was a new subkey.
>
>
> I think it is something dealing with security. Is there somebody who can help
> me?
>
It could very well be a problem of permissions - are you logged in as
administrator on the NT or 2K boxes. I think if you're trying to change a
registery entry for H_KEY_LOCAL_USER, then it might work if you don't
have administrator priviledges. Other branches, such as
HKEY_LOCAL_MACHINE are probably protected from unpriviledged users.
Dave LeBlanc
More information about the Python-list
mailing list