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
1f70f72b
Commit
1f70f72b
authored
Mar 24, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Reimplement EnumUILanguages() using the locale.nls data.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e74b0dc8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
17 deletions
+41
-17
locale.c
dlls/kernel32/tests/locale.c
+4
-0
locale.c
dlls/kernelbase/locale.c
+37
-17
No files found.
dlls/kernel32/tests/locale.c
View file @
1f70f72b
...
...
@@ -3849,6 +3849,10 @@ static void test_EnumUILanguageA(void)
}
ok
(
ret
,
"Expected ret != 0, got %d, error %ld
\n
"
,
ret
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pEnumUILanguagesA
(
luilocale_proc1A
,
MUI_LANGUAGE_NAME
,
0
);
ok
(
ret
,
"Expected ret != 0, got %d, error %ld
\n
"
,
ret
,
GetLastError
());
enumCount
=
0
;
SetLastError
(
ERROR_SUCCESS
);
ret
=
pEnumUILanguagesA
(
luilocale_proc2A
,
0
,
0
);
...
...
dlls/kernelbase/locale.c
View file @
1f70f72b
...
...
@@ -3111,38 +3111,58 @@ BOOL WINAPI DECLSPEC_HOTPATCH Internal_EnumTimeFormats( TIMEFMT_ENUMPROCW proc,
BOOL
WINAPI
DECLSPEC_HOTPATCH
Internal_EnumUILanguages
(
UILANGUAGE_ENUMPROCW
proc
,
DWORD
flags
,
LONG_PTR
param
,
BOOL
unicode
)
{
WCHAR
name
[
10
];
DWORD
name_len
,
type
,
index
=
0
;
HKEY
key
;
WCHAR
name
W
[
LOCALE_NAME_MAX_LENGTH
];
char
nameA
[
LOCALE_NAME_MAX_LENGTH
]
;
DWORD
i
;
if
(
!
proc
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
flags
&
~
MUI_LANGUAGE_ID
)
if
(
flags
&
~
(
MUI_LANGUAGE_ID
|
MUI_LANGUAGE_NAME
)
)
{
SetLastError
(
ERROR_INVALID_FLAGS
);
return
FALSE
;
}
if
(
RegOpenKeyExW
(
nls_key
,
L"Locale"
,
0
,
KEY_READ
,
&
key
))
return
FALSE
;
for
(;;)
for
(
i
=
0
;
i
<
locale_table
->
nb_lcnames
;
i
++
)
{
name_len
=
ARRAY_SIZE
(
name
);
if
(
RegEnumValueW
(
key
,
index
++
,
name
,
&
name_len
,
NULL
,
&
type
,
NULL
,
NULL
))
break
;
if
(
type
!=
REG_SZ
)
continue
;
if
(
!
wcstoul
(
name
,
NULL
,
16
))
continue
;
if
(
!
unicode
)
if
(
!
lcnames_index
[
i
].
name
)
continue
;
/* skip invariant locale */
if
(
lcnames_index
[
i
].
id
&
0x80000000
)
continue
;
/* skip aliases */
if
(
!
get_locale_data
(
lcnames_index
[
i
].
idx
)
->
inotneutral
)
continue
;
/* skip neutral locales */
if
(
!
SORTIDFROMLCID
(
lcnames_index
[
i
].
id
)
!=
!
(
flags
&
LCID_ALTERNATE_SORTS
))
continue
;
/* skip alternate sorts */
if
(
flags
&
MUI_LANGUAGE_NAME
)
{
char
nameA
[
10
];
WideCharToMultiByte
(
CP_ACP
,
0
,
name
,
-
1
,
nameA
,
sizeof
(
nameA
),
NULL
,
NULL
);
if
(
!
((
UILANGUAGE_ENUMPROCA
)
proc
)(
nameA
,
param
))
break
;
const
WCHAR
*
str
=
locale_strings
+
lcnames_index
[
i
].
name
;
if
(
unicode
)
{
memcpy
(
nameW
,
str
+
1
,
(
*
str
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
!
proc
(
nameW
,
param
))
break
;
}
else
{
WideCharToMultiByte
(
CP_ACP
,
0
,
str
+
1
,
-
1
,
nameA
,
sizeof
(
nameA
),
NULL
,
NULL
);
if
(
!
((
UILANGUAGE_ENUMPROCA
)
proc
)(
nameA
,
param
))
break
;
}
}
else
{
if
(
lcnames_index
[
i
].
id
==
LOCALE_CUSTOM_UNSPECIFIED
)
continue
;
/* skip locales with no lcid */
if
(
unicode
)
{
swprintf
(
nameW
,
ARRAY_SIZE
(
nameW
),
L"%04lx"
,
lcnames_index
[
i
].
id
);
if
(
!
proc
(
nameW
,
param
))
break
;
}
else
{
sprintf
(
nameA
,
"%04x"
,
lcnames_index
[
i
].
id
);
if
(
!
((
UILANGUAGE_ENUMPROCA
)
proc
)(
nameA
,
param
))
break
;
}
}
else
if
(
!
proc
(
name
,
param
))
break
;
}
RegCloseKey
(
key
);
return
TRUE
;
}
...
...
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