Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

stringsp.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1989 Microsoft Corporation 00004 00005 Module Name: 00006 00007 stingsup.c 00008 00009 Abstract: 00010 00011 This module defines CPU specific routines for manipulating NT strings. 00012 00013 Author: 00014 00015 Steve Wood (stevewo) 31-Mar-1989 00016 00017 Revision History: 00018 00019 00020 --*/ 00021 00022 #include "nt.h" 00023 #include "ntrtl.h" 00024 00025 00026 VOID 00027 RtlInitAnsiString( 00028 OUT PANSI_STRING DestinationString, 00029 IN PSZ SourceString OPTIONAL 00030 ) 00031 00032 /*++ 00033 00034 Routine Description: 00035 00036 The RtlInitAnsiString function initializes an NT counted string. 00037 The DestinationString is initialized to point to the SourceString 00038 and the Length and MaximumLength fields of DestinationString are 00039 initialized to the length of the SourceString, which is zero if 00040 SourceString is not specified. 00041 00042 Arguments: 00043 00044 DestinationString - Pointer to the counted string to initialize 00045 00046 SourceString - Optional pointer to a null terminated string that 00047 the counted string is to point to. 00048 00049 00050 Return Value: 00051 00052 None. 00053 00054 --*/ 00055 00056 { 00057 USHORT Length; 00058 Length = 0; 00059 DestinationString->Length = 0; 00060 DestinationString->Buffer = SourceString; 00061 if (ARGUMENT_PRESENT( SourceString )) { 00062 while (*SourceString++) { 00063 Length++; 00064 } 00065 00066 DestinationString->Length = Length; 00067 00068 DestinationString->MaximumLength = (SHORT)(Length+1); 00069 } 00070 else { 00071 DestinationString->MaximumLength = 0; 00072 } 00073 } 00074 00075 00076 VOID 00077 RtlInitUnicodeString( 00078 OUT PUNICODE_STRING DestinationString, 00079 IN PWSTR SourceString OPTIONAL 00080 ) 00081 00082 /*++ 00083 00084 Routine Description: 00085 00086 The RtlInitUnicodeString function initializes an NT counted 00087 unicode string. The DestinationString is initialized to point to 00088 the SourceString and the Length and MaximumLength fields of 00089 DestinationString are initialized to the length of the SourceString, 00090 which is zero if SourceString is not specified. 00091 00092 Arguments: 00093 00094 DestinationString - Pointer to the counted string to initialize 00095 00096 SourceString - Optional pointer to a null terminated unicode string that 00097 the counted string is to point to. 00098 00099 00100 Return Value: 00101 00102 None. 00103 00104 --*/ 00105 00106 { 00107 USHORT Length = 0; 00108 DestinationString->Length = 0; 00109 DestinationString->Buffer = SourceString; 00110 if (ARGUMENT_PRESENT( SourceString )) { 00111 while (*SourceString++) { 00112 Length += sizeof(*SourceString); 00113 } 00114 00115 DestinationString->Length = Length; 00116 00117 DestinationString->MaximumLength = Length+(USHORT)sizeof(UNICODE_NULL); 00118 } 00119 else { 00120 DestinationString->MaximumLength = 0; 00121 } 00122 }

Generated on Sat May 15 19:41:53 2004 for test by doxygen 1.3.7