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.
From: Dmitry Timoshkov dmitry@baikal.ru
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: Dmitry Timoshkov dmitry@baikal.ru --- server/unicode.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/server/unicode.c b/server/unicode.c index edb296be0c8..f84520580d7 100644 --- a/server/unicode.c +++ b/server/unicode.c @@ -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')
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.
The tests seem to be missing from this patch.
The tests seem to be missing from this patch.
The tests were accepted long time ago. See dlls/ntdll/om.c,test_null_in_object_name().
The tests seem to be missing from this patch.
The tests were accepted long time ago. See dlls/ntdll/om.c,test_null_in_object_name().
But those tests pass already.
The tests seem to be missing from this patch.
The tests were accepted long time ago. See dlls/ntdll/om.c,test_null_in_object_name().
But those tests pass already.
The description in the patch provides an explanation: "terminating '\0' in the key name doesn't survive saving/loading the registry."
On Mon Sep 11 18:43:45 2023 +0000, Dmitry Timoshkov wrote:
The tests seem to be missing from this patch.
The tests were accepted long time ago. See dlls/ntdll/om.c,test_null_in_object_name().
But those tests pass already.
The description in the patch provides an explanation: "terminating '\0' in the key name doesn't survive saving/loading the registry."
Ah, I'm sorry, I failed to read completely.