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

cmname.c File Reference

#include "cmp.h"

Go to the source code of this file.

Functions

USHORT CmpNameSize (IN PHHIVE Hive, IN PUNICODE_STRING Name)
USHORT CmpCopyName (IN PHHIVE Hive, IN PWCHAR Destination, IN PUNICODE_STRING Source)
USHORT CmpCompressedNameSize (IN PWCHAR Name, IN ULONG Length)
VOID CmpCopyCompressedName (IN PWCHAR Destination, IN ULONG DestinationLength, IN PWCHAR Source, IN ULONG SourceLength)
LONG CmpCompareCompressedName (IN PUNICODE_STRING SearchName, IN PWCHAR CompressedName, IN ULONG NameLength)


Function Documentation

LONG CmpCompareCompressedName IN PUNICODE_STRING  SearchName,
IN PWCHAR  CompressedName,
IN ULONG  NameLength
 

Definition at line 195 of file cmname.c.

References RtlUpcaseUnicodeChar(), and USHORT.

Referenced by CmpCacheLookup(), CmpDoCompareKeyName(), CmpFindNameInList(), CmpFindValueByNameFromCache(), and CmpGetNameControlBlock().

00203 : 00204 00205 Compares a compressed registry string to a Unicode string. Does a case-insensitive 00206 comparison. 00207 00208 Arguments: 00209 00210 SearchName - Supplies the Unicode string to be compared 00211 00212 CompressedName - Supplies the compressed string to be compared 00213 00214 NameLength - Supplies the length of the compressed string 00215 00216 Return Value: 00217 00218 0 = SearchName == CompressedName (of Cell) 00219 00220 < 0 = SearchName < CompressedName 00221 00222 > 0 = SearchName > CompressedName 00223 00224 --*/ 00225 00226 { 00227 WCHAR *s1; 00228 UCHAR *s2; 00229 USHORT n1, n2; 00230 WCHAR c1; 00231 WCHAR c2; 00232 LONG cDiff; 00233 00234 s1 = SearchName->Buffer; 00235 s2 = (UCHAR *)CompressedName; 00236 n1 = (USHORT )(SearchName->Length / sizeof(WCHAR)); 00237 n2 = (USHORT )(NameLength); 00238 while (n1 && n2) { 00239 c1 = *s1++; 00240 c2 = (WCHAR)(*s2++); 00241 00242 c1 = RtlUpcaseUnicodeChar(c1); 00243 c2 = RtlUpcaseUnicodeChar(c2); 00244 00245 if ((cDiff = ((LONG)c1 - (LONG)c2)) != 0) { 00246 return( cDiff ); 00247 } 00248 00249 n1--; 00250 n2--; 00251 } 00252 00253 return( n1 - n2 ); 00254 }

USHORT CmpCompressedNameSize IN PWCHAR  Name,
IN ULONG  Length
 

Definition at line 121 of file cmname.c.

References USHORT.

Referenced by CmpAddDriverToList(), CmpAddSubKey(), CmpFindProfileOption(), CmpInitializeKeyNameString(), CmpInitializeValueNameString(), CmpMarkIndexDirty(), and CmpRemoveSubKey().

00128 : 00129 00130 Computes the length of the unicode string that the given compressed name 00131 expands into. 00132 00133 Arguments: 00134 00135 Name - Supplies the compressed name. 00136 00137 Length - Supplies the length in bytes of the compressed name 00138 00139 Return Value: 00140 00141 The number of bytes of storage required to hold the Unicode expanded name. 00142 00143 --*/ 00144 00145 { 00146 return((USHORT)Length*sizeof(WCHAR)); 00147 }

VOID CmpCopyCompressedName IN PWCHAR  Destination,
IN ULONG  DestinationLength,
IN PWCHAR  Source,
IN ULONG  SourceLength
 

Definition at line 151 of file cmname.c.

