- Removed the Rtlp* string functions from the shared rtl library since
they don't make sense in umode
- Moved RtlpCreateUnicodeString to ntoskrnl for now, it however is
depreciated but still used in various places
- Added RtlpAllocateMemory and RtlpFreeMemory for rtl memory allocations
(from paged pool in ntoskrnl and from the process heap in ntdll) that
replace the ExAllocatePool* and ExFreePool implementations in ntdll
Modified: trunk/reactos/lib/ntdll/rtl/libsupp.c
Deleted: trunk/reactos/lib/rtl/libsupp.h
Modified: trunk/reactos/lib/rtl/registry.c
Modified: trunk/reactos/lib/rtl/rtl.h
Modified: trunk/reactos/lib/rtl/sid.c
Modified: trunk/reactos/lib/rtl/unicode.c
Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h
Modified: trunk/reactos/ntoskrnl/rtl/libsupp.c
_____
Modified: trunk/reactos/lib/ntdll/rtl/libsupp.c
--- trunk/reactos/lib/ntdll/rtl/libsupp.c 2005-07-20 21:38:17 UTC
(rev 16672)
+++ trunk/reactos/lib/ntdll/rtl/libsupp.c 2005-07-20 23:35:59 UTC
(rev 16673)
@@ -23,53 +23,29 @@
PVOID
-STDCALL
-ExAllocatePool(
- IN POOL_TYPE PoolType,
- IN SIZE_T Bytes
-)
+RtlpAllocateMemory(UINT Bytes,
+ ULONG Tag)
{
- return RtlAllocateHeap (
- RtlGetProcessHeap (),
- 0,
- Bytes);
+ UNREFERENCED_PARAMETER(Tag);
+
+ return RtlAllocateHeap(RtlGetProcessHeap(),
+ 0,
+ Bytes);
}
-PVOID
-STDCALL
-ExAllocatePoolWithTag(
- IN POOL_TYPE PoolType,
- IN SIZE_T Bytes,
- IN ULONG Tag
-)
-{
- return RtlAllocateHeap (
- RtlGetProcessHeap (),
- 0,
- Bytes);
-}
VOID
-STDCALL
-ExFreePool(IN PVOID Mem)
+RtlpFreeMemory(PVOID Mem,
+ ULONG Tag)
{
- RtlFreeHeap (
- RtlGetProcessHeap (),
- 0,
- Mem);
+ UNREFERENCED_PARAMETER(Tag);
+
+ RtlFreeHeap(RtlGetProcessHeap(),
+ 0,
+ Mem);
}
-VOID
-STDCALL
-ExFreePoolWithTag(IN PVOID Mem, IN ULONG Tag)
-{
- RtlFreeHeap (
- RtlGetProcessHeap (),
- 0,
- Mem);
-}
-
#ifdef DBG
VOID FASTCALL
CHECK_PAGED_CODE_RTL(char *file, int line)
_____
Deleted: trunk/reactos/lib/rtl/libsupp.h
--- trunk/reactos/lib/rtl/libsupp.h 2005-07-20 21:38:17 UTC (rev
16672)
+++ trunk/reactos/lib/rtl/libsupp.h 2005-07-20 23:35:59 UTC (rev
16673)
@@ -1,31 +0,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS System Libraries
- * FILE: lib/rtl/libsupp.h
- * PURPOSE: Run-Time Library Kernel Support Header
- * PROGRAMMER: Alex Ionescu
- */
-
-/* INCLUDES
******************************************************************/
-
-#define TAG_RTL TAG('R','t', 'l', ' ')
-
-PVOID
-STDCALL
-ExAllocatePoolWithTag(
- IN POOL_TYPE PoolType,
- IN SIZE_T NumberOfBytes,
- IN ULONG Tag
-);
-
-VOID
-STDCALL
-ExFreePoolWithTag(
- IN PVOID Pool,
- IN ULONG Tag
-);
-
-#define ExAllocatePool(p,n) ExAllocatePoolWithTag(p,n, TAG_RTL)
-#define ExFreePool(P) ExFreePoolWithTag(P, TAG_RTL)
-
-/* EOF */
_____
Modified: trunk/reactos/lib/rtl/registry.c
--- trunk/reactos/lib/rtl/registry.c 2005-07-20 21:38:17 UTC (rev
16672)
+++ trunk/reactos/lib/rtl/registry.c 2005-07-20 23:35:59 UTC (rev
16673)
@@ -23,7 +23,9 @@
#define NDEBUG
#include <debug.h>
+#define TAG_RTLREGISTRY TAG('R', 't', 'l', 'R')
+
/* FUNCTIONS
***************************************************************/
static NTSTATUS
@@ -305,11 +307,10 @@
KeyPath->Length = 0;
KeyPath->MaximumLength = Length;
- KeyPath->Buffer = ExAllocatePool (PagedPool,
- KeyPath->MaximumLength);
+ KeyPath->Buffer = RtlpAllocateStringMemory(KeyPath->MaximumLength,
TAG_USTR);
if (KeyPath->Buffer == NULL)
{
- DPRINT1 ("ExAllocatePool() failed\n");
+ DPRINT1 ("RtlpAllocateMemory() failed\n");
RtlFreeUnicodeString (&SidString);
return STATUS_NO_TOKEN;
}
@@ -450,7 +451,7 @@
QueryEntry->Name);
BufferSize = sizeof (KEY_VALUE_PARTIAL_INFORMATION) + 4096;
- ValueInfo = ExAllocatePool(PagedPool, BufferSize);
+ ValueInfo = RtlpAllocateMemory(BufferSize, TAG_RTLREGISTRY);
if (ValueInfo == NULL)
{
Status = STATUS_NO_MEMORY;
@@ -467,7 +468,7 @@
{
if (QueryEntry->Flags & RTL_QUERY_REGISTRY_REQUIRED)
{
- ExFreePool(ValueInfo);
+ RtlpFreeMemory(ValueInfo, TAG_RTLREGISTRY);
Status = STATUS_OBJECT_NAME_NOT_FOUND;
break;
}
@@ -483,7 +484,7 @@
{
ValueString->Length = SourceString->Length;
ValueString->MaximumLength =
SourceString->MaximumLength;
- ValueString->Buffer = ExAllocatePool(PagedPool,
BufferSize);
+ ValueString->Buffer =
RtlpAllocateMemory(BufferSize, TAG_RTLREGISTRY);
if (!ValueString->Buffer)
break;
ValueString->Buffer[0] = 0;
@@ -521,7 +522,7 @@
if (ValueString->Buffer == NULL)
{
ValueString->MaximumLength =
ValueInfo->DataLength;
- ValueString->Buffer = ExAllocatePool(PagedPool,
ValueString->MaximumLength);
+ ValueString->Buffer =
RtlpAllocateMemory(ValueString->MaximumLength, TAG_RTLREGISTRY);
if (ValueString->Buffer == NULL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
@@ -544,7 +545,7 @@
ValueString =
(PUNICODE_STRING)QueryEntry->EntryContext;
- ExpandBuffer = ExAllocatePool(PagedPool,
ValueInfo->DataLength * 2);
+ ExpandBuffer =
RtlpAllocateMemory(ValueInfo->DataLength * 2, TAG_RTLREGISTRY);
if (ExpandBuffer == NULL)
{
Status = STATUS_NO_MEMORY;
@@ -567,7 +568,7 @@
{
ValueString->MaximumLength =
EnvExpandedValue.Length + sizeof(WCHAR);
ValueString->Length = EnvExpandedValue.Length;
- ValueString->Buffer = ExAllocatePool(PagedPool,
ValueString->MaximumLength);
+ ValueString->Buffer =
RtlpAllocateMemory(ValueString->MaximumLength, TAG_RTLREGISTRY);
if (ValueString->Buffer == NULL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
@@ -585,7 +586,7 @@
ValueString->Length);
((PWSTR)ValueString->Buffer)[ValueString->Length /
sizeof(WCHAR)] = 0;
- ExFreePool(ExpandBuffer);
+ RtlpFreeMemory(ExpandBuffer, TAG_RTLREGISTRY);
}
else
{
@@ -601,7 +602,7 @@
}
- ExFreePool(ValueInfo);
+ RtlpFreeMemory(ValueInfo, TAG_RTLREGISTRY);
}
else
{
@@ -612,7 +613,7 @@
QueryEntry->Name);
BufferSize = sizeof (KEY_VALUE_PARTIAL_INFORMATION) +
4096;
- ValueInfo = ExAllocatePool(PagedPool, BufferSize);
+ ValueInfo = RtlpAllocateMemory(BufferSize,
TAG_RTLREGISTRY);
if (ValueInfo == NULL)
{
Status = STATUS_NO_MEMORY;
@@ -661,7 +662,7 @@
{
DPRINT("Expand REG_EXPAND_SZ type\n");
- ExpandBuffer = ExAllocatePool(PagedPool,
ValueInfo->DataLength * 2);
+ ExpandBuffer =
RtlpAllocateMemory(ValueInfo->DataLength * 2, TAG_RTLREGISTRY);
if (ExpandBuffer == NULL)
{
Status = STATUS_NO_MEMORY;
@@ -688,7 +689,7 @@
Context,
QueryEntry->EntryContext);
- ExFreePool(ExpandBuffer);
+ RtlpFreeMemory(ExpandBuffer, TAG_RTLREGISTRY);
}
else
{
@@ -706,7 +707,7 @@
}
- ExFreePool(ValueInfo);
+ RtlpFreeMemory(ValueInfo, TAG_RTLREGISTRY);
if (!NT_SUCCESS(Status))
break;
}
@@ -727,14 +728,14 @@
DPRINT("Enumerate values\n");
BufferSize = sizeof(KEY_VALUE_FULL_INFORMATION) + 4096;
- FullValueInfo = ExAllocatePool(PagedPool, BufferSize);
+ FullValueInfo = RtlpAllocateMemory(BufferSize,
TAG_RTLREGISTRY);
if (FullValueInfo == NULL)
{
Status = STATUS_NO_MEMORY;
break;
}
ValueNameSize = 256 * sizeof(WCHAR);
- ValueName = ExAllocatePool(PagedPool, ValueNameSize);
+ ValueName = RtlpAllocateMemory(ValueNameSize,
TAG_RTLREGISTRY);
if (ValueName == NULL)
{
Status = STATUS_NO_MEMORY;
@@ -767,9 +768,9 @@
if (FullValueInfo->NameLength > ValueNameSize -
sizeof(WCHAR))
{
/* Should not happen, because the name length is
limited to 255 characters */
- ExFreePool(ValueName);
+ RtlpFreeMemory(ValueName, TAG_RTLREGISTRY);
ValueNameSize = FullValueInfo->NameLength +
sizeof(WCHAR);
- ValueName = ExAllocatePool(PagedPool,
ValueNameSize);
+ ValueName = RtlpAllocateMemory(ValueNameSize,
TAG_RTLREGISTRY);
if (ValueName == NULL)
{
Status = STATUS_NO_MEMORY;
@@ -808,7 +809,7 @@
DPRINT("Expand REG_EXPAND_SZ type\n");
StringPtr = (PWSTR)((ULONG_PTR)FullValueInfo +
FullValueInfo->DataOffset);
- ExpandBuffer = ExAllocatePool(PagedPool,
FullValueInfo->DataLength * 2);
+ ExpandBuffer =
RtlpAllocateMemory(FullValueInfo->DataLength * 2, TAG_RTLREGISTRY);
if (ExpandBuffer == NULL)
{
Status = STATUS_NO_MEMORY;
@@ -835,7 +836,7 @@
Context,
QueryEntry->EntryContext);
- ExFreePool(ExpandBuffer);
+ RtlpFreeMemory(ExpandBuffer, TAG_RTLREGISTRY);
}
else
{
@@ -855,8 +856,8 @@
Index++;
}
- ExFreePool(FullValueInfo);
- ExFreePool(ValueName);
+ RtlpFreeMemory(FullValueInfo, TAG_RTLREGISTRY);
+ RtlpFreeMemory(ValueName, TAG_RTLREGISTRY);
if (!NT_SUCCESS(Status))
break;
}
@@ -963,7 +964,7 @@
{
BufferLength = SubKeyName->MaximumLength +
sizeof(KEY_BASIC_INFORMATION);
- KeyInfo = ExAllocatePool(PagedPool, BufferLength);
+ KeyInfo = RtlpAllocateMemory(BufferLength, TAG_RTLREGISTRY);
if (KeyInfo == NULL)
return(STATUS_NO_MEMORY);
}
@@ -992,7 +993,7 @@
if (KeyInfo != NULL)
{
- ExFreePool(KeyInfo);
+ RtlpFreeMemory(KeyInfo, TAG_RTLREGISTRY);
}
return(Status);
@@ -1050,7 +1051,7 @@
if (DataLength != NULL)
BufferLength = *DataLength;
- ValueInfo = ExAllocatePool(PagedPool, BufferLength);
+ ValueInfo = RtlpAllocateMemory(BufferLength, TAG_RTLREGISTRY);
if (ValueInfo == NULL)
return(STATUS_NO_MEMORY);
@@ -1076,7 +1077,7 @@
}
}
- ExFreePool(ValueInfo);
+ RtlpFreeMemory(ValueInfo, TAG_RTLREGISTRY);
return(Status);
}
_____
Modified: trunk/reactos/lib/rtl/rtl.h
--- trunk/reactos/lib/rtl/rtl.h 2005-07-20 21:38:17 UTC (rev 16672)
+++ trunk/reactos/lib/rtl/rtl.h 2005-07-20 23:35:59 UTC (rev 16673)
@@ -16,9 +16,6 @@
/* Helper Header */
#include <reactos/helper.h>
-/* LIBSUPP Header */
-#include "libsupp.h"
-
/* FIXME: Move this somewhere else, maybe */
#ifdef DBG
extern VOID FASTCALL CHECK_PAGED_CODE_RTL(char *file, int line);
@@ -27,4 +24,14 @@
#define PAGED_CODE_RTL()
#endif
+extern PVOID RtlpAllocateMemory(UINT Bytes, ULONG Tag);
+extern VOID RtlpFreeMemory(PVOID Mem, ULONG Tag);
+
+#define RtlpAllocateStringMemory RtlpAllocateMemory
+#define RtlpFreeStringMemory RtlpFreeMemory
+
+#define TAG_USTR TAG('U', 'S', 'T', 'R')
+#define TAG_ASTR TAG('A', 'S', 'T', 'R')
+#define TAG_OSTR TAG('O', 'S', 'T', 'R')
+
/* EOF */
_____
Modified: trunk/reactos/lib/rtl/sid.c
--- trunk/reactos/lib/rtl/sid.c 2005-07-20 21:38:17 UTC (rev 16672)
+++ trunk/reactos/lib/rtl/sid.c 2005-07-20 23:35:59 UTC (rev 16673)
@@ -16,6 +16,8 @@
#define NDEBUG
#include <debug.h>
+#define TAG_SID TAG('p', 'S', 'i', 'd')
+
/* FUNCTIONS
***************************************************************/
BOOLEAN STDCALL
@@ -244,8 +246,8 @@
if (Sid == NULL)
return STATUS_INVALID_PARAMETER;
- pSid = (PSID)ExAllocatePool(PagedPool,
- sizeof(SID) + (SubAuthorityCount - 1) *
sizeof(ULONG));
+ pSid = RtlpAllocateMemory(sizeof(SID) + (SubAuthorityCount - 1) *
sizeof(ULONG),
+ TAG_SID);
if (pSid == NULL)
return STATUS_NO_MEMORY;
@@ -294,7 +296,7 @@
{
PAGED_CODE_RTL();
- ExFreePool(Sid);
+ RtlpFreeMemory(Sid, TAG_SID);
return NULL;
}
@@ -370,7 +372,8 @@
Length = (wcs - Buffer) * sizeof(WCHAR);
if (AllocateBuffer)
{
- String->Buffer = ExAllocatePool(PagedPool,Length +
sizeof(WCHAR));
+ String->Buffer = RtlpAllocateMemory(Length + sizeof(WCHAR),
+ TAG_SID);
if (String->Buffer == NULL)
return STATUS_NO_MEMORY;
String->MaximumLength = Length + sizeof(WCHAR);
_____
Modified: trunk/reactos/lib/rtl/unicode.c
--- trunk/reactos/lib/rtl/unicode.c 2005-07-20 21:38:17 UTC (rev
16672)
+++ trunk/reactos/lib/rtl/unicode.c 2005-07-20 23:35:59 UTC (rev
16673)
@@ -27,11 +27,6 @@
/* GLOBALS
*******************************************************************/
-#define TAG_USTR TAG('U', 'S', 'T', 'R')
-#define TAG_ASTR TAG('A', 'S', 'T', 'R')
-#define TAG_OSTR TAG('O', 'S', 'T', 'R')
-
-
extern BOOLEAN NlsMbCodePageTag;
extern BOOLEAN NlsMbOemCodePageTag;
@@ -386,14 +381,14 @@
STDCALL
RtlFreeAnsiString(IN PANSI_STRING AnsiString)
{
- if (AnsiString->Buffer == NULL)
- return;
+ if (AnsiString->Buffer != NULL)
+ {
+ RtlpFreeStringMemory(AnsiString->Buffer, TAG_ASTR);
- ExFreePoolWithTag(AnsiString->Buffer, TAG_ASTR);
-
- AnsiString->Buffer = NULL;
- AnsiString->Length = 0;
- AnsiString->MaximumLength = 0;
+ AnsiString->Buffer = NULL;
+ AnsiString->Length = 0;
+ AnsiString->MaximumLength = 0;
+ }
}
@@ -404,14 +399,14 @@
STDCALL
RtlFreeOemString(IN POEM_STRING OemString)
{
- if (OemString->Buffer == NULL)
- return;
+ if (OemString->Buffer != NULL)
+ {
+ RtlpFreeStringMemory(OemString->Buffer, TAG_OSTR);
- ExFreePoolWithTag(OemString->Buffer, TAG_OSTR);
-
- OemString->Buffer = NULL;
- OemString->Length = 0;
- OemString->MaximumLength = 0;
+ OemString->Buffer = NULL;
+ OemString->Length = 0;
+ OemString->MaximumLength = 0;
+ }
}
@@ -422,14 +417,14 @@
STDCALL
RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString)
{
- if (UnicodeString->Buffer == NULL)
- return;
+ if (UnicodeString->Buffer != NULL)
+ {
+ RtlpFreeStringMemory(UnicodeString->Buffer, TAG_USTR);
- ExFreePoolWithTag(UnicodeString->Buffer, TAG_USTR);
-
- UnicodeString->Buffer = NULL;
- UnicodeString->Length = 0;
- UnicodeString->MaximumLength = 0;
+ UnicodeString->Buffer = NULL;
+ UnicodeString->Length = 0;
+ UnicodeString->MaximumLength = 0;
+ }
}
/*
@@ -696,17 +691,17 @@
Base,
sizeof(Buffer),
Buffer);
- if (!NT_SUCCESS(Status))
- return Status;
+ if (NT_SUCCESS(Status))
+ {
+ AnsiString.Buffer = Buffer;
+ AnsiString.Length = strlen (Buffer);
+ AnsiString.MaximumLength = sizeof(Buffer);
- AnsiString.Buffer = Buffer;
- AnsiString.Length = strlen (Buffer);
- AnsiString.MaximumLength = sizeof(Buffer);
+ Status = RtlAnsiStringToUnicodeString (String,
+ &AnsiString,
+ FALSE);
+ }
- Status = RtlAnsiStringToUnicodeString (String,
- &AnsiString,
- FALSE);
-
return Status;
}
@@ -733,17 +728,17 @@
Base,
sizeof(Buffer),
Buffer);
- if (!NT_SUCCESS(Status))
- return Status;
+ if (NT_SUCCESS(Status))
+ {
+ AnsiString.Buffer = Buffer;
+ AnsiString.Length = strlen (Buffer);
+ AnsiString.MaximumLength = sizeof(Buffer);
- AnsiString.Buffer = Buffer;
- AnsiString.Length = strlen (Buffer);
- AnsiString.MaximumLength = sizeof(Buffer);
+ Status = RtlAnsiStringToUnicodeString (String,
+ &AnsiString,
+ FALSE);
+ }
- Status = RtlAnsiStringToUnicodeString (String,
- &AnsiString,
- FALSE);
-
return Status;
}
@@ -972,22 +967,22 @@
}
/*
- * private
+ * @implemented
*
+
* NOTES
* This function always writes a terminating '\0'.
* It performs a partial copy if ansi is too small.
*/
NTSTATUS
-FASTCALL
-RtlpUnicodeStringToAnsiString(
+STDCALL
+RtlUnicodeStringToAnsiString(
IN OUT PANSI_STRING AnsiDest,
IN PUNICODE_STRING UniSource,
- IN BOOLEAN AllocateDestinationString,
- IN POOL_TYPE PoolType)
+ IN BOOLEAN AllocateDestinationString)
{
NTSTATUS Status = STATUS_SUCCESS;
- ULONG Length; //including nullterm
+ ULONG Length; /* including nullterm */
if (NlsMbCodePageTag == TRUE)
{
@@ -1000,7 +995,7 @@
if (AllocateDestinationString)
{
- AnsiDest->Buffer = ExAllocatePoolWithTag(PoolType, Length,
TAG_ASTR);
+ AnsiDest->Buffer = RtlpAllocateStringMemory(Length, TAG_ASTR);
if (AnsiDest->Buffer == NULL)
return STATUS_NO_MEMORY;
@@ -1012,7 +1007,7 @@
}
else if (Length > AnsiDest->MaximumLength)
{
- //make room for nullterm
+ /* make room for nullterm */
AnsiDest->Length = AnsiDest->MaximumLength - sizeof(CHAR);
}
@@ -1024,7 +1019,7 @@
if (!NT_SUCCESS(Status) && AllocateDestinationString)
{
- ExFreePoolWithTag(AnsiDest->Buffer, TAG_ASTR);
+ RtlpFreeStringMemory(AnsiDest->Buffer, TAG_ASTR);
return Status;
}
@@ -1032,44 +1027,23 @@
return Status;
}
+
/*
* @implemented
*
-
* NOTES
- * See RtlpUnicodeStringToAnsiString
- */
-NTSTATUS
-STDCALL
-RtlUnicodeStringToAnsiString(
- IN OUT PANSI_STRING AnsiDest,
- IN PUNICODE_STRING UniSource,
- IN BOOLEAN AllocateDestinationString)
-{
- return RtlpUnicodeStringToAnsiString(
- AnsiDest,
- UniSource,
- AllocateDestinationString,
- PagedPool);
-}
-
-/*
- * private
- *
- * NOTES
* This function always writes a terminating '\0'.
* Does NOT perform a partial copy if unicode is too small!
*/
NTSTATUS
-FASTCALL
-RtlpOemStringToUnicodeString(
+STDCALL
+RtlOemStringToUnicodeString(
IN OUT PUNICODE_STRING UniDest,
IN POEM_STRING OemSource,
- IN BOOLEAN AllocateDestinationString,
- IN POOL_TYPE PoolType)
+ IN BOOLEAN AllocateDestinationString)
{
NTSTATUS Status;
- ULONG Length; //including nullterm
+ ULONG Length; /* including nullterm */
if (NlsMbOemCodePageTag == TRUE)
Length = RtlOemStringToUnicodeSize(OemSource);
@@ -1083,7 +1057,7 @@
if (AllocateDestinationString)
{
- UniDest->Buffer = ExAllocatePoolWithTag(PoolType, Length,
TAG_USTR);
+ UniDest->Buffer = RtlpAllocateStringMemory(Length, TAG_USTR);
if (UniDest->Buffer == NULL)
return STATUS_NO_MEMORY;
@@ -1095,7 +1069,7 @@
return STATUS_BUFFER_TOO_SMALL;
}
- //FIXME: Do we need this????? -Gunnar
+ /* FIXME: Do we need this????? -Gunnar */
RtlZeroMemory (UniDest->Buffer,
UniDest->Length);
@@ -1107,7 +1081,7 @@
if (!NT_SUCCESS(Status) && AllocateDestinationString)
{
- ExFreePoolWithTag(UniDest->Buffer, TAG_USTR);
+ RtlpFreeStringMemory(UniDest->Buffer, TAG_USTR);
return Status;
}
@@ -1120,35 +1094,14 @@
* @implemented
*
* NOTES
- * See RtlpOemStringToUnicodeString
- */
-NTSTATUS
-STDCALL
-RtlOemStringToUnicodeString(
- IN OUT PUNICODE_STRING UniDest,
- IN POEM_STRING OemSource,
- IN BOOLEAN AllocateDestinationString)
-{
- return RtlpOemStringToUnicodeString(
- UniDest,
- OemSource,
- AllocateDestinationString,
- PagedPool);
-}
-
-/*
- * private
- *
- * NOTES
* This function always '\0' terminates the string returned.
*/
NTSTATUS
-FASTCALL
-RtlpUnicodeStringToOemString(
+STDCALL
+RtlUnicodeStringToOemString(
IN OUT POEM_STRING OemDest,
IN PUNICODE_STRING UniSource,
- IN BOOLEAN AllocateDestinationString,
- IN POOL_TYPE PoolType)
+ IN BOOLEAN AllocateDestinationString)
{
NTSTATUS Status = STATUS_SUCCESS;
ULONG Length; //including nullterm
@@ -1165,7 +1118,7 @@
if (AllocateDestinationString)
{
- OemDest->Buffer = ExAllocatePoolWithTag(PoolType, Length,
TAG_OSTR);
+ OemDest->Buffer = RtlpAllocateStringMemory(Length, TAG_OSTR);
if (OemDest->Buffer == NULL)
return STATUS_NO_MEMORY;
@@ -1189,7 +1142,7 @@
if (!NT_SUCCESS(Status) && AllocateDestinationString)
{
- ExFreePoolWithTag(OemDest->Buffer, TAG_OSTR);
+ RtlpFreeStringMemory(OemDest->Buffer, TAG_OSTR);
return Status;
}
@@ -1197,26 +1150,6 @@
return Status;
}
-/*
- * @implemented
- *
- * NOTES
- * See RtlpUnicodeStringToOemString.
- */
-NTSTATUS
-STDCALL
-RtlUnicodeStringToOemString(
- IN OUT POEM_STRING OemDest,
- IN PUNICODE_STRING UniSource,
- IN BOOLEAN AllocateDestinationString)
-{
- return RtlpUnicodeStringToOemString(
- OemDest,
- UniSource,
- AllocateDestinationString,
- PagedPool);
-}
-
#define ITU_IMPLEMENTED_TESTS
(IS_TEXT_UNICODE_ODD_LENGTH|IS_TEXT_UNICODE_SIGNATURE)
@@ -1278,23 +1211,23 @@
return Length;
}
+
/*
- * private
+ * @implemented
*
* NOTES
* Same as RtlOemStringToUnicodeString but doesn't write terminating
null
* A partial copy is NOT performed if the dest buffer is too small!
*/
NTSTATUS
-FASTCALL
-RtlpOemStringToCountedUnicodeString(
+STDCALL
+RtlOemStringToCountedUnicodeString(
IN OUT PUNICODE_STRING UniDest,
IN POEM_STRING OemSource,
- IN BOOLEAN AllocateDestinationString,
- IN POOL_TYPE PoolType)
+ IN BOOLEAN AllocateDestinationString)
{
NTSTATUS Status;
- ULONG Length; //excluding nullterm
+ ULONG Length; /* excluding nullterm */
if (NlsMbCodePageTag == TRUE)
Length = RtlOemStringToUnicodeSize(OemSource) - sizeof(WCHAR);
@@ -1306,7 +1239,7 @@
if (AllocateDestinationString == TRUE)
{
- UniDest->Buffer = ExAllocatePoolWithTag (PoolType, Length,
TAG_USTR);
+ UniDest->Buffer = RtlpAllocateStringMemory (Length, TAG_USTR);
if (UniDest->Buffer == NULL)
return STATUS_NO_MEMORY;
@@ -1327,7 +1260,7 @@
if (!NT_SUCCESS(Status) && AllocateDestinationString)
{
- ExFreePoolWithTag(UniDest->Buffer, TAG_USTR);
+ RtlpFreeStringMemory(UniDest->Buffer, TAG_USTR);
return Status;
}
@@ -1337,26 +1270,6 @@
/*
* @implemented
*
- * NOTES
- * See RtlpOemStringToCountedUnicodeString
- */
-NTSTATUS
-STDCALL
-RtlOemStringToCountedUnicodeString(
- IN OUT PUNICODE_STRING UniDest,
- IN POEM_STRING OemSource,
- IN BOOLEAN AllocateDestinationString)
-{
- return RtlpOemStringToCountedUnicodeString(
- UniDest,
- OemSource,
- AllocateDestinationString,
- PagedPool);
-}
-
-/*
- * @implemented
- *
* RETURNS
* TRUE if the names are equal, FALSE if not
*
@@ -1577,17 +1490,14 @@
RtlEraseUnicodeString(
IN PUNICODE_STRING String)
{
- if (String->Buffer == NULL)
- return;
+ if (String->Buffer != NULL &&
+ String->MaximumLength != 0)
+ {
+ RtlZeroMemory (String->Buffer,
+ String->MaximumLength);
- if (String->MaximumLength == 0)
- return;
-
- memset (String->Buffer,
- 0,
- String->MaximumLength);
-
- String->Length = 0;
+ String->Length = 0;
+ }
}
/*
@@ -1643,19 +1553,18 @@
}
/*
- * private
+ * @implemented
*
* NOTES
* Same as RtlUnicodeStringToOemString but doesn't write terminating
null
* Does a partial copy if the dest buffer is too small
*/
NTSTATUS
-FASTCALL
-RtlpUnicodeStringToCountedOemString(
+STDCALL
+RtlUnicodeStringToCountedOemString(
IN OUT POEM_STRING OemDest,
IN PUNICODE_STRING UniSource,
- IN BOOLEAN AllocateDestinationString,
- IN POOL_TYPE PoolType)
+ IN BOOLEAN AllocateDestinationString)
{
NTSTATUS Status;
ULONG Length; //excluding nullterm
@@ -1672,7 +1581,7 @@
if (AllocateDestinationString)
{
- OemDest->Buffer = ExAllocatePoolWithTag(PoolType, Length,
TAG_OSTR);
+ OemDest->Buffer = RtlpAllocateStringMemory(Length, TAG_OSTR);
if (OemDest->Buffer == NULL)
return STATUS_NO_MEMORY;
@@ -1695,7 +1604,7 @@
if (!NT_SUCCESS(Status) && AllocateDestinationString)
{
- ExFreePoolWithTag(OemDest->Buffer, TAG_OSTR);
+ RtlpFreeStringMemory(OemDest->Buffer, TAG_OSTR);
}
return Status;
@@ -1703,29 +1612,9 @@
/*
* @implemented
- *
- * NOTES
- * See RtlpUnicodeStringToCountedOemString.
*/
NTSTATUS
STDCALL
-RtlUnicodeStringToCountedOemString(
- IN OUT POEM_STRING OemDest,
- IN PUNICODE_STRING UniSource,
- IN BOOLEAN AllocateDestinationString)
-{
- return RtlpUnicodeStringToCountedOemString(
- OemDest,
- UniSource,
- AllocateDestinationString,
- PagedPool);
-}
-
-/*
- * @implemented
- */
-NTSTATUS
-STDCALL
RtlLargeIntegerToChar(
IN PLARGE_INTEGER Value,
IN ULONG Base,
@@ -1771,19 +1660,18 @@
}
/*
- * private
+ * @implemented
*
* NOTES
* dest is never '\0' terminated because it may be equal to src, and
src
* might not be '\0' terminated. dest->Length is only set upon
success.
*/
NTSTATUS
-FASTCALL
-RtlpUpcaseUnicodeString(
+STDCALL
+RtlUpcaseUnicodeString(
IN OUT PUNICODE_STRING UniDest,
IN PCUNICODE_STRING UniSource,
- IN BOOLEAN AllocateDestinationString,
- IN POOL_TYPE PoolType)
+ IN BOOLEAN AllocateDestinationString)
{
ULONG i;
PWCHAR Src, Dest;
@@ -1791,7 +1679,7 @@
if (AllocateDestinationString == TRUE)
{
UniDest->MaximumLength = UniSource->Length;
- UniDest->Buffer = ExAllocatePoolWithTag(PoolType,
UniDest->MaximumLength, TAG_USTR);
+ UniDest->Buffer =
RtlpAllocateStringMemory(UniDest->MaximumLength, TAG_USTR);
if (UniDest->Buffer == NULL)
return STATUS_NO_MEMORY;
}
@@ -1818,40 +1706,18 @@
* @implemented
*
* NOTES
- * See RtlpUpcaseUnicodeString
- */
-NTSTATUS
-STDCALL
-RtlUpcaseUnicodeString(
- IN OUT PUNICODE_STRING UniDest,
- IN PCUNICODE_STRING UniSource,
- IN BOOLEAN AllocateDestinationString)
-{
-
- return RtlpUpcaseUnicodeString(
- UniDest,
- UniSource,
- AllocateDestinationString,
- PagedPool);
-}
-
-/*
- * private
- *
- * NOTES
* This function always writes a terminating '\0'.
* It performs a partial copy if ansi is too small.
*/
NTSTATUS
-FASTCALL
-RtlpUpcaseUnicodeStringToAnsiString(
+STDCALL
[truncated at 1000 lines; 556 more skipped]