[python-win32] I need to walk the Windows registry

Mark Hammond mhammond@skippinet.com.au
Fri, 13 Dec 2002 09:29:15 +1100

A patch to _winreg would be good, but you are probably finding that you are
getting "MBCS" encoded values, and that you can pass MBCS back in.


val = val.decode("mbcs")
should get a Unicode string from a returned ASCII string, and passing
unicode.encode("mbcs") should allow Unicode characters to be written.

The best thing would be a _winreg patch, although I am not sure what the
impact on Win9x will be.


> -----Original Message-----
> From: python-win32-admin@python.org
> [mailto:python-win32-admin@python.org]On Behalf Of Martin Katz
> Sent: Friday, 13 December 2002 6:40 AM
> To: python-win32@python.org
> Subject: [python-win32] I need to walk the Windows registry
> I need to retrieve all of the values in a subtree of the registry. I am
> using _winreg.EnumKey() and _winreg.EnumValue().
> My problem is that the key and value names in the registry are not
> ASCII. Value names can contain any 2-byte character from 1 through
> 65535. Key names have an additional restriction that they cannot contain
> a backslash.
> _winreg.EnumValue doesn't return value names correctly if any of the
> characters are  above 255. _winreg.QueryValueEx raises an exception if
> it is passed a name with values above 127.
> Anybody have any suggestions? Do I have to patch _winreg or is there a
> better alternative?
> Martin
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32