Major update to Rtl string functions.

svn path=/trunk/; revision=786
This commit is contained in:
Eric Kohl 1999-11-20 21:49:23 +00:00
parent 174adb3955
commit b09592bf32
16 changed files with 2399 additions and 1499 deletions

View file

@ -1,4 +1,4 @@
/* $Id: rtl.h,v 1.17 1999/11/15 15:55:00 ekohl Exp $
/* $Id: rtl.h,v 1.18 1999/11/20 21:44:09 ekohl Exp $
*
*/
@ -18,29 +18,29 @@ typedef struct _CONTROLLER_OBJECT
} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
typedef struct _STRING
{
USHORT Length;
USHORT MaximumLength;
PCHAR Buffer;
} STRING, *PSTRING;
typedef struct _ANSI_STRING
{
/*
* Length in bytes of the string stored in buffer
*/
USHORT Length;
/*
* Maximum length of the string
*/
USHORT MaximumLength;
/*
* String
*/
PCHAR Buffer;
} ANSI_STRING, *PANSI_STRING;
} STRING, *PSTRING;
typedef STRING ANSI_STRING;
typedef PSTRING PANSI_STRING;
typedef STRING OEM_STRING;
typedef PSTRING POEM_STRING;
typedef struct _TIME_FIELDS
{
@ -189,10 +189,18 @@ RemoveTailList (
PLIST_ENTRY ListHead
);
PVOID
STDCALL
RtlAllocateHeap (
HANDLE Heap,
ULONG Flags,
ULONG Size
);
WCHAR
STDCALL
RtlAnsiCharToUnicodeChar (
PCHAR AnsiChar
CHAR AnsiChar
);
ULONG
@ -330,8 +338,15 @@ RtlCreateSecurityDescriptor (
BOOLEAN
STDCALL
RtlCreateUnicodeString (
PUNICODE_STRING Destination,
PWSTR Source
OUT PUNICODE_STRING Destination,
IN PWSTR Source
);
BOOLEAN
STDCALL
RtlCreateUnicodeStringFromAsciiz (
OUT PUNICODE_STRING Destination,
IN PCSZ Source
);
NTSTATUS
@ -342,6 +357,14 @@ RtlDeleteRegistryValue (
PWSTR ValueName
);
NTSTATUS
STDCALL
RtlDowncaseUnicodeString (
IN OUT PUNICODE_STRING DestinationString,
IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString
);
LARGE_INTEGER
RtlEnlargedIntegerMultiply (
LONG Multiplicand,
@ -377,6 +400,13 @@ RtlEqualUnicodeString (
BOOLEAN CaseInSensitive
);
/* RtlEraseUnicodeString is exported by ntdll.dll only! */
VOID
STDCALL
RtlEraseUnicodeString (
IN PUNICODE_STRING String
);
LARGE_INTEGER
RtlExtendedIntegerMultiply (
LARGE_INTEGER Multiplicand,
@ -422,7 +452,7 @@ RtlFreeAnsiString (
VOID
STDCALL
RtlFreeOemString (
PSTRING OemString
POEM_STRING OemString
);
VOID
@ -459,73 +489,21 @@ RtlInitUnicodeString (
PCWSTR SourceString
);
NTSTATUS
STDCALL
RtlIntegerToChar (
IN ULONG Value,
IN ULONG Base,
IN ULONG Length,
IN OUT PCHAR String
);
NTSTATUS
STDCALL
RtlIntegerToUnicodeString (
ULONG Value,
ULONG Base,
PUNICODE_STRING String
);
LARGE_INTEGER
RtlLargeIntegerAdd (
LARGE_INTEGER Addend1,
LARGE_INTEGER Addend2
);
VOID
RtlLargeIntegerAnd (
PLARGE_INTEGER Result,
LARGE_INTEGER Source,
LARGE_INTEGER Mask
);
/* MISSING FUNCTIONS GO HERE */
LARGE_INTEGER
RtlEnlargedIntegerMultiply (
LONG Multiplicand,
LONG Multiplier
);
ULONG
RtlEnlargedUnsignedDivide (
ULARGE_INTEGER Dividend,
ULONG Divisor,
PULONG Remainder
);
LARGE_INTEGER
RtlEnlargedUnsignedMultiply (
ULONG Multiplicand,
ULONG Multipler
);
LARGE_INTEGER
RtlExtendedIntegerMultiply (
LARGE_INTEGER Multiplicand,
LONG Multiplier
);
LARGE_INTEGER
RtlExtendedLargeIntegerDivide (
LARGE_INTEGER Dividend,
ULONG Divisor,
PULONG Remainder
);
LARGE_INTEGER
RtlExtendedMagicDivide (
LARGE_INTEGER Dividend,
LARGE_INTEGER MagicDivisor,
CCHAR ShiftCount
);
LARGE_INTEGER
ExInterlockedAddLargeInteger (
PLARGE_INTEGER Addend,
LARGE_INTEGER Increment,
PKSPIN_LOCK Lock
IN ULONG Value,
IN ULONG Base,
IN OUT PUNICODE_STRING String
);
LARGE_INTEGER
@ -677,14 +655,14 @@ RtlMultiByteToUnicodeSize (
ULONG
STDCALL
RtlOemStringToUnicodeSize (
PANSI_STRING AnsiString
POEM_STRING AnsiString
);
NTSTATUS
STDCALL
RtlOemStringToUnicodeString (
PUNICODE_STRING DestinationString,
PANSI_STRING SourceString,
POEM_STRING SourceString,
BOOLEAN AllocateDestinationString
);
@ -772,8 +750,8 @@ RtlZeroMemory (
);
typedef struct {
ULONG Length;
ULONG Unknown[11];
ULONG Length;
ULONG Unknown[11];
} RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
// Heap creation routine
@ -789,14 +767,6 @@ RtlCreateHeap (
PRTL_HEAP_DEFINITION Definition
);
PVOID
STDCALL
RtlAllocateHeap (
HANDLE Heap,
ULONG Flags,
ULONG Size
);
BOOLEAN
STDCALL
@ -837,7 +807,7 @@ RtlUnicodeStringToOemSize (
NTSTATUS
STDCALL
RtlUnicodeStringToOemString (
IN OUT PANSI_STRING DestinationString,
IN OUT POEM_STRING DestinationString,
IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString
);
@ -870,12 +840,60 @@ RtlUnicodeToOemN (
ULONG UnicodeSize
);
WCHAR
STDCALL
RtlUpcaseUnicodeChar (
WCHAR Source
);
NTSTATUS
STDCALL
RtlUpcaseUnicodeString (
PUNICODE_STRING DestinationString,
PUNICODE_STRING SourceString,
BOOLEAN AllocateDestinationString
IN OUT PUNICODE_STRING DestinationString,
IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString
);
NTSTATUS
STDCALL
RtlUpcaseUnicodeStringToAnsiString (
IN OUT PANSI_STRING DestinationString,
IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString
);
NTSTATUS
STDCALL
RtlUpcaseUnicodeStringToOemString (
IN OUT POEM_STRING DestinationString,
IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString
);
NTSTATUS
STDCALL
RtlUpcaseUnicodeToMultiByteN (
PCHAR MbString,
ULONG MbSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
);
NTSTATUS
STDCALL
RtlUpcaseUnicodeToOemN (
PCHAR OemString,
ULONG OemSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
);
CHAR
STDCALL
RtlUpperChar (
CHAR Source
);
VOID

View file

@ -1,4 +1,4 @@
; $Id: ntdll.def,v 1.22 1999/11/15 15:57:55 ekohl Exp $
; $Id: ntdll.def,v 1.23 1999/11/20 21:46:16 ekohl Exp $
;
; ReactOS Operating System
;
@ -433,10 +433,14 @@ RtlAllocateHeap@12
RtlAnsiCharToUnicodeChar@4
RtlAnsiStringToUnicodeSize@4
RtlAnsiStringToUnicodeString@12
RtlAppendAsciizToString@12
RtlAppendStringToString@12
RtlAppendUnicodeStringToString@12
RtlAppendUnicodeToString@12
RtlCharToInteger@12
RtlCreateHeap@24
RtlCreateUnicodeString@8
RtlCreateUnicodeStringFromAsciiz@8
RtlCreateUserProcess@32
RtlCreateUserThread@40
RtlCompactHeap@8
@ -447,23 +451,27 @@ RtlConvertUlongToLargeInteger
RtlCopyString@8
RtlCopyUnicodeString@8
RtlDestroyHeap@4
RtlDowncaseUnicodeString@12
RtlEnlargedIntegerMultiply
RtlEnlargedUnsignedDivide
RtlEnlargedUnsignedMultiply
RtlEqualString@12
RtlEqualUnicodeString@12
RtlEraseUnicodeString@4
RtlExtendedIntegerMultiply
RtlExtendedLargeIntegerDivide
RtlExtendedMagicDivide
RtlFillMemory@12
RtlFreeAnsiString@4
RtlFreeHeap@12
RtlFreeOemString@4
RtlFreeUnicodeString@4
RtlGetProcessHeap@0
RtlInitAnsiString@8
RtlInitializeContext@20
RtlInitString@8
RtlInitUnicodeString@8
RtlIntegerToChar@16
RtlIntegerToUnicodeString@12
RtlLargeIntegerAdd
RtlLargeIntegerArithmeticShift
@ -477,19 +485,29 @@ RtlLockHeap@4
RtlMoveMemory@12
RtlMultiByteToUnicodeN@20
RtlNtStatusToDosError
RtlOemStringToUnicodeSize@4
RtlOemStringToUnicodeString@12
RtlOemToUnicodeN@20
RtlReAllocateHeap@16
RtlSizeHeap@12
RtlUnlockHeap@4
RtlUnicodeStringToAnsiSize@4
RtlUnicodeStringToAnsiString@12
RtlUnicodeStringToInteger@12
RtlUnicodeStringToOemSize@4
RtlUnicodeStringToOemString@12
RtlUnicodeToMultiByteN@20
RtlUnicodeToMultiByteSize@12
RtlUnicodeToOemN@20
RtlUnwind@0
RtlUpcaseString@8
RtlUpcaseUnicodeChar
RtlUpcaseUnicodeChar@4
RtlUpcaseUnicodeString@12
RtlUpcaseUnicodeToMultiByteN@0
RtlUpcaseUnicodeStringToAnsiString@12
RtlUpcaseUnicodeStringToOemString@12
RtlUpcaseUnicodeToMultiByteN@20
RtlUpcaseUnicodeToOemN@20
RtlUpperChar@4
RtlUpperString@8
RtlValidateHeap@12
RtlZeroMemory@8
_memccpy

View file

@ -1,4 +1,4 @@
; $Id: ntdll.edf,v 1.11 1999/11/15 15:57:55 ekohl Exp $
; $Id: ntdll.edf,v 1.12 1999/11/20 21:46:16 ekohl Exp $
;
; ReactOS Operating System
;
@ -437,6 +437,8 @@ RtlAppendUnicodeStringToString=RtlAppendUnicodeStringToString@8
RtlAppendUnicodeToString=RtlAppendUnicodeToString@8
RtlCharToInteger=RtlCharToInteger@12
RtlCreateHeap=RtlCreateHeap@24
RtlCreateUnicodeString=RtlCreateUnicodeString@8
RtlCreateUnicodeStringFromAsciiz=RtlCreateUnicodeStringFromAsciiz@8
RtlCreateUserProcess=RtlCreateUserProcess@32
RtlCreateUserThread=RtlCreateUserThread@40
RtlCompactHeap=RtlCompactHeap@8
@ -447,11 +449,13 @@ RtlConvertUlongToLargeInteger
RtlCopyString=RtlCopyString@8
RtlCopyUnicodeString=RtlCopyUnicodeString@8
RtlDestroyHeap=RtlDestroyHeap@4
RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12
RtlEnlargedIntegerMultiply
RtlEnlargedUnsignedDivide
RtlEnlargedUnsignedMultiply
RtlEqualString=RtlEqualString@12
RtlEqualUnicodeString=RtlEqualUnicodeString@12
RtlEraseUnicodeString=RtlEraseUnicodeString@4
RtlExtendedIntegerMultiply
RtlExtendedLargeIntegerDivide
RtlExtendedMagicDivide
@ -464,6 +468,7 @@ RtlInitAnsiString=RtlInitAnsiString@8
RtlInitializeContext=RtlInitializeContext@20
RtlInitString=RtlInitString@8
RtlInitUnicodeString=RtlInitUnicodeString@8
RtlIntegerToChar=RtlIntegerToChar@16
RtlIntegerToUnicodeString=RtlIntegerToUnicodeString@12
RtlLargeIntegerAdd
RtlLargeIntegerArithmeticShift
@ -486,10 +491,14 @@ RtlUnicodeStringToInteger=RtlUnicodeStringToInteger@12
RtlUnicodeToMultiByteN=RtlUnicodeToMultiByteN@20
RtlUnicodeToMultiByteSize=RtlUnicodeToMultiByteSize@12
RtlUnwind=RtlUnwind@0
RtlUpcaseString=RtlUpcaseString@8
RtlUpcaseUnicodeChar=RtlUpcaseUnicodeChar@0
RtlUpcaseUnicodeChar=RtlUpcaseUnicodeChar@4
RtlUpcaseUnicodeString=RtlUpcaseUnicodeString@12
RtlUpcaseUnicodeToMultiByteN=RtlUpcaseUnicodeToMultiByteN@0
RtlUpcaseUnicodeStringToAnsiString=RtlUpcaseUnicodeStringToAnsiString@12
RtlUpcaseUnicodeStringToOemString=RtlUpcaseUnicodeStringToOemString@12
RtlUpcaseUnicodeToMultiByteN=RtlUpcaseUnicodeToMultiByteN@20
RtlUpcaseUnicodeToOemN=RtlUpcaseUnicodeToOemN@20
RtlUpperChar=RtlUpperChar@4
RtlUpperString=RtlUpperString@8
RtlValidateHeap=RtlValidateHeap@12
RtlZeroMemory=RtlZeroMemory@8
_memccpy

View file

@ -1,8 +1,8 @@
/* $Id: nls.c,v 1.1 1999/11/15 15:59:29 ekohl Exp $
/* $Id: nls.c,v 1.2 1999/11/20 21:46:46 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/rtl/nls.c
* FILE: lib/ntdll/rtl/nls.c
* PURPOSE: National Language Support (NLS) functions
* UPDATE HISTORY:
* 20/08/99 Created by Emanuele Aliberti
@ -59,8 +59,8 @@ STDCALL
RtlGetDefaultCodePage (PUSHORT AnsiCodePage,
PUSHORT OemCodePage)
{
*AnsiCodePage = NlsAnsiCodePage;
*OemCodePage = NlsOemCodePage;
*AnsiCodePage = NlsAnsiCodePage;
*OemCodePage = NlsOemCodePage;
}
@ -72,39 +72,39 @@ RtlMultiByteToUnicodeN(PWCHAR UnicodeString,
PCHAR MbString,
ULONG MbSize)
{
ULONG Size = 0;
ULONG i;
ULONG Size = 0;
ULONG i;
if (NlsMbCodePageTag == FALSE)
{
/* single-byte code page */
if (MbSize > (UnicodeSize / sizeof(WCHAR)))
Size = UnicodeSize / sizeof(WCHAR);
else
Size = MbSize;
if (NlsMbCodePageTag == FALSE)
{
/* single-byte code page */
if (MbSize > (UnicodeSize / sizeof(WCHAR)))
Size = UnicodeSize / sizeof(WCHAR);
else
Size = MbSize;
if (ResultSize != NULL)
*ResultSize = Size * sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size * sizeof(WCHAR);
for (i = 0; i < Size; i++)
{
*UnicodeString = *MbString;
for (i = 0; i < Size; i++)
{
*UnicodeString = *MbString;
#if 0
*UnicodeString = AnsiToUnicodeTable[*MbString];
*UnicodeString = AnsiToUnicodeTable[*MbString];
#endif
UnicodeString++;
MbString++;
};
}
else
{
/* multi-byte code page */
/* FIXME */
UnicodeString++;
MbString++;
}
}
else
{
/* multi-byte code page */
/* FIXME */
}
}
return STATUS_SUCCESS;
return STATUS_SUCCESS;
}
@ -114,19 +114,63 @@ RtlMultiByteToUnicodeSize(PULONG UnicodeSize,
PCHAR MbString,
ULONG MbSize)
{
if (NlsMbCodePageTag == FALSE)
{
/* single-byte code page */
*UnicodeSize = MbSize * sizeof (WCHAR);
}
else
{
/* multi-byte code page */
/* FIXME */
if (NlsMbCodePageTag == FALSE)
{
/* single-byte code page */
*UnicodeSize = MbSize * sizeof (WCHAR);
}
else
{
/* multi-byte code page */
/* FIXME */
}
}
return STATUS_SUCCESS;
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
RtlOemToUnicodeN(PWCHAR UnicodeString,
ULONG UnicodeSize,
PULONG ResultSize,
PCHAR OemString,
ULONG OemSize)
{
ULONG Size = 0;
ULONG i;
if (NlsMbOemCodePageTag == FALSE)
{
/* single-byte code page */
if (OemSize > (UnicodeSize / sizeof(WCHAR)))
Size = UnicodeSize / sizeof(WCHAR);
else
Size = OemSize;
if (ResultSize != NULL)
*ResultSize = Size * sizeof(WCHAR);
for (i = 0; i < Size; i++)
{
*UnicodeString = *OemString;
#if 0
*UnicodeString = OemToUnicodeTable[*OemString];
#endif
UnicodeString++;
OemString++;
};
}
else
{
/* multi-byte code page */
/* FIXME */
}
return STATUS_SUCCESS;
}
@ -138,39 +182,39 @@ RtlUnicodeToMultiByteN(PCHAR MbString,
PWCHAR UnicodeString,
ULONG UnicodeSize)
{
ULONG Size = 0;
ULONG i;
ULONG Size = 0;
ULONG i;
if (NlsMbCodePageTag == FALSE)
{
/* single-byte code page */
if (UnicodeSize > (MbSize * sizeof(WCHAR)))
Size = MbSize;
else
Size = UnicodeSize / sizeof(WCHAR);
if (NlsMbCodePageTag == FALSE)
{
/* single-byte code page */
if (UnicodeSize > (MbSize * sizeof(WCHAR)))
Size = MbSize;
else
Size = UnicodeSize / sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size;
if (ResultSize != NULL)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{
*MbString = *UnicodeString;
for (i = 0; i < Size; i++)
{
*MbString = *UnicodeString;
#if 0
*MbString = UnicodeToAnsiTable[*UnicodeString];
*MbString = UnicodeToAnsiTable[*UnicodeString];
#endif
MbString++;
UnicodeString++;
};
}
else
{
/* multi-byte code page */
/* FIXME */
MbString++;
UnicodeString++;
}
}
else
{
/* multi-byte code page */
/* FIXME */
}
}
return STATUS_SUCCESS;
return STATUS_SUCCESS;
}
@ -180,19 +224,157 @@ RtlUnicodeToMultiByteSize(PULONG MbSize,
PWCHAR UnicodeString,
ULONG UnicodeSize)
{
if (NlsMbCodePageTag == FALSE)
{
/* single-byte code page */
*MbSize = UnicodeSize / sizeof (WCHAR);
}
else
{
/* multi-byte code page */
/* FIXME */
if (NlsMbCodePageTag == FALSE)
{
/* single-byte code page */
*MbSize = UnicodeSize / sizeof (WCHAR);
}
else
{
/* multi-byte code page */
/* FIXME */
}
}
return STATUS_SUCCESS;
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
RtlUnicodeToOemN(PCHAR OemString,
ULONG OemSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize)
{
ULONG Size = 0;
ULONG i;
if (NlsMbOemCodePageTag == FALSE)
{
/* single-byte code page */
if (UnicodeSize > (OemSize * sizeof(WCHAR)))
Size = OemSize;
else
Size = UnicodeSize / sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{
*OemString = *UnicodeString;
#if 0
*OemString = UnicodeToOemTable[*UnicodeString];
#endif
OemString++;
UnicodeString++;
};
}
else
{
/* multi-byte code page */
/* FIXME */
}
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
RtlUpcaseUnicodeToMultiByteN (
PCHAR MbString,
ULONG MbSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
)
{
ULONG Size = 0;
ULONG i;
if (NLS_MB_CODE_PAGE_TAG == FALSE)
{
/* single-byte code page */
if (UnicodeSize > (MbSize * sizeof(WCHAR)))
Size = MbSize;
else
Size = UnicodeSize / sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{
/* FIXME: Upcase!! */
*MbString = *UnicodeString;
#if 0
*MbString = UnicodeToAnsiTable[*UnicodeString];
#endif
MbString++;
UnicodeString++;
}
}
else
{
/* multi-byte code page */
/* FIXME */
}
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
RtlUpcaseUnicodeToOemN (
PCHAR OemString,
ULONG OemSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
)
{
ULONG Size = 0;
ULONG i;
if (NLS_MB_OEM_CODE_PAGE_TAG == FALSE)
{
/* single-byte code page */
if (UnicodeSize > (OemSize * sizeof(WCHAR)))
Size = OemSize;
else
Size = UnicodeSize / sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{
/* FIXME: Upcase !! */
*OemString = *UnicodeString;
#if 0
*OemString = UnicodeToOemTable[*UnicodeString];
#endif
OemString++;
UnicodeString++;
}
}
else
{
/* multi-byte code page */
/* FIXME */
}
return STATUS_SUCCESS;
}
/* EOF */

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/* $Id: rtl.c,v 1.2 1999/11/15 16:02:50 ekohl Exp $
/* $Id: rtl.c,v 1.3 1999/11/20 21:47:38 ekohl Exp $
*
* reactos/lib/psxdll/misc/rtl.c
*
@ -12,16 +12,28 @@
#include <ntos.h>
#include <wchar.h>
WCHAR
STDCALL
RtlAnsiCharToUnicodeChar (
PCHAR AnsiChar
CHAR AnsiChar
)
{
/* FIXME: it should probably call RtlMultiByteToUnicodeN
* with length==1.
*/
return (WCHAR) *AnsiChar;
ULONG Size;
WCHAR UnicodeChar;
Size = 1;
#if 0
Size = (NlsLeadByteInfo[AnsiChar] == 0) ? 1 : 2;
#endif
RtlMultiByteToUnicodeN (&UnicodeChar,
sizeof(WCHAR),
NULL,
&AnsiChar,
Size);
return UnicodeChar;
}
@ -59,41 +71,114 @@ RtlMoveMemory (
NTSTATUS
STDCALL
RtlMultiByteToUnicodeN (
PWCHAR UnicodeString,
ULONG UnicodeSize,
PULONG ResultSize,
PCHAR MbString,
ULONG MbSize
)
RtlMultiByteToUnicodeN(PWCHAR UnicodeString,
ULONG UnicodeSize,
PULONG ResultSize,
PCHAR MbString,
ULONG MbSize)
{
return STATUS_NOT_IMPLEMENTED;
ULONG Size = 0;
ULONG i;
if (NLS_MB_CODE_PAGE_TAG == FALSE)
{
/* single-byte code page */
if (MbSize > (UnicodeSize / sizeof(WCHAR)))
Size = UnicodeSize / sizeof(WCHAR);
else
Size = MbSize;
if (ResultSize != NULL)
*ResultSize = Size * sizeof(WCHAR);
for (i = 0; i < Size; i++)
{
*UnicodeString = *MbString;
#if 0
*UnicodeString = AnsiToUnicodeTable[*MbString];
#endif
UnicodeString++;
MbString++;
}
}
else
{
/* multi-byte code page */
/* FIXME */
}
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
RtlUnicodeToMultiByteN (
PCHAR MbString,
ULONG MbSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
PCHAR MbString,
ULONG MbSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
)
{
return STATUS_NOT_IMPLEMENTED;
ULONG Size = 0;
ULONG i;
if (NLS_MB_CODE_PAGE_TAG == FALSE)
{
/* single-byte code page */
if (UnicodeSize > (MbSize * sizeof(WCHAR)))
Size = MbSize;
else
Size = UnicodeSize / sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{
*MbString = *UnicodeString;
#if 0
*MbString = UnicodeToAnsiTable[*UnicodeString];
#endif
MbString++;
UnicodeString++;
}
}
else
{
/* multi-byte code page */
/* FIXME */
}
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
RtlUnicodeToMultiByteSize (
PULONG MbSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
PULONG MbSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
)
{
return STATUS_NOT_IMPLEMENTED;
if (NLS_MB_CODE_PAGE_TAG == FALSE)
{
/* single-byte code page */
*MbSize = UnicodeSize / sizeof (WCHAR);
}
else
{
/* multi-byte code page */
/* FIXME */
}
return STATUS_SUCCESS;
}
@ -106,26 +191,71 @@ RtlUnwind (
}
VOID
WCHAR
STDCALL
RtlUpcaseUnicodeChar (
VOID
WCHAR Source
)
{
if (Source < L'a')
return Source;
if (Source <= L'z')
return (Source - (L'a' - L'A'));
/* FIXME: characters above 'z' */
return Source;
}
VOID
NTSTATUS
STDCALL
RtlUpcaseUnicodeToMultiByteN (
VOID
PCHAR MbString,
ULONG MbSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
)
{
ULONG Size = 0;
ULONG i;
if (NLS_MB_CODE_PAGE_TAG == FALSE)
{
/* single-byte code page */
if (UnicodeSize > (MbSize * sizeof(WCHAR)))
Size = MbSize;
else
Size = UnicodeSize / sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{
/* FIXME: Upcase!! */
*MbString = *UnicodeString;
#if 0
*MbString = UnicodeToAnsiTable[*UnicodeString];
#endif
MbString++;
UnicodeString++;
}
}
else
{
/* multi-byte code page */
/* FIXME */
}
return STATUS_SUCCESS;
}
VOID
STDCALL
RtlZeroMemory (

View file

@ -1,4 +1,4 @@
; $Id: psxdll.def,v 1.5 1999/11/15 16:02:36 ekohl Exp $
; $Id: psxdll.def,v 1.6 1999/11/20 21:47:22 ekohl Exp $
;
; psxdll.def
;
@ -18,8 +18,8 @@ ntdll.RtlMultiByteToUnicodeN@20
ntdll.RtlUnicodeToMultiByteN@20
ntdll.RtlUnicodeToMultiByteSize@12
ntdll.RtlUnwind@0
ntdll.RtlUpcaseUnicodeChar@0
ntdll.RtlUpcaseUnicodeToMultiByteN@0
ntdll.RtlUpcaseUnicodeChar@4
ntdll.RtlUpcaseUnicodeToMultiByteN@20
ntdll.RtlZeroMemory@8
EXPORTS
@ -35,8 +35,8 @@ RtlMultiByteToUnicodeN@20
RtlUnicodeToMultiByteN@20
RtlUnicodeToMultiByteSize@12
RtlUnwind@0
RtlUpcaseUnicodeChar@0
RtlUpcaseUnicodeToMultiByteN@0
RtlUpcaseUnicodeChar@4
RtlUpcaseUnicodeToMultiByteN@20
RtlZeroMemory@8
__PdxGetCmdLine@0
__PdxInitializeData@8

View file

@ -1,4 +1,4 @@
; $Id: psxdll.edf,v 1.4 1999/11/15 16:02:36 ekohl Exp $
; $Id: psxdll.edf,v 1.5 1999/11/20 21:47:22 ekohl Exp $
;
; psxdll.edf
;
@ -18,8 +18,8 @@ ntdll.RtlMultiByteToUnicodeN@20
ntdll.RtlUnicodeToMultiByteN@20
ntdll.RtlUnicodeToMultiByteSize@12
ntdll.RtlUnwind@0
ntdll.RtlUpcaseUnicodeChar@0
ntdll.RtlUpcaseUnicodeToMultiByteN@0
ntdll.RtlUpcaseUnicodeChar@4
ntdll.RtlUpcaseUnicodeToMultiByteN@20
ntdll.RtlZeroMemory@8
EXPORTS
@ -35,8 +35,8 @@ RtlMultiByteToUnicodeN=RtlMultiByteToUnicodeN@20
RtlUnicodeToMultiByteN=RtlUnicodeToMultiByteN@20
RtlUnicodeToMultiByteSize=RtlUnicodeToMultiByteSize@12
RtlUnwind=RtlUnwind@0
RtlUpcaseUnicodeChar=RtlUpcaseUnicodeChar@0
RtlUpcaseUnicodeToMultiByteN=RtlUpcaseUnicodeToMultiByteN@0
RtlUpcaseUnicodeChar=RtlUpcaseUnicodeChar@4
RtlUpcaseUnicodeToMultiByteN=RtlUpcaseUnicodeToMultiByteN@20
RtlZeroMemory=RtlZeroMemory@8
__PdxGetCmdLine=__PdxGetCmdLine@0
__PdxInitializeData=__PdxInitializeData@8

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.25 1999/11/15 15:56:16 ekohl Exp $
; $Id: ntoskrnl.def,v 1.26 1999/11/20 21:44:34 ekohl Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -191,6 +191,7 @@ RtlCopyMemory
RtlCopyString@8
RtlCopyUnicodeString@8
RtlCreateUnicodeString@8
RtlDowncaseUnicodeString@12
RtlEnlargedIntegerMultiply
RtlEnlargedUnsignedDivide
RtlEnlargedUnsignedMultiply
@ -208,6 +209,7 @@ RtlGetDefaultCodePage@8
RtlInitAnsiString@8
RtlInitString@8
RtlInitUnicodeString@8
RtlIntegerToChar@16
RtlIntegerToUnicodeString@12
RtlLargeIntegerAdd
RtlLargeIntegerArithmeticShift
@ -236,8 +238,13 @@ RtlUnicodeStringToOemString@12
RtlUnicodeToMultiByteN@20
RtlUnicodeToMultiByteSize@12
RtlUnicodeToOemN@20
RtlUpcaseUnicodeChar@4
RtlUpcaseUnicodeString@12
RtlUpcaseString@8
RtlUpcaseUnicodeStringToAnsiString@12
RtlUpcaseUnicodeStringToOemString@12
RtlUpcaseUnicodeToMultiByteN@20
RtlUpcaseUnicodeToOemN@20
RtlUpperChar@4
RtlUpperString@8
RtlZeroMemory@8
ZwAccessCheckAndAuditAlarm@44

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.12 1999/11/15 15:56:16 ekohl Exp $
; $Id: ntoskrnl.edf,v 1.13 1999/11/20 21:44:34 ekohl Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -191,6 +191,7 @@ RtlCopyMemory
RtlCopyString=RtlCopyString@8
RtlCopyUnicodeString=RtlCopyUnicodeString@8
RtlCreateUnicodeString=RtlCreateUnicodeString@8
RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12
RtlEnlargedIntegerMultiply
RtlEnlargedUnsignedDivide
RtlEnlargedUnsignedMultiply
@ -208,6 +209,7 @@ RtlGetDefaultCodePage=RtlGetDefaultCodePage@8
RtlInitAnsiString=RtlInitAnsiString@8
RtlInitString=RtlInitString@8
RtlInitUnicodeString=RtlInitUnicodeString@8
RtlIntegerToChar=RtlIntegerToChar@16
RtlIntegerToUnicodeString=RtlIntegerToUnicodeString@12
RtlLargeIntegerAdd
RtlLargeIntegerArithmeticShift
@ -234,8 +236,13 @@ RtlUnicodeStringToOemSize=RtlUnicodeStringToOemSize@4
RtlUnicodeStringToOemString=RtlUnicodeStringToOemString@12
RtlUnicodeToMultiByteN=RtlUnicodeToMultiByteN@20
RtlUnicodeToMultiByteSize=RtlUnicodeToMultiByteSize@12
RtlUpcaseUnicodeChar=RtlUpcaseUnicodeChar@4
RtlUpcaseUnicodeString=RtlUpcaseUnicodeString@12
RtlUpcaseString=RtlUpcaseString@8
RtlUpcaseUnicodeStringToAnsiString=RtlUpcaseUnicodeStringToAnsiString@12
RtlUpcaseUnicodeStringToOemString=RtlUpcaseUnicodeStringToOemString@12
RtlUpcaseUnicodeToMultiByteN=RtlUpcaseUnicodeToMultiByteN@20
RtlUpcaseUnicodeToOemN=RtlUpcaseUnicodeToOemN@20
RtlUpperChar=RtlUpperChar@4
RtlUpperString=RtlUpperString@8
RtlZeroMemory=RtlZeroMemory@8
ZwAccessCheckAndAuditAlarm=ZwAccessCheckAndAuditAlarm@44

View file

@ -1,4 +1,4 @@
/* $Id: nls.c,v 1.1 1999/11/15 15:57:01 ekohl Exp $
/* $Id: nls.c,v 1.2 1999/11/20 21:45:20 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -56,8 +56,10 @@ CHAR UnicodeToOemTable [65536];
VOID
STDCALL
RtlGetDefaultCodePage (PUSHORT AnsiCodePage,
PUSHORT OemCodePage)
RtlGetDefaultCodePage (
PUSHORT AnsiCodePage,
PUSHORT OemCodePage
)
{
*AnsiCodePage = NlsAnsiCodePage;
*OemCodePage = NlsOemCodePage;
@ -66,11 +68,13 @@ RtlGetDefaultCodePage (PUSHORT AnsiCodePage,
NTSTATUS
STDCALL
RtlMultiByteToUnicodeN(PWCHAR UnicodeString,
ULONG UnicodeSize,
PULONG ResultSize,
PCHAR MbString,
ULONG MbSize)
RtlMultiByteToUnicodeN (
PWCHAR UnicodeString,
ULONG UnicodeSize,
PULONG ResultSize,
PCHAR MbString,
ULONG MbSize
)
{
ULONG Size = 0;
ULONG i;
@ -95,7 +99,7 @@ RtlMultiByteToUnicodeN(PWCHAR UnicodeString,
UnicodeString++;
MbString++;
};
}
}
else
{
@ -110,9 +114,11 @@ RtlMultiByteToUnicodeN(PWCHAR UnicodeString,
NTSTATUS
STDCALL
RtlMultiByteToUnicodeSize(PULONG UnicodeSize,
PCHAR MbString,
ULONG MbSize)
RtlMultiByteToUnicodeSize (
PULONG UnicodeSize,
PCHAR MbString,
ULONG MbSize
)
{
if (NlsMbCodePageTag == FALSE)
{
@ -161,7 +167,7 @@ RtlOemToUnicodeN(PWCHAR UnicodeString,
UnicodeString++;
OemString++;
};
}
}
else
{
@ -205,7 +211,7 @@ RtlUnicodeToMultiByteN(PCHAR MbString,
MbString++;
UnicodeString++;
};
}
}
else
{
@ -271,7 +277,101 @@ RtlUnicodeToOemN(PCHAR OemString,
OemString++;
UnicodeString++;
};
}
}
else
{
/* multi-byte code page */
/* FIXME */
}
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
RtlUpcaseUnicodeToMultiByteN (
PCHAR MbString,
ULONG MbSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
)
{
ULONG Size = 0;
ULONG i;
if (NlsMbCodePageTag == FALSE)
{
/* single-byte code page */
if (UnicodeSize > (MbSize * sizeof(WCHAR)))
Size = MbSize;
else
Size = UnicodeSize / sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{
/* FIXME: Upcase !! */
*MbString = *UnicodeString;
#if 0
*MbString = UnicodeToAnsiTable[*UnicodeString];
#endif
MbString++;
UnicodeString++;
}
}
else
{
/* multi-byte code page */
/* FIXME */
}
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
RtlUpcaseUnicodeToOemN (
PCHAR OemString,
ULONG OemSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
)
{
ULONG Size = 0;
ULONG i;
if (NlsMbOemCodePageTag == FALSE)
{
/* single-byte code page */
if (UnicodeSize > (OemSize * sizeof(WCHAR)))
Size = OemSize;
else
Size = UnicodeSize / sizeof(WCHAR);
if (ResultSize != NULL)
*ResultSize = Size;
for (i = 0; i < Size; i++)
{
/* FIXME: Upcase !! */
*OemString = *UnicodeString;
#if 0
*OemString = UnicodeToOemTable[*UnicodeString];
#endif
OemString++;
UnicodeString++;
}
}
else
{

File diff suppressed because it is too large Load diff

View file

@ -1,529 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/rtl/unicode.c
* PURPOSE: String functions
* PROGRAMMER: Jason Filby (jasonfilby@yahoo.com)
* UPDATE HISTORY:
* Created 10/08/98
* Fixed bugs 21/08/98
*/
#include <base.h>
#include <internal/string.h>
#include <ddk/ntddk.h>
#include <internal/ctype.h>
#include <internal/kernel.h>
#include <internal/debug.h>
#define Aa_Difference 'A'-'a';
VOID RtlUpperString(PSTRING DestinationString, PSTRING SourceString)
{
UNIMPLEMENTED;
}
WCHAR wtoupper(WCHAR c)
{
if((c>='a') && (c<='z')) return c+Aa_Difference;
return c;
};
unsigned long wstrlen(PWSTR s)
{
WCHAR c=' ';
unsigned int len=0;
while(c!=0) {
c=*s;
s++;
len++;
};
s-=len;
return len-1;
};
ULONG RtlAnsiStringToUnicodeSize(IN PANSI_STRING AnsiString)
{
return AnsiString->Length*2;
};
NTSTATUS RtlAnsiStringToUnicodeString(IN OUT PUNICODE_STRING DestinationString,
IN PANSI_STRING SourceString, IN BOOLEAN AllocateDestinationString)
{
unsigned long i;
if(AllocateDestinationString==TRUE) {
DestinationString->Buffer=ExAllocatePool(NonPagedPool, SourceString->Length*2+1);
DestinationString->MaximumLength=SourceString->Length;
};
DestinationString->Length=SourceString->Length;
memset(DestinationString->Buffer, 0, SourceString->Length*2);
for (i=0; i<SourceString->Length; i++)
{
*DestinationString->Buffer=*SourceString->Buffer;
SourceString->Buffer++;
DestinationString->Buffer++;
};
*DestinationString->Buffer=0;
SourceString->Buffer-=SourceString->Length;
DestinationString->Buffer-=SourceString->Length;
return STATUS_SUCCESS;
};
NTSTATUS RtlAppendUnicodeStringToString(IN OUT PUNICODE_STRING Destination,
IN PUNICODE_STRING Source)
{
unsigned long i;
if(Destination->MaximumLength-Destination->Length-Source->Length<0)
return STATUS_BUFFER_TOO_SMALL;
Destination->Buffer+=Destination->Length;
for(i=0; i<Source->Length; i++) {
*Destination->Buffer=*Source->Buffer;
Destination->Buffer++;
Source->Buffer++;
};
*Destination->Buffer=0;
Destination->Buffer-=(Destination->Length+Source->Length);
Source->Buffer-=Source->Length;
Destination->Length+=Source->Length;
return STATUS_SUCCESS;
};
NTSTATUS RtlAppendUnicodeToString(IN OUT PUNICODE_STRING Destination,
IN PWSTR Source)
{
unsigned long i, slen=wstrlen(Source);
if(Destination->MaximumLength-Destination->Length-slen<0)
return STATUS_BUFFER_TOO_SMALL;
Destination->Buffer+=Destination->Length;
for(i=0; i<slen; i++) {
*Destination->Buffer=*Source;
Destination->Buffer++;
Source++;
};
*Destination->Buffer=0;
Destination->Buffer-=(Destination->Length+slen);
Source-=slen;
Destination->Length+=slen;
return STATUS_SUCCESS;
};
NTSTATUS RtlCharToInteger(IN PCSZ String, IN ULONG Base, IN OUT PULONG Value)
{
*Value=simple_strtoul((const char *)String, NULL, Base);
};
LONG RtlCompareString(PSTRING String1, PSTRING String2, BOOLEAN CaseInsensitive)
{
unsigned long i;
char c1, c2;
if(String1->Length!=String2->Length) return String1->Length-String2->Length;
for(i=0; i<String1->Length; i++) {
if(CaseInsensitive==TRUE) {
c1=toupper(*String1->Buffer);
c2=toupper(*String2->Buffer);
} else {
c1=*String1->Buffer;
c2=*String2->Buffer;
};
if(c1!=c2) {
String1->Buffer-=i;
String2->Buffer-=i;
return c1-c2;
};
String1->Buffer++;
String2->Buffer++;
};
String1->Buffer-=i;
String2->Buffer-=i;
return 0;
};
LONG RtlCompareUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2,
BOOLEAN CaseInsensitive)
{
unsigned long i;
WCHAR wc1, wc2;
if(String1->Length!=String2->Length) return
String1->Length-String2->Length;
for(i=0; i<String1->Length; i++) {
if(CaseInsensitive==TRUE) {
wc1=wtoupper(*String1->Buffer);
wc2=wtoupper(*String2->Buffer);
} else {
wc1=*String1->Buffer;
wc2=*String2->Buffer;
};
if(wc1!=wc2) {
String1->Buffer-=i;
String2->Buffer-=i;
return wc1-wc2;
};
String1->Buffer++;
String2->Buffer++;
};
String1->Buffer-=i;
String2->Buffer-=i;
return 0;
};
VOID RtlCopyString(IN OUT PSTRING DestinationString, IN PSTRING SourceString)
{
unsigned long copylen, i;
if(SourceString==NULL) {
DestinationString->Length=0;
} else {
if(SourceString->Length<DestinationString->MaximumLength) {
copylen=SourceString->Length;
} else {
copylen=DestinationString->MaximumLength;
};
for(i=0; i<copylen; i++)
{
*DestinationString->Buffer=*SourceString->Buffer;
DestinationString->Buffer++;
SourceString->Buffer++;
};
*DestinationString->Buffer=0;
DestinationString->Buffer-=copylen;
SourceString->Buffer-=copylen;
};
};
VOID RtlCopyUnicodeString(IN OUT PUNICODE_STRING DestinationString,
IN PUNICODE_STRING SourceString)
{
unsigned long copylen, i;
if(SourceString==NULL) {
DestinationString->Length=0;
} else {
if(SourceString->Length<DestinationString->MaximumLength) {
copylen=SourceString->Length;
} else {
copylen=DestinationString->MaximumLength;
};
for(i=0; i<copylen; i++)
{
*DestinationString->Buffer=*SourceString->Buffer;
DestinationString->Buffer++;
SourceString->Buffer++;
};
*DestinationString->Buffer=0;
DestinationString->Buffer-=copylen;
SourceString->Buffer-=copylen;
};
};
BOOLEAN RtlEqualString(PSTRING String1, PSTRING String2, BOOLEAN CaseInsensitive)
{
unsigned long s1l=String1->Length;
unsigned long s2l=String2->Length;
unsigned long i;
char c1, c2;
if(s1l!=s2l) return FALSE;
for(i=0; i<s1l; i++) {
c1=*String1->Buffer;
c2=*String2->Buffer;
if(CaseInsensitive==TRUE) {
c1=toupper(c1);
c2=toupper(c2);
};
if(c1!=c2) {
String1->Buffer-=i;
String2->Buffer-=i;
return FALSE;
};
String1->Buffer++;
String2->Buffer++;
};
String1->Buffer-=i;
String2->Buffer-=i;
return TRUE;
};
BOOLEAN RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2,
BOOLEAN CaseInsensitive)
{
unsigned long s1l=String1->Length;
unsigned long s2l=String2->Length;
unsigned long i;
char wc1, wc2;
if(s1l!=s2l) return FALSE;
for(i=0; i<s1l; i++) {
if(CaseInsensitive==TRUE) {
wc1=wtoupper(*String1->Buffer);
wc2=wtoupper(*String2->Buffer);
} else {
wc1=*String1->Buffer;
wc2=*String2->Buffer;
};
if(wc1!=wc2) {
String1->Buffer-=i;
String2->Buffer-=i;
return FALSE;
};
String1->Buffer++;
String2->Buffer++;
};
String1->Buffer-=i;
String2->Buffer-=i;
return TRUE;
};
VOID RtlFreeAnsiString(IN PANSI_STRING AnsiString)
{
ExFreePool(AnsiString->Buffer);
};
VOID RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString)
{
ExFreePool(UnicodeString->Buffer);
};
VOID RtlInitAnsiString(IN OUT PANSI_STRING DestinationString,
IN PCSZ SourceString)
{
unsigned long DestSize;
if(SourceString==NULL) {
DestinationString->Length=0;
DestinationString->MaximumLength=0;
} else {
DestSize=strlen((const char *)SourceString);
DestinationString->Length=DestSize;
DestinationString->MaximumLength=DestSize+1;
};
DestinationString->Buffer=(PCHAR)SourceString;
};
VOID RtlInitString(IN OUT PSTRING DestinationString,
IN PCSZ SourceString)
{
DestinationString->Length=strlen((char *)SourceString);
DestinationString->MaximumLength=strlen((char *)SourceString)+1;
DestinationString->Buffer=SourceString;
};
VOID RtlInitUnicodeString(IN OUT PUNICODE_STRING DestinationString,
IN PCWSTR SourceString)
{
unsigned long i, DestSize;
UNICODE_STRING Dest=*DestinationString;
if(SourceString==NULL) {
DestinationString->Length=0;
DestinationString->MaximumLength=0;
DestinationString->Buffer=NULL;
} else {
DestSize=wstrlen((PWSTR)SourceString);
DestinationString->Length=DestSize;
DestinationString->MaximumLength=DestSize+1;
DestinationString->Buffer=(PWSTR)SourceString;
};
};
NTSTATUS RtlIntegerToUnicodeString(IN ULONG Value, IN ULONG Base, /* optional */
IN OUT PUNICODE_STRING String)
{
char *str;
unsigned long len, i;
str=ExAllocatePool(NonPagedPool, 1024);
if(Base==16) {
sprintf(str, "%x", Value);
} else
if(Base==8) {
sprintf(str, "%o", Value);
} else
if(Base==2) {
sprintf(str, "%b", Value);
} else {
sprintf(str, "%u", Value);
};
len=strlen(str);
if(String->MaximumLength<len) return STATUS_INVALID_PARAMETER;
for(i=0; i<len; i++) {
*String->Buffer=*str;
String->Buffer++;
str++;
};
*String->Buffer=0;
String->Buffer-=len;
String->Length=len;
str-=len;
ExFreePool(str);
return STATUS_SUCCESS;
};
NTSTATUS RtlUnicodeStringToAnsiString(IN OUT PANSI_STRING DestinationString,
IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString)
{
unsigned long i;
if(AllocateDestinationString==TRUE) {
// Causes excetion 14(0) in _Validate_Free_List
DestinationString->Buffer=ExAllocatePool(NonPagedPool, SourceString->Length+1);
DestinationString->MaximumLength=SourceString->Length+1;
};
DestinationString->Length=SourceString->Length;
for(i=0; i<SourceString->Length; i++) {
*DestinationString->Buffer=*SourceString->Buffer;
DestinationString->Buffer++;
SourceString->Buffer++;
};
*DestinationString->Buffer=0;
DestinationString->Buffer-=SourceString->Length;
SourceString->Buffer-=SourceString->Length;
return STATUS_SUCCESS;
};
NTSTATUS RtlUnicodeStringToInteger(IN PUNICODE_STRING String, IN ULONG Base,
OUT PULONG Value)
{
char *str;
unsigned long i, lenmin=0;
BOOLEAN addneg=FALSE;
str=ExAllocatePool(NonPagedPool, String->Length+1);
for(i=0; i<String->Length; i++) {
*str=*String->Buffer;
if(*str=='b') { Base=2; lenmin++; } else
if(*str=='o') { Base=8; lenmin++; } else
if(*str=='d') { Base=10; lenmin++; } else
if(*str=='x') { Base=16; lenmin++; } else
if(*str=='+') { lenmin++; } else
if(*str=='-') { addneg=TRUE; lenmin++; } else
if((*str>'1') && (Base==2)) {
String->Buffer-=i;
*Value=0;
return STATUS_INVALID_PARAMETER;
} else
if(((*str>'7') || (*str<'0')) && (Base==8)) {
String->Buffer-=i;
*Value=0;
return STATUS_INVALID_PARAMETER;
} else
if(((*str>'9') || (*str<'0')) && (Base==10)) {
String->Buffer-=i;
*Value=0;
return STATUS_INVALID_PARAMETER;
} else
if((((*str>'9') || (*str<'0')) ||
((toupper(*str)>'F') || (toupper(*str)<'A'))) && (Base==16))
{
String->Buffer-=i;
*Value=0;
return STATUS_INVALID_PARAMETER;
} else
str++;
String->Buffer++;
};
*str=0;
String->Buffer-=String->Length;
str-=(String->Length-lenmin);
if(addneg==TRUE) {
*Value=simple_strtoul(str, NULL, Base)*-1;
} else
*Value=simple_strtoul(str, NULL, Base);
ExFreePool(str);
};
NTSTATUS RtlUpcaseUnicodeString(IN OUT PUNICODE_STRING DestinationString,
IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString)
{
unsigned long i;
if(AllocateDestinationString==TRUE) {
DestinationString->Buffer=ExAllocatePool(NonPagedPool, SourceString->Length*2+1);
DestinationString->Length=SourceString->Length;
DestinationString->MaximumLength=SourceString->Length+1;
};
for(i=0; i<SourceString->Length; i++) {
*DestinationString->Buffer=wtoupper(*SourceString->Buffer);
DestinationString->Buffer++;
SourceString->Buffer++;
};
*DestinationString->Buffer=0;
DestinationString->Buffer-=SourceString->Length;
SourceString->Buffer-=SourceString->Length;
return STATUS_SUCCESS;
};
VOID RtlUpcaseString(IN OUT PSTRING DestinationString,
IN PSTRING SourceString)
{
unsigned long i, len;
if(SourceString->Length>DestinationString->MaximumLength) {
len=DestinationString->MaximumLength;
} else {
len=SourceString->Length;
};
for(i=0; i<len; i++) {
*DestinationString->Buffer=toupper(*SourceString->Buffer);
DestinationString->Buffer++;
SourceString->Buffer++;
};
*DestinationString->Buffer=0;
DestinationString->Buffer-=len;
SourceString->Buffer-=len;
};

View file

@ -1,4 +1,4 @@
/* $Id: brush.c,v 1.6 1999/11/17 20:54:05 rex Exp $
/* $Id: brush.c,v 1.7 1999/11/20 21:49:23 ekohl Exp $
*/
@ -7,7 +7,7 @@
#include <ddk/ntddk.h>
#include <win32k/bitmaps.h>
#include <win32k/brush.h>
#include <win32k/debug.h>
//#include <win32k/debug.h>
// #define NDEBUG
#include <internal/debug.h>

View file

@ -157,8 +157,8 @@ STUB(RtlRaiseException)
//STUB(RtlUnicodeToMultiByteN)
//STUB(RtlUnicodeToMultiByteSize)
STUB(RtlUnwind)
STUB(RtlUpcaseUnicodeChar)
STUB(RtlUpcaseUnicodeToMultiByteN)
//STUB(RtlUpcaseUnicodeChar)
//STUB(RtlUpcaseUnicodeToMultiByteN)
STUB(STROBJ_bEnum)
STUB(STROBJ_dwGetCodePage)
STUB(STROBJ_vEnumStart)

View file

@ -1,4 +1,4 @@
; $Id: win32k.def,v 1.6 1999/11/15 16:02:00 ekohl Exp $
; $Id: win32k.def,v 1.7 1999/11/20 21:47:58 ekohl Exp $
;
; win32k.def
;
@ -154,22 +154,22 @@ PATHOBJ_bPolyLineTo
PATHOBJ_vEnumStart
PATHOBJ_vEnumStartClipLines
PATHOBJ_vGetBounds
; RtlAnsiCharToUnicodeChar = NTOSKRNL.RtlAnsiCharToUnicodeChar
;RtlAnsiCharToUnicodeChar
;RtlAnsiCharToUnicodeChar = NTOSKRNL.RtlAnsiCharToUnicodeChar
;RtlAnsiCharToUnicodeChar@4
; RtlMultiByteToUnicodeN = NTOSKRNL.RtlMultiByteToUnicodeN
;RtlMultiByteToUnicodeN
;RtlMultiByteToUnicodeN@20
; RtlRaiseException = NTOSKRNL.RtlRaiseException
RtlRaiseException
;RtlRaiseException
; RtlUnicodeToMultiByteN = NTOSKRNL.RtlUnicodeToMultiByteN
;RtlUnicodeToMultiByteN
;RtlUnicodeToMultiByteN@20
; RtlUnicodeToMultiByteSize = NTOSKRNL.RtlUnicodeToMultiByteSize
;RtlUnicodeToMultiByteSize
;RtlUnicodeToMultiByteSize@12
; RtlUnwind = NTOSKRNL.RtlUnwind
RtlUnwind
; RtlUpcaseUnicodeChar = NTOSKRNL.RtlUpcaseUnicodeChar
RtlUpcaseUnicodeChar
;RtlUpcaseUnicodeChar@4
; RtlUpcaseUnicodeToMultiByteN = NTOSKRNL.RtlUpcaseUnicodeToMultiByteN
RtlUpcaseUnicodeToMultiByteN
;RtlUpcaseUnicodeToMultiByteN@20
STROBJ_bEnum
STROBJ_dwGetCodePage
STROBJ_vEnumStart