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
5dfc2a34
Commit
5dfc2a34
authored
Jul 26, 2012
by
Austin English
Committed by
Alexandre Julliard
Aug 16, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Implement IsValidLocaleName (with tests).
parent
e9c368c9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
0 deletions
+43
-0
kernel32.spec
dlls/kernel32/kernel32.spec
+1
-0
locale.c
dlls/kernel32/locale.c
+15
-0
locale.c
dlls/kernel32/tests/locale.c
+27
-0
No files found.
dlls/kernel32/kernel32.spec
View file @
5dfc2a34
...
...
@@ -779,6 +779,7 @@
@ stdcall IsValidCodePage(long)
@ stdcall IsValidLanguageGroup(long long)
@ stdcall IsValidLocale(long long)
@ stdcall IsValidLocaleName(wstr)
# @ stub IsValidUILanguage
@ stdcall IsWow64Process(ptr ptr)
@ stdcall K32EmptyWorkingSet(long)
...
...
dlls/kernel32/locale.c
View file @
5dfc2a34
...
...
@@ -2210,6 +2210,21 @@ BOOL WINAPI IsValidLocale( LCID lcid, DWORD flags )
(
LPCWSTR
)
LOCALE_ILANGUAGE
,
LANGIDFROMLCID
(
lcid
))
!=
0
;
}
/******************************************************************************
* IsValidLocaleName (KERNEL32.@)
*/
BOOL
WINAPI
IsValidLocaleName
(
LPCWSTR
locale
)
{
struct
locale_name
locale_name
;
/* string parsing */
parse_locale_name
(
locale
,
&
locale_name
);
TRACE
(
"found lcid %x for %s, matches %d
\n
"
,
locale_name
.
lcid
,
debugstr_w
(
locale
),
locale_name
.
matches
);
return
locale_name
.
matches
>
0
;
}
static
BOOL
CALLBACK
enum_lang_proc_a
(
HMODULE
hModule
,
LPCSTR
type
,
LPCSTR
name
,
WORD
LangID
,
LONG_PTR
lParam
)
...
...
dlls/kernel32/tests/locale.c
View file @
5dfc2a34
...
...
@@ -86,6 +86,7 @@ static INT (WINAPI *pIdnToNameprepUnicode)(DWORD, LPCWSTR, INT, LPWSTR, INT);
static
INT
(
WINAPI
*
pIdnToAscii
)(
DWORD
,
LPCWSTR
,
INT
,
LPWSTR
,
INT
);
static
INT
(
WINAPI
*
pIdnToUnicode
)(
DWORD
,
LPCWSTR
,
INT
,
LPWSTR
,
INT
);
static
INT
(
WINAPI
*
pGetLocaleInfoEx
)(
LPCWSTR
,
LCTYPE
,
LPWSTR
,
INT
);
static
BOOL
(
WINAPI
*
pIsValidLocaleName
)(
LPCWSTR
);
static
void
InitFunctionPointers
(
void
)
{
...
...
@@ -104,6 +105,7 @@ static void InitFunctionPointers(void)
pIdnToAscii
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"IdnToAscii"
);
pIdnToUnicode
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"IdnToUnicode"
);
pGetLocaleInfoEx
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"GetLocaleInfoEx"
);
pIsValidLocaleName
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"IsValidLocaleName"
);
}
#define eq(received, expected, label, type) \
...
...
@@ -3435,6 +3437,30 @@ todo_wine
}
}
static
void
test_IsValidLocaleName
(
void
)
{
static
const
WCHAR
enW
[]
=
{
'e'
,
'n'
,
0
};
static
const
WCHAR
enusW
[]
=
{
'e'
,
'n'
,
'-'
,
'U'
,
'S'
,
0
};
static
const
WCHAR
zzW
[]
=
{
'z'
,
'z'
,
0
};
static
const
WCHAR
zzzzW
[]
=
{
'z'
,
'z'
,
'-'
,
'Z'
,
'Z'
,
0
};
BOOL
ret
;
if
(
!
pIsValidLocaleName
)
{
win_skip
(
"IsValidLocaleName not supported
\n
"
);
return
;
}
ret
=
pIsValidLocaleName
(
enW
);
ok
(
ret
,
"IsValidLocaleName failed
\n
"
);
ret
=
pIsValidLocaleName
(
enusW
);
ok
(
ret
,
"IsValidLocaleName failed
\n
"
);
ret
=
pIsValidLocaleName
(
zzW
);
ok
(
!
ret
,
"IsValidLocaleName should have failed
\n
"
);
ret
=
pIsValidLocaleName
(
zzzzW
);
ok
(
!
ret
,
"IsValidLocaleName should have failed
\n
"
);
}
START_TEST
(
locale
)
{
InitFunctionPointers
();
...
...
@@ -3468,6 +3494,7 @@ START_TEST(locale)
test_IdnToNameprepUnicode
();
test_IdnToAscii
();
test_IdnToUnicode
();
test_IsValidLocaleName
();
/* this requires collation table patch to make it MS compatible */
if
(
0
)
test_sorting
();
}
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