On Wed Feb 8 18:43:07 2023 +0000, Zebediah Figura wrote:
I don't understand, what's wrong with using RtlInitUnicodeString() on a static constant?
It's not a logic error, it just results in an unnecessary call to wcslen and makes it less clear that the string is not being duplicated into new memory. For example, the following does not result in any warnings when compiled with `-fanalyzer`:
``` UNICODE_STRING s; RtlInitUnicodeString(&s, L"Hello world!"); s.Buffer[0] = 0; ```
But the following does result in a warning when compiled with `-fanalyzer`:
``` UNICODE_STRING s = RTL_CONSTANT_STRING(L"Hello world!"); s.Buffer[0] = 0; ```