Ftr, 1st case is correct: USHORT bytes into int characters into ULONG.
2nd case is warned: ULONG into DWORD.
It feels like 0xFFFFFFFF should be UNICODE_STRING_MAX_CHARS.
But I am not familiar with RtlDosSearchPath_Ustr() and related functions code, and it/they misses documentation.
This code was added as is in r54713 by alex_ionescu.
Fwiw, RtlDosSearchPath_Ustr() expects a PSIZE_T, not a PULONG. Wrt x64...