ntdll: Implement RtlHashUnicodeString().

This commit is contained in:
Nikolay Sivov 2013-07-20 09:15:34 +04:00 committed by Alexandre Julliard
parent dd64952040
commit 9e5097187e
5 changed files with 32 additions and 3 deletions

View File

@ -651,7 +651,7 @@
@ stub RtlGetUserInfoHeap
@ stdcall RtlGetVersion(ptr)
@ stub RtlGuidToPropertySetName
# @ stub RtlHashUnicodeString
@ stdcall RtlHashUnicodeString(ptr long long ptr)
@ stdcall RtlIdentifierAuthoritySid(ptr)
@ stdcall RtlImageDirectoryEntryToData(long long long ptr)
@ stdcall RtlImageNtHeader(long)

View File

@ -257,4 +257,8 @@ extern mode_t FILE_umask DECLSPEC_HIDDEN;
"ret $(4*" #args ")" ) /* fake ret to make copy protections happy */
#endif
#define HASH_STRING_ALGORITHM_DEFAULT 0
#define HASH_STRING_ALGORITHM_X65599 1
#define HASH_STRING_ALGORITHM_INVALID 0xffffffff
#endif

View File

@ -2138,3 +2138,28 @@ NTSTATUS WINAPI RtlStringFromGUID(const GUID* guid, UNICODE_STRING *str)
return STATUS_SUCCESS;
}
/******************************************************************************
* RtlHashUnicodeString [NTDLL.@]
*/
NTSTATUS WINAPI RtlHashUnicodeString(PCUNICODE_STRING string, BOOLEAN case_insensitive, ULONG alg, ULONG *hash)
{
unsigned int i;
if (!string || !hash) return STATUS_INVALID_PARAMETER;
switch (alg)
{
case HASH_STRING_ALGORITHM_DEFAULT:
case HASH_STRING_ALGORITHM_X65599:
break;
default:
return STATUS_INVALID_PARAMETER;
}
*hash = 0;
for (i = 0; i < string->Length/sizeof(WCHAR); i++)
*hash = *hash*65599 + (case_insensitive ? toupperW(string->Buffer[i]) : string->Buffer[i]);
return STATUS_SUCCESS;
}

View File

@ -1935,7 +1935,7 @@ static void test_RtlHashUnicodeString(void)
if (!pRtlHashUnicodeString)
{
skip("RtlHashUnicodeString is not available\n");
win_skip("RtlHashUnicodeString is not available\n");
return;
}

View File

@ -1046,7 +1046,7 @@
@ stdcall RtlGetSaclSecurityDescriptor(ptr ptr ptr ptr) ntdll.RtlGetSaclSecurityDescriptor
@ stub RtlGetSetBootStatusData
@ stdcall RtlGetVersion(ptr) ntdll.RtlGetVersion
@ stub RtlHashUnicodeString
@ stdcall RtlHashUnicodeString(ptr long long ptr) ntdll.RtlHashUnicodeString
@ stdcall RtlImageDirectoryEntryToData(long long long ptr) ntdll.RtlImageDirectoryEntryToData
@ stdcall RtlImageNtHeader(long) ntdll.RtlImageNtHeader
@ stdcall RtlInitAnsiString(ptr str) ntdll.RtlInitAnsiString