ReactOS  0.4.12-dev-685-gf36cbf7
lang.c File Reference
#include <k32.h>
#include <debug.h>
#include "lcformat_private.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  ENUMLANGUAGEGROUP_CALLBACKS
 
struct  ENUMLANGUAGEGROUPLOCALE_CALLBACKS
 
struct  geoinfo_t
 
struct  ENUMSYSTEMCODEPAGES_CALLBACKS
 
struct  ENUM_UILANG_CALLBACK
 

Macros

#define NDEBUG
 
#define REG_SZ   1
 
#define NLSRC_OFFSET   5000 /* FIXME */
 
#define LOCALE_LOCALEINFOFLAGSMASK
 

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)
 
INT WINAPI LCMapStringEx (LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lparam)
 
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 struct geoinfo_t geoinfodata []
 

Macro Definition Documentation

◆ LOCALE_LOCALEINFOFLAGSMASK

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

Definition at line 41 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 37 of file lang.c.

◆ REG_SZ

#define REG_SZ   1

Definition at line 32 of file lang.c.

Enumeration Type Documentation

◆ locationkind

Enumerator
LOCATION_NATION 
LOCATION_REGION 
LOCATION_BOTH 

Definition at line 2766 of file lang.c.

2766  {
2767  LOCATION_NATION = 0,
2770 };

Function Documentation

◆ CompareStringA()

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

Definition at line 2296 of file lang.c.

2298 {
2299  WCHAR *buf1W = NtCurrentTeb()->StaticUnicodeBuffer;
2300  WCHAR *buf2W = buf1W + 130;
2301  LPWSTR str1W, str2W;
2302  INT len1W = 0, len2W = 0, ret;
2303  UINT locale_cp = CP_ACP;
2304 
2305  if (!str1 || !str2)
2306  {
2308  return 0;
2309  }
2310  if (len1 < 0) len1 = strlen(str1);
2311  if (len2 < 0) len2 = strlen(str2);
2312 
2313  if (!(flags & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage( lcid );
2314 
2315  if (len1)
2316  {
2317  if (len1 <= 130) len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, buf1W, 130);
2318  if (len1W)
2319  str1W = buf1W;
2320  else
2321  {
2322  len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, NULL, 0);
2323  str1W = HeapAlloc(GetProcessHeap(), 0, len1W * sizeof(WCHAR));
2324  if (!str1W)
2325  {
2327  return 0;
2328  }
2329  MultiByteToWideChar(locale_cp, 0, str1, len1, str1W, len1W);
2330  }
2331  }
2332  else
2333  {
2334  len1W = 0;
2335  str1W = buf1W;
2336  }
2337 
2338  if (len2)
2339  {
2340  if (len2 <= 130) len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, buf2W, 130);
2341  if (len2W)
2342  str2W = buf2W;
2343  else
2344  {
2345  len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, NULL, 0);
2346  str2W = HeapAlloc(GetProcessHeap(), 0, len2W * sizeof(WCHAR));
2347  if (!str2W)
2348  {
2349  if (str1W != buf1W) HeapFree(GetProcessHeap(), 0, str1W);
2351  return 0;
2352  }
2353  MultiByteToWideChar(locale_cp, 0, str2, len2, str2W, len2W);
2354  }
2355  }
2356  else
2357  {
2358  len2W = 0;
2359  str2W = buf2W;
2360  }
2361 
2362  ret = CompareStringEx(NULL, flags, str1W, len1W, str2W, len2W, NULL, NULL, 0);
2363 
2364  if (str1W != buf1W) HeapFree(GetProcessHeap(), 0, str1W);
2365  if (str2W != buf2W) HeapFree(GetProcessHeap(), 0, str2W);
2366  return ret;
2367 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
static UINT get_lcid_codepage(LCID lcid)
Definition: lang.c:257
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned int UINT
Definition: ndis.h:50
#define SetLastError(x)
Definition: compat.h:409
GLbitfield flags
Definition: glext.h:7161
int ret
#define LOCALE_USE_CP_ACP
Definition: winnls.h:20
INT WINAPI CompareStringEx(LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lParam)
Definition: lang.c:2225
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

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 2225 of file lang.c.

2227 {
2230  DWORD semistub_flags = NORM_LINGUISTIC_CASING|LINGUISTIC_IGNORECASE|0x10000000;
2231  /* 0x10000000 is related to diacritics in Arabic, Japanese, and Hebrew */
2232  INT ret;
2233  static int once;
2234 
2235  if (version) FIXME("unexpected version parameter\n");
2236  if (reserved) FIXME("unexpected reserved value\n");
2237  if (lParam) FIXME("unexpected lParam\n");
2238 
2239  if (!str1 || !str2)
2240  {
2242  return 0;
2243  }
2244 
2245  if (flags & ~(supported_flags|semistub_flags))
2246  {
2248  return 0;
2249  }
2250 
2251  if (flags & semistub_flags)
2252  {
2253  if (!once++)
2254  FIXME("semi-stub behavior for flag(s) 0x%x\n", flags & semistub_flags);
2255  }
2256 
2257  if (len1 < 0) len1 = strlenW(str1);
2258  if (len2 < 0) len2 = strlenW(str2);
2259 
2260  ret = wine_compare_string(flags, str1, len1, str2, len2);
2261 
2262  if (ret) /* need to translate result */
2263  return (ret < 0) ? CSTR_LESS_THAN : CSTR_GREATER_THAN;
2264  return CSTR_EQUAL;
2265 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define LINGUISTIC_IGNORECASE
Definition: winnls.h:178
#define CSTR_GREATER_THAN
Definition: winnls.h:454
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define SORT_STRINGSORT
Definition: winnls.h:180
#define NORM_IGNORESYMBOLS
Definition: winnls.h:176
#define NORM_IGNORECASE
Definition: winnls.h:173
#define NORM_IGNOREKANATYPE
Definition: winnls.h:174
int32_t INT
Definition: typedefs.h:56
#define NORM_LINGUISTIC_CASING
Definition: winnls.h:179
#define FIXME(fmt,...)
Definition: debug.h:110
r reserved
Definition: btrfs.c:2655
static const WCHAR version[]
Definition: asmname.c:64
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
GLbitfield flags
Definition: glext.h:7161
int ret
#define CSTR_EQUAL
Definition: winnls.h:453
#define LOCALE_USE_CP_ACP
Definition: winnls.h:20
int wine_compare_string(int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2)
Definition: sortkey.c:358
#define CSTR_LESS_THAN
Definition: winnls.h:452
#define NORM_IGNORENONSPACE
Definition: winnls.h:175
#define NORM_IGNOREWIDTH
Definition: winnls.h:177
LPARAM lParam
Definition: combotst.c:139
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583

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

◆ CompareStringW()

◆ convert_default_lcid()

static LCID convert_default_lcid ( LCID  lcid,
LCTYPE  lctype 
)
static

Definition at line 512 of file lang.c.

513 {
514  if (lcid == LOCALE_SYSTEM_DEFAULT ||
515  lcid == LOCALE_USER_DEFAULT ||
516  lcid == LOCALE_NEUTRAL)
517  {
518  LCID default_id = 0;
519 
520  switch(lctype & 0xffff)
521  {
522  case LOCALE_SSORTNAME:
523  default_id = lcid_LC_COLLATE;
524  break;
525 
529  case LOCALE_IDEFAULTEBCDICCODEPAGE:
532  default_id = lcid_LC_CTYPE;
533  break;
534 
535  case LOCALE_ICURRDIGITS:
536  case LOCALE_ICURRENCY:
538  case LOCALE_INEGCURR:
540  case LOCALE_INEGSIGNPOSN:
543  case LOCALE_IPOSSIGNPOSN:
545  case LOCALE_SCURRENCY:
546  case LOCALE_SINTLSYMBOL:
548  case LOCALE_SMONGROUPING:
550  case LOCALE_SNATIVECURRNAME:
551  default_id = lcid_LC_MONETARY;
552  break;
553 
554  case LOCALE_IDIGITS:
555  case LOCALE_IDIGITSUBSTITUTION:
556  case LOCALE_ILZERO:
557  case LOCALE_INEGNUMBER:
558  case LOCALE_SDECIMAL:
559  case LOCALE_SGROUPING:
560  //case LOCALE_SNAN:
563  //case LOCALE_SNEGINFINITY:
564  //case LOCALE_SPOSINFINITY:
566  case LOCALE_STHOUSAND:
567  default_id = lcid_LC_NUMERIC;
568  break;
569 
571  case LOCALE_ICENTURY:
572  case LOCALE_IDATE:
573  case LOCALE_IDAYLZERO:
576  case LOCALE_ILDATE:
577  case LOCALE_IMONLZERO:
579  case LOCALE_ITIME:
581  case LOCALE_ITLZERO:
582  case LOCALE_S1159:
583  case LOCALE_S2359:
604  case LOCALE_SDATE:
605  case LOCALE_SDAYNAME1:
606  case LOCALE_SDAYNAME2:
607  case LOCALE_SDAYNAME3:
608  case LOCALE_SDAYNAME4:
609  case LOCALE_SDAYNAME5:
610  case LOCALE_SDAYNAME6:
611  case LOCALE_SDAYNAME7:
612  //case LOCALE_SDURATION:
613  case LOCALE_SLONGDATE:
614  case LOCALE_SMONTHNAME1:
615  case LOCALE_SMONTHNAME2:
616  case LOCALE_SMONTHNAME3:
617  case LOCALE_SMONTHNAME4:
618  case LOCALE_SMONTHNAME5:
619  case LOCALE_SMONTHNAME6:
620  case LOCALE_SMONTHNAME7:
621  case LOCALE_SMONTHNAME8:
622  case LOCALE_SMONTHNAME9:
623  case LOCALE_SMONTHNAME10:
624  case LOCALE_SMONTHNAME11:
625  case LOCALE_SMONTHNAME12:
626  case LOCALE_SMONTHNAME13:
627  case LOCALE_SSHORTDATE:
628  //case LOCALE_SSHORTESTDAYNAME1:
629  //case LOCALE_SSHORTESTDAYNAME2:
630  //case LOCALE_SSHORTESTDAYNAME3:
631  //case LOCALE_SSHORTESTDAYNAME4:
632  //case LOCALE_SSHORTESTDAYNAME5:
633  //case LOCALE_SSHORTESTDAYNAME6:
634  //case LOCALE_SSHORTESTDAYNAME7:
635  case LOCALE_STIME:
636  case LOCALE_STIMEFORMAT:
637  case LOCALE_SYEARMONTH:
638  default_id = lcid_LC_TIME;
639  break;
640 
641  case LOCALE_IPAPERSIZE:
642  default_id = lcid_LC_PAPER;
643  break;
644 
645  case LOCALE_IMEASURE:
646  default_id = lcid_LC_MEASUREMENT;
647  break;
648 
649  case LOCALE_ICOUNTRY:
650  default_id = lcid_LC_TELEPHONE;
651  break;
652  }
653  if (default_id) lcid = default_id;
654  }
655  return ConvertDefaultLocale( lcid );
656 }
#define LOCALE_SGROUPING
Definition: winnls.h:44
#define LOCALE_IDEFAULTANSICODEPAGE
Definition: winnls.h:38
#define LOCALE_SABBREVMONTHNAME12
Definition: winnls.h:115
#define LOCALE_SMONGROUPING
Definition: winnls.h:53
static LCID lcid_LC_TELEPHONE
Definition: lang.c:143
static LCID lcid_LC_NUMERIC
Definition: lang.c:139
#define LOCALE_SABBREVDAYNAME2
Definition: winnls.h:85
#define LOCALE_SABBREVMONTHNAME1
Definition: winnls.h:104
#define LOCALE_SMONTHNAME5
Definition: winnls.h:95
#define LOCALE_IPOSSYMPRECEDES
Definition: winnls.h:122
#define LOCALE_SABBREVMONTHNAME6
Definition: winnls.h:109
#define LOCALE_SMONTHNAME2
Definition: winnls.h:92
static LCID lcid_LC_MEASUREMENT
Definition: lang.c:142
#define LOCALE_SABBREVDAYNAME4
Definition: winnls.h:87
#define LOCALE_SABBREVDAYNAME7
Definition: winnls.h:90
#define LOCALE_SABBREVDAYNAME1
Definition: winnls.h:84
#define LOCALE_IDATE
Definition: winnls.h:63
#define LOCALE_USER_DEFAULT
#define LOCALE_INEGSYMPRECEDES
Definition: winnls.h:124
#define LOCALE_SMONTHNAME13
Definition: winnls.h:103
#define LOCALE_SDAYNAME2
Definition: winnls.h:78
#define LOCALE_IDEFAULTMACCODEPAGE
Definition: winnls.h:39
#define LOCALE_SMONTHNAME6
Definition: winnls.h:96
#define LOCALE_ICALENDARTYPE
Definition: winnls.h:73
#define LOCALE_ILZERO
Definition: winnls.h:46
#define LOCALE_SABBREVMONTHNAME7
Definition: winnls.h:110
DWORD LCID
Definition: nls.h:13
#define LOCALE_IMEASURE
Definition: winnls.h:41
#define LOCALE_SABBREVMONTHNAME3
Definition: winnls.h:106
#define LOCALE_SMONTHNAME8
Definition: winnls.h:98
#define LOCALE_IPOSSEPBYSPACE
Definition: winnls.h:123
#define LOCALE_SABBREVMONTHNAME8
Definition: winnls.h:111
#define LOCALE_SCURRENCY
Definition: winnls.h:49
static LCID lcid_LC_CTYPE
Definition: lang.c:137
#define LOCALE_INEGNUMBER
Definition: winnls.h:47
#define LOCALE_SDAYNAME5
Definition: winnls.h:81
#define LOCALE_SDAYNAME1
Definition: winnls.h:77
#define LOCALE_SABBREVDAYNAME3
Definition: winnls.h:86
#define LOCALE_SABBREVMONTHNAME5
Definition: winnls.h:108
#define LOCALE_SMONTHNAME1
Definition: winnls.h:91
#define LOCALE_STHOUSAND
Definition: winnls.h:43
LCID WINAPI ConvertDefaultLocale(LCID lcid)
Definition: lang.c:1499
#define LOCALE_SABBREVMONTHNAME10
Definition: winnls.h:113
#define LOCALE_SINTLSYMBOL
Definition: winnls.h:50
#define LOCALE_SABBREVDAYNAME6
Definition: winnls.h:89
#define LOCALE_SLONGDATE
Definition: winnls.h:61
#define LOCALE_ITIMEMARKPOSN
Definition: winnls.h:66
#define LOCALE_IMONLZERO
Definition: winnls.h:70
#define LOCALE_INEGCURR
Definition: winnls.h:57
#define LOCALE_SABBREVMONTHNAME4
Definition: winnls.h:107
#define LOCALE_SMONTHNAME4
Definition: winnls.h:94
#define LOCALE_SABBREVMONTHNAME13
Definition: winnls.h:116
#define LOCALE_SDECIMAL
Definition: winnls.h:42
#define LOCALE_STIME
Definition: winnls.h:59
static LCID lcid_LC_COLLATE
Definition: lang.c:136
static LCID lcid_LC_TIME
Definition: lang.c:140
#define LOCALE_SDAYNAME4
Definition: winnls.h:80
#define LOCALE_ICURRENCY
Definition: winnls.h:56
#define LOCALE_SMONDECIMALSEP
Definition: winnls.h:51
#define LOCALE_SMONTHNAME11
Definition: winnls.h:101
#define LOCALE_SDAYNAME3
Definition: winnls.h:79
#define LOCALE_SMONTHOUSANDSEP
Definition: winnls.h:52
#define LOCALE_SMONTHNAME10
Definition: winnls.h:100
#define LOCALE_SDATE
Definition: winnls.h:58
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:117
#define LOCALE_SABBREVMONTHNAME2
Definition: winnls.h:105
#define LOCALE_IDAYLZERO
Definition: winnls.h:69
#define LOCALE_SYSTEM_DEFAULT
static LCID lcid_LC_PAPER
Definition: lang.c:141
#define LOCALE_SDAYNAME7
Definition: winnls.h:83
#define LOCALE_S1159
Definition: winnls.h:71
#define LOCALE_FONTSIGNATURE
Definition: winnls.h:126
#define LOCALE_ITLZERO
Definition: winnls.h:68
#define LOCALE_INEGSIGNPOSN
Definition: winnls.h:121
#define LOCALE_IINTLCURRDIGITS
Definition: winnls.h:55
#define LOCALE_SMONTHNAME3
Definition: winnls.h:93
#define LOCALE_SDAYNAME6
Definition: winnls.h:82
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:118
#define LOCALE_SSHORTDATE
Definition: winnls.h:60
#define LOCALE_ICOUNTRY
Definition: winnls.h:30
#define LOCALE_IDIGITS
Definition: winnls.h:45
#define LOCALE_ILDATE
Definition: winnls.h:64
#define LOCALE_IFIRSTDAYOFWEEK
Definition: winnls.h:75
#define LOCALE_IDEFAULTCODEPAGE
Definition: winnls.h:37
#define LOCALE_IFIRSTWEEKOFYEAR
Definition: winnls.h:76
static LCID lcid_LC_MONETARY
Definition: lang.c:138
#define LOCALE_SABBREVMONTHNAME9
Definition: winnls.h:112
#define LOCALE_SABBREVMONTHNAME11
Definition: winnls.h:114
#define LOCALE_ICURRDIGITS
Definition: winnls.h:54
#define LOCALE_SABBREVDAYNAME5
Definition: winnls.h:88
#define LOCALE_ITIME
Definition: winnls.h:65
#define LOCALE_SMONTHNAME9
Definition: winnls.h:99
#define LOCALE_SMONTHNAME12
Definition: winnls.h:102
#define LOCALE_IPOSSIGNPOSN
Definition: winnls.h:120
#define LOCALE_INEGSEPBYSPACE
Definition: winnls.h:125
#define LOCALE_SMONTHNAME7
Definition: winnls.h:97
#define LOCALE_NEUTRAL
#define LOCALE_SNATIVEDIGITS
Definition: winnls.h:48
#define LOCALE_ICENTURY
Definition: winnls.h:67
#define LOCALE_IOPTIONALCALENDAR
Definition: winnls.h:74
#define LOCALE_S2359
Definition: winnls.h:72
#define LOCALE_STIMEFORMAT
Definition: winnls.h:62
#define LOCALE_IDEFAULTUNIXCODEPAGE
Definition: winnls.h:171

Referenced by GetLocaleInfoW().

◆ ConvertDefaultLocale()

LCID WINAPI ConvertDefaultLocale ( LCID  lcid)

Definition at line 1499 of file lang.c.

1500 {
1501  LANGID langid;
1502 
1503  switch (lcid)
1504  {
1505  case LOCALE_INVARIANT:
1506  /* keep as-is */
1507  break;
1508  case LOCALE_SYSTEM_DEFAULT:
1509  lcid = GetSystemDefaultLCID();
1510  break;
1511  case LOCALE_USER_DEFAULT:
1512  case LOCALE_NEUTRAL:
1513  lcid = GetUserDefaultLCID();
1514  break;
1515  default:
1516  /* Replace SUBLANG_NEUTRAL with SUBLANG_DEFAULT */
1517  langid = LANGIDFROMLCID(lcid);
1519  {
1521  lcid = MAKELCID(langid, SORTIDFROMLCID(lcid));
1522  }
1523  }
1524  return lcid;
1525 }
#define MAKELCID(lgid, srtid)
#define LOCALE_USER_DEFAULT
#define SUBLANG_DEFAULT
Definition: nls.h:168
WORD LANGID
Definition: typedefs.h:79
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:765
#define SUBLANG_NEUTRAL
Definition: nls.h:167
LANGID langid
Definition: msctf.idl:605
LCID WINAPI GetSystemDefaultLCID(void)
Definition: lang.c:784
#define LOCALE_SYSTEM_DEFAULT
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define LOCALE_INVARIANT
#define SORTIDFROMLCID(lcid)
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LOCALE_NEUTRAL
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define SUBLANGID(l)
Definition: nls.h:17

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 691 of file lang.c.

692 {
693  static const WCHAR cplW[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l',0};
694  static const WCHAR intlW[] = {'I','n','t','e','r','n','a','t','i','o','n','a','l',0};
697  HANDLE cpl_key, hkey = 0;
698 
699  if (RtlOpenCurrentUser( KEY_ALL_ACCESS, &hkey ) != STATUS_SUCCESS) return 0;
700 
701  attr.Length = sizeof(attr);
702  attr.RootDirectory = hkey;
703  attr.ObjectName = &nameW;
704  attr.Attributes = 0;
705  attr.SecurityDescriptor = NULL;
706  attr.SecurityQualityOfService = NULL;
707  RtlInitUnicodeString( &nameW, cplW );
708 
709  if (!NtCreateKey( &cpl_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
710  {
711  NtClose( attr.RootDirectory );
712  attr.RootDirectory = cpl_key;
713  RtlInitUnicodeString( &nameW, intlW );
714  if (NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) hkey = 0;
715  }
716  NtClose( attr.RootDirectory );
717  return hkey;
718 }
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR nameW[]
Definition: main.c:46
Definition: cookie.c:170
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
__u8 attr
Definition: mkdosfs.c:359
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)
return STATUS_SUCCESS
Definition: btrfs.c:2725

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 1553 of file lang.c.

1555 {
1556  LOCALE_ENUMPROCA lpfnLocaleEnum = (LOCALE_ENUMPROCA)lParam;
1557  char buf[20];
1558 
1559  sprintf(buf, "%08x", (UINT)LangID);
1560  return lpfnLocaleEnum( buf );
1561 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define sprintf(buf, format,...)
Definition: sprintf.c:55
BOOL(CALLBACK * LOCALE_ENUMPROCA)(LPSTR)
Definition: winnls.h:534
unsigned int UINT
Definition: ndis.h:50
LPARAM lParam
Definition: combotst.c:139

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 1563 of file lang.c.

1565 {
1566  static const WCHAR formatW[] = {'%','0','8','x',0};
1567  LOCALE_ENUMPROCW lpfnLocaleEnum = (LOCALE_ENUMPROCW)lParam;
1568  WCHAR buf[20];
1569  sprintfW( buf, formatW, (UINT)LangID );
1570  return lpfnLocaleEnum( buf );
1571 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned int UINT
Definition: ndis.h:50
#define sprintfW
Definition: unicode.h:58
BOOL(CALLBACK * LOCALE_ENUMPROCW)(LPWSTR)
Definition: winnls.h:535
LPARAM lParam
Definition: combotst.c:139

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 1618 of file lang.c.

1620 {
1621  struct enum_locale_ex_data *data = (struct enum_locale_ex_data *)lparam;
1622  WCHAR buffer[256];
1623  DWORD neutral;
1624  unsigned int flags;
1625 
1627  buffer, ARRAY_SIZE( buffer ));
1629  LOCALE_INEUTRAL | LOCALE_NOUSEROVERRIDE | LOCALE_RETURN_NUMBER,
1630  (LPWSTR)&neutral, sizeof(neutral) / sizeof(WCHAR) ))
1631  neutral = 0;
1634  if (data->flags && !(data->flags & flags)) return TRUE;
1635  return data->proc( buffer, flags, data->lparam );
1636 }
#define MAKELCID(lgid, srtid)
#define TRUE
Definition: types.h:120
#define LOCALE_INEUTRAL
Definition: winnls.h:154
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLuint buffer
Definition: glext.h:5915
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1095
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
#define LOCALE_NEUTRALDATA
Definition: winnls.h:207
static const WCHAR lang[]
Definition: wbemdisp.c:287
#define SORT_DEFAULT
#define LOCALE_SNAME
Definition: winnls.h:129
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define LOCALE_SPECIFICDATA
Definition: winnls.h:208
GLbitfield flags
Definition: glext.h:7161
#define LOCALE_WINDOWS
Definition: winnls.h:203
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
#define ARRAY_SIZE(a)
Definition: main.h:24
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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 3405 of file lang.c.

3407 {
3409  char buf[20];
3410 
3411  sprintf(buf, "%08x", (UINT)LangID);
3412  return enum_uilang->u.procA( buf, enum_uilang->param );
3413 }
union ENUM_UILANG_CALLBACK::@436 u
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define sprintf(buf, format,...)
Definition: sprintf.c:55
unsigned int UINT
Definition: ndis.h:50
UILANGUAGE_ENUMPROCA procA
Definition: lang.c:3398
LONG_PTR param
Definition: lang.c:3402
LPARAM lParam
Definition: combotst.c:139

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 3415 of file lang.c.

3417 {
3418  static const WCHAR formatW[] = {'%','0','8','x',0};
3420  WCHAR buf[20];
3421 
3422  sprintfW( buf, formatW, (UINT)LangID );
3423  return enum_uilang->u.procW( buf, enum_uilang->param );
3424 }
union ENUM_UILANG_CALLBACK::@436 u
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned int UINT
Definition: ndis.h:50
LONG_PTR param
Definition: lang.c:3402
UILANGUAGE_ENUMPROCW procW
Definition: lang.c:3399
#define sprintfW
Definition: unicode.h:58
LPARAM lParam
Definition: combotst.c:139

Referenced by EnumUILanguagesW().

◆ EnumLanguageGroupLocalesA()

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

Definition at line 3098 of file lang.c.

3100 {
3102 
3103  TRACE("(%p,0x%08X,0x%08X,0x%08lX)\n", pLangGrpLcEnumProc, lgrpid, dwFlags, lParam);
3104 
3105  callbacks.procA = pLangGrpLcEnumProc;
3106  callbacks.procW = NULL;
3107  callbacks.dwFlags = dwFlags;
3108  callbacks.lgrpid = lgrpid;
3109  callbacks.lParam = lParam;
3110 
3111  return NLS_EnumLanguageGroupLocales( pLangGrpLcEnumProc ? &callbacks : NULL );
3112 }
static BOOL NLS_EnumLanguageGroupLocales(ENUMLANGUAGEGROUPLOCALE_CALLBACKS *lpProcs)
Definition: lang.c:2679
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static int callbacks
Definition: xmllint.c:873
LPARAM lParam
Definition: combotst.c:139

Referenced by InitFunctionPointers(), and test_digit_substitution().

◆ EnumLanguageGroupLocalesW()

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

Definition at line 3119 of file lang.c.

3121 {
3123 
3124  TRACE("(%p,0x%08X,0x%08X,0x%08lX)\n", pLangGrpLcEnumProc, lgrpid, dwFlags, lParam);
3125 
3126  callbacks.procA = NULL;
3127  callbacks.procW = pLangGrpLcEnumProc;
3128  callbacks.dwFlags = dwFlags;
3129  callbacks.lgrpid = lgrpid;
3130  callbacks.lParam = lParam;
3131 
3132  return NLS_EnumLanguageGroupLocales( pLangGrpLcEnumProc ? &callbacks : NULL );
3133 }
static BOOL NLS_EnumLanguageGroupLocales(ENUMLANGUAGEGROUPLOCALE_CALLBACKS *lpProcs)
Definition: lang.c:2679
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static int callbacks
Definition: xmllint.c:873
LPARAM lParam
Definition: combotst.c:139

◆ EnumSystemCodePagesA()

BOOL WINAPI EnumSystemCodePagesA ( CODEPAGE_ENUMPROCA  lpCodePageEnumProc,
DWORD  dwFlags 
)

Definition at line 3236 of file lang.c.

3240 {
3242 
3243  TRACE("(%p,0x%08X,0x%08lX)\n", lpCodePageEnumProc, dwFlags);
3244 
3245  procs.procA = lpCodePageEnumProc;
3246  procs.procW = NULL;
3247  procs.dwFlags = dwFlags;
3248 
3249  return NLS_EnumSystemCodePages(lpCodePageEnumProc ? &procs : NULL);
3250 }
static BOOL NLS_EnumSystemCodePages(ENUMSYSTEMCODEPAGES_CALLBACKS *lpProcs)
Definition: lang.c:3144
smooth NULL
Definition: ftsmooth.c:416
CODEPAGE_ENUMPROCW procW
Definition: lang.c:3139
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
CODEPAGE_ENUMPROCA procA
Definition: lang.c:3138

◆ EnumSystemCodePagesW()

BOOL WINAPI EnumSystemCodePagesW ( CODEPAGE_ENUMPROCW  lpCodePageEnumProc,
DWORD  dwFlags 
)

Definition at line 3214 of file lang.c.

3218 {
3220 
3221  TRACE("(%p,0x%08X,0x%08lX)\n", lpCodePageEnumProc, dwFlags);
3222 
3223  procs.procA = NULL;
3224  procs.procW = lpCodePageEnumProc;
3225  procs.dwFlags = dwFlags;
3226 
3227  return NLS_EnumSystemCodePages(lpCodePageEnumProc ? &procs : NULL);
3228 }
static BOOL NLS_EnumSystemCodePages(ENUMSYSTEMCODEPAGES_CALLBACKS *lpProcs)
Definition: lang.c:3144
smooth NULL
Definition: ftsmooth.c:416
CODEPAGE_ENUMPROCW procW
Definition: lang.c:3139
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
CODEPAGE_ENUMPROCA procA
Definition: lang.c:3138

Referenced by InitCodePagesList().

◆ EnumSystemGeoID()

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

Definition at line 3266 of file lang.c.

3267 {
3268  INT i;
3269 
3270  TRACE("(%d, %d, %p)\n", geoclass, parent, enumproc);
3271 
3272  if (!enumproc) {
3274  return FALSE;
3275  }
3276 
3277  if (geoclass != GEOCLASS_NATION && geoclass != GEOCLASS_REGION) {
3279  return FALSE;
3280  }
3281 
3282  for (i = 0; i < sizeof(geoinfodata)/sizeof(struct geoinfo_t); i++) {
3283  const struct geoinfo_t *ptr = &geoinfodata[i];
3284 
3285  if (geoclass == GEOCLASS_NATION && (ptr->kind == LOCATION_REGION))
3286  continue;
3287 
3288  if (geoclass == GEOCLASS_REGION && (ptr->kind == LOCATION_NATION))
3289  continue;
3290 
3291  if (parent && ptr->parent != parent)
3292  continue;
3293 
3294  if (!enumproc(ptr->id))
3295  return TRUE;
3296  }
3297 
3298  return TRUE;
3299 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
int32_t INT
Definition: typedefs.h:56
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:2781
static PVOID ptr
Definition: dispmode.c:27
#define TRACE(s)
Definition: solgame.cpp:4
r parent
Definition: btrfs.c:2659
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583

Referenced by CreateLocationsList(), and InitFunctionPointers().

◆ EnumSystemLanguageGroupsA()

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

Definition at line 2582 of file lang.c.

2584 {
2586 
2587  TRACE("(%p,0x%08X,0x%08lX)\n", pLangGrpEnumProc, dwFlags, lParam);
2588 
2589  procs.procA = pLangGrpEnumProc;
2590  procs.procW = NULL;
2591  procs.dwFlags = dwFlags;
2592  procs.lParam = lParam;
2593 
2594  return NLS_EnumSystemLanguageGroups( pLangGrpEnumProc ? &procs : NULL);
2595 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LANGUAGEGROUP_ENUMPROCA procA
Definition: lang.c:2476
static BOOL NLS_EnumSystemLanguageGroups(ENUMLANGUAGEGROUP_CALLBACKS *lpProcs)
Definition: lang.c:2483
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LANGUAGEGROUP_ENUMPROCW procW
Definition: lang.c:2477
LPARAM lParam
Definition: combotst.c:139

Referenced by InitFunctionPointers().

◆ EnumSystemLanguageGroupsW()

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

Definition at line 2602 of file lang.c.

2604 {
2606 
2607  TRACE("(%p,0x%08X,0x%08lX)\n", pLangGrpEnumProc, dwFlags, lParam);
2608 
2609  procs.procA = NULL;
2610  procs.procW = pLangGrpEnumProc;
2611  procs.dwFlags = dwFlags;
2612  procs.lParam = lParam;
2613 
2614  return NLS_EnumSystemLanguageGroups( pLangGrpEnumProc ? &procs : NULL);
2615 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LANGUAGEGROUP_ENUMPROCA procA
Definition: lang.c:2476
static BOOL NLS_EnumSystemLanguageGroups(ENUMLANGUAGEGROUP_CALLBACKS *lpProcs)
Definition: lang.c:2483
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
LANGUAGEGROUP_ENUMPROCW procW
Definition: lang.c:2477
LPARAM lParam
Definition: combotst.c:139

◆ EnumSystemLocalesA()

BOOL WINAPI EnumSystemLocalesA ( LOCALE_ENUMPROCA  lpfnLocaleEnum,
DWORD  dwFlags 
)

Definition at line 1586 of file lang.c.

1587 {
1588  TRACE("(%p,%08x)\n", lpfnLocaleEnum, dwFlags);
1591  (LONG_PTR)lpfnLocaleEnum);
1592  return TRUE;
1593 }
#define TRUE
Definition: types.h:120
#define LOCALE_ILANGUAGE
Definition: winnls.h:25
char * LPSTR
Definition: xmlstorage.h:182
HMODULE kernel32_handle
Definition: dllmain.c:26
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI EnumResourceLanguagesA(HMODULE hmod, LPCSTR type, LPCSTR name, ENUMRESLANGPROCA lpfun, LONG_PTR lparam)
Definition: res.c:428
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define RT_STRING
Definition: pedump.c:368
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
static BOOL CALLBACK enum_lang_proc_a(HMODULE hModule, LPCSTR type, LPCSTR name, WORD LangID, LONG_PTR lParam)
Definition: lang.c:1553

Referenced by __GetLCID().

◆ EnumSystemLocalesEx()

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

Definition at line 1641 of file lang.c.

1642 {
1643  struct enum_locale_ex_data data;
1644 
1645  if (reserved)
1646  {
1648  return FALSE;
1649  }
1650  data.proc = proc;
1651  data.flags = flags;
1652  data.lparam = lparam;
1654  (LPCWSTR)MAKEINTRESOURCE((LOCALE_SNAME >> 4) + 1),
1656  return TRUE;
1657 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static HANDLE proc()
Definition: pdb.c:32
static BOOL CALLBACK enum_locale_ex_proc(HMODULE module, LPCWSTR type, LPCWSTR name, WORD lang, LONG_PTR lparam)
Definition: lang.c:1618
HMODULE kernel32_handle
Definition: dllmain.c:26
r reserved
Definition: btrfs.c:2655
BOOL WINAPI EnumResourceLanguagesW(HMODULE hmod, LPCWSTR type, LPCWSTR name, ENUMRESLANGPROCW lpfun, LONG_PTR lparam)
Definition: res.c:480
#define LOCALE_SNAME
Definition: winnls.h:129
#define SetLastError(x)
Definition: compat.h:409
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
#define RT_STRING
Definition: pedump.c:368
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

Referenced by InitFunctionPointers().

◆ EnumSystemLocalesW()

BOOL WINAPI EnumSystemLocalesW ( LOCALE_ENUMPROCW  lpfnLocaleEnum,
DWORD  dwFlags 
)

Definition at line 1601 of file lang.c.

1602 {
1603  TRACE("(%p,%08x)\n", lpfnLocaleEnum, dwFlags);
1606  (LONG_PTR)lpfnLocaleEnum);
1607  return TRUE;
1608 }
#define TRUE
Definition: types.h:120
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define LOCALE_ILANGUAGE
Definition: winnls.h:25
HMODULE kernel32_handle
Definition: dllmain.c:26
BOOL WINAPI EnumResourceLanguagesW(HMODULE hmod, LPCWSTR type, LPCWSTR name, ENUMRESLANGPROCW lpfun, LONG_PTR lparam)
Definition: res.c:480
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define RT_STRING
Definition: pedump.c:368
static BOOL CALLBACK enum_lang_proc_w(HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD LangID, LONG_PTR lParam)
Definition: lang.c:1563
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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

◆ EnumUILanguagesA()

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

Definition at line 3429 of file lang.c.

3430 {
3431  ENUM_UILANG_CALLBACK enum_uilang;
3432 
3433  TRACE("%p, %x, %lx\n", pUILangEnumProc, dwFlags, lParam);
3434 
3435  if(!pUILangEnumProc) {
3437  return FALSE;
3438  }
3439  if(dwFlags) {
3441  return FALSE;
3442  }
3443 
3444  enum_uilang.u.procA = pUILangEnumProc;
3445  enum_uilang.flags = dwFlags;
3446  enum_uilang.param = lParam;
3447 
3450  (LONG_PTR)&enum_uilang);
3451  return TRUE;
3452 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
union ENUM_UILANG_CALLBACK::@436 u
#define LOCALE_ILANGUAGE
Definition: winnls.h:25
HMODULE kernel32_handle
Definition: dllmain.c:26
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
UILANGUAGE_ENUMPROCA procA
Definition: lang.c:3398
#define SetLastError(x)
Definition: compat.h:409
BOOL WINAPI EnumResourceLanguagesA(HMODULE hmod, LPCSTR type, LPCSTR name, ENUMRESLANGPROCA lpfun, LONG_PTR lparam)
Definition: res.c:428
LONG_PTR param
Definition: lang.c:3402
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define RT_STRING
Definition: pedump.c:368
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
LPARAM lParam
Definition: combotst.c:139
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
static BOOL CALLBACK enum_uilang_proc_a(HMODULE hModule, LPCSTR type, LPCSTR name, WORD LangID, LONG_PTR lParam)
Definition: lang.c:3405

Referenced by InitFunctionPointers().

◆ EnumUILanguagesW()

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

Definition at line 3457 of file lang.c.

3458 {
3459  ENUM_UILANG_CALLBACK enum_uilang;
3460 
3461  TRACE("%p, %x, %lx\n", pUILangEnumProc, dwFlags, lParam);
3462 
3463 
3464  if(!pUILangEnumProc) {
3466  return FALSE;
3467  }
3468  if(dwFlags) {
3470  return FALSE;
3471  }
3472 
3473  enum_uilang.u.procW = pUILangEnumProc;
3474  enum_uilang.flags = dwFlags;
3475  enum_uilang.param = lParam;
3476 
3479  (LONG_PTR)&enum_uilang);
3480  return TRUE;
3481 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
union ENUM_UILANG_CALLBACK::@436 u
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static BOOL CALLBACK enum_uilang_proc_w(HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD LangID, LONG_PTR lParam)
Definition: lang.c:3415
#define LOCALE_ILANGUAGE
Definition: winnls.h:25
HMODULE kernel32_handle
Definition: dllmain.c:26
BOOL WINAPI EnumResourceLanguagesW(HMODULE hmod, LPCWSTR type, LPCWSTR name, ENUMRESLANGPROCW lpfun, LONG_PTR lparam)
Definition: res.c:480
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:409
LONG_PTR param
Definition: lang.c:3402
UILANGUAGE_ENUMPROCW procW
Definition: lang.c:3399
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define RT_STRING
Definition: pedump.c:368
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
LPARAM lParam
Definition: combotst.c:139
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583

◆ FoldStringA()

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

Definition at line 2134 of file lang.c.

2136 {
2137  INT ret = 0, srclenW = 0;
2138  WCHAR *srcW = NULL, *dstW = NULL;
2139 
2140  if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
2141  {
2143  return 0;
2144  }
2145 
2147  src, srclen, NULL, 0);
2148  srcW = HeapAlloc(GetProcessHeap(), 0, srclenW * sizeof(WCHAR));
2149 
2150  if (!srcW)
2151  {
2153  goto FoldStringA_exit;
2154  }
2155 
2157  src, srclen, srcW, srclenW);
2158 
2160 
2161  ret = FoldStringW(dwFlags, srcW, srclenW, NULL, 0);
2162  if (ret && dstlen)
2163  {
2164  dstW = HeapAlloc(GetProcessHeap(), 0, ret * sizeof(WCHAR));
2165 
2166  if (!dstW)
2167  {
2169  goto FoldStringA_exit;
2170  }
2171 
2172  ret = FoldStringW(dwFlags, srcW, srclenW, dstW, ret);
2173  if (!WideCharToMultiByte(CP_ACP, 0, dstW, ret, dst, dstlen, NULL, NULL))
2174  {
2175  ret = 0;
2177  }
2178  }
2179 
2180  HeapFree(GetProcessHeap(), 0, dstW);
2181 
2182 FoldStringA_exit:
2183  HeapFree(GetProcessHeap(), 0, srcW);
2184  return ret;
2185 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define WideCharToMultiByte
Definition: compat.h:101
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
INT WINAPI FoldStringW(DWORD dwFlags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
Definition: lang.c:2192
#define MB_COMPOSITE
Definition: unicode.h:40
#define MAP_COMPOSITE
Definition: winnls.h:213
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define MAP_FOLDCZONE
Definition: winnls.h:210
int32_t INT
Definition: typedefs.h:56
#define MAP_PRECOMPOSED
Definition: winnls.h:212
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
#define SetLastError(x)
Definition: compat.h:409
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
GLenum src
Definition: glext.h:6340
static DWORD dstlen
Definition: directory.c:51
GLenum GLenum dst
Definition: glext.h:6340
#define MultiByteToWideChar
Definition: compat.h:100
#define HeapFree(x, y, z)
Definition: compat.h:394
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by InitFunctionPointers().

◆ FoldStringW()

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

Definition at line 2192 of file lang.c.

2194 {
2195  int ret;
2196 
2197  switch (dwFlags & (MAP_COMPOSITE|MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES))
2198  {
2199  case 0:
2200  if (dwFlags)
2201  break;
2202  /* Fall through for dwFlags == 0 */
2204  case MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES:
2205  case MAP_COMPOSITE|MAP_EXPAND_LIGATURES:
2207  return 0;
2208  }
2209 
2210  if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
2211  {
2213  return 0;
2214  }
2215 
2217  if (!ret)
2219  return ret;
2220 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define MAP_COMPOSITE
Definition: winnls.h:213
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:212
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
#define SetLastError(x)
Definition: compat.h:409
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
GLenum src
Definition: glext.h:6340
static DWORD dstlen
Definition: directory.c:51
GLenum GLenum dst
Definition: glext.h:6340
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

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

◆ get_geoinfo_dataptr()

static const struct geoinfo_t* get_geoinfo_dataptr ( GEOID  geoid)
static

Definition at line 3499 of file lang.c.

3500 {
3501  int min, max;
3502 
3503  min = 0;
3504  max = sizeof(geoinfodata)/sizeof(struct geoinfo_t)-1;
3505 
3506  while (min <= max) {
3507  const struct geoinfo_t *ptr;
3508  int n = (min+max)/2;
3509 
3510  ptr = &geoinfodata[n];
3511  if (geoid == ptr->id)
3512  /* we don't need empty entry */
3513  return *ptr->iso2W ? ptr : NULL;
3514 
3515  if (ptr->id > geoid)
3516  max = n-1;
3517  else
3518  min = n+1;
3519  }
3520 
3521  return NULL;
3522 }
#define max(a, b)
Definition: svc.c:63
GLdouble n
Definition: glext.h:7729
static const struct geoinfo_t geoinfodata[]
Definition: lang.c:2781
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define min(a, b)
Definition: monoChain.cc:55

Referenced by GetGeoInfoW().

◆ get_lcid_codepage()

static UINT get_lcid_codepage ( LCID  lcid)
inlinestatic

Definition at line 257 of file lang.c.

258 {
259  UINT ret;
260  if (!GetLocaleInfoW( lcid, LOCALE_IDEFAULTANSICODEPAGE|LOCALE_RETURN_NUMBER, (WCHAR *)&ret,
261  sizeof(ret)/sizeof(WCHAR) )) ret = 0;
262  return ret;
263 }
#define LOCALE_IDEFAULTANSICODEPAGE
Definition: winnls.h:38
__wchar_t WCHAR
Definition: xmlstorage.h:180
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1095
unsigned int UINT
Definition: ndis.h:50
int ret

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 1081 of file lang.c.

1082 {
1083  int i;
1084  for (i=0; i < sizeof(registry_values)/sizeof(registry_values[0]); i++)
1085  if (registry_values[i].lctype == lctype)
1086  return &registry_values[i];
1087  return NULL;
1088 }
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
smooth NULL
Definition: ftsmooth.c:416
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 883 of file lang.c.

884 {
885  DWORD size;
886  INT ret;
887  HANDLE hkey;
891  static const int info_size = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data);
892 
894 
896  {
897  if (!(hkey = create_registry_key()))
898  {
900  return -1;
901  }
902 
904  size = info_size + len * sizeof(WCHAR);
905 
906  if (!(info = HeapAlloc( GetProcessHeap(), 0, size )))
907  {
908  NtClose( hkey );
911  return 0;
912  }
913 
915 
916  /* try again with a bigger buffer when we have to return the correct size */
917  if (status == STATUS_BUFFER_OVERFLOW && !buffer && size > info_size)
918  {
920  if ((new_info = HeapReAlloc( GetProcessHeap(), 0, info, size )))
921  {
922  info = new_info;
924  }
925  }
926 
927  NtClose( hkey );
928 
929  if (!status)
930  {
931  INT length = (size - info_size) / sizeof(WCHAR);
932  LPWSTR cached_value;
933 
934  if (!length || ((WCHAR *)&info->Data)[length-1])
935  length++;
936 
937  cached_value = HeapAlloc( GetProcessHeap(), 0, length * sizeof(WCHAR) );
938 
939  if (!cached_value)
940  {
941  HeapFree( GetProcessHeap(), 0, info );
944  return 0;
945  }
946 
947  memcpy( cached_value, info->Data, (length-1) * sizeof(WCHAR) );
948  cached_value[length-1] = 0;
949  HeapFree( GetProcessHeap(), 0, info );
950  registry_value->cached_value = cached_value;
951  }
952  else
953  {
955  {
956  ret = (size - info_size) / sizeof(WCHAR);
957  }
959  {
960  ret = -1;
961  }
962  else
963  {
965  ret = 0;
966  }
967  HeapFree( GetProcessHeap(), 0, info );
969  return ret;
970  }
971  }
972 
974 
975  if (buffer)
976  {
977  if (ret > len)
978  {
980  ret = 0;
981  }
982  else
983  {
985  }
986  }
987 
989 
990  return ret;
991 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * cached_value
Definition: lang.c:189
LONG NTSTATUS
Definition: precomp.h:26
static HANDLE create_registry_key(void)
Definition: lang.c:691
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
GLuint buffer
Definition: glext.h:5915
#define WCHAR
Definition: msvc.h:43
static RTL_CRITICAL_SECTION cache_section
Definition: lang.c:237
#define lstrlenW
Definition: compat.h:407
int32_t INT
Definition: typedefs.h:56
struct _test_info info[]
Definition: SetCursorPos.c:19
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
static const WCHAR nameW[]
Definition: main.c:46
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)
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
unsigned long DWORD
Definition: ntddk_ex.h:95
const WCHAR * name
Definition: lang.c:188
#define SetLastError(x)
Definition: compat.h:409
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#define lstrcpyW
Definition: compat.h:406
#define HeapReAlloc
Definition: compat.h:393
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:394
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
Definition: ps.c:97

Referenced by GetLocaleInfoW().

◆ get_value_base_by_lctype()

static int get_value_base_by_lctype ( LCTYPE  lctype)
static

Definition at line 1071 of file lang.c.

1072 {
1073  return lctype == LOCALE_ILANGUAGE || lctype == LOCALE_IDEFAULTLANGUAGE ? 16 : 10;
1074 }
#define LOCALE_ILANGUAGE
Definition: winnls.h:25
#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 3597 of file lang.c.

3598 {
3599  WCHAR *buffW;
3600  INT len;
3601 
3602  TRACE("%d %d %p %d %d\n", geoid, geotype, data, data_len, lang);
3603 
3604  len = GetGeoInfoW(geoid, geotype, NULL, 0, lang);
3605  if (!len)
3606  return 0;
3607 
3608  buffW = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
3609  if (!buffW)
3610  return 0;
3611 
3612  GetGeoInfoW(geoid, geotype, buffW, len, lang);
3613  len = WideCharToMultiByte(CP_ACP, 0, buffW, -1, NULL, 0, NULL, NULL);
3614  if (!data || !data_len) {
3615  HeapFree(GetProcessHeap(), 0, buffW);
3616  return len;
3617  }
3618 
3619  len = WideCharToMultiByte(CP_ACP, 0, buffW, -1, data, data_len, NULL, NULL);
3620  HeapFree(GetProcessHeap(), 0, buffW);
3621 
3622  if (data_len < len)
3624  return data_len < len ? 0 : len;
3625 }
#define WideCharToMultiByte
Definition: compat.h:101
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR lang[]
Definition: wbemdisp.c:287
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len, LANGID lang)
Definition: lang.c:3527
#define SetLastError(x)
Definition: compat.h:409
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLsizei len
Definition: glext.h:6722
#define HeapFree(x, y, z)
Definition: compat.h:394
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by InitFunctionPointers().

◆ GetGeoInfoW()

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

Definition at line 3527 of file lang.c.

3528 {
3529  const struct geoinfo_t *ptr;
3530  const WCHAR *str = NULL;
3531  WCHAR buffW[12];
3532  LONG val = 0;
3533  INT len;
3534 
3535  TRACE("%d %d %p %d %d\n", geoid, geotype, data, data_len, lang);
3536 
3537  if (!(ptr = get_geoinfo_dataptr(geoid))) {
3539  return 0;
3540  }
3541 
3542  switch (geotype) {
3543  case GEO_FRIENDLYNAME:
3544  {
3545  return NLS_GetGeoFriendlyName(geoid, data, data_len);
3546  }
3547  case GEO_NATION:
3548  val = geoid;
3549  break;
3550  case GEO_ISO_UN_NUMBER:
3551  val = ptr->uncode;
3552  break;
3553  case GEO_PARENT:
3554  val = ptr->parent;
3555  break;
3556  case GEO_ISO2:
3557  case GEO_ISO3:
3558  {
3559  str = geotype == GEO_ISO2 ? ptr->iso2W : ptr->iso3W;
3560  break;
3561  }
3562  case GEO_RFC1766:
3563  case GEO_LCID:
3564  case GEO_OFFICIALNAME:
3565  case GEO_TIMEZONES:
3566  case GEO_OFFICIALLANGUAGES:
3567  case GEO_LATITUDE:
3568  case GEO_LONGITUDE:
3569  FIXME("type %d is not supported\n", geotype);
3571  return 0;
3572  default:
3573  WARN("unrecognized type %d\n", geotype);
3575  return 0;
3576  }
3577 
3578  if (val) {
3579  static const WCHAR fmtW[] = {'%','d',0};
3580  sprintfW(buffW, fmtW, val);
3581  str = buffW;
3582  }
3583 
3584  len = strlenW(str) + 1;
3585  if (!data || !data_len)
3586  return len;
3587 
3588  memcpy(data, str, min(len, data_len)*sizeof(WCHAR));
3589  if (data_len < len)
3591  return data_len < len ? 0 : len;
3592 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WARN(fmt,...)
Definition: debug.h:111
int32_t INT
Definition: typedefs.h:56
long LONG
Definition: pedump.c:60
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
const WCHAR * str
static int NLS_GetGeoFriendlyName(GEOID Location, LPWSTR szFriendlyName, int cchData)
Definition: lang.c:3484
smooth NULL
Definition: ftsmooth.c:416
GLuint GLfloat * val
Definition: glext.h:7180
static const WCHAR lang[]
Definition: wbemdisp.c:287
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:409
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
static const struct geoinfo_t * get_geoinfo_dataptr(GEOID geoid)
Definition: lang.c:3499
#define sprintfW
Definition: unicode.h:58
#define min(a, b)
Definition: monoChain.cc:55
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

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

◆ GetLocaleInfoA()

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

Definition at line 1015 of file lang.c.

1016 {
1017  WCHAR *bufferW;
1018  INT lenW, ret;
1019 
1020  TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d)\n", lcid, lctype, buffer, len );
1021 
1022  if (len < 0 || (len && !buffer))
1023  {
1025  return 0;
1026  }
1027  if (((lctype & ~LOCALE_LOCALEINFOFLAGSMASK) == LOCALE_SSHORTTIME) ||
1028  (lctype & LOCALE_RETURN_GENITIVE_NAMES))
1029  {
1031  return 0;
1032  }
1033 
1034  if (!len) buffer = NULL;
1035 
1036  if (!(lenW = GetLocaleInfoW( lcid, lctype, NULL, 0 ))) return 0;
1037 
1038  if (!(bufferW = HeapAlloc( GetProcessHeap(), 0, lenW * sizeof(WCHAR) )))
1039  {
1041  return 0;
1042  }
1043  if ((ret = GetLocaleInfoW( lcid, lctype, bufferW, lenW )))
1044  {
1045  if ((lctype & LOCALE_RETURN_NUMBER) ||
1047  {
1048  /* it's not an ASCII string, just bytes */
1049  ret *= sizeof(WCHAR);
1050  if (buffer)
1051  {
1052  if (ret <= len) memcpy( buffer, bufferW, ret );
1053  else
1054  {
1056  ret = 0;
1057  }
1058  }
1059  }
1060  else
1061  {
1062  UINT codepage = CP_ACP;
1063  if (!(lctype & LOCALE_USE_CP_ACP)) codepage = get_lcid_codepage( lcid );
1064  ret = WideCharToMultiByte( codepage, 0, bufferW, ret, buffer, len, NULL, NULL );
1065  }
1066  }
1067  HeapFree( GetProcessHeap(), 0, bufferW );
1068  return ret;
1069 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define LOCALE_LOCALEINFOFLAGSMASK
Definition: lang.c:41
#define WideCharToMultiByte
Definition: compat.h:101
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
GLuint buffer
Definition: glext.h:5915
#define WCHAR
Definition: msvc.h:43
int32_t INT
Definition: typedefs.h:56
#define LOCALE_RETURN_GENITIVE_NAMES
Definition: winnls.h:24
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1095
int codepage
Definition: win_iconv.c:156
smooth NULL
Definition: ftsmooth.c:416
#define LOCALE_SSHORTTIME
Definition: winnls.h:160
static UINT get_lcid_codepage(LCID lcid)
Definition: lang.c:257
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned int UINT
Definition: ndis.h:50
#define SetLastError(x)
Definition: compat.h:409
#define LOCALE_FONTSIGNATURE
Definition: winnls.h:126
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define LOCALE_USE_CP_ACP
Definition: winnls.h:20
#define HeapFree(x, y, z)
Definition: compat.h:394
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

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 1095 of file lang.c.

1096 {
1097  LANGID lang_id;
1098  HRSRC hrsrc;
1099  HGLOBAL hmem;
1100  LPCWSTR lpType, lpName;
1101  INT ret;
1102  UINT lcflags;
1103  const WCHAR *p;
1104  unsigned int i;
1105 
1106  if (len < 0 || (len && !buffer))
1107  {
1109  return 0;
1110  }
1111  if (lctype & LOCALE_RETURN_GENITIVE_NAMES &&
1112  !is_genitive_name_supported( lctype ))
1113  {
1115  return 0;
1116  }
1117 
1118  if (!len) buffer = NULL;
1119 
1120  lcid = convert_default_lcid( lcid, lctype );
1121 
1122  lcflags = lctype & LOCALE_LOCALEINFOFLAGSMASK;
1123  lctype &= 0xffff;
1124 
1125  TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d)\n", lcid, lctype, buffer, len );
1126 
1127  /* first check for overrides in the registry */
1128 
1129  if (!(lcflags & LOCALE_NOUSEROVERRIDE) &&
1130  lcid == convert_default_lcid( LOCALE_USER_DEFAULT, lctype ))
1131  {
1133 
1134  if (value)
1135  {
1136  if (lcflags & LOCALE_RETURN_NUMBER)
1137  {
1138  WCHAR tmp[16];
1139  ret = get_registry_locale_info( value, tmp, sizeof(tmp)/sizeof(WCHAR) );
1140  if (ret > 0)
1141  {
1142  WCHAR *end;
1144  if (*end) /* invalid number */
1145  {
1147  return 0;
1148  }
1149  ret = sizeof(UINT)/sizeof(WCHAR);
1150  if (!buffer) return ret;
1151  if (ret > len)
1152  {
1154  return 0;
1155  }
1156  memcpy( buffer, &number, sizeof(number) );
1157  }
1158  }
1160 
1161  if (ret != -1) return ret;
1162  }
1163  }
1164 
1165  /* now load it from kernel resources */
1166 
1167  lang_id = LANGIDFROMLCID( lcid );
1168 
1169  /* replace SUBLANG_NEUTRAL by SUBLANG_DEFAULT */
1170  if (SUBLANGID(lang_id) == SUBLANG_NEUTRAL)
1171  lang_id = MAKELANGID(PRIMARYLANGID(lang_id), SUBLANG_DEFAULT);
1172 
1174  {
1175  lpType = MAKEINTRESOURCEW(RT_STRING);
1176  lpName = MAKEINTRESOURCEW(ULongToPtr((lctype >> 4) + 1));
1177  }
1178  else
1179  {
1180  lpType = MAKEINTRESOURCEW(RT_RCDATA);
1182  }
1183 
1184  if (!(hrsrc = FindResourceExW( kernel32_handle, lpType, lpName, lang_id )))
1185  {
1186  SetLastError( ERROR_INVALID_FLAGS ); /* no such lctype */
1187  return 0;
1188  }
1189  if (!(hmem = LoadResource( kernel32_handle, hrsrc )))
1190  return 0;
1191 
1192  p = LockResource( hmem );
1194  {
1195  for (i = 0; i < (lctype & 0x0f); i++) p += *p + 1;
1196  }
1197 
1198  if (lcflags & LOCALE_RETURN_NUMBER) ret = sizeof(UINT)/sizeof(WCHAR);
1199  else if (is_genitive_name_supported( lctype ) && *p)
1200  {
1201  /* genitive form's stored after a null separator from a nominative */
1202  for (i = 1; i <= *p; i++) if (!p[i]) break;
1203 
1204  if (i <= *p && (lcflags & LOCALE_RETURN_GENITIVE_NAMES))
1205  {
1206  ret = *p - i + 1;
1207  p += i;
1208  }
1209  else ret = i;
1210  }
1211  else if (lctype != LOCALE_FONTSIGNATURE)
1212  ret = *p + 1;
1213  else
1214  ret = SizeofResource(kernel32_handle, hrsrc) / sizeof(WCHAR);
1215 
1216  if (!buffer) return ret;
1217 
1218  if (ret > len)
1219  {
1221  return 0;
1222  }
1223 
1224  if (lcflags & LOCALE_RETURN_NUMBER)
1225  {
1226  UINT number;
1227  WCHAR *end, *tmp = HeapAlloc( GetProcessHeap(), 0, (*p + 1) * sizeof(WCHAR) );
1228  if (!tmp) return 0;
1229  memcpy( tmp, p + 1, *p * sizeof(WCHAR) );
1230  tmp[*p] = 0;
1232  if (!*end)
1233  memcpy( buffer, &number, sizeof(number) );
1234  else /* invalid number */
1235  {
1237  ret = 0;
1238  }
1239  HeapFree( GetProcessHeap(), 0, tmp );
1240 
1241  TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d) returning number %d\n",
1242  lcid, lctype, buffer, len, number );
1243  }
1244  else
1245  {
1246  if (lctype != LOCALE_FONTSIGNATURE) p++;
1247  memcpy( buffer, p, ret * sizeof(WCHAR) );
1248  if (lctype != LOCALE_FONTSIGNATURE) buffer[ret-1] = 0;
1249 
1250  TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d) returning %d %s\n",
1251  lcid, lctype, buffer, len, ret, debugstr_w(buffer) );
1252  }
1253  return ret;
1254 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static struct registry_value * get_locale_registry_value(DWORD lctype)
Definition: lang.c:1081
#define LOCALE_LOCALEINFOFLAGSMASK
Definition: lang.c:41
#define ULongToPtr(ul)
Definition: basetsd.h:92
static int get_value_base_by_lctype(LCTYPE lctype)
Definition: lang.c:1071
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define LOCALE_USER_DEFAULT
#define strtolW(s, e, b)
Definition: unicode.h:33
#define SUBLANG_DEFAULT
Definition: nls.h:168
_In_ LPCSTR lpName
Definition: winbase.h:2729
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static INT get_registry_locale_info(struct registry_value *registry_value, LPWSTR buffer, INT len)
Definition: lang.c:883
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
GLuint buffer
Definition: glext.h:5915
GLuint GLuint end
Definition: gl.h:1545
WORD LANGID
Definition: typedefs.h:79
#define WCHAR
Definition: msvc.h:43
#define SUBLANG_NEUTRAL
Definition: nls.h:167
int32_t INT
Definition: typedefs.h:56
#define LOCALE_RETURN_GENITIVE_NAMES
Definition: winnls.h:24
DWORD lctype
Definition: lang.c:187
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
HMODULE kernel32_handle
Definition: dllmain.c:26
#define LOCALE_NOUSEROVERRIDE
Definition: winnls.h:19
static size_t double number
Definition: printf.c:64
#define debugstr_w
Definition: kernel32.h:32
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned int UINT
Definition: ndis.h:50
#define SetLastError(x)
Definition: compat.h:409
#define RT_RCDATA
Definition: pedump.c:372
#define LOCALE_FONTSIGNATURE
Definition: winnls.h:126
HRSRC WINAPI FindResourceExW(HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD lang)
Definition: res.c:164
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define RT_STRING
Definition: pedump.c:368
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
static BOOL is_genitive_name_supported(LCTYPE lctype)
Definition: lang.c:663
static LCID convert_default_lcid(LCID lcid, LCTYPE lctype)
Definition: lang.c:512
#define MAKELANGID(p, s)
Definition: nls.h:15
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
GLfloat GLfloat p
Definition: glext.h:8902
#define UINT
Definition: msvc.h:27
#define HeapFree(x, y, z)
Definition: compat.h:394
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define SUBLANGID(l)
Definition: nls.h:17

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::CacheINILocale(), create_utc_string(), CreateLanguagesList(), CreateSortList(), date_parse(), date_to_string(), dateobj_to_date_string(), DATETIME_ReturnFieldWidth(), 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(), get_localized_dayname(), GetCalendarInfoW(), GetCurrencyFormatW(), GetFileVersion(), GetLocaleInfoA(), GetNumberFormatW(), InitializeDefaultUserLocale(), InitLanguagesList(), InputList_Add(), InputList_Create(), IntGetCodePageEntry(), is_default_metric(), IsLayoutExists(), lcid_to_rfc1766W(), LocaleList_Create(), LocalesEnumProc(), MONTHCAL_LButtonDown(), MONTHCAL_PaintTitle(), MONTHCAL_PaintWeeknumbers(), MONTHCAL_SetFirstDayOfWeek(), MonthCalFirstDayOfWeek(), MonthCalReload(), MSVCRT__create_locale(), NLS_EnumCalendarInfo(), NLS_EnumDateFormats(), NLS_EnumTimeFormats(), NLS_GetLocaleNumber(), NLS_GetLocaleString(), ParseDate(), ReadChmSystem(), SaveFontSubstitutionSettings(), SaveSystemSettings(), ScriptRecordDigitSubstitution(), 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 
)

