From e611b132f9b8abe35b362e5870b74bce94a1e58e Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 16 May 2020 20:51:50 -0700 Subject: initial commit --- private/ntos/rtl/mips/stringsp.c | 122 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 private/ntos/rtl/mips/stringsp.c (limited to 'private/ntos/rtl/mips/stringsp.c') diff --git a/private/ntos/rtl/mips/stringsp.c b/private/ntos/rtl/mips/stringsp.c new file mode 100644 index 000000000..3cf3f2d5f --- /dev/null +++ b/private/ntos/rtl/mips/stringsp.c @@ -0,0 +1,122 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + stingsup.c + +Abstract: + + This module defines CPU specific routines for manipulating NT strings. + +Author: + + Steve Wood (stevewo) 31-Mar-1989 + +Revision History: + + +--*/ + +#include "nt.h" +#include "ntrtl.h" + + +VOID +RtlInitAnsiString( + OUT PANSI_STRING DestinationString, + IN PSZ SourceString OPTIONAL + ) + +/*++ + +Routine Description: + + The RtlInitAnsiString function initializes an NT counted string. + The DestinationString is initialized to point to the SourceString + and the Length and MaximumLength fields of DestinationString are + initialized to the length of the SourceString, which is zero if + SourceString is not specified. + +Arguments: + + DestinationString - Pointer to the counted string to initialize + + SourceString - Optional pointer to a null terminated string that + the counted string is to point to. + + +Return Value: + + None. + +--*/ + +{ + USHORT Length; + Length = 0; + DestinationString->Length = 0; + DestinationString->Buffer = SourceString; + if (ARGUMENT_PRESENT( SourceString )) { + while (*SourceString++) { + Length++; + } + + DestinationString->Length = Length; + + DestinationString->MaximumLength = (SHORT)(Length+1); + } + else { + DestinationString->MaximumLength = 0; + } +} + + +VOID +RtlInitUnicodeString( + OUT PUNICODE_STRING DestinationString, + IN PWSTR SourceString OPTIONAL + ) + +/*++ + +Routine Description: + + The RtlInitUnicodeString function initializes an NT counted + unicode string. The DestinationString is initialized to point to + the SourceString and the Length and MaximumLength fields of + DestinationString are initialized to the length of the SourceString, + which is zero if SourceString is not specified. + +Arguments: + + DestinationString - Pointer to the counted string to initialize + + SourceString - Optional pointer to a null terminated unicode string that + the counted string is to point to. + + +Return Value: + + None. + +--*/ + +{ + USHORT Length = 0; + DestinationString->Length = 0; + DestinationString->Buffer = SourceString; + if (ARGUMENT_PRESENT( SourceString )) { + while (*SourceString++) { + Length += sizeof(*SourceString); + } + + DestinationString->Length = Length; + + DestinationString->MaximumLength = Length+(USHORT)sizeof(UNICODE_NULL); + } + else { + DestinationString->MaximumLength = 0; + } +} -- cgit v1.2.3