Hi, The easiest way to demonstrate the problem is to run the following shell script:
---- >8 --- regtool -m set /HKEY_LOCAL_MACHINE/SOFTWARE/Test 1234 expected="31 00 32 00 33 00 34 00 00 00 00 00" actual="`regtool get -b /HKEY_LOCAL_MACHINE/SOFTWARE/Test`" if [ "$actual" != "$expected" ]; then echo FAILED else echo OK fi ---- >8 --- The patch is below. --- >8 --- Index: regtool.cc =================================================================== RCS file: /cvs/src/src/winsup/utils/regtool.cc,v retrieving revision 1.30 diff -u -r1.30 regtool.cc --- regtool.cc 28 Aug 2010 11:22:37 -0000 1.30 +++ regtool.cc 30 Oct 2010 22:56:47 -0000 @@ -711,7 +711,7 @@ n += mbstowcs ((wchar_t *) data + n, argv[i], max_n - n) + 1; ((wchar_t *)data)[n] = L'\0'; rv = RegSetValueExW (key, value, 0, REG_MULTI_SZ, (const BYTE *) data, - (max_n + 1) * sizeof (wchar_t)); + (n + 1) * sizeof (wchar_t)); break; case REG_AUTO: rv = ERROR_SUCCESS; --- >8 --- Dmitry