Description
Ftr, 1st case is correct: USHORT bytes into int characters into ULONG.
1361 LengthNeeded = lstrlenW(PathString.Buffer);
|
1362 if (LengthNeeded > UNICODE_STRING_MAX_CHARS) |
2nd case is warned: ULONG into DWORD.
1393 Status = RtlDosSearchPath_Ustr(Flags,
|
1394 &PathString,
|
1395 &FileNameString,
|
1396 &ExtensionString,
|
1397 &CallerBuffer,
|
1398 NULL,
|
1399 NULL,
|
1400 &FilePartSize,
|
1401 &LengthNeeded);
|
...
|
1419 Result = LengthNeeded / sizeof(WCHAR); |
1420 if (Result > 0xFFFFFFFF) BaseSetLastNTError(STATUS_NAME_TOO_LONG); |
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...