Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9bbb66fd
Commit
9bbb66fd
authored
Mar 26, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use the NLS case mapping table for RtlHashUnicodeString().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f66517b5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
33 deletions
+46
-33
locale.c
dlls/ntdll/locale.c
+34
-0
rtlstr.c
dlls/ntdll/rtlstr.c
+0
-25
rtlstr.c
dlls/ntdll/tests/rtlstr.c
+12
-8
No files found.
dlls/ntdll/locale.c
View file @
9bbb66fd
...
...
@@ -1288,6 +1288,40 @@ BOOLEAN WINAPI RtlPrefixUnicodeString( const UNICODE_STRING *s1, const UNICODE_S
}
/******************************************************************************
* RtlHashUnicodeString (NTDLL.@)
*/
NTSTATUS
WINAPI
RtlHashUnicodeString
(
const
UNICODE_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
;
if
(
!
case_insensitive
)
for
(
i
=
0
;
i
<
string
->
Length
/
sizeof
(
WCHAR
);
i
++
)
*
hash
=
*
hash
*
65599
+
string
->
Buffer
[
i
];
else
if
(
nls_info
.
UpperCaseTable
)
for
(
i
=
0
;
i
<
string
->
Length
/
sizeof
(
WCHAR
);
i
++
)
*
hash
=
*
hash
*
65599
+
casemap
(
nls_info
.
UpperCaseTable
,
string
->
Buffer
[
i
]
);
else
/* locale not setup yet */
for
(
i
=
0
;
i
<
string
->
Length
/
sizeof
(
WCHAR
);
i
++
)
*
hash
=
*
hash
*
65599
+
casemap_ascii
(
string
->
Buffer
[
i
]
);
return
STATUS_SUCCESS
;
}
/**************************************************************************
* RtlCustomCPToUnicodeN (NTDLL.@)
*/
...
...
dlls/ntdll/rtlstr.c
View file @
9bbb66fd
...
...
@@ -1708,28 +1708,3 @@ 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
;
}
dlls/ntdll/tests/rtlstr.c
View file @
9bbb66fd
...
...
@@ -1942,14 +1942,18 @@ struct hash_unicodestring_test {
};
static
const
struct
hash_unicodestring_test
hash_test
[]
=
{
{
{
'T'
,
0
},
FALSE
,
0x00000054
},
{
{
'T'
,
'e'
,
's'
,
't'
,
0
},
FALSE
,
0x766bb952
},
{
{
'T'
,
'e'
,
'S'
,
't'
,
0
},
FALSE
,
0x764bb172
},
{
{
't'
,
'e'
,
's'
,
't'
,
0
},
FALSE
,
0x4745d132
},
{
{
't'
,
'e'
,
's'
,
't'
,
0
},
TRUE
,
0x6689c132
},
{
{
'T'
,
'E'
,
'S'
,
'T'
,
0
},
TRUE
,
0x6689c132
},
{
{
'T'
,
'E'
,
'S'
,
'T'
,
0
},
FALSE
,
0x6689c132
},
{
{
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
0
},
FALSE
,
0x971318c3
},
{
L"T"
,
FALSE
,
0x00000054
},
{
L"Test"
,
FALSE
,
0x766bb952
},
{
L"TeSt"
,
FALSE
,
0x764bb172
},
{
L"test"
,
FALSE
,
0x4745d132
},
{
L"test"
,
TRUE
,
0x6689c132
},
{
L"TEST"
,
TRUE
,
0x6689c132
},
{
L"TEST"
,
FALSE
,
0x6689c132
},
{
L"t
\xe9
st"
,
FALSE
,
0x8845cfb6
},
{
L"t
\xe9
st"
,
TRUE
,
0xa789bfb6
},
{
L"T
\xc9
ST"
,
TRUE
,
0xa789bfb6
},
{
L"T
\xc9
ST"
,
FALSE
,
0xa789bfb6
},
{
L"abcdef"
,
FALSE
,
0x971318c3
},
{
{
0
}
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment