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
ea9a776d
Commit
ea9a776d
authored
Mar 22, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Implement RtlIsValidLocaleName().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b631c147
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
11 deletions
+83
-11
locale.c
dlls/kernel32/tests/locale.c
+67
-11
locale.c
dlls/ntdll/locale.c
+14
-0
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-0
winternl.h
include/winternl.h
+1
-0
No files found.
dlls/kernel32/tests/locale.c
View file @
ea9a776d
...
...
@@ -63,6 +63,7 @@ static BOOL (WINAPI *pEnumSystemLocalesEx)(LOCALE_ENUMPROCEX, DWORD, LPARAM, LPV
static
INT
(
WINAPI
*
pLCMapStringEx
)(
LPCWSTR
,
DWORD
,
LPCWSTR
,
INT
,
LPWSTR
,
INT
,
LPNLSVERSIONINFO
,
LPVOID
,
LPARAM
);
static
LCID
(
WINAPI
*
pLocaleNameToLCID
)(
LPCWSTR
,
DWORD
);
static
NTSTATUS
(
WINAPI
*
pRtlLocaleNameToLcid
)(
LPCWSTR
,
LCID
*
,
DWORD
);
static
BOOLEAN
(
WINAPI
*
pRtlIsValidLocaleName
)(
const
WCHAR
*
,
ULONG
);
static
INT
(
WINAPI
*
pLCIDToLocaleName
)(
LCID
,
LPWSTR
,
INT
,
DWORD
);
static
BOOL
(
WINAPI
*
pIsValidLanguageGroup
)(
LGRPID
,
DWORD
);
static
INT
(
WINAPI
*
pIdnToNameprepUnicode
)(
DWORD
,
LPCWSTR
,
INT
,
LPWSTR
,
INT
);
...
...
@@ -145,6 +146,7 @@ static void InitFunctionPointers(void)
mod
=
GetModuleHandleA
(
"ntdll"
);
X
(
RtlUpcaseUnicodeChar
);
X
(
RtlLocaleNameToLcid
);
X
(
RtlIsValidLocaleName
);
X
(
RtlNormalizeString
);
X
(
RtlIsNormalizedString
);
X
(
NtGetNlsSectionPtr
);
...
...
@@ -4734,11 +4736,6 @@ static void test_GetLocaleInfoEx(void)
static
void
test_IsValidLocaleName
(
void
)
{
static
const
WCHAR
enusW
[]
=
{
'e'
,
'n'
,
'-'
,
'U'
,
'S'
,
0
};
static
const
WCHAR
enW
[]
=
{
'e'
,
'n'
,
0
};
static
const
WCHAR
zzW
[]
=
{
'z'
,
'z'
,
0
};
static
const
WCHAR
zz_zzW
[]
=
{
'z'
,
'z'
,
'-'
,
'Z'
,
'Z'
,
0
};
static
const
WCHAR
zzzzW
[]
=
{
'z'
,
'z'
,
'z'
,
'z'
,
0
};
BOOL
ret
;
if
(
!
pIsValidLocaleName
)
...
...
@@ -4747,20 +4744,79 @@ static void test_IsValidLocaleName(void)
return
;
}
ret
=
pIsValidLocaleName
(
enusW
);
ret
=
pIsValidLocaleName
(
L"en-US"
);
ok
(
ret
,
"IsValidLocaleName failed
\n
"
);
ret
=
pIsValidLocaleName
(
L"en"
);
ok
(
ret
,
"IsValidLocaleName failed
\n
"
);
ret
=
pIsValidLocaleName
(
L"es-es"
);
ok
(
ret
,
"IsValidLocaleName failed
\n
"
);
ret
=
pIsValidLocaleName
(
L"de-DE_phoneb"
);
ok
(
ret
,
"IsValidLocaleName failed
\n
"
);
ret
=
pIsValidLocaleName
(
enW
);
ret
=
pIsValidLocaleName
(
L"DE_de-phoneb"
);
ok
(
ret
||
broken
(
!
ret
),
"IsValidLocaleName failed
\n
"
);
ret
=
pIsValidLocaleName
(
zzW
);
ret
=
pIsValidLocaleName
(
L"DE_de_PHONEB"
);
ok
(
ret
||
broken
(
!
ret
),
"IsValidLocaleName failed
\n
"
);
ret
=
pIsValidLocaleName
(
L"DE_de+phoneb"
);
ok
(
!
ret
,
"IsValidLocaleName should have failed
\n
"
);
ret
=
pIsValidLocaleName
(
L"zz"
);
ok
(
!
ret
||
broken
(
ret
),
"IsValidLocaleName should have failed
\n
"
);
ret
=
pIsValidLocaleName
(
L"zz-ZZ"
);
ok
(
!
ret
||
broken
(
ret
),
"IsValidLocaleName should have failed
\n
"
);
ret
=
pIsValidLocaleName
(
zz_zzW
);
ret
=
pIsValidLocaleName
(
L"zzz"
);
ok
(
!
ret
||
broken
(
ret
),
"IsValidLocaleName should have failed
\n
"
);
ret
=
pIsValidLocaleName
(
zzzzW
);
ret
=
pIsValidLocaleName
(
L"zzz-ZZZ"
);
ok
(
!
ret
,
"IsValidLocaleName should have failed
\n
"
);
ret
=
pIsValidLocaleName
(
L"zzzz"
);
ok
(
!
ret
,
"IsValidLocaleName should have failed
\n
"
);
ret
=
pIsValidLocaleName
(
LOCALE_NAME_INVARIANT
);
ok
(
ret
,
"IsValidLocaleName failed
\n
"
);
ret
=
pIsValidLocaleName
(
NULL
);
ret
=
pIsValidLocaleName
(
LOCALE_NAME_USER_DEFAULT
);
ok
(
!
ret
,
"IsValidLocaleName should have failed
\n
"
);
ret
=
pIsValidLocaleName
(
LOCALE_NAME_SYSTEM_DEFAULT
);
ok
(
!
ret
,
"IsValidLocaleName should have failed
\n
"
);
if
(
!
pRtlIsValidLocaleName
)
{
win_skip
(
"RtlIsValidLocaleName not available
\n
"
);
return
;
}
ret
=
pRtlIsValidLocaleName
(
L"en-US"
,
0
);
ok
(
ret
,
"RtlIsValidLocaleName failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"en"
,
0
);
ok
(
!
ret
,
"RtlIsValidLocaleName should have failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"en"
,
1
);
ok
(
!
ret
,
"RtlIsValidLocaleName should have failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"en"
,
2
);
ok
(
ret
,
"RtlIsValidLocaleName failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"en-RR"
,
2
);
ok
(
!
ret
,
"RtlIsValidLocaleName should have failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"es-es"
,
0
);
ok
(
ret
,
"RtlIsValidLocaleName failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"de-DE_phoneb"
,
0
);
ok
(
ret
,
"RtlIsValidLocaleName failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"DE_de_PHONEB"
,
0
);
ok
(
ret
||
broken
(
!
ret
),
"RtlIsValidLocaleName failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"DE_de+phoneb"
,
0
);
ok
(
!
ret
,
"RtlIsValidLocaleName should have failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"zz"
,
0
);
ok
(
!
ret
,
"RtlIsValidLocaleName should have failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"zz"
,
2
);
ok
(
!
ret
,
"RtlIsValidLocaleName should have failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"zz-ZZ"
,
0
);
ok
(
!
ret
,
"RtlIsValidLocaleName should have failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"zzz"
,
0
);
ok
(
!
ret
,
"RtlIsValidLocaleName should have failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"zzz-ZZZ"
,
0
);
ok
(
!
ret
,
"RtlIsValidLocaleName should have failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
L"zzzz"
,
0
);
ok
(
!
ret
,
"RtlIsValidLocaleName should have failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
LOCALE_NAME_INVARIANT
,
0
);
ok
(
ret
,
"RtlIsValidLocaleName failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
LOCALE_NAME_USER_DEFAULT
,
0
);
ok
(
!
ret
,
"RtlIsValidLocaleName should have failed
\n
"
);
ret
=
pRtlIsValidLocaleName
(
LOCALE_NAME_SYSTEM_DEFAULT
,
0
);
ok
(
!
ret
,
"RtlIsValidLocaleName should have failed
\n
"
);
}
static
void
test_CompareStringOrdinal
(
void
)
...
...
dlls/ntdll/locale.c
View file @
ea9a776d
...
...
@@ -1225,6 +1225,20 @@ WCHAR __cdecl towupper( WCHAR ch )
/******************************************************************
* RtlIsValidLocaleName (NTDLL.@)
*/
BOOLEAN
WINAPI
RtlIsValidLocaleName
(
const
WCHAR
*
name
,
ULONG
flags
)
{
const
NLS_LOCALE_LCNAME_INDEX
*
entry
=
find_lcname_entry
(
name
);
if
(
!
entry
)
return
FALSE
;
/* reject neutral locale unless flag 2 is set */
if
(
!
(
flags
&
2
)
&&
!
get_locale_data
(
entry
->
idx
)
->
inotneutral
)
return
FALSE
;
return
TRUE
;
}
/******************************************************************
* RtlLocaleNameToLcid (NTDLL.@)
*/
NTSTATUS
WINAPI
RtlLocaleNameToLcid
(
const
WCHAR
*
name
,
LCID
*
lcid
,
ULONG
flags
)
...
...
dlls/ntdll/ntdll.spec
View file @
ea9a776d
...
...
@@ -834,6 +834,7 @@
# @ stub RtlIsThreadWithinLoaderCallout
@ stdcall RtlIsValidHandle(ptr ptr)
@ stdcall RtlIsValidIndexHandle(ptr long ptr)
@ stdcall RtlIsValidLocaleName(wstr long)
@ stdcall -arch=win32 -ret64 RtlLargeIntegerAdd(int64 int64)
@ stdcall -arch=win32 -ret64 RtlLargeIntegerArithmeticShift(int64 long)
@ stdcall -arch=win32 -ret64 RtlLargeIntegerDivide(int64 int64 ptr)
...
...
include/winternl.h
View file @
ea9a776d
...
...
@@ -4402,6 +4402,7 @@ NTSYSAPI BOOLEAN WINAPI RtlIsProcessorFeaturePresent(UINT);
NTSYSAPI
BOOLEAN
WINAPI
RtlIsTextUnicode
(
LPCVOID
,
INT
,
INT
*
);
NTSYSAPI
BOOLEAN
WINAPI
RtlIsValidHandle
(
const
RTL_HANDLE_TABLE
*
,
const
RTL_HANDLE
*
);
NTSYSAPI
BOOLEAN
WINAPI
RtlIsValidIndexHandle
(
const
RTL_HANDLE_TABLE
*
,
ULONG
Index
,
RTL_HANDLE
**
);
NTSYSAPI
BOOLEAN
WINAPI
RtlIsValidLocaleName
(
const
WCHAR
*
,
ULONG
);
NTSYSAPI
NTSTATUS
WINAPI
RtlLeaveCriticalSection
(
RTL_CRITICAL_SECTION
*
);
NTSYSAPI
DWORD
WINAPI
RtlLengthRequiredSid
(
DWORD
);
NTSYSAPI
ULONG
WINAPI
RtlLengthSecurityDescriptor
(
PSECURITY_DESCRIPTOR
);
...
...
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