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
84cca2ba
Commit
84cca2ba
authored
Mar 20, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Implement IsValidNLSVersion().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
86522976
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
116 additions
and
1 deletion
+116
-1
kernel32.spec
dlls/kernel32/kernel32.spec
+1
-0
locale.c
dlls/kernel32/tests/locale.c
+80
-0
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+1
-1
locale.c
dlls/kernelbase/locale.c
+33
-0
winnls.h
include/winnls.h
+1
-0
No files found.
dlls/kernel32/kernel32.spec
View file @
84cca2ba
...
...
@@ -995,6 +995,7 @@
@ stdcall -import IsValidLanguageGroup(long long)
@ stdcall -import IsValidLocale(long long)
@ stdcall -import IsValidLocaleName(wstr)
@ stdcall -import IsValidNLSVersion(long wstr ptr)
# @ stub IsValidUILanguage
@ stdcall -import IsWow64Process(ptr ptr)
@ stdcall K32EmptyWorkingSet(long)
...
...
dlls/kernel32/tests/locale.c
View file @
84cca2ba
...
...
@@ -87,6 +87,7 @@ static INT (WINAPI *pNormalizeString)(NORM_FORM, LPCWSTR, INT, LPWSTR, INT);
static
INT
(
WINAPI
*
pFindStringOrdinal
)(
DWORD
,
LPCWSTR
lpStringSource
,
INT
,
LPCWSTR
,
INT
,
BOOL
);
static
BOOL
(
WINAPI
*
pGetNLSVersion
)(
NLS_FUNCTION
,
LCID
,
NLSVERSIONINFO
*
);
static
BOOL
(
WINAPI
*
pGetNLSVersionEx
)(
NLS_FUNCTION
,
LPCWSTR
,
NLSVERSIONINFOEX
*
);
static
DWORD
(
WINAPI
*
pIsValidNLSVersion
)(
NLS_FUNCTION
,
LPCWSTR
,
NLSVERSIONINFOEX
*
);
static
NTSTATUS
(
WINAPI
*
pRtlNormalizeString
)(
ULONG
,
LPCWSTR
,
INT
,
LPWSTR
,
INT
*
);
static
NTSTATUS
(
WINAPI
*
pRtlIsNormalizedString
)(
ULONG
,
LPCWSTR
,
INT
,
BOOLEAN
*
);
static
NTSTATUS
(
WINAPI
*
pNtGetNlsSectionPtr
)(
ULONG
,
ULONG
,
void
*
,
void
**
,
SIZE_T
*
);
...
...
@@ -129,6 +130,7 @@ static void InitFunctionPointers(void)
X
(
FindStringOrdinal
);
X
(
GetNLSVersion
);
X
(
GetNLSVersionEx
);
X
(
IsValidNLSVersion
);
mod
=
GetModuleHandleA
(
"ntdll"
);
X
(
RtlUpcaseUnicodeChar
);
...
...
@@ -6763,6 +6765,84 @@ static void test_NLSVersion(void)
else
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
}
else
win_skip
(
"GetNLSVersionEx not available
\n
"
);
if
(
pIsValidNLSVersion
)
{
info
.
dwNLSVersionInfoSize
=
sizeof
(
info
);
pGetNLSVersion
(
COMPARE_STRING
,
LOCALE_USER_DEFAULT
,
(
NLSVERSIONINFO
*
)
&
info
);
SetLastError
(
0xdeadbeef
);
info
.
dwNLSVersionInfoSize
=
sizeof
(
info
);
ret
=
pIsValidNLSVersion
(
COMPARE_STRING
,
L"ja-JP"
,
&
info
);
ok
(
ret
,
"IsValidNLSVersion failed err %u
\n
"
,
GetLastError
()
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
info
.
dwNLSVersionInfoSize
=
offsetof
(
NLSVERSIONINFO
,
dwEffectiveId
);
ret
=
pIsValidNLSVersion
(
COMPARE_STRING
,
L"en-US"
,
&
info
);
ok
(
ret
,
"IsValidNLSVersion failed err %u
\n
"
,
GetLastError
()
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
info
.
dwNLSVersionInfoSize
=
sizeof
(
info
);
ret
=
pIsValidNLSVersion
(
2
,
L"en-US"
,
&
info
);
ok
(
!
ret
,
"IsValidNLSVersion succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
info
.
dwNLSVersionInfoSize
=
sizeof
(
info
);
ret
=
pIsValidNLSVersion
(
COMPARE_STRING
,
L"foobar"
,
&
info
);
ok
(
!
ret
,
"IsValidNLSVersion succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
memset
(
&
info
,
0xcc
,
sizeof
(
info
)
);
info
.
dwNLSVersionInfoSize
=
sizeof
(
info
);
ret
=
pIsValidNLSVersion
(
COMPARE_STRING
,
L"en-US"
,
&
info
);
ok
(
!
ret
,
"IsValidNLSVersion succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"wrong error %u
\n
"
,
GetLastError
()
);
info
.
dwNLSVersionInfoSize
=
sizeof
(
info
);
pGetNLSVersion
(
COMPARE_STRING
,
LOCALE_USER_DEFAULT
,
(
NLSVERSIONINFO
*
)
&
info
);
info
.
dwNLSVersion
++
;
SetLastError
(
0xdeadbeef
);
ret
=
pIsValidNLSVersion
(
COMPARE_STRING
,
L"en-US"
,
&
info
);
ok
(
ret
,
"IsValidNLSVersion failed err %u
\n
"
,
GetLastError
()
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
info
.
dwNLSVersion
+=
0x100
;
SetLastError
(
0xdeadbeef
);
ret
=
pIsValidNLSVersion
(
COMPARE_STRING
,
L"en-US"
,
&
info
);
ok
(
!
ret
,
"IsValidNLSVersion succeeded
\n
"
);
ok
(
GetLastError
()
==
0
,
"wrong error %u
\n
"
,
GetLastError
()
);
info
.
dwNLSVersion
-=
0x200
;
SetLastError
(
0xdeadbeef
);
ret
=
pIsValidNLSVersion
(
COMPARE_STRING
,
L"en-US"
,
&
info
);
ok
(
!
ret
,
"IsValidNLSVersion succeeded
\n
"
);
ok
(
GetLastError
()
==
0
,
"wrong error %u
\n
"
,
GetLastError
()
);
info
.
dwNLSVersion
+=
0x100
;
info
.
dwDefinedVersion
+=
0x100
;
SetLastError
(
0xdeadbeef
);
ret
=
pIsValidNLSVersion
(
COMPARE_STRING
,
L"en-US"
,
&
info
);
ok
(
ret
,
"IsValidNLSVersion failed err %u
\n
"
,
GetLastError
()
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
info
.
dwDefinedVersion
-=
0x100
;
info
.
guidCustomVersion
.
Data1
=
0x123
;
SetLastError
(
0xdeadbeef
);
ret
=
pIsValidNLSVersion
(
COMPARE_STRING
,
L"en-US"
,
&
info
);
ok
(
!
ret
,
"IsValidNLSVersion succeeded
\n
"
);
ok
(
GetLastError
()
==
0
,
"wrong error %u
\n
"
,
GetLastError
()
);
info
.
guidCustomVersion
=
guid_null
;
SetLastError
(
0xdeadbeef
);
ret
=
pIsValidNLSVersion
(
COMPARE_STRING
,
L"en-US"
,
&
info
);
ok
(
ret
,
"IsValidNLSVersion failed err %u
\n
"
,
GetLastError
()
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
}
else
win_skip
(
"IsValidNLSVersion not available
\n
"
);
}
START_TEST
(
locale
)
...
...
dlls/kernelbase/kernelbase.spec
View file @
84cca2ba
...
...
@@ -878,7 +878,7 @@
@ stdcall IsValidLanguageGroup(long long)
@ stdcall IsValidLocale(long long)
@ stdcall IsValidLocaleName(wstr)
# @ stub IsValidNLSVersion
@ stdcall IsValidNLSVersion(long wstr ptr)
@ stub IsValidRelativeSecurityDescriptor
@ stdcall IsValidSecurityDescriptor(ptr)
@ stdcall IsValidSid(ptr)
...
...
dlls/kernelbase/locale.c
View file @
84cca2ba
...
...
@@ -4860,6 +4860,39 @@ BOOL WINAPI DECLSPEC_HOTPATCH IsValidLocaleName( const WCHAR *locale )
}
/******************************************************************************
* IsValidNLSVersion (kernelbase.@)
*/
DWORD
WINAPI
DECLSPEC_HOTPATCH
IsValidNLSVersion
(
NLS_FUNCTION
func
,
const
WCHAR
*
locale
,
NLSVERSIONINFOEX
*
info
)
{
static
const
GUID
GUID_NULL
;
NLSVERSIONINFOEX
infoex
;
DWORD
ret
;
if
(
func
!=
COMPARE_STRING
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
info
->
dwNLSVersionInfoSize
<
sizeof
(
*
info
)
&&
(
info
->
dwNLSVersionInfoSize
!=
offsetof
(
NLSVERSIONINFO
,
dwEffectiveId
)))
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
infoex
.
dwNLSVersionInfoSize
=
sizeof
(
infoex
);
if
(
!
GetNLSVersionEx
(
func
,
locale
,
&
infoex
))
return
FALSE
;
ret
=
(
infoex
.
dwNLSVersion
&
~
0xff
)
==
(
info
->
dwNLSVersion
&
~
0xff
);
if
(
ret
&&
!
IsEqualGUID
(
&
info
->
guidCustomVersion
,
&
GUID_NULL
))
ret
=
find_sortguid
(
&
info
->
guidCustomVersion
)
!=
NULL
;
if
(
!
ret
)
SetLastError
(
ERROR_SUCCESS
);
return
ret
;
}
/***********************************************************************
* LCIDToLocaleName (kernelbase.@)
*/
...
...
include/winnls.h
View file @
84cca2ba
...
...
@@ -957,6 +957,7 @@ WINBASEAPI BOOL WINAPI IsValidCodePage(UINT);
WINBASEAPI
BOOL
WINAPI
IsValidLanguageGroup
(
LGRPID
,
DWORD
);
WINBASEAPI
BOOL
WINAPI
IsValidLocale
(
LCID
,
DWORD
);
WINBASEAPI
BOOL
WINAPI
IsValidLocaleName
(
LPCWSTR
);
WINBASEAPI
DWORD
WINAPI
IsValidNLSVersion
(
NLS_FUNCTION
,
LPCWSTR
,
NLSVERSIONINFOEX
*
);
WINBASEAPI
INT
WINAPI
LCIDToLocaleName
(
LCID
,
LPWSTR
,
INT
,
DWORD
);
WINBASEAPI
INT
WINAPI
LCMapStringA
(
LCID
,
DWORD
,
LPCSTR
,
INT
,
LPSTR
,
INT
);
WINBASEAPI
INT
WINAPI
LCMapStringW
(
LCID
,
DWORD
,
LPCWSTR
,
INT
,
LPWSTR
,
INT
);
...
...
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