- Fix RtlInitUnicodeStringEx for NULL case (spotted by Herv� Poussineau).

svn path=/trunk/; revision=11949
This commit is contained in:
Filip Navara 2004-12-05 21:42:54 +00:00
parent 3d7ae60229
commit 9a8220ce63

View file

@ -504,18 +504,24 @@ NTSTATUS STDCALL
RtlInitUnicodeStringEx(OUT PUNICODE_STRING DestinationString,
IN PCWSTR SourceString)
{
ULONG Length = 0;
ULONG Length;
if (SourceString != NULL)
{
Length = wcslen(SourceString) * sizeof(WCHAR);
if (Length > 0xFFFC)
return STATUS_NAME_TOO_LONG;
}
DestinationString->Length = Length;
DestinationString->MaximumLength = Length + sizeof(WCHAR);
DestinationString->Buffer = (PWSTR)SourceString;
DestinationString->Length = Length;
DestinationString->MaximumLength = Length + sizeof(WCHAR);
DestinationString->Buffer = (PWSTR)SourceString;
}
else
{
DestinationString->Length = 0;
DestinationString->MaximumLength = 0;
DestinationString->Buffer = NULL;
}
return STATUS_SUCCESS;
}