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
8ccb24b1
Commit
8ccb24b1
authored
Mar 23, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move user/system locale initialization to ntdll.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d66d642d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
33 deletions
+25
-33
locale.c
dlls/kernelbase/locale.c
+2
-32
locale.c
dlls/ntdll/locale.c
+23
-1
No files found.
dlls/kernelbase/locale.c
View file @
8ccb24b1
...
@@ -699,27 +699,6 @@ done:
...
@@ -699,27 +699,6 @@ done:
}
}
static
LCID
locale_to_lcid
(
WCHAR
*
win_name
)
{
WCHAR
*
p
;
LCID
lcid
;
if
(
!
RtlLocaleNameToLcid
(
win_name
,
&
lcid
,
0
))
return
lcid
;
/* try neutral name */
if
((
p
=
wcsrchr
(
win_name
,
'-'
)))
{
*
p
=
0
;
if
(
!
RtlLocaleNameToLcid
(
win_name
,
&
lcid
,
2
))
{
if
(
SUBLANGID
(
lcid
)
==
SUBLANG_NEUTRAL
)
lcid
=
MAKELANGID
(
PRIMARYLANGID
(
lcid
),
SUBLANG_DEFAULT
);
return
lcid
;
}
}
return
0
;
}
/***********************************************************************
/***********************************************************************
* init_locale
* init_locale
*/
*/
...
@@ -728,7 +707,7 @@ void init_locale(void)
...
@@ -728,7 +707,7 @@ void init_locale(void)
UINT
ansi_cp
=
0
,
oem_cp
=
0
;
UINT
ansi_cp
=
0
,
oem_cp
=
0
;
USHORT
*
ansi_ptr
,
*
oem_ptr
;
USHORT
*
ansi_ptr
,
*
oem_ptr
;
void
*
sort_ptr
;
void
*
sort_ptr
;
LCID
user_lcid
=
0
,
system_lcid
=
0
;
LCID
user_lcid
;
WCHAR
bufferW
[
LOCALE_NAME_MAX_LENGTH
];
WCHAR
bufferW
[
LOCALE_NAME_MAX_LENGTH
];
DYNAMIC_TIME_ZONE_INFORMATION
timezone
;
DYNAMIC_TIME_ZONE_INFORMATION
timezone
;
GEOID
geoid
=
GEOID_NOT_AVAILABLE
;
GEOID
geoid
=
GEOID_NOT_AVAILABLE
;
...
@@ -738,16 +717,6 @@ void init_locale(void)
...
@@ -738,16 +717,6 @@ void init_locale(void)
if
(
GetEnvironmentVariableW
(
L"WINEUNIXCP"
,
bufferW
,
ARRAY_SIZE
(
bufferW
)
))
if
(
GetEnvironmentVariableW
(
L"WINEUNIXCP"
,
bufferW
,
ARRAY_SIZE
(
bufferW
)
))
unix_cp
=
wcstoul
(
bufferW
,
NULL
,
10
);
unix_cp
=
wcstoul
(
bufferW
,
NULL
,
10
);
if
(
GetEnvironmentVariableW
(
L"WINELOCALE"
,
bufferW
,
ARRAY_SIZE
(
bufferW
)
))
system_lcid
=
locale_to_lcid
(
bufferW
);
if
(
GetEnvironmentVariableW
(
L"WINEUSERLOCALE"
,
bufferW
,
ARRAY_SIZE
(
bufferW
)
))
user_lcid
=
locale_to_lcid
(
bufferW
);
if
(
!
system_lcid
)
system_lcid
=
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_DEFAULT
),
SORT_DEFAULT
);
if
(
!
user_lcid
)
user_lcid
=
system_lcid
;
NtSetDefaultUILanguage
(
LANGIDFROMLCID
(
user_lcid
)
);
NtSetDefaultLocale
(
TRUE
,
user_lcid
);
NtSetDefaultLocale
(
FALSE
,
system_lcid
);
kernel32_handle
=
GetModuleHandleW
(
L"kernel32.dll"
);
kernel32_handle
=
GetModuleHandleW
(
L"kernel32.dll"
);
...
@@ -806,6 +775,7 @@ void init_locale(void)
...
@@ -806,6 +775,7 @@ void init_locale(void)
/* Update registry contents if the user locale has changed.
/* Update registry contents if the user locale has changed.
* This simulates the action of the Windows control panel. */
* This simulates the action of the Windows control panel. */
user_lcid
=
GetUserDefaultLCID
();
count
=
sizeof
(
bufferW
);
count
=
sizeof
(
bufferW
);
if
(
!
RegQueryValueExW
(
intl_key
,
L"Locale"
,
NULL
,
NULL
,
(
BYTE
*
)
bufferW
,
&
count
))
if
(
!
RegQueryValueExW
(
intl_key
,
L"Locale"
,
NULL
,
NULL
,
(
BYTE
*
)
bufferW
,
&
count
))
{
{
...
...
dlls/ntdll/locale.c
View file @
8ccb24b1
...
@@ -273,8 +273,10 @@ static const NLS_LOCALE_DATA *get_locale_data( UINT idx )
...
@@ -273,8 +273,10 @@ static const NLS_LOCALE_DATA *get_locale_data( UINT idx )
void
locale_init
(
void
)
void
locale_init
(
void
)
{
{
WCHAR
locale
[
LOCALE_NAME_MAX_LENGTH
];
UNICODE_STRING
name
,
value
;
LARGE_INTEGER
unused
;
LARGE_INTEGER
unused
;
LCID
system_lcid
;
LCID
system_lcid
,
user_lcid
=
0
;
NTSTATUS
status
;
NTSTATUS
status
;
struct
struct
{
{
...
@@ -298,6 +300,26 @@ void locale_init(void)
...
@@ -298,6 +300,26 @@ void locale_init(void)
lcids_index
=
(
const
NLS_LOCALE_LCID_INDEX
*
)((
char
*
)
locale_table
+
locale_table
->
lcids_offset
);
lcids_index
=
(
const
NLS_LOCALE_LCID_INDEX
*
)((
char
*
)
locale_table
+
locale_table
->
lcids_offset
);
lcnames_index
=
(
const
NLS_LOCALE_LCNAME_INDEX
*
)((
char
*
)
locale_table
+
locale_table
->
lcnames_offset
);
lcnames_index
=
(
const
NLS_LOCALE_LCNAME_INDEX
*
)((
char
*
)
locale_table
+
locale_table
->
lcnames_offset
);
locale_strings
=
(
const
WCHAR
*
)((
char
*
)
locale_table
+
locale_table
->
strings_offset
);
locale_strings
=
(
const
WCHAR
*
)((
char
*
)
locale_table
+
locale_table
->
strings_offset
);
value
.
Buffer
=
locale
;
value
.
MaximumLength
=
sizeof
(
locale
);
RtlInitUnicodeString
(
&
name
,
L"WINELOCALE"
);
if
(
!
RtlQueryEnvironmentVariable_U
(
NULL
,
&
name
,
&
value
))
{
const
NLS_LOCALE_LCNAME_INDEX
*
entry
=
find_lcname_entry
(
locale
);
if
(
entry
)
system_lcid
=
get_locale_data
(
entry
->
idx
)
->
idefaultlanguage
;
}
RtlInitUnicodeString
(
&
name
,
L"WINEUSERLOCALE"
);
if
(
!
RtlQueryEnvironmentVariable_U
(
NULL
,
&
name
,
&
value
))
{
const
NLS_LOCALE_LCNAME_INDEX
*
entry
=
find_lcname_entry
(
locale
);
if
(
entry
)
user_lcid
=
get_locale_data
(
entry
->
idx
)
->
idefaultlanguage
;
}
if
(
!
system_lcid
)
system_lcid
=
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_DEFAULT
);
if
(
!
user_lcid
)
user_lcid
=
system_lcid
;
NtSetDefaultUILanguage
(
user_lcid
);
NtSetDefaultLocale
(
TRUE
,
user_lcid
);
NtSetDefaultLocale
(
FALSE
,
system_lcid
);
}
}
...
...
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