Joseph Galbraith wrote:
I'm curious why we are making this string nul terminated?
IoCreateSymbolicLink() should not care (I'm virtually certain it doesn't under windows.) And I'm pretty sure that IoRegisterDeviceInterface isn't expected to return a nul terminated string either. And I'm also pretty sure our implementation doesn't actually return it NUL terminated because the length doesn't include the NUL termination (rightly so or the symbolic link would actually have a NUL character as part of it's name) and the RtlMoveMemory() at the end of the function is based of off Length().
I'm pretty sure that virtually no windows kernel mode function taking a UNICODE_STRING structure (or a STRING structure) expects nul termination...
We are accessing often the buffer of a string with wcslen, wcschr and wcsrchr. This is dangerous. The real intention for this changes was to prevent the kernel from crashing within the red zone check.
- Hartmut