ReactOS 0.4.15-dev-7928-g68a8619
lang.c File Reference
#include <k32.h>
#include <debug.h>
#include "lcformat_private.h"
#include "full2half.h"
#include "dakuten.h"
#include "sim2tra.h"
#include "tra2sim.h"
Include dependency graph for lang.c:

Go to the source code of this file.

Classes

struct  locale_name
 
struct  registry_value
 
struct  enum_locale_ex_data
 
struct  tagWCHAR_PAIR
 
struct  ENUMLANGUAGEGROUP_CALLBACKS
 
struct  ENUMLANGUAGEGROUPLOCALE_CALLBACKS
 
struct  geoinfo_t
 
struct  ENUMSYSTEMCODEPAGES_CALLBACKS
 
struct  ENUM_UILANG_CALLBACK
 

Macros

#define NDEBUG
 
#define WINVER   DLL_EXPORT_VERSION
 
#define LOCALE_NAME_USER_DEFAULT   NULL
 
#define REG_SZ   1
 
#define NLSRC_OFFSET   5000 /* FIXME */
 
#define LOCALE_LOCALEINFOFLAGSMASK
 
#define DEFINE_FULL2HALF(full, half1, half2)   { full, half1, half2 },
 
#define GET_FULL(table, index)   ((table)[index][0])
 
#define GET_HALF1(table, index)   ((table)[index][1])
 
#define GET_HALF2(table, index)   ((table)[index][2])
 
#define DEFINE_DAKUTEN(voiced, single1, single2, half1, half2)   { voiced, single1, single2 },
 
#define GET_VOICED(table, index)   ((table)[index][0])
 
#define GET_SINGLE1(table, index)   ((table)[index][1])
 
#define GET_SINGLE2(table, index)   ((table)[index][2])
 
#define DEFINE_SIM2TRA(from, to)   { from, to },
 
#define DEFINE_TRA2SIM(from, to)   { from, to },
 

Typedefs

typedef WCHAR FULL2HALF_ENTRY[3]
 
typedef WCHAR DAKUTEN_ENTRY[3]
 
typedef struct tagWCHAR_PAIR WCHAR_PAIR
 
typedef struct tagWCHAR_PAIRPWCHAR_PAIR
 

Enumerations

enum  locationkind { LOCATION_NATION = 0 , LOCATION_REGION , LOCATION_BOTH }
 

Functions

 DEBUG_CHANNEL (nls)
 
int wine_fold_string (int flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
 
int wine_get_sortkey (int flags, const WCHAR *src, int srclen, char *dst, int dstlen)
 
int wine_compare_string (int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2)
 
UINT GetLocalisedText (IN UINT uID, IN LPWSTR lpszDest, IN UINT cchDest)
 
static void strcpynAtoW (WCHAR *dst, const char *src, size_t n)
 
static UINT get_lcid_codepage (LCID lcid)
 
static LCID convert_default_lcid (LCID lcid, LCTYPE lctype)
 
static BOOL is_genitive_name_supported (LCTYPE lctype)
 
static HANDLE create_registry_key (void)
 
LANGID WINAPI GetUserDefaultLangID (void)
 
LANGID WINAPI GetSystemDefaultLangID (void)
 
LCID WINAPI GetUserDefaultLCID (void)
 
LCID WINAPI GetSystemDefaultLCID (void)
 
LANGID WINAPI GetUserDefaultUILanguage (void)
 
LANGID WINAPI GetSystemDefaultUILanguage (void)
 
static INT get_registry_locale_info (struct registry_value *registry_value, LPWSTR buffer, INT len)
 
INT WINAPI GetLocaleInfoA (LCID lcid, LCTYPE lctype, LPSTR buffer, INT len)
 
static int get_value_base_by_lctype (LCTYPE lctype)
 
static struct registry_valueget_locale_registry_value (DWORD lctype)
 
INT WINAPI GetLocaleInfoW (LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
 
BOOL WINAPI SetLocaleInfoA (LCID lcid, LCTYPE lctype, LPCSTR data)
 
BOOL WINAPI SetLocaleInfoW (LCID lcid, LCTYPE lctype, LPCWSTR data)
 
LCID WINAPI GetThreadLocale (void)
 
BOOL WINAPI SetThreadLocale (LCID lcid)
 
LCID WINAPI ConvertDefaultLocale (LCID lcid)
 
BOOL WINAPI IsValidLocale (LCID lcid, DWORD flags)
 
static BOOL CALLBACK enum_lang_proc_a (HMODULE hModule, LPCSTR type, LPCSTR name, WORD LangID, LONG_PTR lParam)
 
static BOOL CALLBACK enum_lang_proc_w (HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD LangID, LONG_PTR lParam)
 
BOOL WINAPI EnumSystemLocalesA (LOCALE_ENUMPROCA lpfnLocaleEnum, DWORD dwFlags)
 
BOOL WINAPI EnumSystemLocalesW (LOCALE_ENUMPROCW lpfnLocaleEnum, DWORD dwFlags)
 
static BOOL CALLBACK enum_locale_ex_proc (HMODULE module, LPCWSTR type, LPCWSTR name, WORD lang, LONG_PTR lparam)
 
BOOL WINAPI EnumSystemLocalesEx (LOCALE_ENUMPROCEX proc, DWORD flags, LPARAM lparam, LPVOID reserved)
 
DWORD WINAPI VerLanguageNameA (DWORD wLang, LPSTR szLang, DWORD nSize)
 
DWORD WINAPI VerLanguageNameW (DWORD wLang, LPWSTR szLang, DWORD nSize)
 
BOOL WINAPI GetStringTypeW (DWORD type, LPCWSTR src, INT count, LPWORD chartype)
 
BOOL WINAPI GetStringTypeExW (LCID locale, DWORD type, LPCWSTR src, INT count, LPWORD chartype)
 
BOOL WINAPI GetStringTypeA (LCID locale, DWORD type, LPCSTR src, INT count, LPWORD chartype)
 
BOOL WINAPI GetStringTypeExA (LCID locale, DWORD type, LPCSTR src, INT count, LPWORD chartype)
 
static void map_byterev (const WCHAR *src, int len, WCHAR *dst)
 
static int map_to_hiragana (const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
 
static int map_to_katakana (const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
 
static int map_to_halfwidth (DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
 
static int map_to_fullwidth (const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
 
static int map_to_lowercase (DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
 
static int map_to_uppercase (DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
 
static int compare_wchar_pair (const void *x, const void *y)
 
static WCHAR find_wchar_pair (const WCHAR_PAIR *pairs, size_t count, WCHAR ch)
 
static int map_to_simplified_chinese (DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
 
static int map_to_traditional_chinese (DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
 
static int map_remove_ignored (DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
 
static int lcmap_string (DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
 
INT WINAPI LCMapStringEx (LPCWSTR locale, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM handle)
 
INT WINAPI LCMapStringW (LCID lcid, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
 
INT WINAPI LCMapStringA (LCID lcid, DWORD flags, LPCSTR src, INT srclen, LPSTR dst, INT dstlen)
 
INT WINAPI FoldStringA (DWORD dwFlags, LPCSTR src, INT srclen, LPSTR dst, INT dstlen)
 
INT WINAPI FoldStringW (DWORD dwFlags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
 
INT WINAPI CompareStringEx (LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lParam)
 
INT WINAPI CompareStringW (LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
 
INT WINAPI CompareStringA (LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
 
static HANDLE NLS_RegOpenKey (HANDLE hRootKey, LPCWSTR szKeyName)
 
static BOOL NLS_RegEnumValue (HANDLE hKey, UINT ulIndex, LPWSTR szValueName, ULONG valueNameSize, LPWSTR szValueData, ULONG valueDataSize)
 
static BOOL NLS_RegGetDword (HANDLE hKey, LPCWSTR szValueName, DWORD *lpVal)
 
static BOOL NLS_GetLanguageGroupName (LGRPID lgrpid, LPWSTR szName, ULONG nameSize)
 
static BOOL NLS_EnumSystemLanguageGroups (ENUMLANGUAGEGROUP_CALLBACKS *lpProcs)
 
BOOL WINAPI EnumSystemLanguageGroupsA (LANGUAGEGROUP_ENUMPROCA pLangGrpEnumProc, DWORD dwFlags, LONG_PTR lParam)
 
BOOL WINAPI EnumSystemLanguageGroupsW (LANGUAGEGROUP_ENUMPROCW pLangGrpEnumProc, DWORD dwFlags, LONG_PTR lParam)
 
BOOL WINAPI IsValidLanguageGroup (LGRPID lgrpid, DWORD dwFlags)
 
static BOOL NLS_EnumLanguageGroupLocales (ENUMLANGUAGEGROUPLOCALE_CALLBACKS *lpProcs)
 
BOOL WINAPI EnumLanguageGroupLocalesA (LANGGROUPLOCALE_ENUMPROCA pLangGrpLcEnumProc, LGRPID lgrpid, DWORD dwFlags, LONG_PTR lParam)
 
BOOL WINAPI EnumLanguageGroupLocalesW (LANGGROUPLOCALE_ENUMPROCW pLangGrpLcEnumProc, LGRPID lgrpid, DWORD dwFlags, LONG_PTR lParam)
 
static BOOL NLS_EnumSystemCodePages (ENUMSYSTEMCODEPAGES_CALLBACKS *lpProcs)
 
BOOL WINAPI EnumSystemCodePagesW (CODEPAGE_ENUMPROCW lpCodePageEnumProc, DWORD dwFlags)
 
BOOL WINAPI EnumSystemCodePagesA (CODEPAGE_ENUMPROCA lpCodePageEnumProc, DWORD dwFlags)
 
BOOL WINAPI EnumSystemGeoID (GEOCLASS geoclass, GEOID parent, GEO_ENUMPROC enumproc)
 
BOOL WINAPI InvalidateNLSCache (void)
 
GEOID WINAPI GetUserGeoID (GEOCLASS GeoClass)
 
BOOL WINAPI SetUserGeoID (GEOID GeoID)
 
static BOOL CALLBACK enum_uilang_proc_a (HMODULE hModule, LPCSTR type, LPCSTR name, WORD LangID, LONG_PTR lParam)
 
static BOOL CALLBACK enum_uilang_proc_w (HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD LangID, LONG_PTR lParam)
 
BOOL WINAPI EnumUILanguagesA (UILANGUAGE_ENUMPROCA pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam)
 
BOOL WINAPI EnumUILanguagesW (UILANGUAGE_ENUMPROCW pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam)
 
static int NLS_GetGeoFriendlyName (GEOID Location, LPWSTR szFriendlyName, int cchData)
 
static const struct geoinfo_tget_geoinfo_dataptr (GEOID geoid)
 
INT WINAPI GetGeoInfoW (GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len, LANGID lang)
 
INT WINAPI GetGeoInfoA (GEOID geoid, GEOTYPE geotype, LPSTR data, int data_len, LANGID lang)
 

Variables

HMODULE kernel32_handle
 
static const WCHAR szLocaleKeyName []
 
static const WCHAR szLangGroupsKeyName []
 
static LCID lcid_LC_COLLATE
 
static LCID lcid_LC_CTYPE
 
static LCID lcid_LC_MONETARY
 
static LCID lcid_LC_NUMERIC
 
static LCID lcid_LC_TIME
 
static LCID lcid_LC_PAPER
 
static LCID lcid_LC_MEASUREMENT
 
static LCID lcid_LC_TELEPHONE
 
static const WCHAR iCalendarTypeW [] = {'i','C','a','l','e','n','d','a','r','T','y','p','e',0}
 
static const WCHAR iCountryW [] = {'i','C','o','u','n','t','r','y',0}
 
static const WCHAR iCurrDigitsW [] = {'i','C','u','r','r','D','i','g','i','t','s',0}
 
static const WCHAR iCurrencyW [] = {'i','C','u','r','r','e','n','c','y',0}
 
static const WCHAR iDateW [] = {'i','D','a','t','e',0}
 
static const WCHAR iDigitsW [] = {'i','D','i','g','i','t','s',0}
 
static const WCHAR iFirstDayOfWeekW [] = {'i','F','i','r','s','t','D','a','y','O','f','W','e','e','k',0}
 
static const WCHAR iFirstWeekOfYearW [] = {'i','F','i','r','s','t','W','e','e','k','O','f','Y','e','a','r',0}
 
static const WCHAR iLDateW [] = {'i','L','D','a','t','e',0}
 
static const WCHAR iLZeroW [] = {'i','L','Z','e','r','o',0}
 
static const WCHAR iMeasureW [] = {'i','M','e','a','s','u','r','e',0}
 
static const WCHAR iNegCurrW [] = {'i','N','e','g','C','u','r','r',0}
 
static const WCHAR iNegNumberW [] = {'i','N','e','g','N','u','m','b','e','r',0}
 
static const WCHAR iPaperSizeW [] = {'i','P','a','p','e','r','S','i','z','e',0}
 
static const WCHAR iTLZeroW [] = {'i','T','L','Z','e','r','o',0}
 
static const WCHAR iTimePrefixW [] = {'i','T','i','m','e','P','r','e','f','i','x',0}
 
static const WCHAR iTimeW [] = {'i','T','i','m','e',0}
 
static const WCHAR s1159W [] = {'s','1','1','5','9',0}
 
static const WCHAR s2359W [] = {'s','2','3','5','9',0}
 
static const WCHAR sCountryW [] = {'s','C','o','u','n','t','r','y',0}
 
static const WCHAR sCurrencyW [] = {'s','C','u','r','r','e','n','c','y',0}
 
static const WCHAR sDateW [] = {'s','D','a','t','e',0}
 
static const WCHAR sDecimalW [] = {'s','D','e','c','i','m','a','l',0}
 
static const WCHAR sGroupingW [] = {'s','G','r','o','u','p','i','n','g',0}
 
static const WCHAR sLanguageW [] = {'s','L','a','n','g','u','a','g','e',0}
 
static const WCHAR sListW [] = {'s','L','i','s','t',0}
 
static const WCHAR sLongDateW [] = {'s','L','o','n','g','D','a','t','e',0}
 
static const WCHAR sMonDecimalSepW [] = {'s','M','o','n','D','e','c','i','m','a','l','S','e','p',0}
 
static const WCHAR sMonGroupingW [] = {'s','M','o','n','G','r','o','u','p','i','n','g',0}
 
static const WCHAR sMonThousandSepW [] = {'s','M','o','n','T','h','o','u','s','a','n','d','S','e','p',0}
 
static const WCHAR sNativeDigitsW [] = {'s','N','a','t','i','v','e','D','i','g','i','t','s',0}
 
static const WCHAR sNegativeSignW [] = {'s','N','e','g','a','t','i','v','e','S','i','g','n',0}
 
static const WCHAR sPositiveSignW [] = {'s','P','o','s','i','t','i','v','e','S','i','g','n',0}
 
static const WCHAR sShortDateW [] = {'s','S','h','o','r','t','D','a','t','e',0}
 
static const WCHAR sThousandW [] = {'s','T','h','o','u','s','a','n','d',0}
 
static const WCHAR sTimeFormatW [] = {'s','T','i','m','e','F','o','r','m','a','t',0}
 
static const WCHAR sTimeW [] = {'s','T','i','m','e',0}
 
static const WCHAR sYearMonthW [] = {'s','Y','e','a','r','M','o','n','t','h',0}
 
static const WCHAR NumShapeW [] = {'N','u','m','s','h','a','p','e',0}
 
static struct registry_value registry_values []
 
static RTL_CRITICAL_SECTION cache_section = { NULL, -1, 0, 0, 0, 0 }
 
static const FULL2HALF_ENTRY full2half_table []
 
static const DAKUTEN_ENTRY dakuten_table []
 
static const WCHAR_PAIR s_sim2tra []
 
static const WCHAR_PAIR s_tra2sim []
 
static const struct geoinfo_t geoinfodata []
 

Macro Definition Documentation

◆ DEFINE_DAKUTEN

#define DEFINE_DAKUTEN (   voiced,
  single1,
  single2,
  half1,
  half2 
)    { voiced, single1, single2 },

◆ DEFINE_FULL2HALF

#define DEFINE_FULL2HALF (   full,
  half1,
  half2 
)    { full, half1, half2 },

◆ DEFINE_SIM2TRA

#define DEFINE_SIM2TRA (   from,
  to 
)    { from, to },

◆ DEFINE_TRA2SIM

#define DEFINE_TRA2SIM (   from,
  to 
)    { from, to },

◆ GET_FULL

#define GET_FULL (   table,
  index 
)    ((table)[index][0])

Definition at line 1937 of file lang.c.

◆ GET_HALF1

#define GET_HALF1 (   table,
  index 
)    ((table)[index][1])

Definition at line 1938 of file lang.c.

◆ GET_HALF2

#define GET_HALF2 (   table,
  index 
)    ((table)[index][2])

Definition at line 1939 of file lang.c.

◆ GET_SINGLE1

#define GET_SINGLE1 (   table,
  index 
)    ((table)[index][1])

Definition at line 1950 of file lang.c.

◆ GET_SINGLE2

#define GET_SINGLE2 (   table,
  index 
)    ((table)[index][2])

Definition at line 1951 of file lang.c.

◆ GET_VOICED

#define GET_VOICED (   table,
  index 
)    ((table)[index][0])

Definition at line 1949 of file lang.c.

◆ LOCALE_LOCALEINFOFLAGSMASK

#define LOCALE_LOCALEINFOFLAGSMASK
Value:
LOCALE_RETURN_NUMBER|LOCALE_RETURN_GENITIVE_NAMES)
#define LOCALE_USE_CP_ACP
Definition: winnls.h:20
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
#define LOCALE_RETURN_GENITIVE_NAMES
Definition: winnls.h:24

Definition at line 54 of file lang.c.

◆ LOCALE_NAME_USER_DEFAULT

#define LOCALE_NAME_USER_DEFAULT   NULL

Definition at line 39 of file lang.c.

◆ NDEBUG

#define NDEBUG

Definition at line 26 of file lang.c.

◆ NLSRC_OFFSET

#define NLSRC_OFFSET   5000 /* FIXME */

Definition at line 50 of file lang.c.

◆ REG_SZ

#define REG_SZ   1

Definition at line 41 of file lang.c.

◆ WINVER

#define WINVER   DLL_EXPORT_VERSION

Definition at line 36 of file lang.c.

Typedef Documentation

◆ DAKUTEN_ENTRY

typedef WCHAR DAKUTEN_ENTRY[3]

Definition at line 1942 of file lang.c.

◆ FULL2HALF_ENTRY

typedef WCHAR FULL2HALF_ENTRY[3]

Definition at line 1930 of file lang.c.

◆ PWCHAR_PAIR

◆ WCHAR_PAIR

Enumeration Type Documentation

◆ locationkind

Enumerator
LOCATION_NATION 
LOCATION_REGION 
LOCATION_BOTH 

Definition at line 3202 of file lang.c.

3202 {
3203 LOCATION_NATION = 0,
3206};
@ LOCATION_REGION
Definition: lang.c:3204
@ LOCATION_BOTH
Definition: lang.c:3205
@ LOCATION_NATION
Definition: lang.c:3203

Function Documentation

◆ compare_wchar_pair()

static int compare_wchar_pair ( const void x,
const void y 
)
static

Definition at line 2158 of file lang.c.

2159{
2160 const WCHAR_PAIR *a = x;
2161 const WCHAR_PAIR *b = y;
2162 if (a->from < b->from)
2163 return -1;
2164 if (a->from > b->from)
2165 return +1;
2166 return 0;
2167}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by find_wchar_pair().

◆ CompareStringA()

INT WINAPI CompareStringA ( LCID  lcid,
DWORD  flags,
LPCSTR  str1,
INT  len1,
LPCSTR  str2,
INT  len2 
)

Definition at line 2695 of file lang.c.

2697{
2698 WCHAR *buf1W = NtCurrentTeb()->StaticUnicodeBuffer;
2699 WCHAR *buf2W = buf1W + 130;
2700 LPWSTR str1W, str2W;
2701 INT len1W = 0, len2W = 0, ret;
2702 UINT locale_cp = CP_ACP;
2703
2704 if (!str1 || !str2)
2705 {
2707 return 0;
2708 }
2709 if (len1 < 0) len1 = strlen(str1);
2710 if (len2 < 0) len2 = strlen(str2);
2711
2712 if (!(flags & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage( lcid );
2713
2714 if (len1)
2715 {
2716 if (len1 <= 130) len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, buf1W, 130);
2717 if (len1W)
2718 str1W = buf1W;
2719 else
2720 {
2721 len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, NULL, 0);
2722 str1W = HeapAlloc(GetProcessHeap(), 0, len1W * sizeof(WCHAR));
2723 if (!str1W)
2724 {
2726 return 0;
2727 }
2728 MultiByteToWideChar(locale_cp, 0, str1, len1, str1W, len1W);
2729 }
2730 }
2731 else
2732 {
2733 len1W = 0;
2734 str1W = buf1W;
2735 }
2736
2737 if (len2)
2738 {
2739 if (len2 <= 130) len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, buf2W, 130);
2740 if (len2W)
2741 str2W = buf2W;
2742 else
2743 {
2744 len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, NULL, 0);
2745 str2W = HeapAlloc(GetProcessHeap(), 0, len2W * sizeof(WCHAR));
2746 if (!str2W)
2747 {
2748 if (str1W != buf1W) HeapFree(GetProcessHeap(), 0, str1W);
2750 return 0;
2751 }
2752 MultiByteToWideChar(locale_cp, 0, str2, len2, str2W, len2W);
2753 }
2754 }
2755 else
2756 {
2757 len2W = 0;
2758 str2W = buf2W;
2759 }
2760
2761 ret = CompareStringEx(NULL, flags, str1W, len1W, str2W, len2W, NULL, NULL, 0);
2762
2763 if (str1W != buf1W) HeapFree(GetProcessHeap(), 0, str1W);
2764 if (str2W != buf2W) HeapFree(GetProcessHeap(), 0, str2W);
2765 return ret;
2766}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
GLbitfield flags
Definition: glext.h:7161
#define NtCurrentTeb
static UINT get_lcid_codepage(LCID lcid)
Definition: lang.c:270
INT WINAPI CompareStringEx(LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lParam)
Definition: lang.c:2624
unsigned int UINT
Definition: ndis.h:50
int32_t INT
Definition: typedefs.h:58
int ret
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by __crtCompareStringA(), _Locale_strcmp_auxA(), check_format(), COMCTL32_ChrCmpHelperA(), compare_line(), compare_string2(), FPropContainsProp(), get_env(), IntlStrEqWorkerA(), lstrcmpA(), lstrcmpiA(), SHLWAPI_ChrCmpHelperA(), StrCmpNA(), StrCmpNIA(), StrIsIntlEqualA(), test_CompareStringA(), test_encoders(), test_sh_new_link_info(), and UrlIsA().

◆ CompareStringEx()

INT WINAPI CompareStringEx ( LPCWSTR  locale,
DWORD  flags,
LPCWSTR  str1,
INT  len1,
LPCWSTR  str2,
INT  len2,
LPNLSVERSIONINFO  version,
LPVOID  reserved,
LPARAM  lParam 
)

Definition at line 2624 of file lang.c.

2626{
2629 DWORD semistub_flags = NORM_LINGUISTIC_CASING|LINGUISTIC_IGNORECASE|0x10000000;
2630 /* 0x10000000 is related to diacritics in Arabic, Japanese, and Hebrew */
2631 INT ret;
2632 static int once;
2633
2634 if (version) FIXME("unexpected version parameter\n");
2635 if (reserved) FIXME("unexpected reserved value\n");
2636 if (lParam) FIXME("unexpected lParam\n");
2637
2638 if (!str1 || !str2)
2639 {
2641 return 0;
2642 }
2643
2644 if (flags & ~(supported_flags|semistub_flags))
2645 {
2647 return 0;
2648 }
2649
2650 if (flags & semistub_flags)
2651 {
2652 if (!once++)
2653 FIXME("semi-stub behavior for flag(s) 0x%x\n", flags & semistub_flags);
2654 }
2655
2656 if (len1 < 0) len1 = strlenW(str1);
2657 if (len2 < 0) len2 = strlenW(str2);
2658
2659 ret = wine_compare_string(flags, str1, len1, str2, len2);
2660
2661 if (ret) /* need to translate result */
2662 return (ret < 0) ? CSTR_LESS_THAN : CSTR_GREATER_THAN;
2663 return CSTR_EQUAL;
2664}
#define FIXME(fmt,...)
Definition: debug.h:111
LPARAM lParam
Definition: combotst.c:139
static const WCHAR version[]
Definition: asmname.c:66
r reserved
Definition: btrfs.c:3006
unsigned long DWORD
Definition: ntddk_ex.h:95
int wine_compare_string(int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2)
Definition: sortkey.c:358
#define strlenW(s)
Definition: unicode.h:28
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define NORM_IGNORECASE
Definition: winnls.h:176
#define SORT_STRINGSORT
Definition: winnls.h:183
#define LINGUISTIC_IGNORECASE
Definition: winnls.h:181
#define NORM_IGNOREKANATYPE
Definition: winnls.h:177
#define NORM_LINGUISTIC_CASING
Definition: winnls.h:182
#define CSTR_EQUAL
Definition: winnls.h:456
#define NORM_IGNORENONSPACE
Definition: winnls.h:178
#define NORM_IGNORESYMBOLS
Definition: winnls.h:179
#define NORM_IGNOREWIDTH
Definition: winnls.h:180
#define CSTR_LESS_THAN
Definition: winnls.h:455
#define CSTR_GREATER_THAN
Definition: winnls.h:457

Referenced by CompareStringA(), CompareStringW(), and InitFunctionPointers().

◆ CompareStringW()

◆ convert_default_lcid()

static LCID convert_default_lcid ( LCID  lcid,
LCTYPE  lctype 
)
static

Definition at line 525 of file lang.c.

526{
527 if (lcid == LOCALE_SYSTEM_DEFAULT ||
528 lcid == LOCALE_USER_DEFAULT ||
529 lcid == LOCALE_NEUTRAL)
530 {
531 LCID default_id = 0;
532
533 switch(lctype & 0xffff)
534 {
535 case LOCALE_SSORTNAME:
536 default_id = lcid_LC_COLLATE;
537 break;
538
542 case LOCALE_IDEFAULTEBCDICCODEPAGE:
545 default_id = lcid_LC_CTYPE;
546 break;
547
549 case LOCALE_ICURRENCY:
551 case LOCALE_INEGCURR:
558 case LOCALE_SCURRENCY:
563 case LOCALE_SNATIVECURRNAME:
564 default_id = lcid_LC_MONETARY;
565 break;
566
567 case LOCALE_IDIGITS:
568 case LOCALE_IDIGITSUBSTITUTION:
569 case LOCALE_ILZERO:
571 case LOCALE_SDECIMAL:
572 case LOCALE_SGROUPING:
573 //case LOCALE_SNAN:
576 //case LOCALE_SNEGINFINITY:
577 //case LOCALE_SPOSINFINITY:
579 case LOCALE_STHOUSAND:
580 default_id = lcid_LC_NUMERIC;
581 break;
582
584 case LOCALE_ICENTURY:
585 case LOCALE_IDATE:
586 case LOCALE_IDAYLZERO:
589 case LOCALE_ILDATE:
590 case LOCALE_IMONLZERO:
592 case LOCALE_ITIME:
594 case LOCALE_ITLZERO:
595 case LOCALE_S1159:
596 case LOCALE_S2359:
617 case LOCALE_SDATE:
618 case LOCALE_SDAYNAME1:
619 case LOCALE_SDAYNAME2:
620 case LOCALE_SDAYNAME3:
621 case LOCALE_SDAYNAME4:
622 case LOCALE_SDAYNAME5:
623 case LOCALE_SDAYNAME6:
624 case LOCALE_SDAYNAME7:
625 //case LOCALE_SDURATION:
626 case LOCALE_SLONGDATE:
641 //case LOCALE_SSHORTESTDAYNAME1:
642 //case LOCALE_SSHORTESTDAYNAME2:
643 //case LOCALE_SSHORTESTDAYNAME3:
644 //case LOCALE_SSHORTESTDAYNAME4:
645 //case LOCALE_SSHORTESTDAYNAME5:
646 //case LOCALE_SSHORTESTDAYNAME6:
647 //case LOCALE_SSHORTESTDAYNAME7:
648 case LOCALE_STIME:
650 case LOCALE_SYEARMONTH:
651 default_id = lcid_LC_TIME;
652 break;
653
654 case LOCALE_IPAPERSIZE:
655 default_id = lcid_LC_PAPER;
656 break;
657
658 case LOCALE_IMEASURE:
659 default_id = lcid_LC_MEASUREMENT;
660 break;
661
662 case LOCALE_ICOUNTRY:
663 default_id = lcid_LC_TELEPHONE;
664 break;
665 }
666 if (default_id) lcid = default_id;
667 }
668 return ConvertDefaultLocale( lcid );
669}
static LCID lcid_LC_MONETARY
Definition: lang.c:151
static LCID lcid_LC_TIME
Definition: lang.c:153
static LCID lcid_LC_NUMERIC
Definition: lang.c:152
static LCID lcid_LC_COLLATE
Definition: lang.c:149
static LCID lcid_LC_CTYPE
Definition: lang.c:150
static LCID lcid_LC_MEASUREMENT
Definition: lang.c:155
static LCID lcid_LC_TELEPHONE
Definition: lang.c:156
static LCID lcid_LC_PAPER
Definition: lang.c:154
LCID WINAPI ConvertDefaultLocale(LCID lcid)
Definition: lang.c:1512
#define LOCALE_NEUTRAL
#define LOCALE_USER_DEFAULT
#define LOCALE_SYSTEM_DEFAULT
DWORD LCID
Definition: nls.h:13
#define LOCALE_SABBREVMONTHNAME10
Definition: winnls.h:113
#define LOCALE_SMONTHNAME12
Definition: winnls.h:102
#define LOCALE_ICURRDIGITS
Definition: winnls.h:54
#define LOCALE_IDEFAULTCODEPAGE
Definition: winnls.h:37
#define LOCALE_SMONTHNAME5
Definition: winnls.h:95
#define LOCALE_SDATE
Definition: winnls.h:58
#define LOCALE_SDAYNAME5
Definition: winnls.h:81
#define LOCALE_SABBREVMONTHNAME9
Definition: winnls.h:112
#define LOCALE_SABBREVMONTHNAME11
Definition: winnls.h:114
#define LOCALE_SABBREVDAYNAME5
Definition: winnls.h:88
#define LOCALE_SABBREVDAYNAME2
Definition: winnls.h:85
#define LOCALE_INEGSEPBYSPACE
Definition: winnls.h:124
#define LOCALE_SABBREVMONTHNAME2
Definition: winnls.h:105
#define LOCALE_INEGSIGNPOSN
Definition: winnls.h:120
#define LOCALE_IDEFAULTUNIXCODEPAGE
Definition: winnls.h:174
#define LOCALE_SMONTHNAME13
Definition: winnls.h:103
#define LOCALE_SGROUPING
Definition: winnls.h:44
#define LOCALE_SMONTHNAME3
Definition: winnls.h:93
#define LOCALE_ICOUNTRY
Definition: winnls.h:30
#define LOCALE_SDECIMAL
Definition: winnls.h:42
#define LOCALE_SMONTHNAME11
Definition: winnls.h:101
#define LOCALE_SMONTHNAME8
Definition: winnls.h:98
#define LOCALE_IDATE
Definition: winnls.h:63
#define LOCALE_SMONTHNAME4
Definition: winnls.h:94
#define LOCALE_FONTSIGNATURE
Definition: winnls.h:125
#define LOCALE_SABBREVMONTHNAME13
Definition: winnls.h:116
#define LOCALE_IFIRSTWEEKOFYEAR
Definition: winnls.h:76
#define LOCALE_SDAYNAME1
Definition: winnls.h:77
#define LOCALE_IMEASURE
Definition: winnls.h:41
#define LOCALE_SLONGDATE
Definition: winnls.h:61
#define LOCALE_SMONTHNAME7
Definition: winnls.h:97
#define LOCALE_IINTLCURRDIGITS
Definition: winnls.h:55
#define LOCALE_S1159
Definition: winnls.h:71
#define LOCALE_SSHORTDATE
Definition: winnls.h:60
#define LOCALE_IPOSSYMPRECEDES
Definition: winnls.h:121
#define LOCALE_IDAYLZERO
Definition: winnls.h:69
#define LOCALE_SABBREVMONTHNAME4
Definition: winnls.h:107
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:117
#define LOCALE_SABBREVDAYNAME4
Definition: winnls.h:87
#define LOCALE_SMONDECIMALSEP
Definition: winnls.h:51
#define LOCALE_ITIME
Definition: winnls.h:65
#define LOCALE_ICURRENCY
Definition: winnls.h:56
#define LOCALE_SMONTHNAME1
Definition: winnls.h:91
#define LOCALE_SABBREVMONTHNAME3
Definition: winnls.h:106
#define LOCALE_ITLZERO
Definition: winnls.h:68
#define LOCALE_INEGSYMPRECEDES
Definition: winnls.h:123
#define LOCALE_SMONTHOUSANDSEP
Definition: winnls.h:52
#define LOCALE_SDAYNAME7
Definition: winnls.h:83
#define LOCALE_IPOSSIGNPOSN
Definition: winnls.h:119
#define LOCALE_SDAYNAME2
Definition: winnls.h:78
#define LOCALE_SABBREVMONTHNAME1
Definition: winnls.h:104
#define LOCALE_IOPTIONALCALENDAR
Definition: winnls.h:74
#define LOCALE_IDIGITS
Definition: winnls.h:45
#define LOCALE_STHOUSAND
Definition: winnls.h:43
#define LOCALE_IDEFAULTANSICODEPAGE
Definition: winnls.h:38
#define LOCALE_SABBREVDAYNAME6
Definition: winnls.h:89
#define LOCALE_SMONTHNAME2
Definition: winnls.h:92
#define LOCALE_STIMEFORMAT
Definition: winnls.h:62
#define LOCALE_SABBREVDAYNAME1
Definition: winnls.h:84
#define LOCALE_IFIRSTDAYOFWEEK
Definition: winnls.h:75
#define LOCALE_SABBREVMONTHNAME6
Definition: winnls.h:109
#define LOCALE_SMONTHNAME6
Definition: winnls.h:96
#define LOCALE_STIME
Definition: winnls.h:59
#define LOCALE_INEGNUMBER
Definition: winnls.h:47
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:118
#define LOCALE_SDAYNAME3
Definition: winnls.h:79
#define LOCALE_S2359
Definition: winnls.h:72
#define LOCALE_SNATIVEDIGITS
Definition: winnls.h:48
#define LOCALE_SABBREVDAYNAME3
Definition: winnls.h:86
#define LOCALE_ILZERO
Definition: winnls.h:46
#define LOCALE_SABBREVMONTHNAME5
Definition: winnls.h:108
#define LOCALE_SABBREVMONTHNAME7
Definition: winnls.h:110
#define LOCALE_ICALENDARTYPE
Definition: winnls.h:73
#define LOCALE_SINTLSYMBOL
Definition: winnls.h:50
#define LOCALE_SABBREVMONTHNAME8
Definition: winnls.h:111
#define LOCALE_SMONGROUPING
Definition: winnls.h:53
#define LOCALE_SDAYNAME4
Definition: winnls.h:80
#define LOCALE_SCURRENCY
Definition: winnls.h:49
#define LOCALE_SMONTHNAME10
Definition: winnls.h:100
#define LOCALE_INEGCURR
Definition: winnls.h:57
#define LOCALE_ILDATE
Definition: winnls.h:64
#define LOCALE_SMONTHNAME9
Definition: winnls.h:99
#define LOCALE_IPOSSEPBYSPACE
Definition: winnls.h:122
#define LOCALE_ICENTURY
Definition: winnls.h:67
#define LOCALE_IMONLZERO
Definition: winnls.h:70
#define LOCALE_SABBREVMONTHNAME12
Definition: winnls.h:115
#define LOCALE_IDEFAULTMACCODEPAGE
Definition: winnls.h:39
#define LOCALE_SDAYNAME6
Definition: winnls.h:82
#define LOCALE_ITIMEMARKPOSN
Definition: winnls.h:66
#define LOCALE_SABBREVDAYNAME7
Definition: winnls.h:90

Referenced by GetLocaleInfoW().

◆ ConvertDefaultLocale()

LCID WINAPI ConvertDefaultLocale ( LCID  lcid)

Definition at line 1512 of file lang.c.

1513{
1514 LANGID langid;
1515
1516 switch (lcid)
1517 {
1518 case LOCALE_INVARIANT:
1519 /* keep as-is */
1520 break;
1522 lcid = GetSystemDefaultLCID();
1523 break;
1525 case LOCALE_NEUTRAL:
1526 lcid = GetUserDefaultLCID();
1527 break;
1528 default:
1529 /* Replace SUBLANG_NEUTRAL with SUBLANG_DEFAULT */
1530 langid = LANGIDFROMLCID(lcid);
1532 {
1534 lcid = MAKELCID(langid, SORTIDFROMLCID(lcid));
1535 }
1536 }
1537 return lcid;
1538}
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:778
LCID WINAPI GetSystemDefaultLCID(void)
Definition: lang.c:797
USHORT LANGID
Definition: mui.h:9
LANGID langid
Definition: msctf.idl:644
#define LOCALE_INVARIANT
#define SORTIDFROMLCID(lcid)
#define MAKELCID(lgid, srtid)
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANGID(l)
Definition: nls.h:17
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define SUBLANG_NEUTRAL
Definition: nls.h:167
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define PRIMARYLANGID(l)
Definition: nls.h:16

Referenced by convert_default_lcid(), GetLocalisedText(), LHashValOfNameSysA(), NLS_IsUnicodeOnlyLcid(), ScriptRecordDigitSubstitution(), SetThreadLocale(), test_ConvertDefaultLocale(), VarBoolFromStr(), and VarBstrFromBool().

◆ create_registry_key()

static HANDLE create_registry_key ( void  )
inlinestatic

Definition at line 704 of file lang.c.

705{
706 static const WCHAR cplW[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l',0};
707 static const WCHAR intlW[] = {'I','n','t','e','r','n','a','t','i','o','n','a','l',0};
710 HANDLE cpl_key, hkey = 0;
711
712 if (RtlOpenCurrentUser( KEY_ALL_ACCESS, &hkey ) != STATUS_SUCCESS) return 0;
713
714 attr.Length = sizeof(attr);
715 attr.RootDirectory = hkey;
716 attr.ObjectName = &nameW;
717 attr.Attributes = 0;
718 attr.SecurityDescriptor = NULL;
719 attr.SecurityQualityOfService = NULL;
720 RtlInitUnicodeString( &nameW, cplW );
721
722 if (!NtCreateKey( &cpl_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
723 {
724 NtClose( attr.RootDirectory );
725 attr.RootDirectory = cpl_key;
726 RtlInitUnicodeString( &nameW, intlW );
727 if (NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) hkey = 0;
728 }
729 NtClose( attr.RootDirectory );
730 return hkey;
731}
static const WCHAR nameW[]
Definition: main.c:46
NTSYSAPI NTSTATUS NTAPI RtlOpenCurrentUser(_In_ ACCESS_MASK DesiredAccess, _Out_ PHANDLE KeyHandle)
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: cookie.c:202

Referenced by get_registry_locale_info(), GetUserGeoID(), SetLocaleInfoW(), and SetUserGeoID().

◆ DEBUG_CHANNEL()

DEBUG_CHANNEL ( nls  )

◆ enum_lang_proc_a()

static BOOL CALLBACK enum_lang_proc_a ( HMODULE  hModule,
LPCSTR  type,
LPCSTR  name,
WORD  LangID,
LONG_PTR  lParam 
)
static

Definition at line 1566 of file lang.c.

1568{
1569 LOCALE_ENUMPROCA lpfnLocaleEnum = (LOCALE_ENUMPROCA)lParam;
1570 char buf[20];
1571
1572 sprintf(buf, "%08x", (UINT)LangID);
1573 return lpfnLocaleEnum( buf );
1574}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define sprintf(buf, format,...)
Definition: sprintf.c:55
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1083
BOOL(CALLBACK * LOCALE_ENUMPROCA)(LPSTR)
Definition: winnls.h:537

Referenced by EnumSystemLocalesA().

◆ enum_lang_proc_w()

static BOOL CALLBACK enum_lang_proc_w ( HMODULE  hModule,
LPCWSTR  type,
LPCWSTR  name,
WORD  LangID,
LONG_PTR  lParam 
)
static

Definition at line 1576 of file lang.c.

1578{
1579 static const WCHAR formatW[] = {'%','0','8','x',0};
1580 LOCALE_ENUMPROCW lpfnLocaleEnum = (LOCALE_ENUMPROCW)lParam;
1581 WCHAR buf[20];
1582 sprintfW( buf, formatW, (UINT)LangID );
1583 return lpfnLocaleEnum( buf );
1584}
#define sprintfW
Definition: unicode.h:58
BOOL(CALLBACK * LOCALE_ENUMPROCW)(LPWSTR)
Definition: winnls.h:538

Referenced by EnumSystemLocalesW().

◆ enum_locale_ex_proc()

static BOOL CALLBACK enum_locale_ex_proc ( HMODULE  module,
LPCWSTR  type,
LPCWSTR  name,
WORD  lang,
LONG_PTR  lparam 
)
static

Definition at line 1631 of file lang.c.

1633{
1635 WCHAR buffer[256];
1636 DWORD neutral;
1637 unsigned int flags;
1638
1642 LOCALE_INEUTRAL | LOCALE_NOUSEROVERRIDE | LOCALE_RETURN_NUMBER,
1643 (LPWSTR)&neutral, sizeof(neutral) / sizeof(WCHAR) ))
1644 neutral = 0;
1647 if (data->flags && !(data->flags & flags)) return TRUE;
1648 return data->proc( buffer, flags, data->lparam );
1649}
@ lparam
Definition: SystemMenu.c:31
#define ARRAY_SIZE(A)
Definition: main.h:33
#define TRUE
Definition: types.h:120
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint buffer
Definition: glext.h:5915
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1108
#define SORT_DEFAULT
static const WCHAR lang[]
Definition: wbemdisp.c:287
#define LOCALE_NEUTRALDATA
Definition: winnls.h:210
#define LOCALE_SNAME
Definition: winnls.h:130
#define LOCALE_SPECIFICDATA
Definition: winnls.h:211
#define LOCALE_INEUTRAL
Definition: winnls.h:156
#define LOCALE_WINDOWS
Definition: winnls.h:206

Referenced by EnumSystemLocalesEx().

◆ enum_uilang_proc_a()

static BOOL CALLBACK enum_uilang_proc_a ( HMODULE  hModule,
LPCSTR  type,
LPCSTR  name,
WORD  LangID,
LONG_PTR  lParam 
)
static

Definition at line 3846 of file lang.c.

3848{
3850 char buf[20];
3851
3852 sprintf(buf, "%08x", (UINT)LangID);
3853 return enum_uilang->u.procA( buf, enum_uilang->param );
3854}
LONG_PTR param
Definition: lang.c:3843
UILANGUAGE_ENUMPROCA procA
Definition: lang.c:3839
union ENUM_UILANG_CALLBACK::@463 u

Referenced by EnumUILanguagesA().

◆ enum_uilang_proc_w()

static BOOL CALLBACK enum_uilang_proc_w ( HMODULE  hModule,
LPCWSTR  type,
LPCWSTR  name,
WORD  LangID,
LONG_PTR  lParam 
)
static

Definition at line 3856 of file lang.c.

3858{
3859 static const WCHAR formatW[] = {'%','0','8','x',0};
3861 WCHAR buf[20];
3862
3863 sprintfW( buf, formatW, (UINT)LangID );
3864 return enum_uilang->u.procW( buf, enum_uilang->param );
3865}
UILANGUAGE_ENUMPROCW procW
Definition: lang.c:3840

Referenced by EnumUILanguagesW().

◆ EnumLanguageGroupLocalesA()

BOOL WINAPI EnumLanguageGroupLocalesA ( LANGGROUPLOCALE_ENUMPROCA  pLangGrpLcEnumProc,
LGRPID  lgrpid,
DWORD  dwFlags,
LONG_PTR  lParam 
)

Definition at line 3534 of file lang.c.

3536{
3538
3539 TRACE("(%p,0x%08X,0x%08X,0x%08lX)\n", pLangGrpLcEnumProc, lgrpid, dwFlags, lParam);
3540
3541 callbacks.procA = pLangGrpLcEnumProc;
3542 callbacks.procW = NULL;
3543 callbacks.dwFlags = dwFlags;
3544 callbacks.lgrpid = lgrpid;
3545 callbacks.lParam = lParam;
3546
3547 return NLS_EnumLanguageGroupLocales( pLangGrpLcEnumProc ? &callbacks : NULL );
3548}
static BOOL NLS_EnumLanguageGroupLocales(ENUMLANGUAGEGROUPLOCALE_CALLBACKS *lpProcs)
Definition: lang.c:3115
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
static int callbacks
Definition: xmllint.c:838

Referenced by InitFunctionPointers(), and test_digit_substitution().

◆ EnumLanguageGroupLocalesW()

BOOL WINAPI EnumLanguageGroupLocalesW ( LANGGROUPLOCALE_ENUMPROCW  pLangGrpLcEnumProc,
LGRPID  lgrpid,
DWORD  dwFlags,
LONG_PTR  lParam 
)

Definition at line 3555 of file lang.c.

3557{
3559
3560 TRACE("(%p,0x%08X,0x%08X,0x%08lX)\n", pLangGrpLcEnumProc, lgrpid, dwFlags, lParam);
3561
3562 callbacks.procA = NULL;
3563 callbacks.procW = pLangGrpLcEnumProc;
3564 callbacks.dwFlags = dwFlags;
3565 callbacks.lgrpid = lgrpid;
3566 callbacks.lParam = lParam;
3567
3568 return NLS_EnumLanguageGroupLocales( pLangGrpLcEnumProc ? &callbacks : NULL );
3569}

◆ EnumSystemCodePagesA()

BOOL WINAPI EnumSystemCodePagesA ( CODEPAGE_ENUMPROCA  lpCodePageEnumProc,
DWORD  dwFlags 
)

Definition at line 3672 of file lang.c.

3676{
3678
3679 TRACE("(%p,0x%08X)\n", lpCodePageEnumProc, dwFlags);
3680
3681 procs.procA = lpCodePageEnumProc;
3682 procs.procW = NULL;
3683 procs.dwFlags = dwFlags;
3684
3685 return NLS_EnumSystemCodePages(lpCodePageEnumProc ? &procs : NULL);
3686}
static BOOL NLS_EnumSystemCodePages(ENUMSYSTEMCODEPAGES_CALLBACKS *lpProcs)
Definition: lang.c:3580
CODEPAGE_ENUMPROCA procA
Definition: lang.c:3574
CODEPAGE_ENUMPROCW procW
Definition: lang.c:3575

◆ EnumSystemCodePagesW()

BOOL WINAPI EnumSystemCodePagesW ( CODEPAGE_ENUMPROCW  lpCodePageEnumProc,
DWORD  dwFlags 
)

Definition at line 3650 of file lang.c.

3654{
3656
3657 TRACE("(%p,0x%08X)\n", lpCodePageEnumProc, dwFlags);
3658
3659 procs.procA = NULL;
3660 procs.procW = lpCodePageEnumProc;
3661 procs.dwFlags = dwFlags;
3662
3663 return NLS_EnumSystemCodePages(lpCodePageEnumProc ? &procs : NULL);
3664}

Referenced by InitCodePagesList().

◆ EnumSystemGeoID()

BOOL WINAPI EnumSystemGeoID ( GEOCLASS  geoclass,
GEOID  parent,
GEO_ENUMPROC  enumproc 
)

Definition at line 3702 of file lang.c.

3703{
3704 INT i;
3705
3706 TRACE("(%d, %d, %p)\n", geoclass, parent, enumproc);
3707
3708 if (!enumproc) {
3710 return FALSE;
3711 }
3712
3713 if (geoclass != GEOCLASS_NATION && geoclass != GEOCLASS_REGION) {
3715 return FALSE;
3716 }
3717
3718 for (i = 0; i < sizeof(geoinfodata)/sizeof(struct geoinfo_t); i++) {
3719 const struct geoinfo_t *ptr = &geoinfodata[i];
3720
3721 if (geoclass == GEOCLASS_NATION && (ptr->kind == LOCATION_REGION))
3722 continue;
3723
3724 if (geoclass == GEOCLASS_REGION && (ptr->kind == LOCATION_NATION))
3725 continue;
3726
3727 if (parent && ptr->parent != parent)
3728 continue;
3729
3730 if (!enumproc(ptr->id))
3731 return TRUE;
3732 }
3733
3734 return TRUE;
3735}
#define FALSE
Definition: types.h:117
r parent
Definition: btrfs.c:3010
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const struct geoinfo_t geoinfodata[]
Definition: lang.c:3217
static PVOID ptr
Definition: dispmode.c:27
@ GEOCLASS_REGION
Definition: winnls.h:556
@ GEOCLASS_NATION
Definition: winnls.h:555

Referenced by CreateLocationsList(), and InitFunctionPointers().

◆ EnumSystemLanguageGroupsA()

BOOL WINAPI EnumSystemLanguageGroupsA ( LANGUAGEGROUP_ENUMPROCA  pLangGrpEnumProc,
DWORD  dwFlags,
LONG_PTR  lParam 
)

Definition at line 3018 of file lang.c.

3020{
3022
3023 TRACE("(%p,0x%08X,0x%08lX)\n", pLangGrpEnumProc, dwFlags, lParam);
3024
3025 procs.procA = pLangGrpEnumProc;
3026 procs.procW = NULL;
3027 procs.dwFlags = dwFlags;
3028 procs.lParam = lParam;
3029
3030 return NLS_EnumSystemLanguageGroups( pLangGrpEnumProc ? &procs : NULL);
3031}
static BOOL NLS_EnumSystemLanguageGroups(ENUMLANGUAGEGROUP_CALLBACKS *lpProcs)
Definition: lang.c:2919
LANGUAGEGROUP_ENUMPROCW procW
Definition: lang.c:2913
LANGUAGEGROUP_ENUMPROCA procA
Definition: lang.c:2912

Referenced by InitFunctionPointers().

◆ EnumSystemLanguageGroupsW()

BOOL WINAPI EnumSystemLanguageGroupsW ( LANGUAGEGROUP_ENUMPROCW  pLangGrpEnumProc,
DWORD  dwFlags,
LONG_PTR  lParam 
)

Definition at line 3038 of file lang.c.

3040{
3042
3043 TRACE("(%p,0x%08X,0x%08lX)\n", pLangGrpEnumProc, dwFlags, lParam);
3044
3045 procs.procA = NULL;
3046 procs.procW = pLangGrpEnumProc;
3047 procs.dwFlags = dwFlags;
3048 procs.lParam = lParam;
3049
3050 return NLS_EnumSystemLanguageGroups( pLangGrpEnumProc ? &procs : NULL);
3051}

◆ EnumSystemLocalesA()

BOOL WINAPI EnumSystemLocalesA ( LOCALE_ENUMPROCA  lpfnLocaleEnum,
DWORD  dwFlags 
)

Definition at line 1599 of file lang.c.

1600{
1601 TRACE("(%p,%08x)\n", lpfnLocaleEnum, dwFlags);
1604 (LONG_PTR)lpfnLocaleEnum);
1605 return TRUE;
1606}
BOOL WINAPI EnumResourceLanguagesA(HMODULE hmod, LPCSTR type, LPCSTR name, ENUMRESLANGPROCA lpfun, LONG_PTR lparam)
Definition: res.c:428
static BOOL CALLBACK enum_lang_proc_a(HMODULE hModule, LPCSTR type, LPCSTR name, WORD LangID, LONG_PTR lParam)
Definition: lang.c:1566
HMODULE kernel32_handle
Definition: dllmain.c:26
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define RT_STRING
Definition: pedump.c:368
#define LOCALE_ILANGUAGE
Definition: winnls.h:25
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182

Referenced by __GetLCID().

◆ EnumSystemLocalesEx()

BOOL WINAPI EnumSystemLocalesEx ( LOCALE_ENUMPROCEX  proc,
DWORD  flags,
LPARAM  lparam,
LPVOID  reserved 
)

Definition at line 1654 of file lang.c.

1655{
1657
1658 if (reserved)
1659 {
1661 return FALSE;
1662 }
1663 data.proc = proc;
1664 data.flags = flags;
1665 data.lparam = lparam;
1669 return TRUE;
1670}
BOOL WINAPI EnumResourceLanguagesW(HMODULE hmod, LPCWSTR type, LPCWSTR name, ENUMRESLANGPROCW lpfun, LONG_PTR lparam)
Definition: res.c:480
static BOOL CALLBACK enum_locale_ex_proc(HMODULE module, LPCWSTR type, LPCWSTR name, WORD lang, LONG_PTR lparam)
Definition: lang.c:1631
static HANDLE proc()
Definition: pdb.c:34
#define MAKEINTRESOURCE
Definition: winuser.h:591
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by InitFunctionPointers().

◆ EnumSystemLocalesW()

BOOL WINAPI EnumSystemLocalesW ( LOCALE_ENUMPROCW  lpfnLocaleEnum,
DWORD  dwFlags 
)

Definition at line 1614 of file lang.c.

1615{
1616 TRACE("(%p,%08x)\n", lpfnLocaleEnum, dwFlags);
1619 (LONG_PTR)lpfnLocaleEnum);
1620 return TRUE;
1621}
static BOOL CALLBACK enum_lang_proc_w(HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD LangID, LONG_PTR lParam)
Definition: lang.c:1576

Referenced by CreateLanguagesList(), CreateSortList(), EnumRfc1766_create(), InitLanguagesList(), and IsSortPageNeeded().

◆ EnumUILanguagesA()

BOOL WINAPI EnumUILanguagesA ( UILANGUAGE_ENUMPROCA  pUILangEnumProc,
DWORD  dwFlags,
LONG_PTR  lParam 
)

Definition at line 3870 of file lang.c.

3871{
3872 ENUM_UILANG_CALLBACK enum_uilang;
3873
3874 TRACE("%p, %x, %lx\n", pUILangEnumProc, dwFlags, lParam);
3875
3876 if(!pUILangEnumProc) {
3878 return FALSE;
3879 }
3880 if(dwFlags) {
3882 return FALSE;
3883 }
3884
3885 enum_uilang.u.procA = pUILangEnumProc;
3886 enum_uilang.flags = dwFlags;
3887 enum_uilang.param = lParam;
3888
3891 (LONG_PTR)&enum_uilang);
3892 return TRUE;
3893}
static BOOL CALLBACK enum_uilang_proc_a(HMODULE hModule, LPCSTR type, LPCSTR name, WORD LangID, LONG_PTR lParam)
Definition: lang.c:3846

Referenced by InitFunctionPointers().

◆ EnumUILanguagesW()

BOOL WINAPI EnumUILanguagesW ( UILANGUAGE_ENUMPROCW  pUILangEnumProc,
DWORD  dwFlags,
LONG_PTR  lParam 
)

Definition at line 3898 of file lang.c.

3899{
3900 ENUM_UILANG_CALLBACK enum_uilang;
3901
3902 TRACE("%p, %x, %lx\n", pUILangEnumProc, dwFlags, lParam);
3903
3904
3905 if(!pUILangEnumProc) {
3907 return FALSE;
3908 }
3909 if(dwFlags) {
3911 return FALSE;
3912 }
3913
3914 enum_uilang.u.procW = pUILangEnumProc;
3915 enum_uilang.flags = dwFlags;
3916 enum_uilang.param = lParam;
3917
3920 (LONG_PTR)&enum_uilang);
3921 return TRUE;
3922}
static BOOL CALLBACK enum_uilang_proc_w(HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD LangID, LONG_PTR lParam)
Definition: lang.c:3856

◆ find_wchar_pair()

static WCHAR find_wchar_pair ( const WCHAR_PAIR pairs,
size_t  count,
WCHAR  ch 
)
static

Definition at line 2169 of file lang.c.

2170{
2171 PWCHAR_PAIR found = bsearch(&ch, pairs, count, sizeof(WCHAR_PAIR), compare_wchar_pair);
2172 if (found)
2173 return found->to;
2174 return ch;
2175}
GLuint GLuint GLsizei count
Definition: gl.h:1545
static int compare_wchar_pair(const void *x, const void *y)
Definition: lang.c:2158
WCHAR to
Definition: lang.c:2138
#define bsearch

Referenced by map_to_simplified_chinese(), and map_to_traditional_chinese().

◆ FoldStringA()

INT WINAPI FoldStringA ( DWORD  dwFlags,
LPCSTR  src,
INT  srclen,
LPSTR  dst,
INT  dstlen 
)

Definition at line 2533 of file lang.c.

2535{
2536 INT ret = 0, srclenW = 0;
2537 WCHAR *srcW = NULL, *dstW = NULL;
2538
2539 if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
2540 {
2542 return 0;
2543 }
2544
2546 src, srclen, NULL, 0);
2547 srcW = HeapAlloc(GetProcessHeap(), 0, srclenW * sizeof(WCHAR));
2548
2549 if (!srcW)
2550 {
2552 goto FoldStringA_exit;
2553 }
2554
2556 src, srclen, srcW, srclenW);
2557
2558 dwFlags = (dwFlags & ~MAP_PRECOMPOSED) | MAP_FOLDCZONE;
2559
2560 ret = FoldStringW(dwFlags, srcW, srclenW, NULL, 0);
2561 if (ret && dstlen)
2562 {
2563 dstW = HeapAlloc(GetProcessHeap(), 0, ret * sizeof(WCHAR));
2564
2565 if (!dstW)
2566 {
2568 goto FoldStringA_exit;
2569 }
2570
2571 ret = FoldStringW(dwFlags, srcW, srclenW, dstW, ret);
2572 if (!WideCharToMultiByte(CP_ACP, 0, dstW, ret, dst, dstlen, NULL, NULL))
2573 {
2574 ret = 0;
2576 }
2577 }
2578
2579 HeapFree(GetProcessHeap(), 0, dstW);
2580
2581FoldStringA_exit:
2582 HeapFree(GetProcessHeap(), 0, srcW);
2583 return ret;
2584}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define WideCharToMultiByte
Definition: compat.h:111
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
#define MB_COMPOSITE
Definition: unicode.h:40
INT WINAPI FoldStringW(DWORD dwFlags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
Definition: lang.c:2591
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:52
static DWORD dstlen
Definition: directory.c:51
#define MAP_COMPOSITE
Definition: winnls.h:216
#define MAP_FOLDCZONE
Definition: winnls.h:213

Referenced by InitFunctionPointers().

◆ FoldStringW()

INT WINAPI FoldStringW ( DWORD  dwFlags,
LPCWSTR  src,
INT  srclen,
LPWSTR  dst,
INT  dstlen 
)

Definition at line 2591 of file lang.c.

2593{
2594 int ret;
2595
2596 switch (dwFlags & (MAP_COMPOSITE|MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES))
2597 {
2598 case 0:
2599 if (dwFlags)
2600 break;
2601 /* Fall through for dwFlags == 0 */
2603 case MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES:
2604 case MAP_COMPOSITE|MAP_EXPAND_LIGATURES:
2606 return 0;
2607 }
2608
2609 if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
2610 {
2612 return 0;
2613 }
2614
2616 if (!ret)
2618 return ret;
2619}
int wine_fold_string(int flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: fold.c:118
#define MAP_PRECOMPOSED
Definition: winnls.h:215

Referenced by FoldStringA(), IdnToNameprepUnicode(), and InitFunctionPointers().

◆ get_geoinfo_dataptr()

static const struct geoinfo_t * get_geoinfo_dataptr ( GEOID  geoid)
static

Definition at line 3952 of file lang.c.

3953{
3954 int min, max;
3955
3956 min = 0;
3957 max = sizeof(geoinfodata)/sizeof(struct geoinfo_t)-1;
3958
3959 while (min <= max) {
3960 const struct geoinfo_t *ptr;
3961 int n = (min+max)/2;
3962
3963 ptr = &geoinfodata[n];
3964 if (geoid == ptr->id)
3965 /* we don't need empty entry */
3966 return *ptr->iso2W ? ptr : NULL;
3967
3968 if (ptr->id > geoid)
3969 max = n-1;
3970 else
3971 min = n+1;
3972 }
3973
3974 return NULL;
3975}
GLdouble n
Definition: glext.h:7729
#define min(a, b)
Definition: monoChain.cc:55
#define max(a, b)
Definition: svc.c:63

Referenced by GetGeoInfoW().

◆ get_lcid_codepage()

static UINT get_lcid_codepage ( LCID  lcid)
inlinestatic

Definition at line 270 of file lang.c.

271{
272 UINT ret;
273 if (!GetLocaleInfoW( lcid, LOCALE_IDEFAULTANSICODEPAGE|LOCALE_RETURN_NUMBER, (WCHAR *)&ret,
274 sizeof(ret)/sizeof(WCHAR) )) ret = 0;
275 return ret;
276}

Referenced by CompareStringA(), GetLocaleInfoA(), GetStringTypeA(), LCMapStringA(), and SetLocaleInfoA().

◆ get_locale_registry_value()

static struct registry_value * get_locale_registry_value ( DWORD  lctype)
static

Definition at line 1094 of file lang.c.

1095{
1096 int i;
1097 for (i=0; i < sizeof(registry_values)/sizeof(registry_values[0]); i++)
1098 if (registry_values[i].lctype == lctype)
1099 return &registry_values[i];
1100 return NULL;
1101}
static struct registry_value registry_values[]

Referenced by GetLocaleInfoW(), and SetLocaleInfoW().

◆ get_registry_locale_info()

static INT get_registry_locale_info ( struct registry_value registry_value,
LPWSTR  buffer,
INT  len 
)
static

Definition at line 896 of file lang.c.

897{
898 DWORD size;
899 INT ret;
900 HANDLE hkey;
904 static const int info_size = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data);
905
907
909 {
910 if (!(hkey = create_registry_key()))
911 {
913 return -1;
914 }
915
917 size = info_size + len * sizeof(WCHAR);
918
919 if (!(info = HeapAlloc( GetProcessHeap(), 0, size )))
920 {
921 NtClose( hkey );
924 return 0;
925 }
926
928
929 /* try again with a bigger buffer when we have to return the correct size */
930 if (status == STATUS_BUFFER_OVERFLOW && !buffer && size > info_size)
931 {
933 if ((new_info = HeapReAlloc( GetProcessHeap(), 0, info, size )))
934 {
935 info = new_info;
937 }
938 }
939
940 NtClose( hkey );
941
942 if (!status)
943 {
944 INT length = (size - info_size) / sizeof(WCHAR);
945 LPWSTR cached_value;
946
947 if (!length || ((WCHAR *)&info->Data)[length-1])
948 length++;
949
950 cached_value = HeapAlloc( GetProcessHeap(), 0, length * sizeof(WCHAR) );
951
952 if (!cached_value)
953 {
957 return 0;
958 }
959
960 memcpy( cached_value, info->Data, (length-1) * sizeof(WCHAR) );
961 cached_value[length-1] = 0;
963 registry_value->cached_value = cached_value;
964 }
965 else
966 {
968 {
969 ret = (size - info_size) / sizeof(WCHAR);
970 }
972 {
973 ret = -1;
974 }
975 else
976 {
978 ret = 0;
979 }
982 return ret;
983 }
984 }
985
987
988 if (buffer)
989 {
990 if (ret > len)
991 {
993 ret = 0;
994 }
995 else
996 {
998 }
999 }
1000
1002
1003 return ret;
1004}
LONG NTSTATUS
Definition: precomp.h:26
#define HeapReAlloc
Definition: compat.h:734
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
GLsizeiptr size
Definition: glext.h:5919
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLenum GLsizei len
Definition: glext.h:6722
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
static RTL_CRITICAL_SECTION cache_section
Definition: lang.c:250
static HANDLE create_registry_key(void)
Definition: lang.c:704
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
@ KeyValuePartialInformation
Definition: nt_native.h:1182
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
WCHAR * cached_value
Definition: lang.c:202
const WCHAR * name
Definition: lang.c:201
Definition: ps.c:97
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149

Referenced by GetLocaleInfoW().

◆ get_value_base_by_lctype()

static int get_value_base_by_lctype ( LCTYPE  lctype)
static

Definition at line 1084 of file lang.c.

1085{
1086 return lctype == LOCALE_ILANGUAGE || lctype == LOCALE_IDEFAULTLANGUAGE ? 16 : 10;
1087}
#define LOCALE_IDEFAULTLANGUAGE
Definition: winnls.h:35

Referenced by GetLocaleInfoW().

◆ GetGeoInfoA()

INT WINAPI GetGeoInfoA ( GEOID  geoid,
GEOTYPE  geotype,
LPSTR  data,
int  data_len,
LANGID  lang 
)

Definition at line 4054 of file lang.c.

4055{
4056 WCHAR *buffW;
4057 INT len;
4058
4059 TRACE("%d %d %p %d %d\n", geoid, geotype, data, data_len, lang);
4060
4061 len = GetGeoInfoW(geoid, geotype, NULL, 0, lang);
4062 if (!len)
4063 return 0;
4064
4065 buffW = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
4066 if (!buffW)
4067 return 0;
4068
4069 GetGeoInfoW(geoid, geotype, buffW, len, lang);
4070 len = WideCharToMultiByte(CP_ACP, 0, buffW, -1, NULL, 0, NULL, NULL);
4071 if (!data || !data_len) {
4072 HeapFree(GetProcessHeap(), 0, buffW);
4073 return len;
4074 }
4075
4076 len = WideCharToMultiByte(CP_ACP, 0, buffW, -1, data, data_len, NULL, NULL);
4077 HeapFree(GetProcessHeap(), 0, buffW);
4078
4079 if (data_len < len)
4081 return data_len < len ? 0 : len;
4082}
INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len, LANGID lang)
Definition: lang.c:3980

Referenced by InitFunctionPointers().

◆ GetGeoInfoW()

INT WINAPI GetGeoInfoW ( GEOID  geoid,
GEOTYPE  geotype,
LPWSTR  data,
int  data_len,
LANGID  lang 
)

Definition at line 3980 of file lang.c.

3981{
3982 const struct geoinfo_t *ptr;
3983 const WCHAR *str = NULL;
3984 WCHAR buffW[12];
3985 LONG val = 0;
3986 INT len;
3987
3988 TRACE("%d %d %p %d %d\n", geoid, geotype, data, data_len, lang);
3989
3990 if (!(ptr = get_geoinfo_dataptr(geoid))) {
3992 return 0;
3993 }
3994
3995 switch (geotype) {
3996 case GEO_FRIENDLYNAME:
3997 {
3998#ifdef __REACTOS__
3999 return NLS_GetGeoFriendlyName(geoid, data, data_len, lang);
4000#else
4001 return NLS_GetGeoFriendlyName(geoid, data, data_len);
4002#endif
4003 }
4004 case GEO_NATION:
4005 val = geoid;
4006 break;
4007 case GEO_ISO_UN_NUMBER:
4008 val = ptr->uncode;
4009 break;
4010 case GEO_PARENT:
4011 val = ptr->parent;
4012 break;
4013 case GEO_ISO2:
4014 case GEO_ISO3:
4015 {
4016 str = geotype == GEO_ISO2 ? ptr->iso2W : ptr->iso3W;
4017 break;
4018 }
4019 case GEO_RFC1766:
4020 case GEO_LCID:
4021 case GEO_OFFICIALNAME:
4022 case GEO_TIMEZONES:
4024 case GEO_LATITUDE:
4025 case GEO_LONGITUDE:
4026 FIXME("type %d is not supported\n", geotype);
4028 return 0;
4029 default:
4030 WARN("unrecognized type %d\n", geotype);
4032 return 0;
4033 }
4034
4035 if (val) {
4036 static const WCHAR fmtW[] = {'%','d',0};
4037 sprintfW(buffW, fmtW, val);
4038 str = buffW;
4039 }
4040
4041 len = strlenW(str) + 1;
4042 if (!data || !data_len)
4043 return len;
4044
4045 memcpy(data, str, min(len, data_len)*sizeof(WCHAR));
4046 if (data_len < len)
4048 return data_len < len ? 0 : len;
4049}
#define WARN(fmt,...)
Definition: debug.h:112
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
GLuint GLfloat * val
Definition: glext.h:7180
static const struct geoinfo_t * get_geoinfo_dataptr(GEOID geoid)
Definition: lang.c:3952
static int NLS_GetGeoFriendlyName(GEOID Location, LPWSTR szFriendlyName, int cchData)
Definition: lang.c:3928
long LONG
Definition: pedump.c:60
const WCHAR * str
@ GEO_ISO3
Definition: winnls.h:566
@ GEO_OFFICIALLANGUAGES
Definition: winnls.h:572
@ GEO_OFFICIALNAME
Definition: winnls.h:570
@ GEO_TIMEZONES
Definition: winnls.h:571
@ GEO_FRIENDLYNAME
Definition: winnls.h:569
@ GEO_LONGITUDE
Definition: winnls.h:564
@ GEO_ISO_UN_NUMBER
Definition: winnls.h:573
@ GEO_PARENT
Definition: winnls.h:574
@ GEO_ISO2
Definition: winnls.h:565
@ GEO_LATITUDE
Definition: winnls.h:563
@ GEO_NATION
Definition: winnls.h:562
@ GEO_LCID
Definition: winnls.h:568
@ GEO_RFC1766
Definition: winnls.h:567

Referenced by CreateLocationsList(), GetGeoInfoA(), InitFunctionPointers(), LocationsEnumProc(), and SetUserLocaleName().

◆ GetLocaleInfoA()

INT WINAPI GetLocaleInfoA ( LCID  lcid,
LCTYPE  lctype,
LPSTR  buffer,
INT  len 
)

Definition at line 1028 of file lang.c.

1029{
1030 WCHAR *bufferW;
1031 INT lenW, ret;
1032
1033 TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d)\n", lcid, lctype, buffer, len );
1034
1035 if (len < 0 || (len && !buffer))
1036 {
1038 return 0;
1039 }
1040 if (((lctype & ~LOCALE_LOCALEINFOFLAGSMASK) == LOCALE_SSHORTTIME) ||
1042 {
1044 return 0;
1045 }
1046
1047 if (!len) buffer = NULL;
1048
1049 if (!(lenW = GetLocaleInfoW( lcid, lctype, NULL, 0 ))) return 0;
1050
1051 if (!(bufferW = HeapAlloc( GetProcessHeap(), 0, lenW * sizeof(WCHAR) )))
1052 {
1054 return 0;
1055 }
1056 if ((ret = GetLocaleInfoW( lcid, lctype, bufferW, lenW )))
1057 {
1058 if ((lctype & LOCALE_RETURN_NUMBER) ||
1060 {
1061 /* it's not an ASCII string, just bytes */
1062 ret *= sizeof(WCHAR);
1063 if (buffer)
1064 {
1065 if (ret <= len) memcpy( buffer, bufferW, ret );
1066 else
1067 {
1069 ret = 0;
1070 }
1071 }
1072 }
1073 else
1074 {
1076 if (!(lctype & LOCALE_USE_CP_ACP)) codepage = get_lcid_codepage( lcid );
1077 ret = WideCharToMultiByte( codepage, 0, bufferW, ret, buffer, len, NULL, NULL );
1078 }
1079 }
1080 HeapFree( GetProcessHeap(), 0, bufferW );
1081 return ret;
1082}
#define LOCALE_LOCALEINFOFLAGSMASK
Definition: lang.c:54
int codepage
Definition: win_iconv.c:156
#define LOCALE_SSHORTTIME
Definition: winnls.h:163

Referenced by __GetLocaleInfoUsingACP(), __GetLocaleName(), __intGetACP(), __intGetOCP(), _Locale_monetary_create(), _Locale_n_cs_precedes(), _Locale_n_sep_by_space(), _Locale_n_sign_posn(), _Locale_numeric_create(), _Locale_p_cs_precedes(), _Locale_p_sep_by_space(), _Locale_p_sign_posn(), _Locale_time_create(), compare_info(), detect_locale(), DosGetCountryInfo(), EnumLocalesProcA(), filetime_to_str(), is_rtl(), lcid_to_rfc1766A(), lineGetTranslateCapsA(), MSVCRT__create_locale(), MSVCRT_locale_to_LCID(), NLS_EnumDateFormats(), NLS_EnumTimeFormats(), START_TEST(), test__Gettnames(), test_EM_POSFROMCHAR(), test_EM_SETCHARFORMAT(), test_EnumDateFormatsA(), test_EnumTimeFormatsA(), test_EnumTimeFormatsW(), test_firstDay(), test_GetAcceptLanguagesA(), test_GetLocaleInfoA(), test_GetLocaleInfoW(), test_hittest(), test_invariant(), test_setlocale(), test_threadcp(), test_VarAbs(), test_VarCat(), test_VarFormat(), test_VarFormatNumber(), test_VarRound(), test_wm_set_get_text(), update_threadlocinfo_category(), and VerLanguageNameA().

◆ GetLocaleInfoW()

INT WINAPI GetLocaleInfoW ( LCID  lcid,
LCTYPE  lctype,
LPWSTR  buffer,
INT  len 
)

Definition at line 1108 of file lang.c.

1109{
1110 LANGID lang_id;
1111 HRSRC hrsrc;
1112 HGLOBAL hmem;
1113 LPCWSTR lpType, lpName;
1114 INT ret;
1115 UINT lcflags;
1116 const WCHAR *p;
1117 unsigned int i;
1118
1119 if (len < 0 || (len && !buffer))
1120 {
1122 return 0;
1123 }
1124 if (lctype & LOCALE_RETURN_GENITIVE_NAMES &&
1125 !is_genitive_name_supported( lctype ))
1126 {
1128 return 0;
1129 }
1130
1131 if (!len) buffer = NULL;
1132
1133 lcid = convert_default_lcid( lcid, lctype );
1134
1135 lcflags = lctype & LOCALE_LOCALEINFOFLAGSMASK;
1136 lctype &= 0xffff;
1137
1138 TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d)\n", lcid, lctype, buffer, len );
1139
1140 /* first check for overrides in the registry */
1141
1142 if (!(lcflags & LOCALE_NOUSEROVERRIDE) &&
1143 lcid == convert_default_lcid( LOCALE_USER_DEFAULT, lctype ))
1144 {
1146
1147 if (value)
1148 {
1149 if (lcflags & LOCALE_RETURN_NUMBER)
1150 {
1151 WCHAR tmp[16];
1152 ret = get_registry_locale_info( value, tmp, sizeof(tmp)/sizeof(WCHAR) );
1153 if (ret > 0)
1154 {
1155 WCHAR *end;
1157 if (*end) /* invalid number */
1158 {
1160 return 0;
1161 }
1162 ret = sizeof(UINT)/sizeof(WCHAR);
1163 if (!buffer) return ret;
1164 if (ret > len)
1165 {
1167 return 0;
1168 }
1169 memcpy( buffer, &number, sizeof(number) );
1170 }
1171 }
1173
1174 if (ret != -1) return ret;
1175 }
1176 }
1177
1178 /* now load it from kernel resources */
1179
1180 lang_id = LANGIDFROMLCID( lcid );
1181
1182 /* replace SUBLANG_NEUTRAL by SUBLANG_DEFAULT */
1183 if (SUBLANGID(lang_id) == SUBLANG_NEUTRAL)
1184 lang_id = MAKELANGID(PRIMARYLANGID(lang_id), SUBLANG_DEFAULT);
1185
1187 {
1188 lpType = MAKEINTRESOURCEW(RT_STRING);
1190 }
1191 else
1192 {
1193 lpType = MAKEINTRESOURCEW(RT_RCDATA);
1195 }
1196
1197 if (!(hrsrc = FindResourceExW( kernel32_handle, lpType, lpName, lang_id )))
1198 {
1199 SetLastError( ERROR_INVALID_FLAGS ); /* no such lctype */
1200 return 0;
1201 }
1202 if (!(hmem = LoadResource( kernel32_handle, hrsrc )))
1203 return 0;
1204
1205 p = LockResource( hmem );
1207 {
1208 for (i = 0; i < (lctype & 0x0f); i++) p += *p + 1;
1209 }
1210
1211 if (lcflags & LOCALE_RETURN_NUMBER) ret = sizeof(UINT)/sizeof(WCHAR);
1212 else if (is_genitive_name_supported( lctype ) && *p)
1213 {
1214 /* genitive form's stored after a null separator from a nominative */
1215 for (i = 1; i <= *p; i++) if (!p[i]) break;
1216
1217 if (i <= *p && (lcflags & LOCALE_RETURN_GENITIVE_NAMES))
1218 {
1219 ret = *p - i + 1;
1220 p += i;
1221 }
1222 else ret = i;
1223 }
1224 else if (lctype != LOCALE_FONTSIGNATURE)
1225 ret = *p + 1;
1226 else
1227 ret = SizeofResource(kernel32_handle, hrsrc) / sizeof(WCHAR);
1228
1229 if (!buffer) return ret;
1230
1231 if (ret > len)
1232 {
1234 return 0;
1235 }
1236
1237 if (lcflags & LOCALE_RETURN_NUMBER)
1238 {
1239 UINT number;
1240 WCHAR *end, *tmp = HeapAlloc( GetProcessHeap(), 0, (*p + 1) * sizeof(WCHAR) );
1241 if (!tmp) return 0;
1242 memcpy( tmp, p + 1, *p * sizeof(WCHAR) );
1243 tmp[*p] = 0;
1245 if (!*end)
1246 memcpy( buffer, &number, sizeof(number) );
1247 else /* invalid number */
1248 {
1250 ret = 0;
1251 }
1252 HeapFree( GetProcessHeap(), 0, tmp );
1253
1254 TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d) returning number %d\n",
1255 lcid, lctype, buffer, len, number );
1256 }
1257 else
1258 {
1259 if (lctype != LOCALE_FONTSIGNATURE) p++;
1260 memcpy( buffer, p, ret * sizeof(WCHAR) );
1261 if (lctype != LOCALE_FONTSIGNATURE) buffer[ret-1] = 0;
1262
1263 TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d) returning %d %s\n",
1264 lcid, lctype, buffer, len, ret, debugstr_w(buffer) );
1265 }
1266 return ret;
1267}
#define ULongToPtr(ul)
Definition: basetsd.h:92
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HRSRC WINAPI FindResourceExW(HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD lang)
Definition: res.c:164
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
GLuint GLuint end
Definition: gl.h:1545
GLfloat GLfloat p
Definition: glext.h:8902
#define debugstr_w
Definition: kernel32.h:32
static struct registry_value * get_locale_registry_value(DWORD lctype)
Definition: lang.c:1094
static INT get_registry_locale_info(struct registry_value *registry_value, LPWSTR buffer, INT len)
Definition: lang.c:896
static LCID convert_default_lcid(LCID lcid, LCTYPE lctype)
Definition: lang.c:525
static BOOL is_genitive_name_supported(LCTYPE lctype)
Definition: lang.c:676
static int get_value_base_by_lctype(LCTYPE lctype)
Definition: lang.c:1084
static unsigned int number
Definition: dsound.c:1479
#define RT_RCDATA
Definition: pedump.c:372
#define strtolW(s, e, b)
Definition: unicode.h:33
DWORD lctype
Definition: lang.c:200
Definition: pdh_main.c:94
_In_ LPCSTR lpName
Definition: winbase.h:2789
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by __crtGetLocaleInfoW(), _WLocale_abbrev_dayofweek(), _WLocale_abbrev_monthname(), _WLocale_am_str(), _WLocale_currency_symbol(), _WLocale_decimal_point(), _WLocale_full_dayofweek(), _WLocale_full_monthname(), _WLocale_int_curr_symbol(), _WLocale_negative_sign(), _WLocale_pm_str(), _WLocale_positive_sign(), _WLocale_thousands_sep(), AboutDlgProc(), add_cert_to_list(), add_cert_to_view(), add_date_string_to_control(), AddCommasW(), AddNewKbLayoutsByLcid(), AddNewLayout(), AllSysInfo(), CConfigParser::CacheINI(), create_utc_string(), CreateLanguagesList(), CreateLayoutIcon(), CreateSortList(), date_parse(), date_to_string(), dateobj_to_date_string(), DATETIME_GetFieldWidth(), DATETIME_ReturnTxt(), DATETIME_SetFormatW(), detect_locale(), enum_locale_ex_proc(), enum_locales_proc(), fill_language_information(), FillMonthsComboBox(), FillNumberFmt(), fnIMultiLanguage3_GetRfc1766Info(), fnIMultiLanguage_GetRfc1766Info(), format_long_date(), format_size(), FormatInteger(), GeneralPropertyPageLocalesEnumProc(), get_countrycode(), get_date_format(), get_decimal_sep(), get_input_codepage(), get_lcid_codepage(), get_locale(), GetCalendarInfoW(), CicProfile::GetCodePageA(), GetCurrencyFormatW(), GetFileVersion(), GetFontSig(), GetHKLName(), GetKeyboardLayoutCP(), GetLocaleInfoA(), GetNumberFormatW(), InatCreateIconBySize(), InitializeDefaultUserLocale(), InitLanguagesList(), InputList_Add(), InputList_Create(), Int64GetNumFormat(), IntGetCodePageEntry(), is_default_metric(), IsBiDiLocalizedSystem(), IsLayoutExists(), lcid_to_rfc1766W(), LocaleList_Create(), LocalesEnumProc(), MONTHCAL_LButtonDown(), MONTHCAL_PaintTitle(), MONTHCAL_SetFirstDayOfWeek(), MonthCalFirstDayOfWeek(), MonthCalReload(), MSVCRT__create_locale(), NLS_EnumCalendarInfo(), NLS_EnumDateFormats(), NLS_EnumTimeFormats(), NLS_GetLocaleNumber(), NLS_GetLocaleString(), ParseDate(), ReadChmSystem(), SaveFontSubstitutionSettings(), SaveSystemSettings(), ScriptRecordDigitSubstitution(), SetUserLocaleName(), SH_FormatInteger(), SortEnumProc(), START_TEST(), test_EnumTimeFormatsW(), test_GetLocaleInfoEx(), test_GetLocaleInfoW(), test_unicode_wm_char(), test_VarWeekdayName(), TranslateCharsetInfo(), UPDOWN_GetThousandSep(), VarBstrFromDate(), VarDateFromStr(), VarFormatCurrency(), VarFormatNumber(), VARIANT_BstrReplaceDecimal(), VARIANT_FormatDate(), VARIANT_FormatNumber(), VARIANT_GetLocalisedNumberChars(), VarMonthName(), VarWeekdayName(), VerLanguageNameW(), and WriteUserLocale().

◆ GetLocalisedText()

UINT GetLocalisedText ( IN UINT  uID,
IN LPWSTR  lpszDest,
IN UINT  cchDest 
)

Referenced by NLS_GetGeoFriendlyName().

◆ GetStringTypeA()

BOOL WINAPI GetStringTypeA ( LCID  locale,
DWORD  type,
LPCSTR  src,
INT  count,
LPWORD  chartype 
)

Definition at line 1823 of file lang.c.

1824{
1825 UINT cp;
1826 INT countW;
1827 LPWSTR srcW;
1828 BOOL ret = FALSE;
1829
1830 if(count == -1) count = strlen(src) + 1;
1831
1832 if (!(cp = get_lcid_codepage( locale )))
1833 {
1834 FIXME("For locale %04x using current ANSI code page\n", locale);
1835 cp = GetACP();
1836 }
1837
1838 countW = MultiByteToWideChar(cp, 0, src, count, NULL, 0);
1839 if((srcW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR))))
1840 {
1841 MultiByteToWideChar(cp, 0, src, count, srcW, countW);
1842 /*
1843 * NOTE: the target buffer has 1 word for each CHARACTER in the source
1844 * string, with multibyte characters there maybe be more bytes in count
1845 * than character space in the buffer!
1846 */
1847 ret = GetStringTypeW(type, srcW, countW, chartype);
1848 HeapFree(GetProcessHeap(), 0, srcW);
1849 }
1850 return ret;
1851}
Definition: _locale.h:75
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: lang.c:1709
POINT cp
Definition: magnifier.c:59
UINT WINAPI GetACP(void)
Definition: nls.c:2307

Referenced by _Locale_ctype_create(), GetStringTypeExA(), IsCharSpaceA(), and MSVCRT__create_locale().

◆ GetStringTypeExA()

BOOL WINAPI GetStringTypeExA ( LCID  locale,
DWORD  type,
LPCSTR  src,
INT  count,
LPWORD  chartype 
)

Definition at line 1870 of file lang.c.

1871{
1872 return GetStringTypeA(locale, type, src, count, chartype);
1873}
BOOL WINAPI GetStringTypeA(LCID locale, DWORD type, LPCSTR src, INT count, LPWORD chartype)
Definition: lang.c:1823

Referenced by _isctype_l().

◆ GetStringTypeExW()

BOOL WINAPI GetStringTypeExW ( LCID  locale,
DWORD  type,
LPCWSTR  src,
INT  count,
LPWORD  chartype 
)

Definition at line 1799 of file lang.c.

1800{
1801 /* locale is ignored for Unicode */
1802 return GetStringTypeW( type, src, count, chartype );
1803}

◆ GetStringTypeW()

BOOL WINAPI GetStringTypeW ( DWORD  type,
LPCWSTR  src,
INT  count,
LPWORD  chartype 
)

Definition at line 1709 of file lang.c.

1710{
1711 static const unsigned char type2_map[16] =
1712 {
1713 C2_NOTAPPLICABLE, /* unassigned */
1714 C2_LEFTTORIGHT, /* L */
1715 C2_RIGHTTOLEFT, /* R */
1716 C2_EUROPENUMBER, /* EN */
1717 C2_EUROPESEPARATOR, /* ES */
1718 C2_EUROPETERMINATOR, /* ET */
1719 C2_ARABICNUMBER, /* AN */
1720 C2_COMMONSEPARATOR, /* CS */
1721 C2_BLOCKSEPARATOR, /* B */
1722 C2_SEGMENTSEPARATOR, /* S */
1723 C2_WHITESPACE, /* WS */
1724 C2_OTHERNEUTRAL, /* ON */
1725 C2_RIGHTTOLEFT, /* AL */
1726 C2_NOTAPPLICABLE, /* NSM */
1727 C2_NOTAPPLICABLE, /* BN */
1728 C2_OTHERNEUTRAL /* LRE, LRO, RLE, RLO, PDF */
1729 };
1730
1731 if (!src)
1732 {
1734 return FALSE;
1735 }
1736
1737 if (count == -1) count = strlenW(src) + 1;
1738 switch(type)
1739 {
1740 case CT_CTYPE1:
1741 while (count--) *chartype++ = get_char_typeW( *src++ ) & 0xfff;
1742 break;
1743 case CT_CTYPE2:
1744 while (count--) *chartype++ = type2_map[get_char_typeW( *src++ ) >> 12];
1745 break;
1746 case CT_CTYPE3:
1747 {
1748 WARN("CT_CTYPE3: semi-stub.\n");
1749 while (count--)
1750 {
1751 int c = *src;
1752 WORD type1, type3 = 0; /* C3_NOTAPPLICABLE */
1753
1754 type1 = get_char_typeW( *src++ ) & 0xfff;
1755 /* try to construct type3 from type1 */
1756 if(type1 & C1_SPACE) type3 |= C3_SYMBOL;
1757 if(type1 & C1_ALPHA) type3 |= C3_ALPHA;
1758 if ((c>=0x30A0)&&(c<=0x30FF)) type3 |= C3_KATAKANA;
1759 if ((c>=0x3040)&&(c<=0x309F)) type3 |= C3_HIRAGANA;
1760 if ((c>=0x4E00)&&(c<=0x9FAF)) type3 |= C3_IDEOGRAPH;
1761 if (c == 0x0640) type3 |= C3_KASHIDA;
1762 if ((c>=0x3000)&&(c<=0x303F)) type3 |= C3_SYMBOL;
1763
1764 if ((c>=0xD800)&&(c<=0xDBFF)) type3 |= C3_HIGHSURROGATE;
1765 if ((c>=0xDC00)&&(c<=0xDFFF)) type3 |= C3_LOWSURROGATE;
1766
1767 if ((c>=0xFF00)&&(c<=0xFF60)) type3 |= C3_FULLWIDTH;
1768 if ((c>=0xFF00)&&(c<=0xFF20)) type3 |= C3_SYMBOL;
1769 if ((c>=0xFF3B)&&(c<=0xFF40)) type3 |= C3_SYMBOL;
1770 if ((c>=0xFF5B)&&(c<=0xFF60)) type3 |= C3_SYMBOL;
1771 if ((c>=0xFF21)&&(c<=0xFF3A)) type3 |= C3_ALPHA;
1772 if ((c>=0xFF41)&&(c<=0xFF5A)) type3 |= C3_ALPHA;
1773 if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_FULLWIDTH;
1774 if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_SYMBOL;
1775
1776 if ((c>=0xFF61)&&(c<=0xFFDC)) type3 |= C3_HALFWIDTH;
1777 if ((c>=0xFF61)&&(c<=0xFF64)) type3 |= C3_SYMBOL;
1778 if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_KATAKANA;
1779 if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_ALPHA;
1780 if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_HALFWIDTH;
1781 if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_SYMBOL;
1782 *chartype++ = type3;
1783 }
1784 break;
1785 }
1786 default:
1788 return FALSE;
1789 }
1790 return TRUE;
1791}
unsigned short WORD
Definition: ntddk_ex.h:93
const GLubyte * c
Definition: glext.h:8905
#define C1_SPACE
Definition: unicode.h:34
#define C1_ALPHA
Definition: unicode.h:39
WINE_UNICODE_INLINE unsigned short get_char_typeW(WCHAR ch)
Definition: unicode.h:149
#define C2_ARABICNUMBER
Definition: winnls.h:255
#define C3_FULLWIDTH
Definition: winnls.h:269
#define C3_ALPHA
Definition: winnls.h:273
#define C2_OTHERNEUTRAL
Definition: winnls.h:260
#define C2_LEFTTORIGHT
Definition: winnls.h:250
#define CT_CTYPE2
Definition: winnls.h:238
#define C3_IDEOGRAPH
Definition: winnls.h:270
#define CT_CTYPE3
Definition: winnls.h:239
#define CT_CTYPE1
Definition: winnls.h:237
#define C3_HALFWIDTH
Definition: winnls.h:268
#define C2_EUROPENUMBER
Definition: winnls.h:252
#define C3_SYMBOL
Definition: winnls.h:265
#define C3_LOWSURROGATE
Definition: winnls.h:276
#define C2_COMMONSEPARATOR
Definition: winnls.h:256
#define C3_KATAKANA
Definition: winnls.h:266
#define C2_EUROPESEPARATOR
Definition: winnls.h:253
#define C2_EUROPETERMINATOR
Definition: winnls.h:254
#define C2_SEGMENTSEPARATOR
Definition: winnls.h:258
#define C3_KASHIDA
Definition: winnls.h:271
#define C2_RIGHTTOLEFT
Definition: winnls.h:251
#define C3_HIRAGANA
Definition: winnls.h:267
#define C2_WHITESPACE
Definition: winnls.h:259
#define C3_HIGHSURROGATE
Definition: winnls.h:275
#define C2_NOTAPPLICABLE
Definition: winnls.h:261
#define C2_BLOCKSEPARATOR
Definition: winnls.h:257

Referenced by __crtGetStringTypeW(), _Locale_ctype_create(), _setmbcp_l(), _WLocale_ctype(), DoWordBreakProc(), get_char_script(), GetC1Type(), GetStringType3ExW(), GetStringTypeA(), GetStringTypeExW(), IsBlankLine(), IsCharBlankW(), IsCharCntrlW(), IsCharDigitW(), IsCharPunctW(), IsCharSpaceW(), IsCharXDigitW(), isdigitW(), map_remove_ignored(), SampCheckPassword(), test_crtGetStringTypeW(), and test_GetStringTypeW().

◆ GetSystemDefaultLangID()

◆ GetSystemDefaultLCID()

◆ GetSystemDefaultUILanguage()

LANGID WINAPI GetSystemDefaultUILanguage ( void  )

Definition at line 836 of file lang.c.

837{
838 LANGID lang;
840 return lang;
841}
NTSTATUS NTAPI NtQueryInstallUILanguage(OUT LANGID *LanguageId)
Definition: locale.c:611

Referenced by LsaLookupPrivilegeDisplayName(), and SHGetWebFolderFilePathW().

◆ GetThreadLocale()

◆ GetUserDefaultLangID()

◆ GetUserDefaultLCID()

◆ GetUserDefaultUILanguage()

LANGID WINAPI GetUserDefaultUILanguage ( void  )

◆ GetUserGeoID()

GEOID WINAPI GetUserGeoID ( GEOCLASS  GeoClass)

Definition at line 3763 of file lang.c.

3764{
3766 static const WCHAR geoW[] = {'G','e','o',0};
3767 static const WCHAR nationW[] = {'N','a','t','i','o','n',0};
3768 WCHAR bufferW[40], *end;
3769 DWORD count;
3770 HANDLE hkey, hSubkey = 0;
3771 UNICODE_STRING keyW;
3773 RtlInitUnicodeString( &keyW, nationW );
3774 count = sizeof(bufferW);
3775
3776 if(!(hkey = create_registry_key())) return ret;
3777
3778 switch( GeoClass ){
3779 case GEOCLASS_NATION:
3780 if ((hSubkey = NLS_RegOpenKey(hkey, geoW)))
3781 {
3782 if((NtQueryValueKey(hSubkey, &keyW, KeyValuePartialInformation,
3783 bufferW, count, &count) == STATUS_SUCCESS ) && info->DataLength)
3784 ret = strtolW((LPCWSTR)info->Data, &end, 10);
3785 }
3786 break;
3787 case GEOCLASS_REGION:
3788 FIXME("GEOCLASS_REGION not handled yet\n");
3789 break;
3790 }
3791
3792 NtClose(hkey);
3793 if (hSubkey) NtClose(hSubkey);
3794 return ret;
3795}
static HANDLE NLS_RegOpenKey(HANDLE hRootKey, LPCWSTR szKeyName)
Definition: lang.c:2794
ULONG GEOID
Definition: mui.h:28
#define GEOID_NOT_AVAILABLE
Definition: winnls.h:13

Referenced by CreateLocationsList(), and SetUserLocaleName().

◆ InvalidateNLSCache()

BOOL WINAPI InvalidateNLSCache ( void  )

Definition at line 3749 of file lang.c.

3750{
3751#ifdef __REACTOS__
3753 return TRUE;
3754#else
3755 FIXME("() stub\n");
3756 return FALSE;
3757#endif
3758}
void JapaneseEra_ClearCache(void)
Definition: japanese.c:38

◆ is_genitive_name_supported()

static BOOL is_genitive_name_supported ( LCTYPE  lctype)
static

Definition at line 676 of file lang.c.

677{
678 switch(lctype & 0xffff)
679 {
693 return TRUE;
694 default:
695 return FALSE;
696 }
697}

Referenced by GetLocaleInfoW().

◆ IsValidLanguageGroup()

BOOL WINAPI IsValidLanguageGroup ( LGRPID  lgrpid,
DWORD  dwFlags 
)

Definition at line 3066 of file lang.c.

3067{
3068 static const WCHAR szFormat[] = { '%','x','\0' };
3069 WCHAR szValueName[16], szValue[2];
3070 BOOL bSupported = FALSE, bInstalled = FALSE;
3071 HANDLE hKey;
3072
3073
3074 switch (dwFlags)
3075 {
3076 case LGRPID_INSTALLED:
3077 case LGRPID_SUPPORTED:
3078
3080
3081 sprintfW( szValueName, szFormat, lgrpid );
3082
3083 if (NLS_RegGetDword( hKey, szValueName, (LPDWORD)szValue ))
3084 {
3085 bSupported = TRUE;
3086
3087 if (szValue[0] == '1')
3088 bInstalled = TRUE;
3089 }
3090
3091 if (hKey)
3092 NtClose( hKey );
3093
3094 break;
3095 }
3096
3097 if ((dwFlags == LGRPID_SUPPORTED && bSupported) ||
3098 (dwFlags == LGRPID_INSTALLED && bInstalled))
3099 return TRUE;
3100
3101 return FALSE;
3102}
FxAutoRegKey hKey
static const WCHAR szLangGroupsKeyName[]
Definition: lang.c:64
static BOOL NLS_RegGetDword(HANDLE hKey, LPCWSTR szValueName, DWORD *lpVal)
Definition: lang.c:2847
uint32_t * LPDWORD
Definition: typedefs.h:59
#define LGRPID_INSTALLED
Definition: winnls.h:458
#define LGRPID_SUPPORTED
Definition: winnls.h:459

Referenced by InitFunctionPointers().

◆ IsValidLocale()

◆ lcmap_string()

static int lcmap_string ( DWORD  flags,
const WCHAR src,
int  srclen,
WCHAR dst,
int  dstlen 
)
static

Definition at line 2230 of file lang.c.

2231{
2232 int ret = 0;
2233
2235 {
2237 return 0;
2238 }
2239
2241 {
2242 case LCMAP_HIRAGANA:
2244 break;
2245 case LCMAP_KATAKANA:
2247 break;
2248 case LCMAP_HALFWIDTH:
2250 break;
2253 break;
2256 break;
2257 case LCMAP_FULLWIDTH:
2259 break;
2262 if (dstlen && ret)
2264 break;
2267 if (dstlen && ret)
2269 break;
2272 break;
2275 break;
2277 case NORM_IGNORESYMBOLS:
2280 {
2282 return 0;
2283 }
2285 break;
2286 case 0:
2287 if (flags & LCMAP_LOWERCASE)
2288 {
2290 flags &= ~LCMAP_LOWERCASE;
2291 break;
2292 }
2293 if (flags & LCMAP_UPPERCASE)
2294 {
2296 flags &= ~LCMAP_UPPERCASE;
2297 break;
2298 }
2299 if (flags & LCMAP_BYTEREV)
2300 {
2301 if (dstlen == 0)
2302 {
2303 ret = srclen;
2304 break;
2305 }
2306 ret = min(srclen, dstlen);
2307 RtlCopyMemory(dst, src, ret * sizeof(WCHAR));
2308 break;
2309 }
2310 /* fall through */
2311 default:
2313 return 0;
2314 }
2315
2316 if (dstlen)
2317 {
2318 if (flags & LCMAP_LOWERCASE)
2320 if (flags & LCMAP_UPPERCASE)
2322 if (flags & LCMAP_BYTEREV)
2324
2325 if (dstlen < ret)
2326 {
2328 return 0;
2329 }
2330 }
2331
2332 return ret;
2333}
static int map_to_simplified_chinese(DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: lang.c:2177
static int map_to_traditional_chinese(DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: lang.c:2190
static int map_to_lowercase(DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: lang.c:2106
static int map_to_uppercase(DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: lang.c:2121
static int map_to_fullwidth(const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: lang.c:2019
static int map_remove_ignored(DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: lang.c:2203
static int map_to_katakana(const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: lang.c:1905
static void map_byterev(const WCHAR *src, int len, WCHAR *dst)
Definition: lang.c:1875
static int map_to_halfwidth(DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: lang.c:1953
static int map_to_hiragana(const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: lang.c:1881
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define LCMAP_LINGUISTIC_CASING
Definition: winnls.h:192
#define LCMAP_SIMPLIFIED_CHINESE
Definition: winnls.h:193
#define LCMAP_TRADITIONAL_CHINESE
Definition: winnls.h:194
#define LCMAP_HALFWIDTH
Definition: winnls.h:190
#define LCMAP_HIRAGANA
Definition: winnls.h:188
#define LCMAP_UPPERCASE
Definition: winnls.h:185
#define LCMAP_LOWERCASE
Definition: winnls.h:184
#define LCMAP_KATAKANA
Definition: winnls.h:189
#define LCMAP_FULLWIDTH
Definition: winnls.h:191
#define LCMAP_BYTEREV
Definition: winnls.h:187

Referenced by LCMapStringEx().

◆ LCMapStringA()

INT WINAPI LCMapStringA ( LCID  lcid,
DWORD  flags,
LPCSTR  src,
INT  srclen,
LPSTR  dst,
INT  dstlen 
)

Definition at line 2443 of file lang.c.

2445{
2446 WCHAR *bufW = NtCurrentTeb()->StaticUnicodeBuffer;
2447 LPWSTR srcW, dstW;
2448 INT ret = 0, srclenW, dstlenW;
2449 UINT locale_cp = CP_ACP;
2450
2451 if (!src || !srclen || dstlen < 0)
2452 {
2454 return 0;
2455 }
2456
2457 if (!(flags & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage( lcid );
2458
2459 srclenW = MultiByteToWideChar(locale_cp, 0, src, srclen, bufW, 260);
2460 if (srclenW)
2461 srcW = bufW;
2462 else
2463 {
2464 srclenW = MultiByteToWideChar(locale_cp, 0, src, srclen, NULL, 0);
2465 srcW = HeapAlloc(GetProcessHeap(), 0, srclenW * sizeof(WCHAR));
2466 if (!srcW)
2467 {
2469 return 0;
2470 }
2471 MultiByteToWideChar(locale_cp, 0, src, srclen, srcW, srclenW);
2472 }
2473
2474 if (flags & LCMAP_SORTKEY)
2475 {
2476 if (src == dst)
2477 {
2479 goto map_string_exit;
2480 }
2481 ret = wine_get_sortkey(flags, srcW, srclenW, dst, dstlen);
2482 if (ret == 0)
2484 else
2485 ret++;
2486 goto map_string_exit;
2487 }
2488
2489 if (flags & SORT_STRINGSORT)
2490 {
2492 goto map_string_exit;
2493 }
2494
2495 dstlenW = LCMapStringEx(NULL, flags, srcW, srclenW, NULL, 0, NULL, NULL, 0);
2496 if (!dstlenW)
2497 goto map_string_exit;
2498
2499 dstW = HeapAlloc(GetProcessHeap(), 0, dstlenW * sizeof(WCHAR));
2500 if (!dstW)
2501 {
2503 goto map_string_exit;
2504 }
2505
2506 LCMapStringEx(NULL, flags, srcW, srclenW, dstW, dstlenW, NULL, NULL, 0);
2507 ret = WideCharToMultiByte(locale_cp, 0, dstW, dstlenW, dst, dstlen, NULL, NULL);
2508 HeapFree(GetProcessHeap(), 0, dstW);
2509
2510map_string_exit:
2511 if (srcW != bufW) HeapFree(GetProcessHeap(), 0, srcW);
2512 return ret;
2513}
int wine_get_sortkey(int flags, const WCHAR *src, int srclen, char *dst, int dstlen)
Definition: sortkey.c:33
INT WINAPI LCMapStringEx(LPCWSTR locale, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM handle)
Definition: lang.c:2355
#define LCMAP_SORTKEY
Definition: winnls.h:186

Referenced by __crtLCMapStringA(), _Locale_strxfrm(), _Locale_tolower(), _Locale_toupper(), _strxfrm_l(), compare_string3(), lcid_to_rfc1766A(), MSVCRT__create_locale(), test_GetRfc1766FromLcid(), test_LcidToRfc1766(), and test_LCMapStringA().

◆ LCMapStringEx()

INT WINAPI LCMapStringEx ( LPCWSTR  locale,
DWORD  flags,
LPCWSTR  src,
INT  srclen,
LPWSTR  dst,
INT  dstlen,
LPNLSVERSIONINFO  version,
LPVOID  reserved,
LPARAM  handle 
)

Definition at line 2355 of file lang.c.

2357{
2358 if (version) FIXME("unsupported version structure %p\n", version);
2359 if (reserved) FIXME("unsupported reserved pointer %p\n", reserved);
2360 if (handle)
2361 {
2362 static int once;
2363 if (!once++) FIXME("unsupported lparam %Ix\n", handle);
2364 }
2365
2366 if (!src || !srclen || dstlen < 0)
2367 {
2369 return 0;
2370 }
2371
2372 if (srclen < 0) srclen = lstrlenW(src) + 1;
2373
2374 TRACE( "(%s,0x%08lx,%s,%d,%p,%d)\n",
2376
2377 flags &= ~LOCALE_USE_CP_ACP;
2378
2379 if (src == dst && (flags & ~(LCMAP_LOWERCASE | LCMAP_UPPERCASE)))
2380 {
2382 return 0;
2383 }
2384
2385 if (!dstlen) dst = NULL;
2386
2387 if (flags & LCMAP_SORTKEY)
2388 {
2389 INT ret;
2390
2391 if (srclen < 0)
2392 srclen = strlenW(src);
2393
2394 ret = wine_get_sortkey(flags, src, srclen, (char *)dst, dstlen);
2395 if (ret == 0)
2397 else
2398 ret++;
2399 return ret;
2400 }
2401
2402 /* SORT_STRINGSORT must be used exclusively with LCMAP_SORTKEY */
2403 if (flags & SORT_STRINGSORT)
2404 {
2406 return 0;
2407 }
2408
2409 return lcmap_string(flags, src, srclen, dst, dstlen);
2410}
#define debugstr_wn
Definition: kernel32.h:33
static int lcmap_string(DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: lang.c:2230

Referenced by InitFunctionPointers(), LCMapStringA(), and LCMapStringW().

◆ LCMapStringW()

INT WINAPI LCMapStringW ( LCID  lcid,
DWORD  flags,
LPCWSTR  src,
INT  srclen,
LPWSTR  dst,
INT  dstlen 
)

Definition at line 2417 of file lang.c.

2419{
2420 TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
2422
2423 return LCMapStringEx(NULL, flags, src, srclen, dst, dstlen, NULL, NULL, 0);
2424}

Referenced by __crtLCMapStringW(), _WLocale_strxfrm(), _WLocale_tolower(), _WLocale_toupper(), lcid_to_rfc1766W(), LCMapStringW_wrapper(), SvchostCharLowerW(), test_LCMapStringW(), and test_tolower().

◆ map_byterev()

static void map_byterev ( const WCHAR src,
int  len,
WCHAR dst 
)
inlinestatic

Definition at line 1875 of file lang.c.

1876{
1877 while (len--)
1878 *dst++ = RtlUshortByteSwap(*src++);
1879}
#define RtlUshortByteSwap(_x)
Definition: rtlfuncs.h:3197

Referenced by lcmap_string().

◆ map_remove_ignored()

static int map_remove_ignored ( DWORD  flags,
const WCHAR src,
int  srclen,
WCHAR dst,
int  dstlen 
)
static

Definition at line 2203 of file lang.c.

2204{
2205 int pos;
2206 WORD wC1, wC2, wC3;
2207 for (pos = 0; srclen; src++, srclen--)
2208 {
2209 WCHAR wch = *src;
2210 GetStringTypeW(CT_CTYPE1, &wch, 1, &wC1);
2211 GetStringTypeW(CT_CTYPE2, &wch, 1, &wC2);
2212 GetStringTypeW(CT_CTYPE3, &wch, 1, &wC3);
2214 {
2215 if ((wC1 & C1_PUNCT) || (wC3 & C3_SYMBOL))
2216 continue;
2217 }
2219 {
2220 if ((wC2 & C2_OTHERNEUTRAL) && (wC3 & (C3_NONSPACING | C3_DIACRITIC)))
2221 continue;
2222 }
2223 if (pos < dstlen)
2224 dst[pos] = wch;
2225 pos++;
2226 }
2227 return pos;
2228}
#define C1_PUNCT
Definition: unicode.h:35
#define C3_DIACRITIC
Definition: winnls.h:263
#define C3_NONSPACING
Definition: winnls.h:262

Referenced by lcmap_string().

◆ map_to_fullwidth()

static int map_to_fullwidth ( const WCHAR src,
int  srclen,
WCHAR dst,
int  dstlen 
)
static

Definition at line 2019 of file lang.c.

2020{
2021 int pos, i;
2022 const FULL2HALF_ENTRY *table1 = full2half_table;
2023 const DAKUTEN_ENTRY *table2 = dakuten_table;
2024 const int count1 = (int)ARRAY_SIZE(full2half_table);
2025 const int count2 = (int)ARRAY_SIZE(dakuten_table);
2026
2027 for (pos = 0; srclen; src++, srclen--, pos++)
2028 {
2029 WCHAR ch = *src;
2030
2031 if (ch == 0x20) /* U+0020: Space */
2032 {
2033 if (pos < dstlen)
2034 dst[pos] = 0x3000; /* U+3000: Ideographic Space */
2035 continue;
2036 }
2037
2038 if (0x21 <= ch && ch <= 0x7E) /* Mappable halfwidth ASCII */
2039 {
2040 if (pos < dstlen)
2041 dst[pos] = ch + 0xFEE0; /* U+FF01 ... U+FF5E */
2042 continue;
2043 }
2044
2045 if (ch < 0xFF00) /* Quick judgment */
2046 {
2047 if (pos < dstlen)
2048 dst[pos] = ch;
2049 continue;
2050 }
2051
2052 /* Search in table1 (full/half) */
2053 for (i = count1 - 1; i >= 0; --i) /* In reverse order */
2054 {
2055 if (GET_HALF1(table1, i) != ch)
2056 continue; /* Mismatched */
2057
2058 if (GET_HALF2(table1, i) == 0)
2059 {
2060 if (pos < dstlen)
2061 dst[pos] = GET_FULL(table1, i);
2062 break;
2063 }
2064
2065 if (srclen <= 1 || GET_HALF2(table1, i) != src[1])
2066 continue; /* Mismatched */
2067
2068 --srclen;
2069 ++src;
2070
2071 if (pos < dstlen)
2072 dst[pos] = GET_FULL(table1, i);
2073 break;
2074 }
2075
2076 if (i >= 0)
2077 continue;
2078
2079 /* Search in table2 (dakuten) */
2080 for (i = count2 - 1; i >= 0; --i) /* In reverse order */
2081 {
2082 if (GET_SINGLE1(table2, i) != ch)
2083 continue; /* Mismatched */
2084
2085 if (srclen <= 1 || GET_SINGLE2(table2, i) != src[1])
2086 continue; /* Mismatched */
2087
2088 --srclen;
2089 ++src;
2090
2091 if (pos < dstlen)
2092 dst[pos] = GET_VOICED(table2, i);
2093 break;
2094 }
2095
2096 if (i >= 0)
2097 continue;
2098
2099 if (pos < dstlen)
2100 dst[pos] = ch;
2101 }
2102
2103 return pos;
2104}
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
WCHAR DAKUTEN_ENTRY[3]
Definition: lang.c:1942
#define GET_SINGLE1(table, index)
Definition: lang.c:1950
#define GET_HALF2(table, index)
Definition: lang.c:1939
#define GET_VOICED(table, index)
Definition: lang.c:1949
#define GET_SINGLE2(table, index)
Definition: lang.c:1951
static const FULL2HALF_ENTRY full2half_table[]
Definition: lang.c:1931
#define GET_HALF1(table, index)
Definition: lang.c:1938
#define GET_FULL(table, index)
Definition: lang.c:1937
WCHAR FULL2HALF_ENTRY[3]
Definition: lang.c:1930
static const DAKUTEN_ENTRY dakuten_table[]
Definition: lang.c:1943

Referenced by lcmap_string().

◆ map_to_halfwidth()

static int map_to_halfwidth ( DWORD  flags,
const WCHAR src,
int  srclen,
WCHAR dst,
int  dstlen 
)
static

Definition at line 1953 of file lang.c.

1954{
1955 int pos, i;
1956 const int count1 = (int)ARRAY_SIZE(full2half_table);
1957 const FULL2HALF_ENTRY *table1 = full2half_table;
1958
1959 for (pos = 0; srclen; src++, srclen--, pos++)
1960 {
1961 WCHAR ch = *src;
1962
1963 if (flags & LCMAP_KATAKANA)
1964 map_to_katakana(&ch, 1, &ch, 1);
1965 else if (flags & LCMAP_HIRAGANA)
1966 map_to_hiragana(&ch, 1, &ch, 1);
1967
1968 if (ch < 0x3000) /* Quick judgment */
1969 {
1970 if (pos < dstlen)
1971 dst[pos] = ch;
1972 continue;
1973 }
1974
1975 if (0xFF01 <= ch && ch <= 0xFF5E) /* U+FF01 ... U+FF5E */
1976 {
1977 if (pos < dstlen)
1978 dst[pos] = ch - 0xFEE0; /* Fullwidth ASCII to halfwidth ASCII */
1979 continue;
1980 }
1981
1982 /* Search in table1 (full/half) */
1983 for (i = count1 - 1; i >= 0; --i) /* In reverse order */
1984 {
1985 if (GET_FULL(table1, i) != ch)
1986 continue;
1987
1988 if (GET_HALF2(table1, i) == 0)
1989 {
1990 if (pos < dstlen)
1991 dst[pos] = GET_HALF1(table1, i);
1992 }
1993 else if (!dstlen)
1994 {
1995 pos++;
1996 }
1997 else if (pos + 1 < dstlen)
1998 {
1999 dst[pos++] = GET_HALF1(table1, i);
2000 dst[pos ] = GET_HALF2(table1, i);
2001 }
2002 else
2003 {
2004 dst[pos] = ch;
2005 }
2006 break;
2007 }
2008
2009 if (i >= 0)
2010 continue;
2011
2012 if (pos < dstlen)
2013 dst[pos] = ch;
2014 }
2015
2016 return pos;
2017}

Referenced by lcmap_string().

◆ map_to_hiragana()

static int map_to_hiragana ( const WCHAR src,
int  srclen,
WCHAR dst,
int  dstlen 
)
static

Definition at line 1881 of file lang.c.

1882{
1883 int pos;
1884 for (pos = 0; srclen; src++, srclen--, pos++)
1885 {
1886 /*
1887 * U+30A1 ... U+30F3: Katakana
1888 * U+30F4: Katakana Letter VU
1889 * U+30F5: Katakana Letter Small KA
1890 * U+30FD: Katakana Iteration Mark
1891 * U+30FE: Katakana Voiced Iteration Mark
1892 */
1893 WCHAR wch = *src;
1894 if ((0x30A1 <= wch && wch <= 0x30F3) ||
1895 wch == 0x30F4 || wch == 0x30F5 || wch == 0x30FD || wch == 0x30FE)
1896 {
1897 wch -= 0x60; /* Katakana to Hiragana */
1898 }
1899 if (pos < dstlen)
1900 dst[pos] = wch;
1901 }
1902 return pos;
1903}

Referenced by lcmap_string(), and map_to_halfwidth().

◆ map_to_katakana()

static int map_to_katakana ( const WCHAR src,
int  srclen,
WCHAR dst,
int  dstlen 
)
static

Definition at line 1905 of file lang.c.

1906{
1907 int pos;
1908 for (pos = 0; srclen; src++, srclen--, pos++)
1909 {
1910 /*
1911 * U+3041 ... U+3093: Hiragana
1912 * U+3094: Hiragana Letter VU
1913 * U+3095: Hiragana Letter Small KA
1914 * U+309D: Hiragana Iteration Mark
1915 * U+309E: Hiragana Voiced Iteration Mark
1916 */
1917 WCHAR wch = *src;
1918 if ((0x3041 <= wch && wch <= 0x3093) ||
1919 wch == 3094 || wch == 0x3095 || wch == 0x309D || wch == 0x309E)
1920 {
1921 wch += 0x60; /* Hiragana to Katakana */
1922 }
1923 if (pos < dstlen)
1924 dst[pos] = wch;
1925 }
1926 return pos;
1927}

Referenced by lcmap_string(), and map_to_halfwidth().

◆ map_to_lowercase()

static int map_to_lowercase ( DWORD  flags,
const WCHAR src,
int  srclen,
WCHAR dst,
int  dstlen 
)
static

Definition at line 2106 of file lang.c.

2107{
2108 int pos;
2109 for (pos = 0; srclen; src++, srclen--)
2110 {
2111 WCHAR wch = *src;
2113 continue;
2114 if (pos < dstlen)
2115 dst[pos] = tolowerW(wch);
2116 pos++;
2117 }
2118 return pos;
2119}
#define tolowerW(n)
Definition: unicode.h:44

Referenced by lcmap_string().

◆ map_to_simplified_chinese()

static int map_to_simplified_chinese ( DWORD  flags,
const WCHAR src,
int  srclen,
WCHAR dst,
int  dstlen 
)
static

Definition at line 2177 of file lang.c.

2178{
2179 int pos;
2180 for (pos = 0; srclen; src++, srclen--)
2181 {
2182 WCHAR wch = *src;
2183 if (pos < dstlen)
2185 pos++;
2186 }
2187 return pos;
2188}
static WCHAR find_wchar_pair(const WCHAR_PAIR *pairs, size_t count, WCHAR ch)
Definition: lang.c:2169
static const WCHAR_PAIR s_tra2sim[]
Definition: lang.c:2150

Referenced by lcmap_string().

◆ map_to_traditional_chinese()

static int map_to_traditional_chinese ( DWORD  flags,
const WCHAR src,
int  srclen,
WCHAR dst,
int  dstlen 
)
static

Definition at line 2190 of file lang.c.

2191{
2192 int pos;
2193 for (pos = 0; srclen; src++, srclen--)
2194 {
2195 WCHAR wch = *src;
2196 if (pos < dstlen)
2198 pos++;
2199 }
2200 return pos;
2201}
static const WCHAR_PAIR s_sim2tra[]
Definition: lang.c:2142

Referenced by lcmap_string().

◆ map_to_uppercase()

static int map_to_uppercase ( DWORD  flags,
const WCHAR src,
int  srclen,
WCHAR dst,
int  dstlen 
)
static

Definition at line 2121 of file lang.c.

2122{
2123 int pos;
2124 for (pos = 0; srclen; src++, srclen--)
2125 {
2126 WCHAR wch = *src;
2128 continue;
2129 if (pos < dstlen)
2130 dst[pos] = toupperW(wch);
2131 pos++;
2132 }
2133 return pos;
2134}
#define toupperW(n)
Definition: unicode.h:45

Referenced by lcmap_string().

◆ NLS_EnumLanguageGroupLocales()

static BOOL NLS_EnumLanguageGroupLocales ( ENUMLANGUAGEGROUPLOCALE_CALLBACKS lpProcs)
static

Definition at line 3115 of file lang.c.

3116{
3117 static const WCHAR szAlternateSortsKeyName[] = {
3118 'A','l','t','e','r','n','a','t','e',' ','S','o','r','t','s','\0'
3119 };
3120 WCHAR szNumber[10], szValue[4];
3121 HANDLE hKey;
3122 BOOL bContinue = TRUE, bAlternate = FALSE;
3123 LGRPID lgrpid;
3124 ULONG ulIndex = 1; /* Ignore default entry of 1st key */
3125
3126 if (!lpProcs || !lpProcs->lgrpid || lpProcs->lgrpid > LGRPID_ARMENIAN)
3127 {
3129 return FALSE;
3130 }
3131
3132 if (lpProcs->dwFlags)
3133 {
3135 return FALSE;
3136 }
3137
3139
3140 if (!hKey)
3141 WARN("NLS registry key not found. Please apply the default registry file 'wine.inf'\n");
3142
3143 while (bContinue)
3144 {
3145 if (NLS_RegEnumValue( hKey, ulIndex, szNumber, sizeof(szNumber),
3146 szValue, sizeof(szValue) ))
3147 {
3148 lgrpid = strtoulW( szValue, NULL, 16 );
3149
3150 TRACE("lcid %s, grpid %d (%smatched)\n", debugstr_w(szNumber),
3151 lgrpid, lgrpid == lpProcs->lgrpid ? "" : "not ");
3152
3153 if (lgrpid == lpProcs->lgrpid)
3154 {
3155 LCID lcid;
3156
3157 lcid = strtoulW( szNumber, NULL, 16 );
3158
3159 /* FIXME: native returns extra text for a few (17/150) locales, e.g:
3160 * '00000437 ;Georgian'
3161 * At present we only pass the LCID string.
3162 */
3163
3164 if (lpProcs->procW)
3165 bContinue = lpProcs->procW( lgrpid, lcid, szNumber, lpProcs->lParam );
3166 else
3167 {
3168 char szNumberA[sizeof(szNumber)/sizeof(WCHAR)];
3169
3170 WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0);
3171
3172 bContinue = lpProcs->procA( lgrpid, lcid, szNumberA, lpProcs->lParam );
3173 }
3174 }
3175
3176 ulIndex++;
3177 }
3178 else
3179 {
3180 /* Finished enumerating this key */
3181 if (!bAlternate)
3182 {
3183 /* Enumerate alternate sorts also */
3184 hKey = NLS_RegOpenKey( hKey, szAlternateSortsKeyName );
3185 bAlternate = TRUE;
3186 ulIndex = 0;
3187 }
3188 else
3189 bContinue = FALSE; /* Finished both keys */
3190 }
3191
3192 if (!bContinue)
3193 break;
3194 }
3195
3196 if (hKey)
3197 NtClose( hKey );
3198
3199 return TRUE;
3200}
static const WCHAR szLocaleKeyName[]
Definition: lang.c:57
static BOOL NLS_RegEnumValue(HANDLE hKey, UINT ulIndex, LPWSTR szValueName, ULONG valueNameSize, LPWSTR szValueData, ULONG valueDataSize)
Definition: lang.c:2819
#define strtoulW(s1, s2, b)
Definition: unicode.h:41
LANGGROUPLOCALE_ENUMPROCW procW
Definition: lang.c:3108
LANGGROUPLOCALE_ENUMPROCA procA
Definition: lang.c:3107
uint32_t ULONG
Definition: typedefs.h:59
DWORD LGRPID
Definition: winnls.h:520
#define LGRPID_ARMENIAN
Definition: winnls.h:476

Referenced by EnumLanguageGroupLocalesA(), and EnumLanguageGroupLocalesW().

◆ NLS_EnumSystemCodePages()

static BOOL NLS_EnumSystemCodePages ( ENUMSYSTEMCODEPAGES_CALLBACKS lpProcs)
static

Definition at line 3580 of file lang.c.

3581{
3582 WCHAR szNumber[5 + 1], szValue[MAX_PATH];
3583 HANDLE hKey;
3584 BOOL bContinue = TRUE;
3585 ULONG ulIndex = 0;
3586
3587 if (!lpProcs)
3588 {
3590 return FALSE;
3591 }
3592
3593 switch (lpProcs->dwFlags)
3594 {
3595 case CP_INSTALLED:
3596 case CP_SUPPORTED:
3597 break;
3598 default:
3600 return FALSE;
3601 }
3602
3603 hKey = NLS_RegOpenKey(0, L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage");
3604 if (!hKey)
3605 {
3606 WARN("NLS_RegOpenKey() failed\n");
3607 return FALSE;
3608 }
3609
3610 while (bContinue)
3611 {
3612 if (NLS_RegEnumValue(hKey, ulIndex, szNumber, sizeof(szNumber),
3613 szValue, sizeof(szValue)))
3614 {
3615 if ((lpProcs->dwFlags == CP_SUPPORTED)||
3616 ((lpProcs->dwFlags == CP_INSTALLED)&&(wcslen(szValue) > 2)))
3617 {
3618 if (lpProcs->procW)
3619 {
3620 bContinue = lpProcs->procW(szNumber);
3621 }
3622 else
3623 {
3624 char szNumberA[sizeof(szNumber)/sizeof(WCHAR)];
3625
3626 WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0);
3627 bContinue = lpProcs->procA(szNumberA);
3628 }
3629 }
3630
3631 ulIndex++;
3632
3633 } else bContinue = FALSE;
3634
3635 if (!bContinue)
3636 break;
3637 }
3638
3639 if (hKey)
3640 NtClose(hKey);
3641
3642 return TRUE;
3643}
#define MAX_PATH
Definition: compat.h:34
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define L(x)
Definition: ntvdm.h:50
#define CP_INSTALLED
Definition: winnls.h:199
#define CP_SUPPORTED
Definition: winnls.h:200

Referenced by EnumSystemCodePagesA(), and EnumSystemCodePagesW().

◆ NLS_EnumSystemLanguageGroups()

static BOOL NLS_EnumSystemLanguageGroups ( ENUMLANGUAGEGROUP_CALLBACKS lpProcs)
static

Definition at line 2919 of file lang.c.

2920{
2921 WCHAR szNumber[10], szValue[4];
2922 HANDLE hKey;
2923 BOOL bContinue = TRUE;
2924 ULONG ulIndex = 0;
2925
2926 if (!lpProcs)
2927 {
2929 return FALSE;
2930 }
2931
2932 switch (lpProcs->dwFlags)
2933 {
2934 case 0:
2935 /* Default to LGRPID_INSTALLED */
2936 lpProcs->dwFlags = LGRPID_INSTALLED;
2937 /* Fall through... */
2938 case LGRPID_INSTALLED:
2939 case LGRPID_SUPPORTED:
2940 break;
2941 default:
2943 return FALSE;
2944 }
2945
2947
2948 if (!hKey)
2949 FIXME("NLS registry key not found. Please apply the default registry file 'wine.inf'\n");
2950
2951 while (bContinue)
2952 {
2953 if (NLS_RegEnumValue( hKey, ulIndex, szNumber, sizeof(szNumber),
2954 szValue, sizeof(szValue) ))
2955 {
2956 BOOL bInstalled = szValue[0] == '1';
2957 LGRPID lgrpid = strtoulW( szNumber, NULL, 16 );
2958
2959 TRACE("grpid %s (%sinstalled)\n", debugstr_w(szNumber),
2960 bInstalled ? "" : "not ");
2961
2962 if (lpProcs->dwFlags == LGRPID_SUPPORTED || bInstalled)
2963 {
2964 WCHAR szGrpName[48];
2965
2966 if (!NLS_GetLanguageGroupName( lgrpid, szGrpName, sizeof(szGrpName) / sizeof(WCHAR) ))
2967 szGrpName[0] = '\0';
2968
2969 if (lpProcs->procW)
2970 bContinue = lpProcs->procW( lgrpid, szNumber, szGrpName, lpProcs->dwFlags,
2971 lpProcs->lParam );
2972 else
2973 {
2974 char szNumberA[sizeof(szNumber)/sizeof(WCHAR)];
2975 char szGrpNameA[48];
2976
2977 /* FIXME: MSDN doesn't say which code page the W->A translation uses,
2978 * or whether the language names are ever localised. Assume CP_ACP.
2979 */
2980
2981 WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0);
2982 WideCharToMultiByte(CP_ACP, 0, szGrpName, -1, szGrpNameA, sizeof(szGrpNameA), 0, 0);
2983
2984 bContinue = lpProcs->procA( lgrpid, szNumberA, szGrpNameA, lpProcs->dwFlags,
2985 lpProcs->lParam );
2986 }
2987 }
2988
2989 ulIndex++;
2990 }
2991 else
2992 bContinue = FALSE;
2993
2994 if (!bContinue)
2995 break;
2996 }
2997
2998 if (hKey)
2999 NtClose( hKey );
3000
3001 return TRUE;
3002}
static BOOL NLS_GetLanguageGroupName(LGRPID lgrpid, LPWSTR szName, ULONG nameSize)
Definition: lang.c:2868

Referenced by EnumSystemLanguageGroupsA(), and EnumSystemLanguageGroupsW().

◆ NLS_GetGeoFriendlyName()

static int NLS_GetGeoFriendlyName ( GEOID  Location,
LPWSTR  szFriendlyName,
int  cchData 
)
static

Definition at line 3928 of file lang.c.

3930{
3931 /* FIXME: move *.nls resources out of kernel32 into locale.nls */
3932 Location += NLSRC_OFFSET;
3933 Location &= 0xFFFF;
3934
3935 if (cchData == 0)
3936#ifdef __REACTOS__
3937 return GetLocalisedText(Location, NULL, 0, lang);
3938#else
3939 return GetLocalisedText(Location, NULL, 0);
3940#endif
3941
3942#ifdef __REACTOS__
3943 if (GetLocalisedText(Location, szFriendlyName, (UINT)cchData, lang))
3944#else
3945 if (GetLocalisedText(Location, szFriendlyName, (UINT)cchData))
3946#endif
3947 return strlenW(szFriendlyName) + 1;
3948
3949 return 0;
3950}
#define NLSRC_OFFSET
Definition: lang.c:50
UINT GetLocalisedText(IN UINT uID, IN LPWSTR lpszDest, IN UINT cchDest)

Referenced by GetGeoInfoW().

◆ NLS_GetLanguageGroupName()

static BOOL NLS_GetLanguageGroupName ( LGRPID  lgrpid,
LPWSTR  szName,
ULONG  nameSize 
)
static

Definition at line 2868 of file lang.c.

2869{
2870 LANGID langId;
2871 LPCWSTR szResourceName = MAKEINTRESOURCEW(((lgrpid + 0x2000) >> 4) + 1);
2872 HRSRC hResource;
2873 BOOL bRet = FALSE;
2874
2875 /* FIXME: Is it correct to use the system default langid? */
2876 langId = GetSystemDefaultLangID();
2877
2878 if (SUBLANGID(langId) == SUBLANG_NEUTRAL)
2879 langId = MAKELANGID( PRIMARYLANGID(langId), SUBLANG_DEFAULT );
2880
2881 hResource = FindResourceExW( kernel32_handle, (LPWSTR)RT_STRING, szResourceName, langId );
2882
2883 if (hResource)
2884 {
2885 HGLOBAL hResDir = LoadResource( kernel32_handle, hResource );
2886
2887 if (hResDir)
2888 {
2889 ULONG iResourceIndex = lgrpid & 0xf;
2890 LPCWSTR lpResEntry = LockResource( hResDir );
2891 ULONG i;
2892
2893 for (i = 0; i < iResourceIndex; i++)
2894 lpResEntry += *lpResEntry + 1;
2895
2896 if (*lpResEntry < nameSize)
2897 {
2898 memcpy( szName, lpResEntry + 1, *lpResEntry * sizeof(WCHAR) );
2899 szName[*lpResEntry] = '\0';
2900 bRet = TRUE;
2901 }
2902
2903 }
2904 FreeResource( hResource );
2905 }
2906 return bRet;
2907}
BOOL WINAPI FreeResource(HGLOBAL handle)
Definition: res.c:559
LANGID WINAPI GetSystemDefaultLangID(void)
Definition: lang.c:761
static const WCHAR szName[]
Definition: powrprof.c:45

Referenced by NLS_EnumSystemLanguageGroups().

◆ NLS_RegEnumValue()