[PATCH] server: Write terminating '\0' in the strings.

Dmitry Timoshkov dmitry at baikal.ru
Thu Jul 28 09:23:07 CDT 2022


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 name "Something\0"
it's possible to only open it as "Something\0", an attempt opening it
as "Something" fails with STATUS_OBJECT_NAME_NOT_FOUND, and vice versa.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 server/unicode.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/server/unicode.c b/server/unicode.c
index 86a1217b01f..a146677cf21 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')
-- 
2.37.1




More information about the wine-devel mailing list