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
152924c9
Commit
152924c9
authored
Sep 08, 2023
by
Huw Davies
Committed by
Alexandre Julliard
Sep 08, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Store the codepage data addresses in both PEBs.
Spotted by Jactry Zeng.
parent
3c2e980d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
locale.c
dlls/ntdll/locale.c
+11
-0
wow64.c
dlls/ntdll/tests/wow64.c
+9
-0
No files found.
dlls/ntdll/locale.c
View file @
152924c9
...
@@ -89,6 +89,13 @@ invalid:
...
@@ -89,6 +89,13 @@ invalid:
return
STATUS_INVALID_PARAMETER
;
return
STATUS_INVALID_PARAMETER
;
}
}
static
PEB64
*
get_peb64
(
void
)
{
TEB64
*
teb64
=
NtCurrentTeb64
();
if
(
!
teb64
)
return
NULL
;
return
(
PEB64
*
)(
UINT_PTR
)
teb64
->
Peb
;
}
void
locale_init
(
void
)
void
locale_init
(
void
)
{
{
...
@@ -101,6 +108,7 @@ void locale_init(void)
...
@@ -101,6 +108,7 @@ void locale_init(void)
void
*
ansi_ptr
=
utf8
,
*
oem_ptr
=
utf8
,
*
case_ptr
;
void
*
ansi_ptr
=
utf8
,
*
oem_ptr
=
utf8
,
*
case_ptr
;
NTSTATUS
status
;
NTSTATUS
status
;
const
struct
locale_nls_header
*
header
;
const
struct
locale_nls_header
*
header
;
PEB64
*
peb64
=
get_peb64
();
status
=
RtlGetLocaleFileMappingAddress
(
(
void
**
)
&
header
,
&
system_lcid
,
&
unused
);
status
=
RtlGetLocaleFileMappingAddress
(
(
void
**
)
&
header
,
&
system_lcid
,
&
unused
);
if
(
status
)
if
(
status
)
...
@@ -158,15 +166,18 @@ void locale_init(void)
...
@@ -158,15 +166,18 @@ void locale_init(void)
NtGetNlsSectionPtr
(
10
,
0
,
NULL
,
&
case_ptr
,
&
size
);
NtGetNlsSectionPtr
(
10
,
0
,
NULL
,
&
case_ptr
,
&
size
);
NtCurrentTeb
()
->
Peb
->
UnicodeCaseTableData
=
case_ptr
;
NtCurrentTeb
()
->
Peb
->
UnicodeCaseTableData
=
case_ptr
;
if
(
peb64
)
peb64
->
UnicodeCaseTableData
=
PtrToUlong
(
case_ptr
);
if
(
ansi_cp
!=
CP_UTF8
)
if
(
ansi_cp
!=
CP_UTF8
)
{
{
NtGetNlsSectionPtr
(
11
,
ansi_cp
,
NULL
,
&
ansi_ptr
,
&
size
);
NtGetNlsSectionPtr
(
11
,
ansi_cp
,
NULL
,
&
ansi_ptr
,
&
size
);
NtCurrentTeb
()
->
Peb
->
AnsiCodePageData
=
ansi_ptr
;
NtCurrentTeb
()
->
Peb
->
AnsiCodePageData
=
ansi_ptr
;
if
(
peb64
)
peb64
->
AnsiCodePageData
=
PtrToUlong
(
ansi_ptr
);
}
}
if
(
oem_cp
!=
CP_UTF8
)
if
(
oem_cp
!=
CP_UTF8
)
{
{
NtGetNlsSectionPtr
(
11
,
oem_cp
,
NULL
,
&
oem_ptr
,
&
size
);
NtGetNlsSectionPtr
(
11
,
oem_cp
,
NULL
,
&
oem_ptr
,
&
size
);
NtCurrentTeb
()
->
Peb
->
OemCodePageData
=
oem_ptr
;
NtCurrentTeb
()
->
Peb
->
OemCodePageData
=
oem_ptr
;
if
(
peb64
)
peb64
->
OemCodePageData
=
PtrToUlong
(
oem_ptr
);
}
}
RtlInitNlsTables
(
ansi_ptr
,
oem_ptr
,
case_ptr
,
&
nls_info
);
RtlInitNlsTables
(
ansi_ptr
,
oem_ptr
,
case_ptr
,
&
nls_info
);
NlsAnsiCodePage
=
nls_info
.
AnsiTableInfo
.
CodePage
;
NlsAnsiCodePage
=
nls_info
.
AnsiTableInfo
.
CodePage
;
...
...
dlls/ntdll/tests/wow64.c
View file @
152924c9
...
@@ -875,6 +875,15 @@ static void test_peb_teb(void)
...
@@ -875,6 +875,15 @@ static void test_peb_teb(void)
peb64
->
OSBuildNumber
,
NtCurrentTeb
()
->
Peb
->
OSBuildNumber
);
peb64
->
OSBuildNumber
,
NtCurrentTeb
()
->
Peb
->
OSBuildNumber
);
ok
(
peb64
->
OSPlatformId
==
NtCurrentTeb
()
->
Peb
->
OSPlatformId
,
"wrong OSPlatformId %lx / %lx
\n
"
,
ok
(
peb64
->
OSPlatformId
==
NtCurrentTeb
()
->
Peb
->
OSPlatformId
,
"wrong OSPlatformId %lx / %lx
\n
"
,
peb64
->
OSPlatformId
,
NtCurrentTeb
()
->
Peb
->
OSPlatformId
);
peb64
->
OSPlatformId
,
NtCurrentTeb
()
->
Peb
->
OSPlatformId
);
ok
(
peb64
->
AnsiCodePageData
==
PtrToUlong
(
NtCurrentTeb
()
->
Peb
->
AnsiCodePageData
),
"wrong AnsiCodePageData %I64x / %p
\n
"
,
peb64
->
AnsiCodePageData
,
NtCurrentTeb
()
->
Peb
->
AnsiCodePageData
);
ok
(
peb64
->
OemCodePageData
==
PtrToUlong
(
NtCurrentTeb
()
->
Peb
->
OemCodePageData
),
"wrong OemCodePageData %I64x / %p
\n
"
,
peb64
->
OemCodePageData
,
NtCurrentTeb
()
->
Peb
->
OemCodePageData
);
ok
(
peb64
->
UnicodeCaseTableData
==
PtrToUlong
(
NtCurrentTeb
()
->
Peb
->
UnicodeCaseTableData
),
"wrong UnicodeCaseTableData %I64x / %p
\n
"
,
peb64
->
UnicodeCaseTableData
,
NtCurrentTeb
()
->
Peb
->
UnicodeCaseTableData
);
return
;
return
;
}
}
#endif
#endif
...
...
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