various minor fixes

svn path=/trunk/; revision=18941
This commit is contained in:
Thomas Bluemel 2005-11-01 22:45:35 +00:00
parent 837e60ee47
commit 3cda2939fe

View file

@ -69,6 +69,8 @@ RtlAnsiStringToUnicodeString(
ULONG Length;
ULONG Index;
PAGED_CODE_RTL();
Length = RtlAnsiStringToUnicodeSize(AnsiSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
UniDest->Length = (USHORT)Length - sizeof(WCHAR);
@ -350,10 +352,11 @@ VOID
NTAPI
RtlFreeAnsiString(IN PANSI_STRING AnsiString)
{
PAGED_CODE_RTL();
if (AnsiString->Buffer)
{
RtlpFreeStringMemory(AnsiString->Buffer, TAG_ASTR);
RtlZeroMemory(AnsiString, sizeof(ANSI_STRING));
}
}
@ -364,7 +367,12 @@ VOID
NTAPI
RtlFreeOemString(IN POEM_STRING OemString)
{
if (OemString->Buffer) RtlpFreeStringMemory(OemString->Buffer, TAG_OSTR);
PAGED_CODE_RTL();
if (OemString->Buffer)
{
RtlpFreeStringMemory(OemString->Buffer, TAG_OSTR);
}
}
/*
@ -374,10 +382,11 @@ VOID
NTAPI
RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString)
{
PAGED_CODE_RTL();
if (UnicodeString->Buffer)
{
RtlpFreeStringMemory(UnicodeString->Buffer, TAG_ASTR);
RtlZeroMemory(UnicodeString, sizeof(UNICODE_STRING));
}
}
@ -476,7 +485,7 @@ RtlInitUnicodeStringEx(OUT PUNICODE_STRING DestinationString,
if(SourceString)
{
DestSize = wcslen(SourceString) * sizeof(WCHAR);
if (DestSize > 0xFFFC) return STATUS_NAME_TOO_LONG;
if (DestSize > 0xFFFE) return STATUS_NAME_TOO_LONG;
DestinationString->Length = (USHORT)DestSize;
DestinationString->MaximumLength = (USHORT)DestSize + sizeof(WCHAR);
}
@ -905,6 +914,8 @@ RtlUnicodeStringToAnsiString(
ULONG Length;
ULONG Index;
PAGED_CODE_RTL();
Length = RtlUnicodeStringToAnsiSize(UniSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
@ -958,6 +969,8 @@ RtlOemStringToUnicodeString(
ULONG Length;
ULONG Index;
PAGED_CODE_RTL();
Length = RtlOemStringToUnicodeSize(OemSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
@ -1008,6 +1021,8 @@ RtlUnicodeStringToOemString(
ULONG Length;
ULONG Index;
PAGED_CODE_RTL();
Length = RtlUnicodeStringToOemSize(UniSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
@ -1119,6 +1134,8 @@ RtlOemStringToCountedUnicodeString(
ULONG Length;
ULONG Index;
PAGED_CODE_RTL();
Length = RtlOemStringToCountedUnicodeSize(OemSource);
if (!Length)
@ -1427,6 +1444,8 @@ RtlUnicodeStringToCountedOemString(
ULONG Length;
ULONG Index;
PAGED_CODE_RTL();
Length = RtlUnicodeStringToCountedOemSize(UniSource);
if (!Length)
@ -1532,6 +1551,8 @@ RtlUpcaseUnicodeString(
{
ULONG i, j;
PAGED_CODE_RTL();
if (AllocateDestinationString == TRUE)
{
UniDest->MaximumLength = UniSource->Length;
@ -1572,6 +1593,8 @@ RtlUpcaseUnicodeStringToAnsiString(
ULONG Length;
ULONG Index;
PAGED_CODE_RTL();
Length = RtlUnicodeStringToAnsiSize(UniSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
@ -1623,6 +1646,8 @@ RtlUpcaseUnicodeStringToCountedOemString(
ULONG Length;
ULONG Index;
PAGED_CODE_RTL();
Length = RtlUnicodeStringToCountedOemSize(UniSource);
if (!Length)
@ -1680,6 +1705,8 @@ RtlUpcaseUnicodeStringToOemString (
ULONG Length;
ULONG Index;
PAGED_CODE_RTL();
Length = RtlUnicodeStringToOemSize(UniSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
@ -1914,7 +1941,11 @@ RtlCreateUnicodeString(
{
ULONG Length;
PAGED_CODE_RTL();
Length = (wcslen(Source) + 1) * sizeof(WCHAR);
if (Length > 0xFFFE) return FALSE;
UniDest->Buffer = RtlpAllocateStringMemory(Length, TAG_USTR);
if (UniDest->Buffer == NULL) return FALSE;
@ -1965,6 +1996,8 @@ RtlDowncaseUnicodeString(
ULONG i;
ULONG StopGap;
PAGED_CODE_RTL();
if (AllocateDestinationString)
{
UniDest->MaximumLength = UniSource->Length;
@ -2108,6 +2141,8 @@ RtlDuplicateUnicodeString(
IN PCUNICODE_STRING SourceString,
OUT PUNICODE_STRING DestinationString)
{
PAGED_CODE_RTL();
if (SourceString == NULL || DestinationString == NULL)
return STATUS_INVALID_PARAMETER;