--- trunk/reactos/lib/rtl/unicode.c 2005-11-01 22:39:14 UTC (rev 18940)
+++ trunk/reactos/lib/rtl/unicode.c 2005-11-01 22:45:35 UTC (rev 18941)
@@ -69,6 +69,8 @@
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 @@
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 @@
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 @@
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 @@
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 @@
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlUnicodeStringToAnsiSize(UniSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
@@ -958,6 +969,8 @@
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlOemStringToUnicodeSize(OemSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
@@ -1008,6 +1021,8 @@
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlUnicodeStringToOemSize(UniSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
@@ -1119,6 +1134,8 @@
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlOemStringToCountedUnicodeSize(OemSource);
if (!Length)
@@ -1427,6 +1444,8 @@
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlUnicodeStringToCountedOemSize(UniSource);
if (!Length)
@@ -1532,6 +1551,8 @@
{
ULONG i, j;
+ PAGED_CODE_RTL();
+
if (AllocateDestinationString == TRUE)
{
UniDest->MaximumLength = UniSource->Length;
@@ -1572,6 +1593,8 @@
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlUnicodeStringToAnsiSize(UniSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
@@ -1623,6 +1646,8 @@
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlUnicodeStringToCountedOemSize(UniSource);
if (!Length)
@@ -1680,6 +1705,8 @@
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlUnicodeStringToOemSize(UniSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
@@ -1914,7 +1941,11 @@
{
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 @@
ULONG i;
ULONG StopGap;
+ PAGED_CODE_RTL();
+
if (AllocateDestinationString)
{
UniDest->MaximumLength = UniSource->Length;
@@ -2108,6 +2141,8 @@
IN PCUNICODE_STRING SourceString,
OUT PUNICODE_STRING DestinationString)
{
+ PAGED_CODE_RTL();
+
if (SourceString == NULL || DestinationString == NULL)
return STATUS_INVALID_PARAMETER;