A UNICODE_STRING with Length==0 is an empty string, the value of Buffer
is irrelevant.
If

RtlInitEmptyUnicodeString(&EmptyString, NULL, 0);
printf("%wZ", &EmptyString);

prints "(null)", then that's a bug in printf.
This special-casing with L"" is highly irregular and should be avoided.


On 2018-06-09 14:37, Hermès BÉLUSCA-MAÏTO wrote:
This change (on my own code snippet btw, see commit 5a1a35ca5a6) was necessary because 
otherwise, the StringPrintf call that is done below (which would then use a 
WindowTitleU.Buffer == NULL) would generate the harderror dialog title: 
"(null)" (in addition to other strings being appended), instead of just an 
empty string.
And so the bug is that I forgot to adjust the condition that needs to be 
checked before freeing the window title string (if it has been allocated).

Hermès

-----Message d'origine-----
De : Thomas Faber [mailto:thomas.fa...@reactos.org]
Envoyé : samedi 9 juin 2018 09:21
À : ros-dev@reactos.org; Hermès Bélusca-Maïto
Objet : Re: [ros-diffs] 01/01: [USERSRV] HardError: Fix compilation warning;
fix few comments; fix the default empty window title string.

On 2018-04-08 16:17, Hermès Bélusca-Maïto wrote:
       /* Retrieve the window title of the client, if it has one */
-    RtlInitEmptyUnicodeString(&WindowTitleU, NULL, 0);
+    RtlInitEmptyUnicodeString(&WindowTitleU, L"", 0);

This looks like a bug. Can you explain why you think it's necessary please?

In particular, it will break this:

if (WindowTitleU.Buffer) RtlFreeUnicodeString(&WindowTitleU);


Thanks,
Thomas


_______________________________________________
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev



_______________________________________________
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev

Reply via email to