* @implemented
*/
WCHAR
-STDCALL
+NTAPI
RtlAnsiCharToUnicodeChar(IN PUCHAR *AnsiChar)
{
ULONG Size;
NTSTATUS Status;
- WCHAR UnicodeChar = 0x20;
+ WCHAR UnicodeChar = L' ';
Size = (NlsLeadByteInfo[**AnsiChar] == 0) ? 1 : 2;
Status = RtlMultiByteToUnicodeN(&UnicodeChar,
sizeof(WCHAR),
NULL,
- *AnsiChar,
+ (PCHAR)*AnsiChar,
Size);
if (!NT_SUCCESS(Status))
{
- UnicodeChar = 0x20;
+ UnicodeChar = L' ';
}
*AnsiChar += Size;
* If the dest buffer is too small a partial copy is NOT performed!
*/
NTSTATUS
-STDCALL
+NTAPI
RtlAnsiStringToUnicodeString(
IN OUT PUNICODE_STRING UniDest,
IN PANSI_STRING AnsiSource,
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlAnsiStringToUnicodeSize(AnsiSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
UniDest->Length = (USHORT)Length - sizeof(WCHAR);
* The calculated size in bytes including nullterm.
*/
ULONG
-STDCALL
+NTAPI
RtlxAnsiStringToUnicodeSize(IN PCANSI_STRING AnsiString)
{
ULONG Size;
* Dest is never nullterminated.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlAppendStringToString(IN PSTRING Destination,
IN PSTRING Source)
{
* When dest fits exactly in MaximumLength characters the nullterm is ommitted.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlAppendUnicodeStringToString(
IN OUT PUNICODE_STRING Destination,
IN PCUNICODE_STRING Source)
* This function does not read garbage behind '\0' as the native version does.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlCharToInteger(
PCSZ str, /* [I] '\0' terminated single-byte string containing a number */
ULONG base, /* [I] Number base for conversion (allowed 0, 2, 8, 10 or 16) */
* @implemented
*/
LONG
-STDCALL
+NTAPI
RtlCompareString(
IN PSTRING s1,
IN PSTRING s2,
* TRUE if strings are equal.
*/
BOOLEAN
-STDCALL
+NTAPI
RtlEqualString(
IN PSTRING s1,
IN PSTRING s2,
* TRUE if strings are equal.
*/
BOOLEAN
-STDCALL
+NTAPI
RtlEqualUnicodeString(
IN CONST UNICODE_STRING *s1,
IN CONST UNICODE_STRING *s2,
* @implemented
*/
VOID
-STDCALL
+NTAPI
RtlFreeAnsiString(IN PANSI_STRING AnsiString)
{
+ PAGED_CODE_RTL();
+
if (AnsiString->Buffer)
{
RtlpFreeStringMemory(AnsiString->Buffer, TAG_ASTR);
* @implemented
*/
VOID
-STDCALL
+NTAPI
RtlFreeOemString(IN POEM_STRING OemString)
{
+ PAGED_CODE_RTL();
+
if (OemString->Buffer) RtlpFreeStringMemory(OemString->Buffer, TAG_OSTR);
}
* @implemented
*/
VOID
-STDCALL
+NTAPI
RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString)
{
+ PAGED_CODE_RTL();
+
if (UnicodeString->Buffer)
{
RtlpFreeStringMemory(UnicodeString->Buffer, TAG_ASTR);
* @unimplemented
*/
BOOLEAN
-STDCALL
+NTAPI
RtlIsValidOemCharacter(IN PWCHAR Char)
{
UNIMPLEMENTED;
* If source is NULL the length of source is assumed to be 0.
*/
VOID
-STDCALL
+NTAPI
RtlInitAnsiString(IN OUT PANSI_STRING DestinationString,
IN PCSZ SourceString)
{
* If source is NULL the length of source is assumed to be 0.
*/
VOID
-STDCALL
+NTAPI
RtlInitString(
IN OUT PSTRING DestinationString,
IN PCSZ SourceString)
* If source is NULL the length of source is assumed to be 0.
*/
VOID
-STDCALL
+NTAPI
RtlInitUnicodeString(IN OUT PUNICODE_STRING DestinationString,
IN PCWSTR SourceString)
{
* @implemented
*/
NTSTATUS
-STDCALL
+NTAPI
RtlInitUnicodeStringEx(OUT PUNICODE_STRING DestinationString,
IN PCWSTR SourceString)
{
if(SourceString)
{
DestSize = wcslen(SourceString) * sizeof(WCHAR);
- if (DestSize > 0xFFFC) return STATUS_NAME_TOO_LONG;
+ if (DestSize >= 0xFFFC) return STATUS_NAME_TOO_LONG;
DestinationString->Length = (USHORT)DestSize;
DestinationString->MaximumLength = (USHORT)DestSize + sizeof(WCHAR);
}
* When str fits exactly in length characters the nullterm is ommitted.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlIntegerToChar(
IN ULONG Value,
IN ULONG Base,
* @implemented
*/
NTSTATUS
-STDCALL
+NTAPI
RtlIntegerToUnicode(
IN ULONG Value,
IN ULONG Base OPTIONAL,
* @implemented
*/
NTSTATUS
-STDCALL
+NTAPI
RtlIntegerToUnicodeString(
IN ULONG Value,
IN ULONG Base OPTIONAL,
* @implemented
*/
NTSTATUS
-STDCALL
+NTAPI
RtlInt64ToUnicodeString (
IN ULONGLONG Value,
IN ULONG Base OPTIONAL,
* TRUE if String2 contains String1 as a prefix.
*/
BOOLEAN
-STDCALL
+NTAPI
RtlPrefixString(
PANSI_STRING String1,
PANSI_STRING String2,
* TRUE if String2 contains String1 as a prefix.
*/
BOOLEAN
-STDCALL
+NTAPI
RtlPrefixUnicodeString(
PCUNICODE_STRING String1,
PCUNICODE_STRING String2,
* version does.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlUnicodeStringToInteger(
PCUNICODE_STRING str, /* [I] Unicode string to be converted */
ULONG base, /* [I] Number base for conversion (allowed 0, 2, 8, 10 or 16) */
* Bytes necessary for the conversion including nullterm.
*/
ULONG
-STDCALL
+NTAPI
RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString)
{
ULONG Size;
* It performs a partial copy if ansi is too small.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlUnicodeStringToAnsiString(
IN OUT PANSI_STRING AnsiDest,
IN PCUNICODE_STRING UniSource,
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlUnicodeStringToAnsiSize(UniSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
* Does NOT perform a partial copy if unicode is too small!
*/
NTSTATUS
-STDCALL
+NTAPI
RtlOemStringToUnicodeString(
IN OUT PUNICODE_STRING UniDest,
IN PCOEM_STRING OemSource,
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlOemStringToUnicodeSize(OemSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
* This function always '\0' terminates the string returned.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlUnicodeStringToOemString(
IN OUT POEM_STRING OemDest,
IN PCUNICODE_STRING UniSource,
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlUnicodeStringToOemSize(UniSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
* RETURNS
* The length of the string if all tests were passed, 0 otherwise.
*/
-ULONG STDCALL
+ULONG NTAPI
RtlIsTextUnicode (PVOID Buffer,
ULONG Length,
ULONG *Flags)
* A partial copy is NOT performed if the dest buffer is too small!
*/
NTSTATUS
-STDCALL
+NTAPI
RtlOemStringToCountedUnicodeString(
IN OUT PUNICODE_STRING UniDest,
IN PCOEM_STRING OemSource,
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlOemStringToCountedUnicodeSize(OemSource);
if (!Length)
* The comparison is case insensitive.
*/
BOOLEAN
-STDCALL
+NTAPI
RtlEqualComputerName(
IN PUNICODE_STRING ComputerName1,
IN PUNICODE_STRING ComputerName2)
* The comparison is case insensitive.
*/
BOOLEAN
-STDCALL
+NTAPI
RtlEqualDomainName (
IN PUNICODE_STRING DomainName1,
IN PUNICODE_STRING DomainName2
* See RtlStringFromGUID.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlGUIDFromString(
IN UNICODE_STRING *str,
OUT GUID* guid
* @implemented
*/
VOID
-STDCALL
+NTAPI
RtlEraseUnicodeString(
IN PUNICODE_STRING String)
{
* @implemented
*/
NTSTATUS
-STDCALL
+NTAPI
RtlHashUnicodeString(
IN CONST UNICODE_STRING *String,
IN BOOLEAN CaseInSensitive,
* Does a partial copy if the dest buffer is too small
*/
NTSTATUS
-STDCALL
+NTAPI
RtlUnicodeStringToCountedOemString(
IN OUT POEM_STRING OemDest,
IN PUNICODE_STRING UniSource,
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlUnicodeStringToCountedOemSize(UniSource);
if (!Length)
* @implemented
*/
NTSTATUS
-STDCALL
+NTAPI
RtlLargeIntegerToChar(
IN PLARGE_INTEGER Value,
IN ULONG Base,
* might not be '\0' terminated. dest->Length is only set upon success.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlUpcaseUnicodeString(
IN OUT PUNICODE_STRING UniDest,
IN PCUNICODE_STRING UniSource,
{
ULONG i, j;
+ PAGED_CODE_RTL();
+
if (AllocateDestinationString == TRUE)
{
UniDest->MaximumLength = UniSource->Length;
* It performs a partial copy if ansi is too small.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlUpcaseUnicodeStringToAnsiString(
IN OUT PANSI_STRING AnsiDest,
IN PUNICODE_STRING UniSource,
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlUnicodeStringToAnsiSize(UniSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
* It performs a partial copy if ansi is too small.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlUpcaseUnicodeStringToCountedOemString(
IN OUT POEM_STRING OemDest,
IN PCUNICODE_STRING UniSource,
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlUnicodeStringToCountedOemSize(UniSource);
if (!Length)
* It performs a partial copy if oem is too small.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlUpcaseUnicodeStringToOemString (
IN OUT POEM_STRING OemDest,
IN PCUNICODE_STRING UniSource,
ULONG Length;
ULONG Index;
+ PAGED_CODE_RTL();
+
Length = RtlUnicodeStringToOemSize(UniSource);
if (Length > MAXUSHORT) return STATUS_INVALID_PARAMETER_2;
* Bytes calculated including nullterm
*/
ULONG
-STDCALL
+NTAPI
RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString)
{
ULONG Size;
* @implemented
*/
NTSTATUS
-STDCALL
+NTAPI
RtlStringFromGUID (IN REFGUID Guid,
OUT PUNICODE_STRING GuidString)
{
- STATIC CONST PWCHAR Hex = L"0123456789ABCDEF";
+ static CONST PWCHAR Hex = L"0123456789ABCDEF";
WCHAR Buffer[40];
PWCHAR BufferPtr;
ULONG i;
* Bytes calculated including nullterm
*/
ULONG
-STDCALL
+NTAPI
RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString)
{
ULONG Size;
* @implemented
*/
LONG
-STDCALL
+NTAPI
RtlCompareUnicodeString(
IN PCUNICODE_STRING s1,
IN PCUNICODE_STRING s2,
* @implemented
*/
VOID
-STDCALL
+NTAPI
RtlCopyString(
IN OUT PSTRING DestinationString,
IN PSTRING SourceString OPTIONAL)
* @implemented
*/
VOID
-STDCALL
+NTAPI
RtlCopyUnicodeString(
IN OUT PUNICODE_STRING DestinationString,
IN PCUNICODE_STRING SourceString)
* Creates a nullterminated UNICODE_STRING
*/
BOOLEAN
-STDCALL
+NTAPI
RtlCreateUnicodeString(
IN OUT PUNICODE_STRING UniDest,
IN PCWSTR Source)
{
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;
- RtlMoveMemory(UniDest->Buffer, Source, Length);
+ RtlCopyMemory(UniDest->Buffer, Source, Length);
UniDest->MaximumLength = (USHORT)Length;
UniDest->Length = Length - sizeof (WCHAR);
* @implemented
*/
BOOLEAN
-STDCALL
+NTAPI
RtlCreateUnicodeStringFromAsciiz(
OUT PUNICODE_STRING Destination,
IN PCSZ Source)
* Dest->Length is only set upon success.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlDowncaseUnicodeString(
IN OUT PUNICODE_STRING UniDest,
IN PCUNICODE_STRING UniSource,
ULONG i;
ULONG StopGap;
+ PAGED_CODE_RTL();
+
if (AllocateDestinationString)
{
UniDest->MaximumLength = UniSource->Length;
* When dest fits exactly in MaximumLength characters the '\0' is ommitted.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlAppendUnicodeToString(IN OUT PUNICODE_STRING Destination,
IN PCWSTR Source)
{
* dest is never '\0' terminated.
*/
NTSTATUS
-STDCALL
+NTAPI
RtlAppendAsciizToString(
IN OUT PSTRING Destination,
IN PCSZ Source)
* @implemented
*/
VOID
-STDCALL
+NTAPI
RtlUpperString(PSTRING DestinationString,
PSTRING SourceString)
{
* See RtlpDuplicateUnicodeString
*/
NTSTATUS
-STDCALL
+NTAPI
RtlDuplicateUnicodeString(
IN ULONG Flags,
IN PCUNICODE_STRING SourceString,
OUT PUNICODE_STRING DestinationString)
{
+ PAGED_CODE_RTL();
+
if (SourceString == NULL || DestinationString == NULL)
return STATUS_INVALID_PARAMETER;
/*
* @implemented
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
RtlValidateUnicodeString(IN ULONG Flags,
IN PUNICODE_STRING UnicodeString)
{