[issue6443] _winreg.QueryValueEx confused on double null terminated strings

Amaury Forgeot d'Arc report at bugs.python.org
Thu Jul 9 11:40:35 CEST 2009


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

It seems that regedit itself cannot handle these values, see how users
have to edit data in binary mode to enter empty strings:
http://www.pcreview.co.uk/forums/thread-1715654.php

Here is a script that shows the problem: the value is returned truncated
before the empty string.

from _winreg import *
test_key_name = "SOFTWARE\\Python Registry Test Key - Delete Me"
hkey = CreateKey(HKEY_CURRENT_USER, test_key_name)
SetValueEx(hkey, "Multi", 0, REG_MULTI_SZ,
           ['test', 'with', '', 'an', 'empty', 'line'])
print QueryValueEx(hkey, "Multi")

----------
stage:  -> needs patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6443>
_______________________________________


More information about the Python-bugs-list mailing list