Commit 9e509718 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ntdll: Implement RtlHashUnicodeString().

parent dd649520
...@@ -651,7 +651,7 @@ ...@@ -651,7 +651,7 @@
@ stub RtlGetUserInfoHeap @ stub RtlGetUserInfoHeap
@ stdcall RtlGetVersion(ptr) @ stdcall RtlGetVersion(ptr)
@ stub RtlGuidToPropertySetName @ stub RtlGuidToPropertySetName
# @ stub RtlHashUnicodeString @ stdcall RtlHashUnicodeString(ptr long long ptr)
@ stdcall RtlIdentifierAuthoritySid(ptr) @ stdcall RtlIdentifierAuthoritySid(ptr)
@ stdcall RtlImageDirectoryEntryToData(long long long ptr) @ stdcall RtlImageDirectoryEntryToData(long long long ptr)
@ stdcall RtlImageNtHeader(long) @ stdcall RtlImageNtHeader(long)
......
...@@ -257,4 +257,8 @@ extern mode_t FILE_umask DECLSPEC_HIDDEN; ...@@ -257,4 +257,8 @@ extern mode_t FILE_umask DECLSPEC_HIDDEN;
"ret $(4*" #args ")" ) /* fake ret to make copy protections happy */ "ret $(4*" #args ")" ) /* fake ret to make copy protections happy */
#endif #endif
#define HASH_STRING_ALGORITHM_DEFAULT 0
#define HASH_STRING_ALGORITHM_X65599 1
#define HASH_STRING_ALGORITHM_INVALID 0xffffffff
#endif #endif
...@@ -2138,3 +2138,28 @@ NTSTATUS WINAPI RtlStringFromGUID(const GUID* guid, UNICODE_STRING *str) ...@@ -2138,3 +2138,28 @@ NTSTATUS WINAPI RtlStringFromGUID(const GUID* guid, UNICODE_STRING *str)
return STATUS_SUCCESS; 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;
}
...@@ -1935,7 +1935,7 @@ static void test_RtlHashUnicodeString(void) ...@@ -1935,7 +1935,7 @@ static void test_RtlHashUnicodeString(void)
if (!pRtlHashUnicodeString) if (!pRtlHashUnicodeString)
{ {
skip("RtlHashUnicodeString is not available\n"); win_skip("RtlHashUnicodeString is not available\n");
return; return;
} }
......
...@@ -1046,7 +1046,7 @@ ...@@ -1046,7 +1046,7 @@
@ stdcall RtlGetSaclSecurityDescriptor(ptr ptr ptr ptr) ntdll.RtlGetSaclSecurityDescriptor @ stdcall RtlGetSaclSecurityDescriptor(ptr ptr ptr ptr) ntdll.RtlGetSaclSecurityDescriptor
@ stub RtlGetSetBootStatusData @ stub RtlGetSetBootStatusData
@ stdcall RtlGetVersion(ptr) ntdll.RtlGetVersion @ stdcall RtlGetVersion(ptr) ntdll.RtlGetVersion
@ stub RtlHashUnicodeString @ stdcall RtlHashUnicodeString(ptr long long ptr) ntdll.RtlHashUnicodeString
@ stdcall RtlImageDirectoryEntryToData(long long long ptr) ntdll.RtlImageDirectoryEntryToData @ stdcall RtlImageDirectoryEntryToData(long long long ptr) ntdll.RtlImageDirectoryEntryToData
@ stdcall RtlImageNtHeader(long) ntdll.RtlImageNtHeader @ stdcall RtlImageNtHeader(long) ntdll.RtlImageNtHeader
@ stdcall RtlInitAnsiString(ptr str) ntdll.RtlInitAnsiString @ stdcall RtlInitAnsiString(ptr str) ntdll.RtlInitAnsiString
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment