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
117dbfa2
Commit
117dbfa2
authored
Dec 06, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Fix DBCS mappings in RtlCustomCPToUnicodeN().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8f005769
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
7 deletions
+32
-7
locale.c
dlls/kernel32/tests/locale.c
+28
-3
locale.c
dlls/ntdll/locale.c
+4
-4
No files found.
dlls/kernel32/tests/locale.c
View file @
117dbfa2
...
@@ -89,6 +89,7 @@ static NTSTATUS (WINAPI *pRtlNormalizeString)(ULONG, LPCWSTR, INT, LPWSTR, INT*)
...
@@ -89,6 +89,7 @@ static NTSTATUS (WINAPI *pRtlNormalizeString)(ULONG, LPCWSTR, INT, LPWSTR, INT*)
static
NTSTATUS
(
WINAPI
*
pRtlIsNormalizedString
)(
ULONG
,
LPCWSTR
,
INT
,
BOOLEAN
*
);
static
NTSTATUS
(
WINAPI
*
pRtlIsNormalizedString
)(
ULONG
,
LPCWSTR
,
INT
,
BOOLEAN
*
);
static
NTSTATUS
(
WINAPI
*
pNtGetNlsSectionPtr
)(
ULONG
,
ULONG
,
void
*
,
void
**
,
SIZE_T
*
);
static
NTSTATUS
(
WINAPI
*
pNtGetNlsSectionPtr
)(
ULONG
,
ULONG
,
void
*
,
void
**
,
SIZE_T
*
);
static
void
(
WINAPI
*
pRtlInitCodePageTable
)(
USHORT
*
,
CPTABLEINFO
*
);
static
void
(
WINAPI
*
pRtlInitCodePageTable
)(
USHORT
*
,
CPTABLEINFO
*
);
static
NTSTATUS
(
WINAPI
*
pRtlCustomCPToUnicodeN
)(
CPTABLEINFO
*
,
WCHAR
*
,
DWORD
,
DWORD
*
,
const
char
*
,
DWORD
);
static
void
InitFunctionPointers
(
void
)
static
void
InitFunctionPointers
(
void
)
{
{
...
@@ -134,6 +135,7 @@ static void InitFunctionPointers(void)
...
@@ -134,6 +135,7 @@ static void InitFunctionPointers(void)
X
(
RtlIsNormalizedString
);
X
(
RtlIsNormalizedString
);
X
(
NtGetNlsSectionPtr
);
X
(
NtGetNlsSectionPtr
);
X
(
RtlInitCodePageTable
);
X
(
RtlInitCodePageTable
);
X
(
RtlCustomCPToUnicodeN
);
#undef X
#undef X
}
}
...
@@ -4196,17 +4198,40 @@ static void test_GetCPInfo(void)
...
@@ -4196,17 +4198,40 @@ static void test_GetCPInfo(void)
ret
=
UnmapViewOfFile
(
ptr
);
ret
=
UnmapViewOfFile
(
ptr
);
todo_wine
ok
(
ret
,
"UnmapViewOfFile failed err %u
\n
"
,
GetLastError
()
);
todo_wine
ok
(
ret
,
"UnmapViewOfFile failed err %u
\n
"
,
GetLastError
()
);
status
=
pNtGetNlsSectionPtr
(
11
,
93
2
,
NULL
,
&
ptr
,
&
size
);
status
=
pNtGetNlsSectionPtr
(
11
,
93
6
,
NULL
,
&
ptr
,
&
size
);
ok
(
!
status
,
"failed %x
\n
"
,
status
);
ok
(
!
status
,
"failed %x
\n
"
,
status
);
ok
(
size
>
0x
20000
&&
size
<=
0x3
0000
,
"wrong size %lx
\n
"
,
size
);
ok
(
size
>
0x
30000
&&
size
<=
0x4
0000
,
"wrong size %lx
\n
"
,
size
);
memset
(
&
table
,
0xcc
,
sizeof
(
table
)
);
memset
(
&
table
,
0xcc
,
sizeof
(
table
)
);
if
(
pRtlInitCodePageTable
)
if
(
pRtlInitCodePageTable
)
{
{
pRtlInitCodePageTable
(
ptr
,
&
table
);
pRtlInitCodePageTable
(
ptr
,
&
table
);
ok
(
table
.
CodePage
==
93
2
,
"wrong codepage %u
\n
"
,
table
.
CodePage
);
ok
(
table
.
CodePage
==
93
6
,
"wrong codepage %u
\n
"
,
table
.
CodePage
);
ok
(
table
.
MaximumCharacterSize
==
2
,
"wrong char size %u
\n
"
,
table
.
MaximumCharacterSize
);
ok
(
table
.
MaximumCharacterSize
==
2
,
"wrong char size %u
\n
"
,
table
.
MaximumCharacterSize
);
ok
(
table
.
DefaultChar
==
'?'
,
"wrong default char %x
\n
"
,
table
.
DefaultChar
);
ok
(
table
.
DefaultChar
==
'?'
,
"wrong default char %x
\n
"
,
table
.
DefaultChar
);
ok
(
table
.
DBCSCodePage
==
TRUE
,
"wrong dbcs %u
\n
"
,
table
.
DBCSCodePage
);
ok
(
table
.
DBCSCodePage
==
TRUE
,
"wrong dbcs %u
\n
"
,
table
.
DBCSCodePage
);
if
(
pRtlCustomCPToUnicodeN
)
{
static
const
unsigned
char
buf
[]
=
{
0xbf
,
0xb4
,
0xc7
,
0
,
0x78
};
static
const
WCHAR
expect
[][
4
]
=
{
{
0xcccc
,
0xcccc
,
0xcccc
,
0xcccc
},
{
0x0000
,
0xcccc
,
0xcccc
,
0xcccc
},
{
0x770b
,
0xcccc
,
0xcccc
,
0xcccc
},
{
0x770b
,
0x0000
,
0xcccc
,
0xcccc
},
{
0x770b
,
0x003f
,
0xcccc
,
0xcccc
},
{
0x770b
,
0x003f
,
0x0078
,
0xcccc
}
};
WCHAR
wbuf
[
5
];
DWORD
i
,
j
,
reslen
;
for
(
i
=
0
;
i
<=
sizeof
(
buf
);
i
++
)
{
memset
(
wbuf
,
0xcc
,
sizeof
(
wbuf
)
);
RtlCustomCPToUnicodeN
(
&
table
,
wbuf
,
sizeof
(
wbuf
),
&
reslen
,
(
char
*
)
buf
,
i
);
for
(
j
=
0
;
j
<
4
;
j
++
)
if
(
expect
[
i
][
j
]
==
0xcccc
)
break
;
ok
(
reslen
==
j
*
sizeof
(
WCHAR
),
"%u: wrong len %u
\n
"
,
i
,
reslen
);
for
(
j
=
0
;
j
<
4
;
j
++
)
ok
(
wbuf
[
j
]
==
expect
[
i
][
j
],
"%u: char %u got %04x
\n
"
,
i
,
j
,
wbuf
[
j
]
);
}
}
}
}
ret
=
UnmapViewOfFile
(
ptr
);
ret
=
UnmapViewOfFile
(
ptr
);
todo_wine
ok
(
ret
,
"UnmapViewOfFile failed err %u
\n
"
,
GetLastError
()
);
todo_wine
ok
(
ret
,
"UnmapViewOfFile failed err %u
\n
"
,
GetLastError
()
);
...
...
dlls/ntdll/locale.c
View file @
117dbfa2
...
@@ -841,10 +841,10 @@ WCHAR WINAPI RtlAnsiCharToUnicodeChar( char **ansi )
...
@@ -841,10 +841,10 @@ WCHAR WINAPI RtlAnsiCharToUnicodeChar( char **ansi )
if
(
nls_info
.
AnsiTableInfo
.
DBCSOffsets
)
if
(
nls_info
.
AnsiTableInfo
.
DBCSOffsets
)
{
{
USHORT
off
=
nls_info
.
AnsiTableInfo
.
DBCSOffsets
[(
unsigned
char
)
**
ansi
];
USHORT
off
=
nls_info
.
AnsiTableInfo
.
DBCSOffsets
[(
unsigned
char
)
**
ansi
];
if
(
off
&&
(
*
ansi
)[
1
]
)
if
(
off
)
{
{
(
*
ansi
)
++
;
(
*
ansi
)
++
;
return
nls_info
.
AnsiTableInfo
.
MultiByteTable
[
off
+
(
unsigned
char
)
*
(
*
ansi
)
++
];
return
nls_info
.
AnsiTableInfo
.
DBCSOffsets
[
off
+
(
unsigned
char
)
*
(
*
ansi
)
++
];
}
}
}
}
return
nls_info
.
AnsiTableInfo
.
MultiByteTable
[(
unsigned
char
)
*
(
*
ansi
)
++
];
return
nls_info
.
AnsiTableInfo
.
MultiByteTable
[(
unsigned
char
)
*
(
*
ansi
)
++
];
...
@@ -919,11 +919,11 @@ NTSTATUS WINAPI RtlCustomCPToUnicodeN( CPTABLEINFO *info, WCHAR *dst, DWORD dstl
...
@@ -919,11 +919,11 @@ NTSTATUS WINAPI RtlCustomCPToUnicodeN( CPTABLEINFO *info, WCHAR *dst, DWORD dstl
for
(
i
=
dstlen
;
srclen
&&
i
;
i
--
,
srclen
--
,
src
++
,
dst
++
)
for
(
i
=
dstlen
;
srclen
&&
i
;
i
--
,
srclen
--
,
src
++
,
dst
++
)
{
{
USHORT
off
=
info
->
DBCSOffsets
[(
unsigned
char
)
*
src
];
USHORT
off
=
info
->
DBCSOffsets
[(
unsigned
char
)
*
src
];
if
(
off
&&
srclen
>
1
&&
src
[
1
]
)
if
(
off
&&
srclen
>
1
)
{
{
src
++
;
src
++
;
srclen
--
;
srclen
--
;
*
dst
=
info
->
MultiByteTable
[
off
+
(
unsigned
char
)
*
src
];
*
dst
=
info
->
DBCSOffsets
[
off
+
(
unsigned
char
)
*
src
];
}
}
else
*
dst
=
info
->
MultiByteTable
[(
unsigned
char
)
*
src
];
else
*
dst
=
info
->
MultiByteTable
[(
unsigned
char
)
*
src
];
}
}
...
...
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