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
8d11c087
Commit
8d11c087
authored
Feb 03, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Fix NormalizeString() return value and last error.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a7cc191a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
13 deletions
+24
-13
locale.c
dlls/kernel32/tests/locale.c
+11
-12
locale.c
dlls/kernelbase/locale.c
+13
-1
No files found.
dlls/kernel32/tests/locale.c
View file @
8d11c087
...
@@ -6034,12 +6034,10 @@ static void test_NormalizeString(void)
...
@@ -6034,12 +6034,10 @@ static void test_NormalizeString(void)
dstlen
=
pNormalizeString
(
norm_forms
[
i
],
ptest
->
str
,
-
1
,
NULL
,
0
);
dstlen
=
pNormalizeString
(
norm_forms
[
i
],
ptest
->
str
,
-
1
,
NULL
,
0
);
ok
(
dstlen
>
lstrlenW
(
ptest
->
str
),
"%s:%d: wrong len %d / %d
\n
"
,
ok
(
dstlen
>
lstrlenW
(
ptest
->
str
),
"%s:%d: wrong len %d / %d
\n
"
,
wine_dbgstr_w
(
ptest
->
str
),
i
,
dstlen
,
lstrlenW
(
ptest
->
str
)
);
wine_dbgstr_w
(
ptest
->
str
),
i
,
dstlen
,
lstrlenW
(
ptest
->
str
)
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"%s:%d: got error %u
\n
"
,
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"%s:%d: got error %u
\n
"
,
wine_dbgstr_w
(
ptest
->
str
),
i
,
GetLastError
());
wine_dbgstr_w
(
ptest
->
str
),
i
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
dstlen
=
pNormalizeString
(
norm_forms
[
i
],
ptest
->
str
,
-
1
,
dst
,
dstlen
);
dstlen
=
pNormalizeString
(
norm_forms
[
i
],
ptest
->
str
,
-
1
,
dst
,
dstlen
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"%s:%d: got error %u
\n
"
,
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"%s:%d: got error %u
\n
"
,
wine_dbgstr_w
(
ptest
->
str
),
i
,
GetLastError
());
wine_dbgstr_w
(
ptest
->
str
),
i
,
GetLastError
());
ok
(
dstlen
==
lstrlenW
(
dst
)
+
1
,
"%s:%d: Copied length differed: was %d, should be %d
\n
"
,
ok
(
dstlen
==
lstrlenW
(
dst
)
+
1
,
"%s:%d: Copied length differed: was %d, should be %d
\n
"
,
...
@@ -6086,33 +6084,33 @@ static void test_NormalizeString(void)
...
@@ -6086,33 +6084,33 @@ static void test_NormalizeString(void)
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
dstlen
=
pNormalizeString
(
NormalizationD
,
part0_str1
,
-
1
,
dst
,
1
);
dstlen
=
pNormalizeString
(
NormalizationD
,
part0_str1
,
-
1
,
dst
,
1
);
todo_wine
ok
(
dstlen
<=
0
,
"wrong len %d
\n
"
,
dstlen
);
ok
(
dstlen
<=
0
,
"wrong len %d
\n
"
,
dstlen
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"got error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"got error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
dstlen
=
pNormalizeString
(
NormalizationC
,
part0_str2
,
-
1
,
dst
,
1
);
dstlen
=
pNormalizeString
(
NormalizationC
,
part0_str2
,
-
1
,
dst
,
1
);
todo_wine
ok
(
dstlen
<=
0
,
"wrong len %d
\n
"
,
dstlen
);
ok
(
dstlen
<=
0
,
"wrong len %d
\n
"
,
dstlen
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"got error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"got error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
dstlen
=
pNormalizeString
(
NormalizationC
,
part0_str2
,
-
1
,
NULL
,
0
);
dstlen
=
pNormalizeString
(
NormalizationC
,
part0_str2
,
-
1
,
NULL
,
0
);
ok
(
dstlen
==
12
,
"wrong len %d
\n
"
,
dstlen
);
ok
(
dstlen
==
12
,
"wrong len %d
\n
"
,
dstlen
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"got error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"got error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
dstlen
=
pNormalizeString
(
NormalizationC
,
part0_str2
,
-
1
,
dst
,
3
);
dstlen
=
pNormalizeString
(
NormalizationC
,
part0_str2
,
-
1
,
dst
,
3
);
ok
(
dstlen
==
3
,
"wrong len %d
\n
"
,
dstlen
);
ok
(
dstlen
==
3
,
"wrong len %d
\n
"
,
dstlen
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"got error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"got error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
dstlen
=
pNormalizeString
(
NormalizationC
,
part0_str2
,
0
,
NULL
,
0
);
dstlen
=
pNormalizeString
(
NormalizationC
,
part0_str2
,
0
,
NULL
,
0
);
ok
(
dstlen
==
0
,
"wrong len %d
\n
"
,
dstlen
);
ok
(
dstlen
==
0
,
"wrong len %d
\n
"
,
dstlen
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"got error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"got error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
dstlen
=
pNormalizeString
(
NormalizationC
,
part0_str2
,
0
,
dst
,
3
);
dstlen
=
pNormalizeString
(
NormalizationC
,
part0_str2
,
0
,
dst
,
3
);
ok
(
dstlen
==
0
,
"wrong len %d
\n
"
,
dstlen
);
ok
(
dstlen
==
0
,
"wrong len %d
\n
"
,
dstlen
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"got error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"got error %u
\n
"
,
GetLastError
());
/* size estimations */
/* size estimations */
...
@@ -6144,11 +6142,11 @@ static void test_NormalizeString(void)
...
@@ -6144,11 +6142,11 @@ static void test_NormalizeString(void)
if
(
i
==
0
||
i
==
2
)
if
(
i
==
0
||
i
==
2
)
{
{
ok
(
dstlen
==
srclen
,
"%d: wrong len %d
\n
"
,
i
,
dstlen
);
ok
(
dstlen
==
srclen
,
"%d: wrong len %d
\n
"
,
i
,
dstlen
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"got error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"got error %u
\n
"
,
GetLastError
());
}
}
else
else
{
{
todo_wine
ok
(
dstlen
<
-
expect
,
"%d: wrong len %d
\n
"
,
i
,
dstlen
);
ok
(
dstlen
<
-
expect
,
"%d: wrong len %d
\n
"
,
i
,
dstlen
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"got error %u
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"got error %u
\n
"
,
GetLastError
());
}
}
if
(
pRtlNormalizeString
)
if
(
pRtlNormalizeString
)
...
@@ -6185,12 +6183,13 @@ static void test_NormalizeString(void)
...
@@ -6185,12 +6183,13 @@ static void test_NormalizeString(void)
case
NormalizationKD
:
case
NormalizationKD
:
case
13
:
/* Idn */
case
13
:
/* Idn */
todo_wine_if
(
i
==
13
)
todo_wine_if
(
i
==
13
)
{
ok
(
dstlen
>
0
,
"%d: wrong len %d
\n
"
,
i
,
dstlen
);
ok
(
dstlen
>
0
,
"%d: wrong len %d
\n
"
,
i
,
dstlen
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"%d: got error %u
\n
"
,
i
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"%d: got error %u
\n
"
,
i
,
GetLastError
());
}
break
;
break
;
default:
default:
ok
(
dstlen
<=
0
,
"%d: wrong len %d
\n
"
,
i
,
dstlen
);
ok
(
dstlen
<=
0
,
"%d: wrong len %d
\n
"
,
i
,
dstlen
);
todo_wine_if
(
i
)
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"%d: got error %u
\n
"
,
i
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"%d: got error %u
\n
"
,
i
,
GetLastError
());
break
;
break
;
}
}
...
...
dlls/kernelbase/locale.c
View file @
8d11c087
...
@@ -4923,7 +4923,19 @@ INT WINAPI DECLSPEC_HOTPATCH MultiByteToWideChar( UINT codepage, DWORD flags, co
...
@@ -4923,7 +4923,19 @@ INT WINAPI DECLSPEC_HOTPATCH MultiByteToWideChar( UINT codepage, DWORD flags, co
INT
WINAPI
DECLSPEC_HOTPATCH
NormalizeString
(
NORM_FORM
form
,
const
WCHAR
*
src
,
INT
src_len
,
INT
WINAPI
DECLSPEC_HOTPATCH
NormalizeString
(
NORM_FORM
form
,
const
WCHAR
*
src
,
INT
src_len
,
WCHAR
*
dst
,
INT
dst_len
)
WCHAR
*
dst
,
INT
dst_len
)
{
{
set_ntstatus
(
RtlNormalizeString
(
form
,
src
,
src_len
,
dst
,
&
dst_len
));
NTSTATUS
status
=
RtlNormalizeString
(
form
,
src
,
src_len
,
dst
,
&
dst_len
);
switch
(
status
)
{
case
STATUS_OBJECT_NAME_NOT_FOUND
:
status
=
STATUS_INVALID_PARAMETER
;
break
;
case
STATUS_BUFFER_TOO_SMALL
:
case
STATUS_NO_UNICODE_TRANSLATION
:
dst_len
=
-
dst_len
;
break
;
}
SetLastError
(
RtlNtStatusToDosError
(
status
));
return
dst_len
;
return
dst_len
;
}
}
...
...
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