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
21b6d994
Commit
21b6d994
authored
Mar 18, 2012
by
André Hentschel
Committed by
Alexandre Julliard
Mar 27, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Handle LOCALE_NAME_USER_DEFAULT with tests.
parent
32612b7d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
0 deletions
+66
-0
locale.c
dlls/kernel32/locale.c
+4
-0
locale.c
dlls/kernel32/tests/locale.c
+42
-0
winnls.h
include/winnls.h
+19
-0
winnt.h
include/winnt.h
+1
-0
No files found.
dlls/kernel32/locale.c
View file @
21b6d994
...
...
@@ -976,6 +976,10 @@ LCID WINAPI LocaleNameToLCID( LPCWSTR name, DWORD flags )
if
(
flags
)
FIXME
(
"unsupported flags %x
\n
"
,
flags
);
if
(
name
==
LOCALE_NAME_USER_DEFAULT
)
return
GetUserDefaultLCID
();
/* string parsing */
parse_locale_name
(
name
,
&
locale_name
);
TRACE
(
"found lcid %x for %s, matches %d
\n
"
,
...
...
dlls/kernel32/tests/locale.c
View file @
21b6d994
...
...
@@ -71,6 +71,8 @@ static BOOL (WINAPI *pEnumSystemLanguageGroupsA)(LANGUAGEGROUP_ENUMPROC, DWORD,
static
BOOL
(
WINAPI
*
pEnumLanguageGroupLocalesA
)(
LANGGROUPLOCALE_ENUMPROC
,
LGRPID
,
DWORD
,
LONG_PTR
);
static
BOOL
(
WINAPI
*
pEnumUILanguagesA
)(
UILANGUAGE_ENUMPROC
,
DWORD
,
LONG_PTR
);
static
BOOL
(
WINAPI
*
pEnumSystemLocalesEx
)(
LOCALE_ENUMPROCEX
,
DWORD
,
LPARAM
,
LPVOID
);
static
LCID
(
WINAPI
*
pLocaleNameToLCID
)(
LPCWSTR
,
DWORD
);
static
INT
(
WINAPI
*
pLCIDToLocaleName
)(
LCID
,
LPWSTR
,
INT
,
DWORD
);
static
INT
(
WINAPI
*
pFoldStringA
)(
DWORD
,
LPCSTR
,
INT
,
LPSTR
,
INT
);
static
INT
(
WINAPI
*
pFoldStringW
)(
DWORD
,
LPCWSTR
,
INT
,
LPWSTR
,
INT
);
static
BOOL
(
WINAPI
*
pIsValidLanguageGroup
)(
LGRPID
,
DWORD
);
...
...
@@ -80,6 +82,8 @@ static void InitFunctionPointers(void)
hKernel32
=
GetModuleHandleA
(
"kernel32"
);
pEnumSystemLanguageGroupsA
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"EnumSystemLanguageGroupsA"
);
pEnumLanguageGroupLocalesA
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"EnumLanguageGroupLocalesA"
);
pLocaleNameToLCID
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"LocaleNameToLCID"
);
pLCIDToLocaleName
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"LCIDToLocaleName"
);
pFoldStringA
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"FoldStringA"
);
pFoldStringW
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"FoldStringW"
);
pIsValidLanguageGroup
=
(
void
*
)
GetProcAddress
(
hKernel32
,
"IsValidLanguageGroup"
);
...
...
@@ -1637,6 +1641,43 @@ static void test_LCMapStringW(void)
"unexpected error code %d
\n
"
,
GetLastError
());
}
static
void
test_LocaleNames
(
void
)
{
LCID
lcid
;
INT
ret
;
WCHAR
buffer
[
LOCALE_NAME_MAX_LENGTH
];
if
(
!
pLocaleNameToLCID
)
{
win_skip
(
"LocaleNameToLCID not available
\n
"
);
return
;
}
/* special cases */
buffer
[
0
]
=
0
;
lcid
=
pLocaleNameToLCID
(
LOCALE_NAME_USER_DEFAULT
,
0
);
ok
(
lcid
==
GetUserDefaultLCID
()
||
broken
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
/* Vista */
),
"Expected lcid == %08x, got %08x, error %d
\n
"
,
lcid
,
GetUserDefaultLCID
(),
GetLastError
());
ret
=
pLCIDToLocaleName
(
lcid
,
buffer
,
LOCALE_NAME_MAX_LENGTH
,
0
);
ok
(
ret
>
0
,
"Expected ret > 0, got %d, error %d
\n
"
,
ret
,
GetLastError
());
trace
(
"%08x, %s
\n
"
,
lcid
,
wine_dbgstr_w
(
buffer
));
buffer
[
0
]
=
0
;
lcid
=
pLocaleNameToLCID
(
LOCALE_NAME_SYSTEM_DEFAULT
,
0
);
todo_wine
ok
(
!
lcid
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected lcid != 0, got %08x, error %d
\n
"
,
lcid
,
GetLastError
());
ret
=
pLCIDToLocaleName
(
lcid
,
buffer
,
LOCALE_NAME_MAX_LENGTH
,
0
);
ok
(
ret
>
0
,
"Expected ret > 0, got %d, error %d
\n
"
,
ret
,
GetLastError
());
trace
(
"%08x, %s
\n
"
,
lcid
,
wine_dbgstr_w
(
buffer
));
buffer
[
0
]
=
0
;
lcid
=
pLocaleNameToLCID
(
LOCALE_NAME_INVARIANT
,
0
);
todo_wine
ok
(
lcid
==
0x7F
,
"Expected lcid = 0x7F, got %08x, error %d
\n
"
,
lcid
,
GetLastError
());
ret
=
pLCIDToLocaleName
(
lcid
,
buffer
,
LOCALE_NAME_MAX_LENGTH
,
0
);
ok
(
ret
>
0
,
"Expected ret > 0, got %d, error %d
\n
"
,
ret
,
GetLastError
());
trace
(
"%08x, %s
\n
"
,
lcid
,
wine_dbgstr_w
(
buffer
));
}
/* this requires collation table patch to make it MS compatible */
static
const
char
*
const
strings_sorted
[]
=
{
...
...
@@ -2782,6 +2823,7 @@ START_TEST(locale)
test_CompareStringA
();
test_LCMapStringA
();
test_LCMapStringW
();
test_LocaleNames
();
test_FoldStringA
();
test_FoldStringW
();
test_ConvertDefaultLocale
();
...
...
include/winnls.h
View file @
21b6d994
...
...
@@ -321,6 +321,25 @@ extern "C" {
#define LOCALE_SSORTNAME 0x1013
#define LOCALE_IDIGITSUBSTITUTION 0x1014
/* Locale name special values */
#if defined(__GNUC__)
# define LOCALE_NAME_INVARIANT (const WCHAR []){ 0 }
#elif defined(_MSC_VER)
# define LOCALE_NAME_INVARIANT L""
#else
static
const
WCHAR
LOCALE_NAME_INVARIANT
[]
=
{
0
};
#endif
#if defined(__GNUC__)
# define LOCALE_NAME_SYSTEM_DEFAULT (const WCHAR []){'!','s','y','s','-','d','e','f','a','u','l','t','-','l','o','c','a','l','e',0}
#elif defined(_MSC_VER)
# define LOCALE_NAME_SYSTEM_DEFAULT L"!sys-default-locale"
#else
static
const
WCHAR
LOCALE_NAME_SYSTEM_DEFAULT
[]
=
{
'!'
,
's'
,
'y'
,
's'
,
'-'
,
'd'
,
'e'
,
'f'
,
'a'
,
'u'
,
'l'
,
't'
,
'-'
,
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'e'
,
0
};
#endif
#define LOCALE_NAME_USER_DEFAULT NULL
#define LOCALE_IDEFAULTUNIXCODEPAGE 0x1030
/* Wine extension */
#define NORM_IGNORECASE 0x00001
...
...
include/winnt.h
View file @
21b6d994
...
...
@@ -1985,6 +1985,7 @@ NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*);
#define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_DEFAULT),SORT_DEFAULT))
#define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_UNSPECIFIED),SORT_DEFAULT))
#define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_UI_CUSTOM_DEFAULT),SORT_DEFAULT))
#define LOCALE_NAME_MAX_LENGTH 85
#define UNREFERENCED_PARAMETER(u) (void)(u)
...
...
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