Referenced by CmpAddDriverToList(), CmpAddSubKey(), CmpFindProfileOption(), CmpGetHiveName(), CmpInitializeKeyNameString(), CmpInitializeValueNameString(), CmpLoadHiveVolatile(), CmpMarkIndexDirty(), CmpQueryKeyData(), CmpQueryKeyValueData(), and CmpRemoveSubKey().

00160 : 00161 00162 Copies a compressed name from the registry and expands it to Unicode. 00163 00164 Arguments: 00165 00166 Destination - Supplies the destination Unicode buffer 00167 00168 DestinationLength - Supplies the max length of the destination buffer in bytes 00169 00170 Source - Supplies the compressed string. 00171 00172 SourceLength - Supplies the length of the compressed string in bytes 00173 00174 Return Value: 00175 00176 None. 00177 00178 --*/ 00179 00180 { 00181 ULONG i; 00182 ULONG Chars; 00183 00184 Chars = (DestinationLength/sizeof(WCHAR) < SourceLength) 00185 ? DestinationLength/sizeof(WCHAR) 00186 : SourceLength; 00187 00188 for (i=0;i<Chars;i++) { 00189 Destination[i] = (WCHAR)(((PUCHAR)Source)[i]); 00190 } 00191 }

USHORT CmpCopyName IN PHHIVE  Hive,
IN PWCHAR  Destination,
IN PUNICODE_STRING  Source
 

Definition at line 74 of file cmname.c.

References Hive, USHORT, and _HHIVE::Version.

Referenced by CmpCreateLinkNode(), CmpCreateRootNode(), CmpDoCreateChild(), and CmpSetValueKeyNew().

00082 : 00083 00084 Copies the given unicode name into the registry, applying any relevant compression 00085 at the same time. 00086 00087 Arguments: 00088 00089 Hive - supplies the hive control structure (For version checking) 00090 00091 Destination - Supplies the destination of the given string. 00092 00093 Source - Supplies the unicode string to copy into the registry. 00094 00095 Return Value: 00096 00097 Number of bytes of storage copied 00098 00099 --*/ 00100 00101 { 00102 ULONG i; 00103 00104 if (Hive->Version==1) { 00105 RtlCopyMemory(Destination,Source->Buffer, Source->Length); 00106 return(Source->Length); 00107 } 00108 00109 for (i=0;i<Source->Length/sizeof(WCHAR);i++) { 00110 if ((USHORT)Source->Buffer[i] > (UCHAR)-1) { 00111 RtlCopyMemory(Destination,Source->Buffer, Source->Length); 00112 return(Source->Length); 00113 } 00114 ((PUCHAR)Destination)[i] = (UCHAR)(Source->Buffer[i]); 00115 } 00116 return(Source->Length / sizeof(WCHAR)); 00117 }

USHORT CmpNameSize IN PHHIVE  Hive,
IN PUNICODE_STRING  Name
 

Definition at line 33 of file cmname.c.

References Hive, Name, USHORT, and _HHIVE::Version.

00040 : 00041 00042 Determines the space needed to store a given string in the registry. May apply 00043 any relevant compression to compute the length, but the compression used is 00044 guaranteed to be the same as CmpCopyName. 00045 00046 Arguments: 00047 00048 Hive - supplies the hive control structure (for version checking) 00049 00050 Name - Supplies the unicode string to be copied into the registry. 00051 00052 Return Value: 00053 00054 The number of bytes of storage required to store this name. 00055 00056 --*/ 00057 00058 { 00059 ULONG i; 00060 00061 if (Hive->Version == 1) { 00062 return(Name->Length); 00063 } 00064 for (i=0;i<Name->Length/sizeof(WCHAR);i++) { 00065 if ((USHORT)Name->Buffer[i] > (UCHAR)-1) { 00066 return(Name->Length); 00067 } 00068 } 00069 return(Name->Length / sizeof(WCHAR)); 00070 00071 }


Generated on Sat May 15 19:43:08 2004 for test by doxygen 1.3.7