mirror of
https://github.com/reactos/reactos.git
synced 2024-10-06 17:35:07 +00:00
implemented RtlHashUnicodeString and export it in ntdll
svn path=/trunk/; revision=16226
This commit is contained in:
parent
9900f1ee91
commit
204ad68d21
|
@ -184,6 +184,11 @@
|
|||
#define VER_CONDITION_MASK 7
|
||||
#define VER_NUM_BITS_PER_CONDITION_MASK 3
|
||||
|
||||
/* RTL String Hash Algorithms */
|
||||
#define HASH_STRING_ALGORITHM_DEFAULT 0
|
||||
#define HASH_STRING_ALGORITHM_X65599 1
|
||||
#define HASH_STRING_ALGORITHM_INVALID 0xffffffff
|
||||
|
||||
/* List Macros */
|
||||
static __inline
|
||||
VOID
|
||||
|
|
|
@ -475,6 +475,7 @@ RtlGetSaclSecurityDescriptor@16
|
|||
RtlGetSecurityDescriptorRMControl@8
|
||||
;RtlGetUserInfoHeap
|
||||
RtlGetVersion@4
|
||||
RtlHashUnicodeString@16
|
||||
RtlIdentifierAuthoritySid@4
|
||||
RtlImageDirectoryEntryToData@16
|
||||
RtlImageNtHeader@4
|
||||
|
|
|
@ -1603,19 +1603,55 @@ RtlEraseUnicodeString(
|
|||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlHashUnicodeString(
|
||||
IN const UNICODE_STRING *String,
|
||||
IN BOOLEAN CaseInSensitive,
|
||||
IN ULONG HashAlgorithm,
|
||||
OUT PULONG HashValue
|
||||
)
|
||||
IN CONST UNICODE_STRING *String,
|
||||
IN BOOLEAN CaseInSensitive,
|
||||
IN ULONG HashAlgorithm,
|
||||
OUT PULONG HashValue)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
if (String != NULL && HashValue != NULL)
|
||||
{
|
||||
switch (HashAlgorithm)
|
||||
{
|
||||
case HASH_STRING_ALGORITHM_DEFAULT:
|
||||
case HASH_STRING_ALGORITHM_X65599:
|
||||
{
|
||||
WCHAR *c, *end;
|
||||
|
||||
*HashValue = 0;
|
||||
end = String->Buffer + (String->Length / sizeof(WCHAR));
|
||||
|
||||
if (CaseInSensitive)
|
||||
{
|
||||
for (c = String->Buffer;
|
||||
c != end;
|
||||
c++)
|
||||
{
|
||||
/* only uppercase characters if they are 'a' ... 'z'! */
|
||||
*HashValue = ((65599 * (*HashValue)) +
|
||||
(ULONG)(((*c) >= L'a' && (*c) <= L'z') ?
|
||||
(*c) - L'a' + L'A' : (*c)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (c = String->Buffer;
|
||||
c != end;
|
||||
c++)
|
||||
{
|
||||
*HashValue = ((65599 * (*HashValue)) + (ULONG)(*c));
|
||||
}
|
||||
}
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue