VerifyScripts

Compares two enumerated lists of scripts.

Syntax

BOOL VerifyScripts(
         DWORD dwFlags,
         LPCWSTR lpLocaleScripts,
         int cchLocaleScripts,
         LPCWSTR lpTestScripts,
         int cchTestScripts
)  

Parameters

dwFlags
Type: DWORD 

Flags specifying script verification options.

lpLocaleScripts
Type: LPCWSTR 

Pointer to the locale list, the enumerated list of scripts for a given locale. This list is typically populated by calling GetLocaleInfoEx with LCType set to LOCALE_SSCRIPTS.

cchLocaleScripts
Type: int 

Size, in characters, of the string indicated by lpLocaleScripts. The application sets this parameter to -1 if the string is null-terminated. If this parameter is set to 0, the function fails.

lpTestScripts
Type: LPCWSTR 

Pointer to the test list, a second enumerated list of scripts. This list is typically populated by calling GetStringScripts.

cchTestScripts
Type: int 

Size, in characters, of the string indicated by lpTestScripts. The application sets this parameter to -1 if the string is null-terminated. If this parameter is set to 0, the function fails.

Return value

Type: BOOL 

Returns TRUE if the test list is non-empty and all items in the list are also included in the locale list. The function still returns TRUE if the locale list contains more scripts than the test list, but all the test list scripts must be contained in the locale list. If VS_ALLOW_LATIN is specified in dwFlags, the function behaves as if “Latn;” is always in the locale list.

In all other cases, the function returns FALSE. This return can indicate that the test list contains an item that is not in the locale list, or it can indicate an error. To distinguish between these two cases, the application should call GetLastError, which can return one of the following error codes:

Remarks

This function compares strings, such as “Latn;Cyrl;”, that consist of a series of 4-character script names, with each script name followed by a semicolon. It also has a special case to account for the fact that the Latin script is often used in languages and locales for which it is not native.

This function is useful as part of a strategy to mitigate security issues related to internationalized domain names (IDNs).

The following are examples of the return of this function and a subsequent call to GetLastError in various scenarios. The last two examples illustrate, respectively, a case in which the test list lacks a terminating semicolon (malformed string) and a case in which the test list is empty.

Locale string Test string dwFlags Return value GetLastError return
Hani;Hira;Kana; Hani; * TRUE (unchanged)
Hani;Hira;Kana; Hani;Latn; 0 FALSE ERROR_SUCCESS
Hani;Hira;Kana; Hani;Latn; VS_ALLOW_LATIN TRUE (unchanged)
Hani;Hira;Kana; Cyrl; * FALSE ERROR_SUCCESS
Hani; Hani;Hira;Kana; * FALSE ERROR_SUCCESS
Hani;Hira;Kana; Cyrl * FALSE ERROR_INVALID_PARAMETER
Hani;Hira;Kana;   * TRUE (unchanged)

Requirements

Header: Declared in winnls.h.

Library: Use kernelx.lib.