Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
d05c9f12
Commit
d05c9f12
authored
Nov 27, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Initialize codepage data using ntdll functions.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fbb41150
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
locale.c
dlls/kernelbase/locale.c
+18
-5
No files found.
dlls/kernelbase/locale.c
View file @
d05c9f12
...
...
@@ -94,8 +94,7 @@ static const struct registry_value
{
LOCALE_ITIMEMARKPOSN
,
L"iTimePrefix"
},
};
static
UINT
ansi_cp
=
1252
;
static
UINT
oem_cp
=
437
;
static
NLSTABLEINFO
nls_info
;
static
UINT
mac_cp
=
10000
;
static
HKEY
intl_key
;
static
HKEY
nls_key
;
...
...
@@ -106,9 +105,12 @@ static HKEY nls_key;
*/
void
init_locale
(
void
)
{
UINT
ansi_cp
=
0
,
oem_cp
=
0
;
USHORT
*
ansi_ptr
,
*
oem_ptr
,
*
casemap_ptr
;
LCID
lcid
=
GetUserDefaultLCID
();
WCHAR
bufferW
[
80
];
DWORD
count
,
i
;
SIZE_T
size
;
HKEY
hkey
;
kernel32_handle
=
GetModuleHandleW
(
L"kernel32.dll"
);
...
...
@@ -120,6 +122,17 @@ void init_locale(void)
GetLocaleInfoW
(
LOCALE_SYSTEM_DEFAULT
,
LOCALE_IDEFAULTCODEPAGE
|
LOCALE_RETURN_NUMBER
,
(
WCHAR
*
)
&
oem_cp
,
sizeof
(
oem_cp
)
/
sizeof
(
WCHAR
)
);
NtGetNlsSectionPtr
(
10
,
0
,
0
,
(
void
**
)
&
casemap_ptr
,
&
size
);
if
(
!
ansi_cp
||
NtGetNlsSectionPtr
(
11
,
ansi_cp
,
NULL
,
(
void
**
)
&
ansi_ptr
,
&
size
))
NtGetNlsSectionPtr
(
11
,
1252
,
NULL
,
(
void
**
)
&
ansi_ptr
,
&
size
);
if
(
!
oem_cp
||
NtGetNlsSectionPtr
(
11
,
oem_cp
,
0
,
(
void
**
)
&
oem_ptr
,
&
size
))
NtGetNlsSectionPtr
(
11
,
437
,
NULL
,
(
void
**
)
&
oem_ptr
,
&
size
);
NtCurrentTeb
()
->
Peb
->
AnsiCodePageData
=
ansi_ptr
;
NtCurrentTeb
()
->
Peb
->
OemCodePageData
=
oem_ptr
;
NtCurrentTeb
()
->
Peb
->
UnicodeCaseTableData
=
casemap_ptr
;
RtlInitNlsTables
(
ansi_ptr
,
oem_ptr
,
casemap_ptr
,
&
nls_info
);
RtlResetRtlTranslations
(
&
nls_info
);
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
L"System
\\
CurrentControlSet
\\
Control
\\
Nls"
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
KEY_ALL_ACCESS
,
NULL
,
&
nls_key
,
NULL
);
RegCreateKeyExW
(
HKEY_CURRENT_USER
,
L"Control Panel
\\
International"
,
...
...
@@ -163,7 +176,7 @@ void init_locale(void)
static
UINT
get_lcid_codepage
(
LCID
lcid
,
ULONG
flags
)
{
UINT
ret
=
CP_ACP
;
UINT
ret
=
GetACP
()
;
if
(
!
(
flags
&
LOCALE_USE_CP_ACP
)
&&
lcid
!=
GetSystemDefaultLCID
())
GetLocaleInfoW
(
lcid
,
LOCALE_IDEFAULTANSICODEPAGE
|
LOCALE_RETURN_NUMBER
,
...
...
@@ -837,7 +850,7 @@ INT WINAPI DECLSPEC_HOTPATCH FindStringOrdinal( DWORD flag, const WCHAR *src, IN
*/
UINT
WINAPI
GetACP
(
void
)
{
return
ansi_cp
;
return
nls_info
.
AnsiTableInfo
.
CodePage
;
}
...
...
@@ -1111,7 +1124,7 @@ INT WINAPI DECLSPEC_HOTPATCH GetLocaleInfoEx( const WCHAR *locale, LCTYPE info,
*/
UINT
WINAPI
GetOEMCP
(
void
)
{
return
oem_cp
;
return
nls_info
.
OemTableInfo
.
CodePage
;
}
...
...
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