https://bugs.winehq.org/show_bug.cgi?id=37575
Bug ID: 37575 Summary: regedit: duplicated null charactors Product: Wine Version: unspecified Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: programs Assignee: wine-bugs@winehq.org Reporter: s.wanabe@gmail.com Distribution: ---
regedit.exe seems add duplicate null charactors when type of value is "str".
$ echo "[HKEY_LOCAL_MACHINE\SYSTEM]" $'\n''"TestKey"=str:"a"'|wine regedit - $ wine C:/Ruby200/bin/ruby.exe -rwin32/registry -e 'Win32::Registry::HKEY_LOCAL_MACHINE.open("SYSTEM") do |reg| p reg.read("TestKey") end' [1, "a\u0000"]
$ echo "[HKEY_LOCAL_MACHINE\SYSTEM]" $'\n''"TestKey"=hex(1):61, 00, 00, 00'|wine regedit - $ wine C:/Ruby200/bin/ruby.exe -rwin32/registry -e 'Win32::Registry::HKEY_LOCAL_MACHINE.open("SYSTEM") do |reg| p reg.read("TestKey") end' [1, "a"]
I guess this is due to programs/regedit/regproc.c.
static LONG setValue(WCHAR* val_name, WCHAR* val_data, BOOL is_unicode) { ... val_data[dwLen-1] = '\0'; /* remove last quotes */ lpbData = (BYTE*) val_data; dwLen++; /* include terminating null */ ... }
"include terminating null" should be discarded because "remove last quotes" already add terminating null.