Definition at line 1726 of file nls.c.

1730 {
1731  HRSRC hrsrc;
1732  HGLOBAL hmem;
1733  LCID lcid;
1734  LANGID langId;
1735  const WCHAR *p;
1736  UINT i;
1737 
1738  /* See HACK in winnls/lang/xx-XX.rc files */
1739  if (uID == 37)
1740  uID = uID * 100;
1741 
1742  lcid = GetUserDefaultLCID();
1743  lcid = ConvertDefaultLocale(lcid);
1744 
1745  langId = LANGIDFROMLCID(lcid);
1746 
1747  if (PRIMARYLANGID(langId) == LANG_NEUTRAL)
1749 
1751  (LPWSTR)RT_STRING,
1752  MAKEINTRESOURCEW((uID >> 4) + 1),
1753  langId);
1754 
1755  /* English fallback */
1756  if (!hrsrc)
1757  {
1759  (LPWSTR)RT_STRING,
1760  MAKEINTRESOURCEW((uID >> 4) + 1),
1762  }
1763 
1764  if (!hrsrc)
1765  goto NotFound;
1766 
1767  hmem = LoadResource(hCurrentModule, hrsrc);
1768  if (!hmem)
1769  goto NotFound;
1770 
1771  p = LockResource(hmem);
1772 
1773  for (i = 0; i < (uID & 0x0F); i++)
1774  p += *p + 1;
1775 
1776  /* Needed for GetGeoInfo(): return the needed string size including the NULL terminator */
1777  if (cchDest == 0)
1778  return *p + 1;
1779  /* Needed for GetGeoInfo(): bail out if the user buffer is not large enough */
1780  if (*p + 1 > cchDest)
1781  {
1783  return 0;
1784  }
1785 
1786  i = *p;
1787  if (i > 0)
1788  {
1789  memcpy(lpszDest, p + 1, i * sizeof(WCHAR));
1790  lpszDest[i] = L'\0';
1791  return i;
1792  }
1793 #if 0
1794  else
1795  {
1796  if (cchDest >= 1)
1797  lpszDest[0] = L'\0';
1798  /* Fall-back */
1799  }
1800 #endif
1801 
1802 NotFound:
1803  DPRINT1("Resource not found: uID = %lu\n", uID);
1805  return 0;
1806 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define LANG_NEUTRAL
Definition: nls.h:22
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
DWORD LCID
Definition: nls.h:13
WORD LANGID
Definition: typedefs.h:79
LCID WINAPI GetUserDefaultLCID(void)
Definition: lang.c:765
#define SUBLANG_ENGLISH_US
Definition: nls.h:222
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
LCID WINAPI ConvertDefaultLocale(LCID lcid)
Definition: lang.c:1499
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
WCHAR lpszDest[260]
HMODULE hCurrentModule
Definition: dllmain.c:25
unsigned int UINT
Definition: ndis.h:50
#define SetLastError(x)
Definition: compat.h:409
#define LANG_ENGLISH
Definition: nls.h:52
HRSRC WINAPI FindResourceExW(HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD lang)
Definition: res.c:164
static const WCHAR L[]
Definition: oid.c:1250
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define RT_STRING
Definition: pedump.c:368
#define DPRINT1
Definition: precomp.h:8
#define MAKELANGID(p, s)
Definition: nls.h:15
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by GetCPInfoExW(), and NLS_GetGeoFriendlyName().

◆ GetStringTypeA()

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

Definition at line 1810 of file lang.c.

1811 {
1812  UINT cp;
1813  INT countW;
1814  LPWSTR srcW;
1815  BOOL ret = FALSE;
1816 
1817  if(count == -1) count = strlen(src) + 1;
1818 
1819  if (!(cp = get_lcid_codepage( locale )))
1820  {
1821  FIXME("For locale %04x using current ANSI code page\n", locale);
1822  cp = GetACP();
1823  }
1824 
1825  countW = MultiByteToWideChar(cp, 0, src, count, NULL, 0);
1826  if((srcW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR))))
1827  {
1828  MultiByteToWideChar(cp, 0, src, count, srcW, countW);
1829  /*
1830  * NOTE: the target buffer has 1 word for each CHARACTER in the source
1831  * string, with multibyte characters there maybe be more bytes in count
1832  * than character space in the buffer!
1833  */
1834  ret = GetStringTypeW(type, srcW, countW, chartype);
1835  HeapFree(GetProcessHeap(), 0, srcW);
1836  }
1837  return ret;
1838 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:56
Definition: _locale.h:75
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI GetACP(VOID)
Definition: nls.c:2078
static UINT get_lcid_codepage(LCID lcid)
Definition: lang.c:257
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: lang.c:1696
unsigned int UINT
Definition: ndis.h:50
int ret
GLenum src
Definition: glext.h:6340
#define MultiByteToWideChar
Definition: compat.h:100
POINT cp
Definition: magnifier.c:60
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

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 1857 of file lang.c.

1858 {
1859  return GetStringTypeA(locale, type, src, count, chartype);
1860 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
Definition: _locale.h:75
BOOL WINAPI GetStringTypeA(LCID locale, DWORD type, LPCSTR src, INT count, LPWORD chartype)
Definition: lang.c:1810
GLenum src
Definition: glext.h:6340

Referenced by _isctype_l().

◆ GetStringTypeExW()

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

Definition at line 1786 of file lang.c.

1787 {
1788  /* locale is ignored for Unicode */
1789  return GetStringTypeW( type, src, count, chartype );
1790 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: lang.c:1696
GLenum src
Definition: glext.h:6340

◆ GetStringTypeW()

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

Definition at line 1696 of file lang.c.

1697 {
1698  static const unsigned char type2_map[16] =
1699  {
1700  C2_NOTAPPLICABLE, /* unassigned */
1701  C2_LEFTTORIGHT, /* L */
1702  C2_RIGHTTOLEFT, /* R */
1703  C2_EUROPENUMBER, /* EN */
1704  C2_EUROPESEPARATOR, /* ES */
1705  C2_EUROPETERMINATOR, /* ET */
1706  C2_ARABICNUMBER, /* AN */
1707  C2_COMMONSEPARATOR, /* CS */
1708  C2_BLOCKSEPARATOR, /* B */
1709  C2_SEGMENTSEPARATOR, /* S */
1710  C2_WHITESPACE, /* WS */
1711  C2_OTHERNEUTRAL, /* ON */
1712  C2_RIGHTTOLEFT, /* AL */
1713  C2_NOTAPPLICABLE, /* NSM */
1714  C2_NOTAPPLICABLE, /* BN */
1715  C2_OTHERNEUTRAL /* LRE, LRO, RLE, RLO, PDF */
1716  };
1717 
1718  if (!src)
1719  {
1721  return FALSE;
1722  }
1723 
1724  if (count == -1) count = strlenW(src) + 1;
1725  switch(type)
1726  {
1727  case CT_CTYPE1:
1728  while (count--) *chartype++ = get_char_typeW( *src++ ) & 0xfff;
1729  break;
1730  case CT_CTYPE2:
1731  while (count--) *chartype++ = type2_map[get_char_typeW( *src++ ) >> 12];
1732  break;
1733  case CT_CTYPE3:
1734  {
1735  WARN("CT_CTYPE3: semi-stub.\n");
1736  while (count--)
1737  {
1738  int c = *src;
1739  WORD type1, type3 = 0; /* C3_NOTAPPLICABLE */
1740 
1741  type1 = get_char_typeW( *src++ ) & 0xfff;
1742  /* try to construct type3 from type1 */
1743  if(type1 & C1_SPACE) type3 |= C3_SYMBOL;
1744  if(type1 & C1_ALPHA) type3 |= C3_ALPHA;
1745  if ((c>=0x30A0)&&(c<=0x30FF)) type3 |= C3_KATAKANA;
1746  if ((c>=0x3040)&&(c<=0x309F)) type3 |= C3_HIRAGANA;
1747  if ((c>=0x4E00)&&(c<=0x9FAF)) type3 |= C3_IDEOGRAPH;
1748  if (c == 0x0640) type3 |= C3_KASHIDA;
1749  if ((c>=0x3000)&&(c<=0x303F)) type3 |= C3_SYMBOL;
1750 
1751  if ((c>=0xD800)&&(c<=0xDBFF)) type3 |= C3_HIGHSURROGATE;
1752  if ((c>=0xDC00)&&(c<=0xDFFF)) type3 |= C3_LOWSURROGATE;
1753 
1754  if ((c>=0xFF00)&&(c<=0xFF60)) type3 |= C3_FULLWIDTH;
1755  if ((c>=0xFF00)&&(c<=0xFF20)) type3 |= C3_SYMBOL;
1756  if ((c>=0xFF3B)&&(c<=0xFF40)) type3 |= C3_SYMBOL;
1757  if ((c>=0xFF5B)&&(c<=0xFF60)) type3 |= C3_SYMBOL;
1758  if ((c>=0xFF21)&&(c<=0xFF3A)) type3 |= C3_ALPHA;
1759  if ((c>=0xFF41)&&(c<=0xFF5A)) type3 |= C3_ALPHA;
1760  if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_FULLWIDTH;
1761  if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_SYMBOL;
1762 
1763  if ((c>=0xFF61)&&(c<=0xFFDC)) type3 |= C3_HALFWIDTH;
1764  if ((c>=0xFF61)&&(c<=0xFF64)) type3 |= C3_SYMBOL;
1765  if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_KATAKANA;
1766  if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_ALPHA;
1767  if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_HALFWIDTH;
1768  if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_SYMBOL;
1769  *chartype++ = type3;
1770  }
1771  break;
1772  }
1773  default:
1775  return FALSE;
1776  }
1777  return TRUE;
1778 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define C2_LEFTTORIGHT
Definition: winnls.h:247
#define C3_FULLWIDTH
Definition: winnls.h:266
#define CT_CTYPE2
Definition: winnls.h:235
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define C2_RIGHTTOLEFT
Definition: winnls.h:248
#define C2_BLOCKSEPARATOR
Definition: winnls.h:254
#define C2_EUROPENUMBER
Definition: winnls.h:249
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define C3_IDEOGRAPH
Definition: winnls.h:267
#define C3_HALFWIDTH
Definition: winnls.h:265
#define C2_EUROPESEPARATOR
Definition: winnls.h:250
#define C2_NOTAPPLICABLE
Definition: winnls.h:258
#define CT_CTYPE3
Definition: winnls.h:236
#define C3_KASHIDA
Definition: winnls.h:268
#define C3_KATAKANA
Definition: winnls.h:263
#define C1_ALPHA
Definition: unicode.h:39
#define C2_COMMONSEPARATOR
Definition: winnls.h:253
const GLubyte * c
Definition: glext.h:8905
unsigned short WORD
Definition: ntddk_ex.h:93
#define SetLastError(x)
Definition: compat.h:409
WINE_UNICODE_INLINE unsigned short get_char_typeW(WCHAR ch)
Definition: unicode.h:149
#define C3_HIRAGANA
Definition: winnls.h:264
#define CT_CTYPE1
Definition: winnls.h:234
#define C2_EUROPETERMINATOR
Definition: winnls.h:251
#define C3_SYMBOL
Definition: winnls.h:262
GLenum src
Definition: glext.h:6340
#define C3_ALPHA
Definition: winnls.h:270
#define C3_LOWSURROGATE
Definition: winnls.h:273
#define C2_ARABICNUMBER
Definition: winnls.h:252
#define C3_HIGHSURROGATE
Definition: winnls.h:272
#define C2_WHITESPACE
Definition: winnls.h:256
#define C1_SPACE
Definition: unicode.h:34
#define C2_SEGMENTSEPARATOR
Definition: winnls.h:255
#define C2_OTHERNEUTRAL
Definition: winnls.h:257

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

◆ GetSystemDefaultLangID()

◆ GetSystemDefaultLCID()

◆ GetSystemDefaultUILanguage()

LANGID WINAPI GetSystemDefaultUILanguage ( void  )

Definition at line 823 of file lang.c.

824 {
825  LANGID lang;
827  return lang;
828 }
WORD LANGID
Definition: typedefs.h:79
static const WCHAR lang[]
Definition: wbemdisp.c:287
NTSTATUS NTAPI NtQueryInstallUILanguage(OUT LANGID *LanguageId)
Definition: locale.c:368

Referenced by LsaLookupPrivilegeDisplayName(), and SHGetWebFolderFilePathW().

◆ GetThreadLocale()

◆ GetUserDefaultLangID()

◆ GetUserDefaultLCID()

◆ GetUserDefaultUILanguage()

LANGID WINAPI GetUserDefaultUILanguage ( void  )

Definition at line 803 of file lang.c.

804 {
805  LANGID lang;
807  return lang;
808 }
WORD LANGID
Definition: typedefs.h:79
static const WCHAR lang[]
Definition: wbemdisp.c:287
NTSTATUS NTAPI NtQueryDefaultUILanguage(OUT LANGID *LanguageId)
Definition: locale.c:402

Referenced by _tWinMain(), detect_locale(), FGetComponentPath(), LsaLookupPrivilegeDisplayName(), OmNavigator_get_browserLanguage(), SHGetWebFolderFilePathW(), test_GetFileVersionInfoEx(), WinMain(), and wWinMain().

◆ GetUserGeoID()

GEOID WINAPI GetUserGeoID ( GEOCLASS  GeoClass)

Definition at line 3322 of file lang.c.

3323 {
3325  static const WCHAR geoW[] = {'G','e','o',0};
3326  static const WCHAR nationW[] = {'N','a','t','i','o','n',0};
3327  WCHAR bufferW[40], *end;
3328  DWORD count;
3329  HANDLE hkey, hSubkey = 0;
3332  RtlInitUnicodeString( &keyW, nationW );
3333  count = sizeof(bufferW);
3334 
3335  if(!(hkey = create_registry_key())) return ret;
3336 
3337  switch( GeoClass ){
3338  case GEOCLASS_NATION:
3339  if ((hSubkey = NLS_RegOpenKey(hkey, geoW)))
3340  {
3342  bufferW, count, &count) == STATUS_SUCCESS ) && info->DataLength)
3343  ret = strtolW((LPCWSTR)info->Data, &end, 10);
3344  }
3345  break;
3346  case GEOCLASS_REGION:
3347  FIXME("GEOCLASS_REGION not handled yet\n");
3348  break;
3349  }
3350 
3351  NtClose(hkey);
3352  if (hSubkey) NtClose(hSubkey);
3353  return ret;
3354 }
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define strtolW(s, e, b)
Definition: unicode.h:33
static HANDLE create_registry_key(void)
Definition: lang.c:691
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
GLuint GLuint end
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:110
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)
static const WCHAR keyW[]
Definition: tokenize.c:60
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
int ret
DWORD GEOID
Definition: winnls.h:518
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static HANDLE NLS_RegOpenKey(HANDLE hRootKey, LPCWSTR szKeyName)
Definition: lang.c:2369
#define GEOID_NOT_AVAILABLE
Definition: winnls.h:13
return STATUS_SUCCESS
Definition: btrfs.c:2725

Referenced by CreateLocationsList().

◆ InvalidateNLSCache()

BOOL WINAPI InvalidateNLSCache ( void  )

Definition at line 3313 of file lang.c.

3314 {
3315  FIXME("() stub\n");
3316  return FALSE;
3317 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ is_genitive_name_supported()

static BOOL is_genitive_name_supported ( LCTYPE  lctype)
static

Definition at line 663 of file lang.c.

664 {
665  switch(lctype & 0xffff)
666  {
667  case LOCALE_SMONTHNAME1:
668  case LOCALE_SMONTHNAME2:
669  case LOCALE_SMONTHNAME3:
670  case LOCALE_SMONTHNAME4:
671  case LOCALE_SMONTHNAME5:
672  case LOCALE_SMONTHNAME6:
673  case LOCALE_SMONTHNAME7:
674  case LOCALE_SMONTHNAME8:
675  case LOCALE_SMONTHNAME9:
676  case LOCALE_SMONTHNAME10:
677  case LOCALE_SMONTHNAME11:
678  case LOCALE_SMONTHNAME12:
679  case LOCALE_SMONTHNAME13:
680  return TRUE;
681  default:
682  return FALSE;
683  }
684 }
#define TRUE
Definition: types.h:120
#define LOCALE_SMONTHNAME5
Definition: winnls.h:95
#define LOCALE_SMONTHNAME2
Definition: winnls.h:92
#define LOCALE_SMONTHNAME13
Definition: winnls.h:103
#define LOCALE_SMONTHNAME6
Definition: winnls.h:96
#define LOCALE_SMONTHNAME8
Definition: winnls.h:98
DWORD lctype
Definition: lang.c:187
#define LOCALE_SMONTHNAME1
Definition: winnls.h:91
#define LOCALE_SMONTHNAME4
Definition: winnls.h:94
#define LOCALE_SMONTHNAME11
Definition: winnls.h:101
#define LOCALE_SMONTHNAME10
Definition: winnls.h:100
#define LOCALE_SMONTHNAME3
Definition: winnls.h:93
#define LOCALE_SMONTHNAME9
Definition: winnls.h:99
#define LOCALE_SMONTHNAME12
Definition: winnls.h:102
#define LOCALE_SMONTHNAME7
Definition: winnls.h:97

Referenced by GetLocaleInfoW().

◆ IsValidLanguageGroup()

BOOL WINAPI IsValidLanguageGroup ( LGRPID  lgrpid,
DWORD  dwFlags 
)

Definition at line 2630 of file lang.c.

2631 {
2632  static const WCHAR szFormat[] = { '%','x','\0' };
2633  WCHAR szValueName[16], szValue[2];
2634  BOOL bSupported = FALSE, bInstalled = FALSE;
2635  HANDLE hKey;
2636 
2637 
2638  switch (dwFlags)
2639  {
2640  case LGRPID_INSTALLED:
2641  case LGRPID_SUPPORTED:
2642 
2643  hKey = NLS_RegOpenKey( 0, szLangGroupsKeyName );
2644 
2645  sprintfW( szValueName, szFormat, lgrpid );
2646 
2647  if (NLS_RegGetDword( hKey, szValueName, (LPDWORD)szValue ))
2648  {
2649  bSupported = TRUE;
2650 
2651  if (szValue[0] == '1')
2652  bInstalled = TRUE;
2653  }
2654 
2655  if (hKey)
2656  NtClose( hKey );
2657 
2658  break;
2659  }
2660 
2661  if ((dwFlags == LGRPID_SUPPORTED && bSupported) ||
2662  (dwFlags == LGRPID_INSTALLED && bInstalled))
2663  return TRUE;
2664 
2665  return FALSE;
2666 }
static BOOL NLS_RegGetDword(HANDLE hKey, LPCWSTR szValueName, DWORD *lpVal)
Definition: lang.c:2411
#define TRUE
Definition: types.h:120
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR szLangGroupsKeyName[]
Definition: lang.c:51
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LGRPID_INSTALLED
Definition: winnls.h:455
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
const char * szValue
Definition: shortcut.c:57
#define LGRPID_SUPPORTED
Definition: winnls.h:456
#define sprintfW
Definition: unicode.h:58
uint32_t * LPDWORD
Definition: typedefs.h:57
static HANDLE NLS_RegOpenKey(HANDLE hRootKey, LPCWSTR szKeyName)
Definition: lang.c:2369

Referenced by InitFunctionPointers().

◆ IsValidLocale()

BOOL WINAPI IsValidLocale ( LCID  lcid,
DWORD  flags 
)

Definition at line 1545 of file lang.c.

1546 {
1547  /* check if language is registered in the kernel32 resources */
1549  (LPCWSTR)LOCALE_ILANGUAGE, LANGIDFROMLCID(lcid)) != 0;
1550 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define LOCALE_ILANGUAGE
Definition: winnls.h:25
HMODULE kernel32_handle
Definition: dllmain.c:26
HRSRC WINAPI FindResourceExW(HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD lang)
Definition: res.c:164
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define RT_STRING
Definition: pedump.c:368
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by enum_proc(), GeneralPropertyPageLocalesEnumProc(), GetCurrencyFormatW(), GetNumberFormatW(), lgrplocale_procA(), LISTBOX_WindowProc(), ListBoxWndProc_common(), LocalesEnumProc(), ScriptRecordDigitSubstitution(), SetThreadLocale(), START_TEST(), test_GetNumberFormatA(), and validate_package().

◆ LCMapStringA()

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

Definition at line 2044 of file lang.c.

2046 {
2047  WCHAR *bufW = NtCurrentTeb()->StaticUnicodeBuffer;
2048  LPWSTR srcW, dstW;
2049  INT ret = 0, srclenW, dstlenW;
2050  UINT locale_cp = CP_ACP;
2051 
2052  if (!src || !srclen || dstlen < 0)
2053  {
2055  return 0;
2056  }
2057 
2058  if (!(flags & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage( lcid );
2059 
2060  srclenW = MultiByteToWideChar(locale_cp, 0, src, srclen, bufW, 260);
2061  if (srclenW)
2062  srcW = bufW;
2063  else
2064  {
2065  srclenW = MultiByteToWideChar(locale_cp, 0, src, srclen, NULL, 0);
2066  srcW = HeapAlloc(GetProcessHeap(), 0, srclenW * sizeof(WCHAR));
2067  if (!srcW)
2068  {
2070  return 0;
2071  }
2072  MultiByteToWideChar(locale_cp, 0, src, srclen, srcW, srclenW);
2073  }
2074 
2075  if (flags & LCMAP_SORTKEY)
2076  {
2077  if (src == dst)
2078  {
2080  goto map_string_exit;
2081  }
2082  ret = wine_get_sortkey(flags, srcW, srclenW, dst, dstlen);
2083  if (ret == 0)
2085  else
2086  ret++;
2087  goto map_string_exit;
2088  }
2089 
2090  if (flags & SORT_STRINGSORT)
2091  {
2093  goto map_string_exit;
2094  }
2095 
2096  dstlenW = LCMapStringEx(NULL, flags, srcW, srclenW, NULL, 0, NULL, NULL, 0);
2097  if (!dstlenW)
2098  goto map_string_exit;
2099 
2100  dstW = HeapAlloc(GetProcessHeap(), 0, dstlenW * sizeof(WCHAR));
2101  if (!dstW)
2102  {
2104  goto map_string_exit;
2105  }
2106 
2107  LCMapStringEx(NULL, flags, srcW, srclenW, dstW, dstlenW, NULL, NULL, 0);
2108  ret = WideCharToMultiByte(locale_cp, 0, dstW, dstlenW, dst, dstlen, NULL, NULL);
2109  HeapFree(GetProcessHeap(), 0, dstW);
2110 
2111 map_string_exit:
2112  if (srcW != bufW) HeapFree(GetProcessHeap(), 0, srcW);
2113  return ret;
2114 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define WideCharToMultiByte
Definition: compat.h:101
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
#define SORT_STRINGSORT
Definition: winnls.h:180
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
int32_t INT
Definition: typedefs.h:56
INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lparam)
Definition: lang.c:1882
int wine_get_sortkey(int flags, const WCHAR *src, int srclen, char *dst, int dstlen)
Definition: sortkey.c:33
smooth NULL
Definition: ftsmooth.c:416
static UINT get_lcid_codepage(LCID lcid)
Definition: lang.c:257
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
unsigned int UINT
Definition: ndis.h:50
#define LCMAP_SORTKEY
Definition: winnls.h:183
#define SetLastError(x)
Definition: compat.h:409
GLbitfield flags
Definition: glext.h:7161
int ret
GLenum src
Definition: glext.h:6340
#define LOCALE_USE_CP_ACP
Definition: winnls.h:20
static DWORD dstlen
Definition: directory.c:51
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
GLenum GLenum dst
Definition: glext.h:6340
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

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  name,
DWORD  flags,
LPCWSTR  src,
INT  srclen,
LPWSTR  dst,
INT  dstlen,
LPNLSVERSIONINFO  version,
LPVOID  reserved,
LPARAM  lparam 
)

Definition at line 1882 of file lang.c.

1884 {
1885  LPWSTR dst_ptr;
1886 
1887  if (version) FIXME("unsupported version structure %p\n", version);
1888  if (reserved) FIXME("unsupported reserved pointer %p\n", reserved);
1889  if (lparam)
1890  {
1891  static int once;
1892  if (!once++) FIXME("unsupported lparam %lx\n", lparam);
1893  }
1894 
1895  if (!src || !srclen || dstlen < 0)
1896  {
1898  return 0;
1899  }
1900 
1901  /* mutually exclusive flags */
1906  {
1908  return 0;
1909  }
1910 
1911  if (!dstlen) dst = NULL;
1912 
1913  if (flags & LCMAP_SORTKEY)
1914  {
1915  INT ret;
1916  if (src == dst)
1917  {
1919  return 0;
1920  }
1921 
1922  if (srclen < 0) srclen = strlenW(src);
1923 
1924  TRACE("(%s,0x%08x,%s,%d,%p,%d)\n",
1926 
1927  ret = wine_get_sortkey(flags, src, srclen, (char *)dst, dstlen);
1928  if (ret == 0)
1930  else
1931  ret++;
1932  return ret;
1933  }
1934 
1935  /* SORT_STRINGSORT must be used exclusively with LCMAP_SORTKEY */
1936  if (flags & SORT_STRINGSORT)
1937  {
1939  return 0;
1940  }
1941 
1942  if (srclen < 0) srclen = strlenW(src) + 1;
1943 
1944  TRACE("(%s,0x%08x,%s,%d,%p,%d)\n",
1946 
1947  if (!dst) /* return required string length */
1948  {
1949  INT len;
1950 
1951  for (len = 0; srclen; src++, srclen--)
1952  {
1953  WCHAR wch = *src;
1954  /* tests show that win2k just ignores NORM_IGNORENONSPACE,
1955  * and skips white space and punctuation characters for
1956  * NORM_IGNORESYMBOLS.
1957  */
1958  if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
1959  continue;
1960  len++;
1961  }
1962  return len;
1963  }
1964 
1965  if (flags & LCMAP_UPPERCASE)
1966  {
1967  for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
1968  {
1969  WCHAR wch = *src;
1970  if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
1971  continue;
1972  *dst_ptr++ = toupperW(wch);
1973  dstlen--;
1974  }
1975  }
1976  else if (flags & LCMAP_LOWERCASE)
1977  {
1978  for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
1979  {
1980  WCHAR wch = *src;
1981  if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
1982  continue;
1983  *dst_ptr++ = tolowerW(wch);
1984  dstlen--;
1985  }
1986  }
1987  else
1988  {
1989  if (src == dst)
1990  {
1992  return 0;
1993  }
1994  for (dst_ptr = dst; srclen && dstlen; src++, srclen--)
1995  {
1996  WCHAR wch = *src;
1997  if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE)))
1998  continue;
1999  *dst_ptr++ = wch;
2000  dstlen--;
2001  }
2002  }
2003 
2004  if (srclen)
2005  {
2007  return 0;
2008  }
2009 
2010  return dst_ptr - dst;
2011 }
#define LCMAP_SIMPLIFIED_CHINESE
Definition: winnls.h:190
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SORT_STRINGSORT
Definition: winnls.h:180
#define NORM_IGNORESYMBOLS
Definition: winnls.h:176
int32_t INT
Definition: typedefs.h:56
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
r reserved
Definition: btrfs.c:2655
#define LCMAP_LOWERCASE
Definition: winnls.h:181
int wine_get_sortkey(int flags, const WCHAR *src, int srclen, char *dst, int dstlen)
Definition: sortkey.c:33
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
WINE_UNICODE_INLINE WCHAR toupperW(WCHAR ch)
Definition: unicode.h:141
#define LCMAP_KATAKANA
Definition: winnls.h:186
#define LCMAP_TRADITIONAL_CHINESE
Definition: winnls.h:191
#define TRACE(s)
Definition: solgame.cpp:4
#define LCMAP_FULLWIDTH
Definition: winnls.h:188
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
WINE_UNICODE_INLINE WCHAR tolowerW(WCHAR ch)
Definition: unicode.h:135
#define LCMAP_SORTKEY
Definition: winnls.h:183
#define SetLastError(x)
Definition: compat.h:409
WINE_UNICODE_INLINE unsigned short get_char_typeW(WCHAR ch)
Definition: unicode.h:149
GLbitfield flags
Definition: glext.h:7161
#define C1_PUNCT
Definition: unicode.h:35
int ret
#define LCMAP_HALFWIDTH
Definition: winnls.h:187
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
UINT WPARAM LPARAM lparam
Definition: msvc.h:92
#define debugstr_wn
Definition: kernel32.h:33
static DWORD dstlen
Definition: directory.c:51
GLenum GLenum dst
Definition: glext.h:6340
#define LCMAP_HIRAGANA
Definition: winnls.h:185
#define LCMAP_UPPERCASE
Definition: winnls.h:182
Definition: name.c:36
#define C1_SPACE
Definition: unicode.h:34
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define ERROR_INVALID_FLAGS
Definition: winerror.h:583
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

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 2018 of file lang.c.

2020 {
2021  TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n",
2022  lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen);
2023 
2024  return LCMapStringEx(NULL, flags, src, srclen, dst, dstlen, NULL, NULL, 0);
2025 }
INT WINAPI LCMapStringEx(LPCWSTR name, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lparam)
Definition: lang.c:1882
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:51
GLbitfield flags
Definition: glext.h:7161
GLenum src
Definition: glext.h:6340
#define debugstr_wn
Definition: kernel32.h:33
static DWORD dstlen
Definition: directory.c:51
GLenum GLenum dst
Definition: glext.h:6340

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

◆ NLS_EnumLanguageGroupLocales()

static BOOL NLS_EnumLanguageGroupLocales ( ENUMLANGUAGEGROUPLOCALE_CALLBACKS lpProcs)
static

Definition at line 2679 of file lang.c.

2680 {
2681  static const WCHAR szAlternateSortsKeyName[] = {
2682  'A','l','t','e','r','n','a','t','e',' ','S','o','r','t','s','\0'
2683  };
2684  WCHAR szNumber[10], szValue[4];
2685  HANDLE hKey;
2686  BOOL bContinue = TRUE, bAlternate = FALSE;
2687  LGRPID lgrpid;
2688  ULONG ulIndex = 1; /* Ignore default entry of 1st key */
2689 
2690  if (!lpProcs || !lpProcs->lgrpid || lpProcs->lgrpid > LGRPID_ARMENIAN)
2691  {
2693  return FALSE;
2694  }
2695 
2696  if (lpProcs->dwFlags)
2697  {
2699  return FALSE;
2700  }
2701 
2702  hKey = NLS_RegOpenKey( 0, szLocaleKeyName );
2703 
2704  if (!hKey)
2705  WARN("NLS registry key not found. Please apply the default registry file 'wine.inf'\n");
2706 
2707  while (bContinue)
2708  {
2709  if (NLS_RegEnumValue( hKey, ulIndex, szNumber, sizeof(szNumber),
2710  szValue, sizeof(szValue) ))
2711  {
2712  lgrpid = strtoulW( szValue, NULL, 16 );
2713 
2714  TRACE("lcid %s, grpid %d (%smatched)\n", debugstr_w(szNumber),
2715  lgrpid, lgrpid == lpProcs->lgrpid ? "" : "not ");
2716 
2717  if (lgrpid == lpProcs->lgrpid)
2718  {
2719  LCID lcid;
2720 
2721  lcid = strtoulW( szNumber, NULL, 16 );
2722 
2723  /* FIXME: native returns extra text for a few (17/150) locales, e.g:
2724  * '00000437 ;Georgian'
2725  * At present we only pass the LCID string.
2726  */
2727 
2728  if (lpProcs->procW)
2729  bContinue = lpProcs->procW( lgrpid, lcid, szNumber, lpProcs->lParam );
2730  else
2731  {
2732  char szNumberA[sizeof(szNumber)/sizeof(WCHAR)];
2733 
2734  WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0);
2735 
2736  bContinue = lpProcs->procA( lgrpid, lcid, szNumberA, lpProcs->lParam );
2737  }
2738  }
2739 
2740  ulIndex++;
2741  }
2742  else
2743  {
2744  /* Finished enumerating this key */
2745  if (!bAlternate)
2746  {
2747  /* Enumerate alternate sorts also */
2748  hKey = NLS_RegOpenKey( hKey, szAlternateSortsKeyName );
2749  bAlternate = TRUE;
2750  ulIndex = 0;
2751  }
2752  else
2753  bContinue = FALSE; /* Finished both keys */
2754  }
2755 
2756  if (!bContinue)
2757  break;
2758  }
2759 
2760  if (hKey)
2761  NtClose( hKey );
2762 
2763  return TRUE;
2764 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
LANGGROUPLOCALE_ENUMPROCW procW
Definition: lang.c:2672
#define TRUE
Definition: types.h:120
#define WideCharToMultiByte
Definition: compat.h:101
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
DWORD LGRPID
Definition: winnls.h:517
#define WARN(fmt,...)
Definition: debug.h:111
LANGGROUPLOCALE_ENUMPROCA procA
Definition: lang.c:2671
static const WCHAR szNumber[]
Definition: table.c:80
DWORD LCID
Definition: nls.h:13
#define debugstr_w
Definition: kernel32.h:32
static BOOL NLS_RegEnumValue(HANDLE hKey, UINT ulIndex, LPWSTR szValueName, ULONG valueNameSize, LPWSTR szValueData, ULONG valueDataSize)
Definition: lang.c:2384
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SetLastError(x)
Definition: compat.h:409
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
const char * szValue
Definition: shortcut.c:57
ULONG ulIndex
Definition: symbols.c:92
static const WCHAR szLocaleKeyName[]
Definition: lang.c:44
unsigned int ULONG
Definition: retypes.h:1
static HANDLE NLS_RegOpenKey(HANDLE hRootKey, LPCWSTR szKeyName)
Definition: lang.c:2369
#define strtoulW(s1, s2, b)
Definition: unicode.h:41
#define LGRPID_ARMENIAN
Definition: