Commit d289dfc2 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

server: Write terminating '\0' in the strings.

I have an application that creates its special registry key using NtCreateKey(parent, "Something\0"), and then expects to be able to open this key with NtOpenKey("Something\0") on start up. Currently this fails because terminating '\0' in the key name doesn't survive saving/loading the registry. parse_strW() helper already supports loading such key names. As the tests show after creating a kernel object with the name "Something\0" it's possible to only open it as "Something\0", and an attempt opening it as "Something" fails with STATUS_OBJECT_NAME_NOT_FOUND, and vice versa. Signed-off-by: 's avatarDmitry Timoshkov <dmitry@baikal.ru>
parent 1b987bfd
......@@ -256,7 +256,7 @@ static void dump_value( const struct key_value *value, FILE *f )
if (((WCHAR *)value->data)[value->len / sizeof(WCHAR) - 1]) break;
if (value->type != REG_SZ) fprintf( f, "str(%x):", value->type );
fputc( '\"', f );
dump_strW( (WCHAR *)value->data, value->len, f, "\"\"" );
dump_strW( (WCHAR *)value->data, value->len - sizeof(WCHAR), f, "\"\"" );
fprintf( f, "\"\n" );
return;
......
......@@ -219,7 +219,6 @@ int dump_strW( const WCHAR *str, data_size_t len, FILE *f, const char escape[2]
}
if (*str < 32) /* octal or C escape */
{
if (!*str && len == 1) continue; /* do not output terminating NULL */
if (escapes[*str] != '.')
pos += sprintf( pos, "\\%c", escapes[*str] );
else if (len > 1 && str[1] >= '0' && str[1] <= '7')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment