ReactOS 0.4.16-dev-2293-g4d8327b
locale.c File Reference
#include <k32.h>
#include <debug.h>
#include "lcformat_private.h"
Include dependency graph for locale.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  ENUM_UILANG_CALLBACK
 
struct  geoinfo_t
 

Macros

#define NDEBUG
 
#define WINVER   DLL_EXPORT_VERSION
 
#define LOCALE_NAME_USER_DEFAULT   NULL
 
#define REG_SZ   1
 
#define NLSRC_OFFSET   5000 /* FIXME */
 
#define LOCALE_LOCALEINFOFLAGSMASK
 
#define MB_FLAGSMASK   (MB_PRECOMPOSED|MB_COMPOSITE|MB_USEGLYPHCHARS|MB_ERR_INVALID_CHARS)
 
#define WC_FLAGSMASK
 
#define GET_UNIX_LOCALE(cat)
 

Enumerations

enum  locationkind { LOCATION_NATION = 0 , LOCATION_REGION , LOCATION_BOTH }
 
enum  {
  BASE = 36 , TMIN = 1 , TMAX = 26 , SKEW = 38 ,
  DAMP = 700 , INIT_BIAS = 72 , INIT_N = 128
}
 

Functions

 DEBUG_CHANNEL (nls)
 
INT WINAPI CompareStringEx (LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lParam)
 
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 unsigned short get_table_entry (const unsigned short *table, WCHAR ch)
 
static UINT get_lcid_codepage (LCID lcid)
 
static const union cptableget_codepage_table (unsigned int codepage)
 
static LANGID get_default_sublang (LANGID lang)
 
static LCID convert_default_lcid (LCID lcid, LCTYPE lctype)
 
static BOOL is_genitive_name_supported (LCTYPE lctype)
 
static HANDLE create_registry_key (void)
 
static BOOL locale_update_registry (HKEY hkey, const WCHAR *name, LCID lcid, const LCTYPE *values, UINT nb_values)
 
void LOCALE_InitRegistry (void)
 
static const charget_locale (int category, const char *category_name)
 
static UINT setup_unix_locales (void)
 
LANGID WINAPI GetUserDefaultLangID (void)
 
LANGID WINAPI GetSystemDefaultLangID (void)
 
LCID WINAPI GetUserDefaultLCID (void)
 
LCID WINAPI GetSystemDefaultLCID (void)
 
INT WINAPI GetSystemDefaultLocaleName (LPWSTR localename, INT len)
 
static BOOL get_dummy_preferred_ui_language (DWORD flags, ULONG *count, WCHAR *buffer, ULONG *size)
 
BOOL WINAPI GetSystemPreferredUILanguages (DWORD flags, ULONG *count, WCHAR *buffer, ULONG *size)
 
BOOL WINAPI SetThreadPreferredUILanguages (DWORD flags, PCZZWSTR buffer, PULONG count)
 
BOOL WINAPI GetThreadPreferredUILanguages (DWORD flags, ULONG *count, WCHAR *buf, ULONG *size)
 
LANGID WINAPI GetUserDefaultUILanguage (void)
 
LANGID WINAPI GetSystemDefaultUILanguage (void)
 
static struct registry_valueget_locale_registry_value (DWORD lctype)
 
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)
 
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)
 
UINT WINAPI GetACP (void)
 
UINT WINAPI SetCPGlobal (UINT acp)
 
UINT WINAPI GetOEMCP (void)
 
BOOL WINAPI IsValidCodePage (UINT codepage)
 
BOOL WINAPI IsDBCSLeadByteEx (UINT codepage, BYTE testchar)
 
BOOL WINAPI IsDBCSLeadByte (BYTE testchar)
 
BOOL WINAPI GetCPInfo (UINT codepage, LPCPINFO cpinfo)
 
BOOL WINAPI GetCPInfoExA (UINT codepage, DWORD dwFlags, LPCPINFOEXA cpinfo)
 
BOOL WINAPI GetCPInfoExW (UINT codepage, DWORD dwFlags, LPCPINFOEXW cpinfo)
 
BOOL WINAPI EnumSystemCodePagesA (CODEPAGE_ENUMPROCA lpfnCodePageEnum, DWORD flags)
 
BOOL WINAPI EnumSystemCodePagesW (CODEPAGE_ENUMPROCW lpfnCodePageEnum, DWORD flags)
 
static BOOL utf7_write_w (WCHAR *dst, int dstlen, int *index, WCHAR character)
 
static int utf7_mbstowcs (const char *src, int srclen, WCHAR *dst, int dstlen)
 
INT WINAPI MultiByteToWideChar (UINT page, DWORD flags, LPCSTR src, INT srclen, LPWSTR dst, INT dstlen)
 
static BOOL utf7_can_directly_encode (WCHAR codepoint)
 
static BOOL utf7_write_c (char *dst, int dstlen, int *index, char character)
 
static int utf7_wcstombs (const WCHAR *src, int srclen, char *dst, int dstlen)
 
INT WINAPI WideCharToMultiByte (UINT page, DWORD flags, LPCWSTR src, INT srclen, LPSTR dst, INT dstlen, LPCSTR defchar, BOOL *used)
 
LCID WINAPI GetThreadLocale (void)
 
BOOL WINAPI SetThreadLocale (LCID lcid)
 
LANGID WINAPI SetThreadUILanguage (LANGID langid)
 
LCID WINAPI ConvertDefaultLocale (LCID lcid)
 
BOOL WINAPI IsValidLocale (LCID lcid, DWORD flags)
 
BOOL WINAPI IsValidLocaleName (LPCWSTR locale)
 
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)
 
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 locale, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM handle)
 
INT WINAPI LCMapStringW (LCID lcid, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
 
INT WINAPI LCMapStringA (LCID lcid, DWORD flags, LPCSTR src, INT srclen, LPSTR dst, INT dstlen)
 
INT WINAPI FoldStringW (DWORD dwFlags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
 
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)
 
int WINAPI lstrcmpA (LPCSTR str1, LPCSTR str2)
 
int WINAPI lstrcmpiA (LPCSTR str1, LPCSTR str2)
 
int WINAPI lstrcmpW (LPCWSTR str1, LPCWSTR str2)
 
int WINAPI lstrcmpiW (LPCWSTR str1, LPCWSTR str2)
 
void LOCALE_Init (void)
 
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)
 
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 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)
 
BOOL WINAPI EnumSystemGeoID (GEOCLASS geoclass, GEOID parent, GEO_ENUMPROC enumproc)
 
INT WINAPI GetUserDefaultLocaleName (LPWSTR localename, int buffersize)
 
INT WINAPI NormalizeString (NORM_FORM NormForm, LPCWSTR lpSrcString, INT cwSrcLength, LPWSTR lpDstString, INT cwDstLength)
 
BOOL WINAPI IsNormalizedString (NORM_FORM NormForm, LPCWSTR lpString, INT cwLength)
 
static INT adapt (INT delta, INT numpoints, BOOL firsttime)
 
INT WINAPI IdnToAscii (DWORD dwFlags, LPCWSTR lpUnicodeCharStr, INT cchUnicodeChar, LPWSTR lpASCIICharStr, INT cchASCIIChar)
 
INT WINAPI IdnToNameprepUnicode (DWORD dwFlags, LPCWSTR lpUnicodeCharStr, INT cchUnicodeChar, LPWSTR lpNameprepCharStr, INT cchNameprepChar)
 
INT WINAPI IdnToUnicode (DWORD dwFlags, LPCWSTR lpASCIICharStr, INT cchASCIIChar, LPWSTR lpUnicodeCharStr, INT cchUnicodeChar)
 
BOOL WINAPI GetFileMUIPath (DWORD flags, PCWSTR filepath, PWSTR language, PULONG languagelen, PWSTR muipath, PULONG muipathlen, PULONGLONG enumerator)
 
BOOL WINAPI GetFileMUIInfo (DWORD flags, PCWSTR path, FILEMUIINFO *info, DWORD *size)
 
INT WINAPI ResolveLocaleName (LPCWSTR name, LPWSTR localename, INT len)
 

Variables

HMODULE kernel32_handle
 
static const union cptableansi_cptable
 
static const union cptableoem_cptable
 
static const union cptablemac_cptable
 
static const union cptableunix_cptable
 
static const WCHAR szLocaleKeyName []
 
static const WCHAR szLangGroupsKeyName []
 
static LCID lcid_LC_COLLATE
 
static LCID lcid_LC_CTYPE
 
static LCID lcid_LC_MESSAGES
 
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

◆ GET_UNIX_LOCALE

#define GET_UNIX_LOCALE (   cat)
Value:
do \
if ((locale = get_locale( cat, #cat ))) \
{ \
strcpynAtoW( buffer, locale, sizeof(buffer)/sizeof(WCHAR) ); \
if (!strcmpW( buffer, ctype_buff )) lcid_##cat = lcid_LC_CTYPE; \
else { \
parse_locale_name( buffer, &locale_name ); \
lcid_##cat = locale_name.lcid; \
TRACE( "got lcid %04x (%d matches) for " #cat "=%s\n", \
} \
} while (0)
static WCHAR * get_locale(void)
Definition: builtin.c:3937
Definition: _locale.h:75
static LCID lcid_LC_CTYPE
Definition: locale.c:162
GLuint buffer
Definition: glext.h:5915
#define debugstr_a
Definition: kernel32.h:31
int matches
Definition: locale.c:156
LCID lcid
Definition: locale.c:155
#define strcmpW(s1, s2)
Definition: unicode.h:44
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ LOCALE_LOCALEINFOFLAGSMASK

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

Definition at line 58 of file locale.c.

◆ LOCALE_NAME_USER_DEFAULT

#define LOCALE_NAME_USER_DEFAULT   NULL

Definition at line 43 of file locale.c.

◆ MB_FLAGSMASK

Definition at line 60 of file locale.c.

◆ NDEBUG

#define NDEBUG

Definition at line 26 of file locale.c.

◆ NLSRC_OFFSET

#define NLSRC_OFFSET   5000 /* FIXME */

Definition at line 54 of file locale.c.

◆ REG_SZ

#define REG_SZ   1

Definition at line 45 of file locale.c.

◆ WC_FLAGSMASK

#define WC_FLAGSMASK
Value:
#define WC_DEFAULTCHAR
Definition: unicode.h:45
#define WC_COMPOSITECHECK
Definition: unicode.h:43
#define WC_DISCARDNS
Definition: unicode.h:44
#define WC_ERR_INVALID_CHARS
Definition: unicode.h:47
#define WC_NO_BEST_FIT_CHARS
Definition: unicode.h:46
#define WC_SEPCHARS
Definition: winnls.h:237

Definition at line 61 of file locale.c.

◆ WINVER

#define WINVER   DLL_EXPORT_VERSION

Definition at line 40 of file locale.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BASE 
TMIN 
TMAX 
SKEW 
DAMP 
INIT_BIAS 
INIT_N 

Definition at line 5609 of file locale.c.

5609 {
5610 BASE = 36,
5611 TMIN = 1,
5612 TMAX = 26,
5613 SKEW = 38,
5614 DAMP = 700,
5615 INIT_BIAS = 72,
5616 INIT_N = 128
5617};
@ INIT_N
Definition: locale.c:5616
@ DAMP
Definition: locale.c:5614
@ SKEW
Definition: locale.c:5613
@ BASE
Definition: locale.c:5610
@ TMIN
Definition: locale.c:5611
@ TMAX
Definition: locale.c:5612
@ INIT_BIAS
Definition: locale.c:5615

◆ locationkind

Enumerator
LOCATION_NATION 
LOCATION_REGION 
LOCATION_BOTH 

Definition at line 4931 of file locale.c.

4931 {
4932 LOCATION_NATION = 0,
4935};
@ LOCATION_REGION
Definition: locale.c:4933
@ LOCATION_BOTH
Definition: locale.c:4934
@ LOCATION_NATION
Definition: locale.c:4932

Function Documentation

◆ adapt()

static INT adapt ( INT  delta,
INT  numpoints,
BOOL  firsttime 
)
inlinestatic

Definition at line 5619 of file locale.c.

5620{
5621 INT k;
5622
5623 delta /= (firsttime ? DAMP : 2);
5624 delta += delta/numpoints;
5625
5626 for(k=0; delta>((BASE-TMIN)*TMAX)/2; k+=BASE)
5627 delta /= BASE-TMIN;
5628 return k+((BASE-TMIN+1)*delta)/(delta+SKEW);
5629}
int k
Definition: mpi.c:3369
int32_t INT
Definition: typedefs.h:58

Referenced by IdnToAscii(), and IdnToUnicode().

◆ CompareStringA()

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

Definition at line 4015 of file locale.c.

4017{
4018 WCHAR *buf1W = NtCurrentTeb()->StaticUnicodeBuffer;
4019 WCHAR *buf2W = buf1W + 130;
4020 LPWSTR str1W, str2W;
4021 INT len1W = 0, len2W = 0, ret;
4022 UINT locale_cp = CP_ACP;
4023
4024 if (!str1 || !str2)
4025 {
4027 return 0;
4028 }
4029 if (len1 < 0) len1 = strlen(str1);
4030 if (len2 < 0) len2 = strlen(str2);
4031
4032 if (!(flags & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage( lcid );
4033
4034 if (len1)
4035 {
4036 if (len1 <= 130) len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, buf1W, 130);
4037 if (len1W)
4038 str1W = buf1W;
4039 else
4040 {
4041 len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, NULL, 0);
4042 str1W = HeapAlloc(GetProcessHeap(), 0, len1W * sizeof(WCHAR));
4043 if (!str1W)
4044 {
4046 return 0;
4047 }
4048 MultiByteToWideChar(locale_cp, 0, str1, len1, str1W, len1W);
4049 }
4050 }
4051 else
4052 {
4053 len1W = 0;
4054 str1W = buf1W;
4055 }
4056
4057 if (len2)
4058 {
4059 if (len2 <= 130) len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, buf2W, 130);
4060 if (len2W)
4061 str2W = buf2W;
4062 else
4063 {
4064 len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, NULL, 0);
4065 str2W = HeapAlloc(GetProcessHeap(), 0, len2W * sizeof(WCHAR));
4066 if (!str2W)
4067 {
4068 if (str1W != buf1W) HeapFree(GetProcessHeap(), 0, str1W);
4070 return 0;
4071 }
4072 MultiByteToWideChar(locale_cp, 0, str2, len2, str2W, len2W);
4073 }
4074 }
4075 else
4076 {
4077 len2W = 0;
4078 str2W = buf2W;
4079 }
4080
4081 ret = CompareStringEx(NULL, flags, str1W, len1W, str2W, len2W, NULL, NULL, 0);
4082
4083 if (str1W != buf1W) HeapFree(GetProcessHeap(), 0, str1W);
4084 if (str2W != buf2W) HeapFree(GetProcessHeap(), 0, str2W);
4085 return ret;
4086}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
static UINT get_lcid_codepage(LCID lcid)
Definition: locale.c:288
INT WINAPI CompareStringEx(LPCWSTR locale, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM lParam)
Definition: locale.c:3955
LCID lcid
Definition: locale.c:5656
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
return ret
Definition: mutex.c:146
GLbitfield flags
Definition: glext.h:7161
#define NtCurrentTeb
unsigned int UINT
Definition: ndis.h:50
XML_HIDDEN void xmlParserErrors const char const xmlChar const xmlChar * str2
Definition: parser.h:35
XML_HIDDEN void xmlParserErrors const char const xmlChar * str1
Definition: parser.h:35
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by __crtCompareStringA(), _Locale_strcmp_auxA(), _mbscoll(), _mbsicoll(), _mbsnbcoll_l(), _mbsnbicoll_l(), _strcoll_l(), _stricoll_l(), _strncoll_l(), _strnicoll_l(), char_compare(), 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 3955 of file locale.c.

3957{
3960 DWORD semistub_flags = NORM_LINGUISTIC_CASING|LINGUISTIC_IGNORECASE|0x10000000;
3961 /* 0x10000000 is related to diacritics in Arabic, Japanese, and Hebrew */
3962 INT ret;
3963 static int once;
3964
3965 if (version) FIXME("unexpected version parameter\n");
3966 if (reserved) FIXME("unexpected reserved value\n");
3967 if (lParam) FIXME("unexpected lParam\n");
3968
3969 if (!str1 || !str2)
3970 {
3972 return 0;
3973 }
3974
3975 if (flags & ~(supported_flags|semistub_flags))
3976 {
3978 return 0;
3979 }
3980
3981 if (flags & semistub_flags)
3982 {
3983 if (!once++)
3984 FIXME("semi-stub behavior for flag(s) 0x%x\n", flags & semistub_flags);
3985 }
3986
3987 if (len1 < 0) len1 = strlenW(str1);
3988 if (len2 < 0) len2 = strlenW(str2);
3989
3990 ret = wine_compare_string(flags, str1, len1, str2, len2);
3991
3992 if (ret) /* need to translate result */
3993 return (ret < 0) ? CSTR_LESS_THAN : CSTR_GREATER_THAN;
3994 return CSTR_EQUAL;
3995}
#define FIXME(fmt,...)
Definition: precomp.h:53
LPARAM lParam
Definition: combotst.c:139
static const WCHAR version[]
Definition: asmname.c:66
int wine_compare_string(int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2)
Definition: sortkey.c:358
r reserved
Definition: btrfs.c:3006
unsigned long DWORD
Definition: ntddk_ex.h:95
#define strlenW(s)
Definition: unicode.h:34
#define ERROR_INVALID_FLAGS
Definition: winerror.h:907
#define NORM_IGNORECASE
Definition: winnls.h:187
#define SORT_STRINGSORT
Definition: winnls.h:195
#define LINGUISTIC_IGNORECASE
Definition: winnls.h:192
#define NORM_IGNOREKANATYPE
Definition: winnls.h:188
#define NORM_LINGUISTIC_CASING
Definition: winnls.h:194
#define CSTR_EQUAL
Definition: winnls.h:500
#define NORM_IGNORENONSPACE
Definition: winnls.h:189
#define NORM_IGNORESYMBOLS
Definition: winnls.h:190
#define NORM_IGNOREWIDTH
Definition: winnls.h:191
#define CSTR_LESS_THAN
Definition: winnls.h:499
#define CSTR_GREATER_THAN
Definition: winnls.h:501

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

◆ CompareStringW()

◆ convert_default_lcid()

static LCID convert_default_lcid ( LCID  lcid,
LCTYPE  lctype 
)
static

Definition at line 592 of file locale.c.

593{
597 {
598 LCID default_id = 0;
599
600 switch(lctype & 0xffff)
601 {
602 case LOCALE_SSORTNAME:
603 default_id = lcid_LC_COLLATE;
604 break;
605
609 case LOCALE_IDEFAULTEBCDICCODEPAGE:
612 default_id = lcid_LC_CTYPE;
613 break;
614
616 case LOCALE_ICURRENCY:
618 case LOCALE_INEGCURR:
625 case LOCALE_SCURRENCY:
630 case LOCALE_SNATIVECURRNAME:
631 default_id = lcid_LC_MONETARY;
632 break;
633
634 case LOCALE_IDIGITS:
635 case LOCALE_IDIGITSUBSTITUTION:
636 case LOCALE_ILZERO:
638 case LOCALE_SDECIMAL:
639 case LOCALE_SGROUPING:
640 //case LOCALE_SNAN:
643 //case LOCALE_SNEGINFINITY:
644 //case LOCALE_SPOSINFINITY:
646 case LOCALE_STHOUSAND:
647 default_id = lcid_LC_NUMERIC;
648 break;
649
651 case LOCALE_ICENTURY:
652 case LOCALE_IDATE:
653 case LOCALE_IDAYLZERO:
656 case LOCALE_ILDATE:
657 case LOCALE_IMONLZERO:
659 case LOCALE_ITIME:
661 case LOCALE_ITLZERO:
662 case LOCALE_S1159:
663 case LOCALE_S2359:
684 case LOCALE_SDATE:
685 case LOCALE_SDAYNAME1:
686 case LOCALE_SDAYNAME2:
687 case LOCALE_SDAYNAME3:
688 case LOCALE_SDAYNAME4:
689 case LOCALE_SDAYNAME5:
690 case LOCALE_SDAYNAME6:
691 case LOCALE_SDAYNAME7:
692 //case LOCALE_SDURATION:
693 case LOCALE_SLONGDATE:
708 //case LOCALE_SSHORTESTDAYNAME1:
709 //case LOCALE_SSHORTESTDAYNAME2:
710 //case LOCALE_SSHORTESTDAYNAME3:
711 //case LOCALE_SSHORTESTDAYNAME4:
712 //case LOCALE_SSHORTESTDAYNAME5:
713 //case LOCALE_SSHORTESTDAYNAME6:
714 //case LOCALE_SSHORTESTDAYNAME7:
715 case LOCALE_STIME:
717 case LOCALE_SYEARMONTH:
718 default_id = lcid_LC_TIME;
719 break;
720
721 case LOCALE_IPAPERSIZE:
722 default_id = lcid_LC_PAPER;
723 break;
724
725 case LOCALE_IMEASURE:
726 default_id = lcid_LC_MEASUREMENT;
727 break;
728
729 case LOCALE_ICOUNTRY:
730 default_id = lcid_LC_TELEPHONE;
731 break;
732 }
733 if (default_id) lcid = default_id;
734 }
735 return ConvertDefaultLocale( lcid );
736}
static LCID lcid_LC_MONETARY
Definition: locale.c:164
static LCID lcid_LC_TIME
Definition: locale.c:166
static LCID lcid_LC_NUMERIC
Definition: locale.c:165
static LCID lcid_LC_COLLATE
Definition: locale.c:161
static LCID lcid_LC_MEASUREMENT
Definition: locale.c:168
static LCID lcid_LC_TELEPHONE
Definition: locale.c:169
static LCID lcid_LC_PAPER
Definition: locale.c:167
LCID WINAPI ConvertDefaultLocale(LCID lcid)
Definition: locale.c:2879
#define LOCALE_NEUTRAL
#define LOCALE_USER_DEFAULT
#define LOCALE_SYSTEM_DEFAULT
DWORD LCID
Definition: nls.h:13
#define LOCALE_SABBREVMONTHNAME10
Definition: winnls.h:120
#define LOCALE_SMONTHNAME12
Definition: winnls.h:109
#define LOCALE_ICURRDIGITS
Definition: winnls.h:61
#define LOCALE_IDEFAULTCODEPAGE
Definition: winnls.h:44
#define LOCALE_SMONTHNAME5
Definition: winnls.h:102
#define LOCALE_SDATE
Definition: winnls.h:65
#define LOCALE_SDAYNAME5
Definition: winnls.h:88
#define LOCALE_SABBREVMONTHNAME9
Definition: winnls.h:119
#define LOCALE_SABBREVMONTHNAME11
Definition: winnls.h:121
#define LOCALE_SABBREVDAYNAME5
Definition: winnls.h:95
#define LOCALE_SABBREVDAYNAME2
Definition: winnls.h:92
#define LOCALE_INEGSEPBYSPACE
Definition: winnls.h:131
#define LOCALE_SABBREVMONTHNAME2
Definition: winnls.h:112
#define LOCALE_INEGSIGNPOSN
Definition: winnls.h:127
#define LOCALE_IDEFAULTUNIXCODEPAGE
Definition: winnls.h:185
#define LOCALE_SMONTHNAME13
Definition: winnls.h:110
#define LOCALE_SGROUPING
Definition: winnls.h:51
#define LOCALE_SMONTHNAME3
Definition: winnls.h:100
#define LOCALE_ICOUNTRY
Definition: winnls.h:36
#define LOCALE_SDECIMAL
Definition: winnls.h:49
#define LOCALE_SMONTHNAME11
Definition: winnls.h:108
#define LOCALE_SMONTHNAME8
Definition: winnls.h:105
#define LOCALE_IDATE
Definition: winnls.h:70
#define LOCALE_SMONTHNAME4
Definition: winnls.h:101
#define LOCALE_FONTSIGNATURE
Definition: winnls.h:132
#define LOCALE_SABBREVMONTHNAME13
Definition: winnls.h:123
#define LOCALE_IFIRSTWEEKOFYEAR
Definition: winnls.h:83
#define LOCALE_SDAYNAME1
Definition: winnls.h:84
#define LOCALE_IMEASURE
Definition: winnls.h:48
#define LOCALE_SLONGDATE
Definition: winnls.h:68
#define LOCALE_SMONTHNAME7
Definition: winnls.h:104
#define LOCALE_IINTLCURRDIGITS
Definition: winnls.h:62
#define LOCALE_S1159
Definition: winnls.h:78
#define LOCALE_SSHORTDATE
Definition: winnls.h:67
#define LOCALE_IPOSSYMPRECEDES
Definition: winnls.h:128
#define LOCALE_IDAYLZERO
Definition: winnls.h:76
#define LOCALE_SABBREVMONTHNAME4
Definition: winnls.h:114
#define LOCALE_SPOSITIVESIGN
Definition: winnls.h:124
#define LOCALE_SABBREVDAYNAME4
Definition: winnls.h:94
#define LOCALE_SMONDECIMALSEP
Definition: winnls.h:58
#define LOCALE_ITIME
Definition: winnls.h:72
#define LOCALE_ICURRENCY
Definition: winnls.h:63
#define LOCALE_SMONTHNAME1
Definition: winnls.h:98
#define LOCALE_SABBREVMONTHNAME3
Definition: winnls.h:113
#define LOCALE_ITLZERO
Definition: winnls.h:75
#define LOCALE_INEGSYMPRECEDES
Definition: winnls.h:130
#define LOCALE_SMONTHOUSANDSEP
Definition: winnls.h:59
#define LOCALE_SDAYNAME7
Definition: winnls.h:90
#define LOCALE_IPOSSIGNPOSN
Definition: winnls.h:126
#define LOCALE_SDAYNAME2
Definition: winnls.h:85
#define LOCALE_SABBREVMONTHNAME1
Definition: winnls.h:111
#define LOCALE_IOPTIONALCALENDAR
Definition: winnls.h:81
#define LOCALE_IDIGITS
Definition: winnls.h:52
#define LOCALE_STHOUSAND
Definition: winnls.h:50
#define LOCALE_IDEFAULTANSICODEPAGE
Definition: winnls.h:45
#define LOCALE_SABBREVDAYNAME6
Definition: winnls.h:96
#define LOCALE_SMONTHNAME2
Definition: winnls.h:99
#define LOCALE_STIMEFORMAT
Definition: winnls.h:69
#define LOCALE_SABBREVDAYNAME1
Definition: winnls.h:91
#define LOCALE_IFIRSTDAYOFWEEK
Definition: winnls.h:82
#define LOCALE_SABBREVMONTHNAME6
Definition: winnls.h:116
#define LOCALE_SMONTHNAME6
Definition: winnls.h:103
#define LOCALE_STIME
Definition: winnls.h:66
#define LOCALE_INEGNUMBER
Definition: winnls.h:54
#define LOCALE_SNEGATIVESIGN
Definition: winnls.h:125
#define LOCALE_SDAYNAME3
Definition: winnls.h:86
#define LOCALE_S2359
Definition: winnls.h:79
#define LOCALE_SNATIVEDIGITS
Definition: winnls.h:55
#define LOCALE_SABBREVDAYNAME3
Definition: winnls.h:93
#define LOCALE_ILZERO
Definition: winnls.h:53
#define LOCALE_SABBREVMONTHNAME5
Definition: winnls.h:115
#define LOCALE_SABBREVMONTHNAME7
Definition: winnls.h:117
#define LOCALE_ICALENDARTYPE
Definition: winnls.h:80
#define LOCALE_SINTLSYMBOL
Definition: winnls.h:57
#define LOCALE_SABBREVMONTHNAME8
Definition: winnls.h:118
#define LOCALE_SMONGROUPING
Definition: winnls.h:60
#define LOCALE_SDAYNAME4
Definition: winnls.h:87
#define LOCALE_SCURRENCY
Definition: winnls.h:56
#define LOCALE_SMONTHNAME10
Definition: winnls.h:107
#define LOCALE_INEGCURR
Definition: winnls.h:64
#define LOCALE_ILDATE
Definition: winnls.h:71
#define LOCALE_SMONTHNAME9
Definition: winnls.h:106
#define LOCALE_IPOSSEPBYSPACE
Definition: winnls.h:129
#define LOCALE_ICENTURY
Definition: winnls.h:74
#define LOCALE_IMONLZERO
Definition: winnls.h:77
#define LOCALE_SABBREVMONTHNAME12
Definition: winnls.h:122
#define LOCALE_IDEFAULTMACCODEPAGE
Definition: winnls.h:46
#define LOCALE_SDAYNAME6
Definition: winnls.h:89
#define LOCALE_ITIMEMARKPOSN
Definition: winnls.h:73
#define LOCALE_SABBREVDAYNAME7
Definition: winnls.h:97

Referenced by GetLocaleInfoW().

◆ ConvertDefaultLocale()

LCID WINAPI ConvertDefaultLocale ( LCID  lcid)

Definition at line 2879 of file locale.c.

2880{
2881 LANGID langid;
2882
2883 switch (lcid)
2884 {
2885 case LOCALE_INVARIANT:
2886 /* keep as-is */
2887 break;
2890 break;
2892 case LOCALE_NEUTRAL:
2894 break;
2895 default:
2896 /* Replace SUBLANG_NEUTRAL with SUBLANG_DEFAULT */
2899 {
2902 }
2903 }
2904 return lcid;
2905}
static LANGID get_default_sublang(LANGID lang)
Definition: locale.c:369
LCID WINAPI GetUserDefaultLCID(void)
Definition: locale.c:1216
LCID WINAPI GetSystemDefaultLCID(void)
Definition: locale.c:1235
USHORT LANGID
Definition: mui.h:9
LANGID langid
Definition: msctf.idl:626
#define LOCALE_INVARIANT
#define SORTIDFROMLCID(lcid)
#define MAKELCID(lgid, srtid)
#define SUBLANGID(l)
Definition: nls.h:17
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define SUBLANG_NEUTRAL
Definition: nls.h:167

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

◆ create_registry_key()

static HANDLE create_registry_key ( void  )
inlinestatic

Definition at line 771 of file locale.c.

772{
773 static const WCHAR cplW[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l',0};
774 static const WCHAR intlW[] = {'I','n','t','e','r','n','a','t','i','o','n','a','l',0};
777 HANDLE cpl_key, hkey = 0;
778
779 if (RtlOpenCurrentUser( KEY_ALL_ACCESS, &hkey ) != STATUS_SUCCESS) return 0;
780
781 attr.Length = sizeof(attr);
782 attr.RootDirectory = hkey;
783 attr.ObjectName = &nameW;
784 attr.Attributes = 0;
785 attr.SecurityDescriptor = NULL;
786 attr.SecurityQualityOfService = NULL;
787 RtlInitUnicodeString( &nameW, cplW );
788
789 if (!NtCreateKey( &cpl_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
790 {
791 NtClose( attr.RootDirectory );
792 attr.RootDirectory = cpl_key;
793 RtlInitUnicodeString( &nameW, intlW );
794 if (NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) hkey = 0;
795 }
796 NtClose( attr.RootDirectory );
797 return hkey;
798}
static const WCHAR nameW[]
Definition: main.c:49
NTSYSAPI NTSTATUS NTAPI RtlOpenCurrentUser(_In_ ACCESS_MASK DesiredAccess, _Out_ PHANDLE KeyHandle)
#define KEY_ALL_ACCESS
Definition: nt_native.h:1044
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: cookie.c:202

Referenced by get_registry_locale_info(), GetUserGeoID(), LOCALE_InitRegistry(), 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 2953 of file locale.c.

2955{
2956 LOCALE_ENUMPROCA lpfnLocaleEnum = (LOCALE_ENUMPROCA)lParam;
2957 char buf[20];
2958
2959 sprintf(buf, "%08x", (UINT)LangID);
2960 return lpfnLocaleEnum( buf );
2961}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define sprintf
Definition: sprintf.c:45
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1083
BOOL(CALLBACK * LOCALE_ENUMPROCA)(LPSTR)
Definition: winnls.h:601

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 2963 of file locale.c.

2965{
2966 static const WCHAR formatW[] = {'%','0','8','x',0};
2967 LOCALE_ENUMPROCW lpfnLocaleEnum = (LOCALE_ENUMPROCW)lParam;
2968 WCHAR buf[20];
2969 sprintfW( buf, formatW, (UINT)LangID );
2970 return lpfnLocaleEnum( buf );
2971}
#define sprintfW
Definition: unicode.h:64
BOOL(CALLBACK * LOCALE_ENUMPROCW)(LPWSTR)
Definition: winnls.h:602

Referenced by EnumSystemLocalesW().

◆ 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 4853 of file locale.c.

4855{
4857 char buf[20];
4858
4859 sprintf(buf, "%08x", (UINT)LangID);
4860 return enum_uilang->u.procA( buf, enum_uilang->param );
4861}
union ENUM_UILANG_CALLBACK::@456 u
UILANGUAGE_ENUMPROCA procA
Definition: locale.c:4846

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 4863 of file locale.c.

4865{
4866 static const WCHAR formatW[] = {'%','0','8','x',0};
4868 WCHAR buf[20];
4869
4870 sprintfW( buf, formatW, (UINT)LangID );
4871 return enum_uilang->u.procW( buf, enum_uilang->param );
4872}
UILANGUAGE_ENUMPROCW procW
Definition: locale.c:4847

Referenced by EnumUILanguagesW().

◆ EnumLanguageGroupLocalesA()

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

Definition at line 4707 of file locale.c.

4709{
4711
4712 TRACE("(%p,0x%08X,0x%08X,0x%08lX)\n", pLangGrpLcEnumProc, lgrpid, dwFlags, lParam);
4713
4714 callbacks.procA = pLangGrpLcEnumProc;
4715 callbacks.procW = NULL;
4716 callbacks.dwFlags = dwFlags;
4717 callbacks.lgrpid = lgrpid;
4718 callbacks.lParam = lParam;
4719
4720 return NLS_EnumLanguageGroupLocales( pLangGrpLcEnumProc ? &callbacks : NULL );
4721}
static BOOL NLS_EnumLanguageGroupLocales(ENUMLANGUAGEGROUPLOCALE_CALLBACKS *lpProcs)
Definition: locale.c:4605
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define TRACE(s)
Definition: solgame.cpp:4
LANGGROUPLOCALE_ENUMPROCW procW
Definition: locale.c:4598
LANGGROUPLOCALE_ENUMPROCA procA
Definition: locale.c:4597

Referenced by InitFunctionPointers(), and test_digit_substitution().

◆ EnumLanguageGroupLocalesW()

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

Definition at line 4728 of file locale.c.

4730{
4732
4733 TRACE("(%p,0x%08X,0x%08X,0x%08lX)\n", pLangGrpLcEnumProc, lgrpid, dwFlags, lParam);
4734
4735 callbacks.procA = NULL;
4736 callbacks.procW = pLangGrpLcEnumProc;
4737 callbacks.dwFlags = dwFlags;
4738 callbacks.lgrpid = lgrpid;
4739 callbacks.lParam = lParam;
4740
4741 return NLS_EnumLanguageGroupLocales( pLangGrpLcEnumProc ? &callbacks : NULL );
4742}

◆ EnumSystemCodePagesA()

BOOL WINAPI EnumSystemCodePagesA ( CODEPAGE_ENUMPROCA  lpfnCodePageEnum,
DWORD  flags 
)

Definition at line 2276 of file locale.c.

2277{
2278 const union cptable *table;
2279 char buffer[10];
2280 int index = 0;
2281
2282 for (;;)
2283 {
2284 if (!(table = wine_cp_enum_table( index++ ))) break;
2285 sprintf( buffer, "%d", table->info.codepage );
2286 if (!lpfnCodePageEnum( buffer )) break;
2287 }
2288 return TRUE;
2289}
#define TRUE
Definition: types.h:120
GLuint index
Definition: glext.h:6031
const union cptable * wine_cp_enum_table(unsigned int index)
Definition: cptable.c:203

◆ EnumSystemCodePagesW()

BOOL WINAPI EnumSystemCodePagesW ( CODEPAGE_ENUMPROCW  lpfnCodePageEnum,
DWORD  flags 
)

Definition at line 2297 of file locale.c.

2298{
2299 const union cptable *table;
2300 WCHAR buffer[10], *p;
2301 int page, index = 0;
2302
2303 for (;;)
2304 {
2305 if (!(table = wine_cp_enum_table( index++ ))) break;
2306 p = buffer + sizeof(buffer)/sizeof(WCHAR);
2307 *--p = 0;
2308 page = table->info.codepage;
2309 do
2310 {
2311 *--p = '0' + (page % 10);
2312 page /= 10;
2313 } while( page );
2314 if (!lpfnCodePageEnum( p )) break;
2315 }
2316 return TRUE;
2317}
GLfloat GLfloat p
Definition: glext.h:8902
Definition: module.h:576

Referenced by InitCodePagesList().

◆ EnumSystemGeoID()

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

Definition at line 5542 of file locale.c.

5543{
5544 INT i;
5545
5546 TRACE("(%d, %d, %p)\n", geoclass, parent, enumproc);
5547
5548 if (!enumproc) {
5550 return FALSE;
5551 }
5552
5553 if (geoclass != GEOCLASS_NATION && geoclass != GEOCLASS_REGION) {
5555 return FALSE;
5556 }
5557
5558 for (i = 0; i < sizeof(geoinfodata)/sizeof(struct geoinfo_t); i++) {
5559 const struct geoinfo_t *ptr = &geoinfodata[i];
5560
5561 if (geoclass == GEOCLASS_NATION && (ptr->kind == LOCATION_REGION))
5562 continue;
5563
5564 if (geoclass == GEOCLASS_REGION && (ptr->kind == LOCATION_NATION))
5565 continue;
5566
5567 if (parent && ptr->parent != parent)
5568 continue;
5569
5570 if (!enumproc(ptr->id))
5571 return TRUE;
5572 }
5573
5574 return TRUE;
5575}
#define FALSE
Definition: types.h:117
static const struct geoinfo_t geoinfodata[]
Definition: locale.c:4946
r parent
Definition: btrfs.c:3010
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static PVOID ptr
Definition: dispmode.c:27
@ GEOCLASS_REGION
Definition: winnls.h:620
@ GEOCLASS_NATION
Definition: winnls.h:621

Referenced by CreateLocationsList(), and InitFunctionPointers().

◆ EnumSystemLanguageGroupsA()

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

Definition at line 4508 of file locale.c.

4510{
4512
4513 TRACE("(%p,0x%08X,0x%08lX)\n", pLangGrpEnumProc, dwFlags, lParam);
4514
4515 procs.procA = pLangGrpEnumProc;
4516 procs.procW = NULL;
4517 procs.dwFlags = dwFlags;
4518 procs.lParam = lParam;
4519
4520 return NLS_EnumSystemLanguageGroups( pLangGrpEnumProc ? &procs : NULL);
4521}
static BOOL NLS_EnumSystemLanguageGroups(ENUMLANGUAGEGROUP_CALLBACKS *lpProcs)
Definition: locale.c:4409
LANGUAGEGROUP_ENUMPROCW procW
Definition: locale.c:4403
LANGUAGEGROUP_ENUMPROCA procA
Definition: locale.c:4402

Referenced by InitFunctionPointers().

◆ EnumSystemLanguageGroupsW()

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

Definition at line 4528 of file locale.c.

4530{
4532
4533 TRACE("(%p,0x%08X,0x%08lX)\n", pLangGrpEnumProc, dwFlags, lParam);
4534
4535 procs.procA = NULL;
4536 procs.procW = pLangGrpEnumProc;
4537 procs.dwFlags = dwFlags;
4538 procs.lParam = lParam;
4539
4540 return NLS_EnumSystemLanguageGroups( pLangGrpEnumProc ? &procs : NULL);
4541}

◆ EnumSystemLocalesA()

BOOL WINAPI EnumSystemLocalesA ( LOCALE_ENUMPROCA  lpfnLocaleEnum,
DWORD  dwFlags 
)

Definition at line 2986 of file locale.c.

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

Referenced by __GetLCID(), and InitFunctionPointers().

◆ EnumSystemLocalesW()

BOOL WINAPI EnumSystemLocalesW ( LOCALE_ENUMPROCW  lpfnLocaleEnum,
DWORD  dwFlags 
)

Definition at line 3001 of file locale.c.

3002{
3003 TRACE("(%p,%08x)\n", lpfnLocaleEnum, dwFlags);
3006 (LONG_PTR)lpfnLocaleEnum);
3007 return TRUE;
3008}
BOOL WINAPI EnumResourceLanguagesW(HMODULE hmod, LPCWSTR type, LPCWSTR name, ENUMRESLANGPROCW lpfun, LONG_PTR lparam)
Definition: res.c:480
static BOOL CALLBACK enum_lang_proc_w(HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD LangID, LONG_PTR lParam)
Definition: locale.c:2963
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by CreateLanguagesList(), CreateSortList(), enum_system_locales_ex_nolock(), EnumRfc1766_create(), GetLcidFromCountry(), GetLcidFromLangCountry(), GetLcidFromLanguage(), InitFunctionPointers(), InitLanguagesList(), and IsSortPageNeeded().

◆ EnumUILanguagesA()

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

Definition at line 4877 of file locale.c.

4878{
4879 ENUM_UILANG_CALLBACK enum_uilang;
4880
4881 TRACE("%p, %x, %lx\n", pUILangEnumProc, dwFlags, lParam);
4882
4883 if(!pUILangEnumProc) {
4885 return FALSE;
4886 }
4887 if(dwFlags) {
4889 return FALSE;
4890 }
4891
4892 enum_uilang.u.procA = pUILangEnumProc;
4893 enum_uilang.flags = dwFlags;
4894 enum_uilang.param = lParam;
4895
4898 (LONG_PTR)&enum_uilang);
4899 return TRUE;
4900}
static BOOL CALLBACK enum_uilang_proc_a(HMODULE hModule, LPCSTR type, LPCSTR name, WORD LangID, LONG_PTR lParam)
Definition: locale.c:4853

Referenced by InitFunctionPointers().

◆ EnumUILanguagesW()

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

Definition at line 4905 of file locale.c.

4906{
4907 ENUM_UILANG_CALLBACK enum_uilang;
4908
4909 TRACE("%p, %x, %lx\n", pUILangEnumProc, dwFlags, lParam);
4910
4911
4912 if(!pUILangEnumProc) {
4914 return FALSE;
4915 }
4916 if(dwFlags) {
4918 return FALSE;
4919 }
4920
4921 enum_uilang.u.procW = pUILangEnumProc;
4922 enum_uilang.flags = dwFlags;
4923 enum_uilang.param = lParam;
4924
4927 (LONG_PTR)&enum_uilang);
4928 return TRUE;
4929}
static BOOL CALLBACK enum_uilang_proc_w(HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD LangID, LONG_PTR lParam)
Definition: locale.c:4863

◆ FoldStringW()

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

Definition at line 3911 of file locale.c.

3913{
3914 int ret;
3915
3916 switch (dwFlags & (MAP_COMPOSITE|MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES))
3917 {
3918 case 0:
3919 if (dwFlags)
3920 break;
3921 /* Fall through for dwFlags == 0 */
3923 case MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES:
3924 case MAP_COMPOSITE|MAP_EXPAND_LIGATURES:
3926 return 0;
3927 }
3928
3929 if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst)
3930 {
3932 return 0;
3933 }
3934
3936 if (!ret)
3938 return ret;
3939}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
int wine_fold_string(int flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: fold.c:118
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:52
static DWORD dstlen
Definition: directory.c:51
#define MAP_PRECOMPOSED
Definition: winnls.h:233
#define MAP_COMPOSITE
Definition: winnls.h:234

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

◆ get_codepage_table()

static const union cptable * get_codepage_table ( unsigned int  codepage)
static

Definition at line 302 of file locale.c.

303{
304 const union cptable *ret = NULL;
305
306 assert( ansi_cptable ); /* init must have been done already */
307
308 switch(codepage)
309 {
310 case CP_ACP:
311 return ansi_cptable;
312 case CP_OEMCP:
313 return oem_cptable;
314 case CP_MACCP:
315 return mac_cptable;
316 case CP_UTF7:
317 case CP_UTF8:
318 break;
319 case CP_THREAD_ACP:
320 if (NtCurrentTeb()->CurrentLocale == GetUserDefaultLCID()) return ansi_cptable;
321 codepage = get_lcid_codepage( NtCurrentTeb()->CurrentLocale );
322 if (!codepage) return ansi_cptable;
323 /* fall through */
324 default:
325 if (codepage == ansi_cptable->info.codepage) return ansi_cptable;
326 if (codepage == oem_cptable->info.codepage) return oem_cptable;
327 if (codepage == mac_cptable->info.codepage) return mac_cptable;
329 break;
330 }
331 return ret;
332}
static const union cptable * oem_cptable
Definition: locale.c:66
static const union cptable * ansi_cptable
Definition: locale.c:65
static const union cptable * mac_cptable
Definition: locale.c:67
#define assert(_expr)
Definition: assert.h:32
const union cptable * wine_cp_get_table(unsigned int codepage)
Definition: cptable.c:192
#define CP_UTF8
Definition: nls.h:20
struct cp_info info
Definition: unicode.h:96
int codepage
Definition: win_iconv.c:156
#define CP_THREAD_ACP
Definition: winnls.h:251
#define CP_OEMCP
Definition: winnls.h:249
#define CP_UTF7
Definition: winnls.h:253
#define CP_MACCP
Definition: winnls.h:250

Referenced by GetCPInfo(), GetCPInfoExW(), IsDBCSLeadByteEx(), IsValidCodePage(), MultiByteToWideChar(), and WideCharToMultiByte().

◆ get_default_sublang()

static LANGID get_default_sublang ( LANGID  lang)
static

Definition at line 369 of file locale.c.

370{
371 switch (lang)
372 {
382 }
384 return lang;
385}
return
Definition: dirsup.c:529
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_CHINESE_SINGAPORE
Definition: nls.h:211
#define LANG_SPANISH
Definition: nls.h:123
#define SUBLANG_CHINESE_MACAU
Definition: nls.h:212
#define SUBLANG_CHINESE_TRADITIONAL
Definition: nls.h:208
#define SUBLANG_CHINESE_SIMPLIFIED
Definition: nls.h:209
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define SUBLANG_CHINESE_HONGKONG
Definition: nls.h:210
#define LANG_CHINESE
Definition: nls.h:42
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define SUBLANG_SPANISH_MODERN
Definition: nls.h:338
static const WCHAR lang[]
Definition: wbemdisp.c:287

Referenced by ConvertDefaultLocale(), GetLocaleInfoW(), and NLS_GetLanguageGroupName().

◆ get_dummy_preferred_ui_language()

static BOOL get_dummy_preferred_ui_language ( DWORD  flags,
ULONG count,
WCHAR buffer,
ULONG size 
)
static

Definition at line 1252 of file locale.c.

1253{
1254 LCTYPE type;
1255 int lsize;
1256
1257 FIXME("(0x%x %p %p %p) returning a dummy value (current locale)\n", flags, count, buffer, size);
1258
1259 if (flags & MUI_LANGUAGE_ID)
1261 else
1263
1265 if (!lsize)
1266 {
1267 /* keep last error from callee */
1268 return FALSE;
1269 }
1270 lsize++;
1271 if (!*size)
1272 {
1273 *size = lsize;
1274 *count = 1;
1275 return TRUE;
1276 }
1277
1278 if (lsize > *size)
1279 {
1281 return FALSE;
1282 }
1283
1285 {
1286 /* keep last error from callee */
1287 return FALSE;
1288 }
1289
1290 buffer[lsize-1] = 0;
1291 *size = lsize;
1292 *count = 1;
1293 TRACE("returned variable content: %d, \"%s\", %d\n", *count, debugstr_w(buffer), *size);
1294 return TRUE;
1295
1296}
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: locale.c:1675
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
#define debugstr_w
Definition: kernel32.h:32
#define LOCALE_SNAME
Definition: winnls.h:137
DWORD LCTYPE
Definition: winnls.h:581

Referenced by GetSystemPreferredUILanguages(), and GetThreadPreferredUILanguages().

◆ get_geoinfo_dataptr()

static const struct geoinfo_t * get_geoinfo_dataptr ( GEOID  geoid)
static

Definition at line 5396 of file locale.c.

5397{
5398 int min, max;
5399
5400 min = 0;
5401 max = sizeof(geoinfodata)/sizeof(struct geoinfo_t)-1;
5402
5403 while (min <= max) {
5404 const struct geoinfo_t *ptr;
5405 int n = (min+max)/2;
5406
5407 ptr = &geoinfodata[n];
5408 if (geoid == ptr->id)
5409 /* we don't need empty entries */
5410 return *ptr->iso2W ? ptr : NULL;
5411
5412 if (ptr->id > geoid)
5413 max = n-1;
5414 else
5415 min = n+1;
5416 }
5417
5418 return NULL;
5419}
GLdouble n
Definition: glext.h:7729
#define min(a, b)
Definition: monoChain.cc:55
#define max(a, b)
Definition: svc.c:63

Referenced by GetGeoInfoW().

◆ get_lcid_codepage()

static UINT get_lcid_codepage ( LCID  lcid)
inlinestatic

Definition at line 288 of file locale.c.

289{
290 UINT ret;
291 if (!GetLocaleInfoW( lcid, LOCALE_IDEFAULTANSICODEPAGE|LOCALE_RETURN_NUMBER, (WCHAR *)&ret,
292 sizeof(ret)/sizeof(WCHAR) )) ret = 0;
293 return ret;
294}

Referenced by CompareStringA(), get_codepage_table(), GetDateFormatA(), GetLocaleInfoA(), GetStringTypeA(), GetTimeFormatA(), LCMapStringA(), LOCALE_Init(), and SetLocaleInfoA().

◆ get_locale()

static const char * get_locale ( int  category,
const char category_name 
)
static

Definition at line 1026 of file locale.c.

1027{
1028 const char* ret = setlocale(category, NULL);
1029
1030#ifdef __ANDROID__
1031 if (!strcmp(ret, "C"))
1032 {
1033 ret = getenv( category_name );
1034 if (!ret || !ret[0]) ret = getenv( "LC_ALL" );
1035 if (!ret || !ret[0]) ret = "C";
1036 }
1037#endif
1038
1039#ifdef __APPLE__
1040 /* If LC_ALL is set, respect it as a user override.
1041 If LC_* is set, respect it as a user override, except if it's LC_CTYPE
1042 and equal to UTF-8. That's because, when the Mac locale isn't supported
1043 by the C library, Terminal.app sets LC_CTYPE=UTF-8 and doesn't set LANG.
1044 parse_locale_name() doesn't handle that properly, so we override that
1045 with the Mac locale (which uses UTF-8 for the charset, anyway).
1046 Otherwise:
1047 For LC_MESSAGES, we override the C library because the user language
1048 setting is separate from the locale setting on which LANG was based.
1049 If the C library didn't get anything better from LANG than C or POSIX,
1050 override that. That probably means the Mac locale isn't supported by
1051 the C library. */
1052 if (!has_env( "LC_ALL" ) &&
1053 ((category == LC_CTYPE && !strcmp( ret, "UTF-8" )) ||
1054 (!has_env( category_name ) &&
1055 (category == LC_MESSAGES || !strcmp( ret, "C" ) || !strcmp( ret, "POSIX" )))))
1056 {
1057 const char* override = get_mac_locale();
1058
1059 if (category == LC_MESSAGES)
1060 {
1061 /* Retrieve the preferred language as chosen in System Preferences. */
1062 static char messages_locale[50];
1063
1064 if (!messages_locale[0])
1065 {
1066 CFArrayRef preferred_langs = CFLocaleCopyPreferredLanguages();
1067 if (preferred_langs && CFArrayGetCount( preferred_langs ))
1068 {
1069 CFStringRef preferred_lang = CFArrayGetValueAtIndex( preferred_langs, 0 );
1070 CFDictionaryRef components = CFLocaleCreateComponentsFromLocaleIdentifier( NULL, preferred_lang );
1071 if (components)
1072 {
1073 CFStringRef lang = CFDictionaryGetValue( components, kCFLocaleLanguageCode );
1074 CFStringRef country = CFDictionaryGetValue( components, kCFLocaleCountryCode );
1075 CFLocaleRef locale = NULL;
1076 CFStringRef locale_string;
1077
1078 if (!country)
1079 {
1080 locale = CFLocaleCopyCurrent();
1081 country = CFLocaleGetValue( locale, kCFLocaleCountryCode );
1082 }
1083
1084 if (country)
1085 locale_string = CFStringCreateWithFormat( NULL, NULL, CFSTR("%@_%@"), lang, country );
1086 else
1087 locale_string = CFStringCreateCopy( NULL, lang );
1088 CFStringGetCString( locale_string, messages_locale, sizeof(messages_locale), kCFStringEncodingUTF8 );
1089 strcat( messages_locale, ".UTF-8" );
1090
1091 CFRelease( locale_string );
1092 if (locale) CFRelease( locale );
1093 CFRelease( components );
1094 }
1095 }
1096 if (preferred_langs)
1097 CFRelease( preferred_langs );
1098 }
1099
1100 if (messages_locale[0])
1101 override = messages_locale;
1102 }
1103
1104 TRACE( "%s is %s; overriding with %s\n", category_name, debugstr_a(ret), debugstr_a(override) );
1105 ret = override;
1106 }
1107#endif
1108
1109 return ret;
1110}
char *CDECL getenv(const char *name)
Definition: environ.c:227
#define LC_CTYPE
Definition: locale.h:27
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
GLenum GLenum GLuint components
Definition: glext.h:9620
strcat
Definition: string.h:92
#define setlocale(n, s)
Definition: locale.h:46

◆ get_locale_registry_value()

static struct registry_value * get_locale_registry_value ( DWORD  lctype)
static

Definition at line 1461 of file locale.c.

1462{
1463 int i;
1464 for (i=0; i < sizeof(registry_values)/sizeof(registry_values[0]); i++)
1465 if (registry_values[i].lctype == lctype)
1466 return &registry_values[i];
1467 return NULL;
1468}
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 1477 of file locale.c.

1478{
1479 DWORD size;
1480 INT ret;
1481 HANDLE hkey;
1485 static const int info_size = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data);
1486
1488
1490 {
1491 if (!(hkey = create_registry_key()))
1492 {
1494 return -1;
1495 }
1496
1498 size = info_size + len * sizeof(WCHAR);
1499
1500 if (!(info = HeapAlloc( GetProcessHeap(), 0, size )))
1501 {
1502 NtClose( hkey );
1505 return 0;
1506 }
1507
1509
1510 /* try again with a bigger buffer when we have to return the correct size */
1511 if (status == STATUS_BUFFER_OVERFLOW && !buffer && size > info_size)
1512 {
1514 if ((new_info = HeapReAlloc( GetProcessHeap(), 0, info, size )))
1515 {
1516 info = new_info;
1518 }
1519 }
1520
1521 NtClose( hkey );
1522
1523 if (!status)
1524 {
1525 INT length = (size - info_size) / sizeof(WCHAR);
1526 LPWSTR cached_value;
1527
1528 if (!length || ((WCHAR *)&info->Data)[length-1])
1529 length++;
1530
1531 cached_value = HeapAlloc( GetProcessHeap(), 0, length * sizeof(WCHAR) );
1532
1533 if (!cached_value)
1534 {
1535 HeapFree( GetProcessHeap(), 0, info );
1538 return 0;
1539 }
1540
1541 memcpy( cached_value, info->Data, (length-1) * sizeof(WCHAR) );
1542 cached_value[length-1] = 0;
1543 HeapFree( GetProcessHeap(), 0, info );
1544 registry_value->cached_value = cached_value;
1545 }
1546 else
1547 {
1549 {
1550 ret = (size - info_size) / sizeof(WCHAR);
1551 }
1553 {
1554 ret = -1;
1555 }
1556 else
1557 {
1559 ret = 0;
1560 }
1561 HeapFree( GetProcessHeap(), 0, info );
1563 return ret;
1564 }
1565 }
1566
1568
1569 if (buffer)
1570 {
1571 if (ret > len)
1572 {
1574 ret = 0;
1575 }
1576 else
1577 {
1579 }
1580 }
1581
1583
1584 return ret;
1585}
LONG NTSTATUS
Definition: precomp.h:26
#define HeapReAlloc
Definition: compat.h:734
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
static RTL_CRITICAL_SECTION cache_section
Definition: locale.c:263
static HANDLE create_registry_key(void)
Definition: locale.c:771
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLenum GLsizei len
Definition: glext.h:6722
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
@ KeyValuePartialInformation
Definition: nt_native.h:1185
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
WCHAR * cached_value
Definition: locale.c:215
const WCHAR * name
Definition: locale.c:214
Definition: ps.c:97
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149

Referenced by GetLocaleInfoW().

◆ get_table_entry()

static unsigned short get_table_entry ( const unsigned short table,
WCHAR  ch 
)
inlinestatic

Definition at line 277 of file locale.c.

278{
279 return table[table[table[ch >> 8] + ((ch >> 4) & 0x0f)] + (ch & 0xf)];
280}
unsigned char ch[4][2]
Definition: console.c:118

Referenced by IdnToNameprepUnicode(), and IdnToUnicode().

◆ get_value_base_by_lctype()

static int get_value_base_by_lctype ( LCTYPE  lctype)
static

Definition at line 1665 of file locale.c.

1666{
1667 return lctype == LOCALE_ILANGUAGE || lctype == LOCALE_IDEFAULTLANGUAGE ? 16 : 10;
1668}
#define LOCALE_IDEFAULTLANGUAGE
Definition: winnls.h:42

Referenced by GetLocaleInfoW().

◆ GetACP()

◆ GetCPInfo()

BOOL WINAPI GetCPInfo ( UINT  codepage,
LPCPINFO  cpinfo 
)

Definition at line 2146 of file locale.c.

2147{
2148 const union cptable *table;
2149
2150 if (!cpinfo)
2151 {
2153 return FALSE;
2154 }
2155
2156 if (!(table = get_codepage_table( codepage )))
2157 {
2158 switch(codepage)
2159 {
2160 case CP_UTF7:
2161 case CP_UTF8:
2162 cpinfo->DefaultChar[0] = 0x3f;
2163 cpinfo->DefaultChar[1] = 0;
2164 cpinfo->LeadByte[0] = cpinfo->LeadByte[1] = 0;
2165 cpinfo->MaxCharSize = (codepage == CP_UTF7) ? 5 : 4;
2166 return TRUE;
2167 }
2168
2170 return FALSE;
2171 }
2172 if (table->info.def_char & 0xff00)
2173 {
2174 cpinfo->DefaultChar[0] = (table->info.def_char & 0xff00) >> 8;
2175 cpinfo->DefaultChar[1] = table->info.def_char & 0x00ff;
2176 }
2177 else
2178 {
2179 cpinfo->DefaultChar[0] = table->info.def_char & 0xff;
2180 cpinfo->DefaultChar[1] = 0;
2181 }
2182 if ((cpinfo->MaxCharSize = table->info.char_size) == 2)
2183 memcpy( cpinfo->LeadByte, table->dbcs.lead_bytes, sizeof(cpinfo->LeadByte) );
2184 else
2185 cpinfo->LeadByte[0] = cpinfo->LeadByte[1] = 0;
2186
2187 return TRUE;
2188}
static const union cptable * get_codepage_table(unsigned int codepage)
Definition: locale.c:302
BYTE LeadByte[MAX_LEADBYTES]
Definition: winnls.h:652
BYTE DefaultChar[MAX_DEFAULTCHAR]
Definition: winnls.h:651
UINT MaxCharSize
Definition: winnls.h:650

Referenced by __acrt_locale_initialize_ctype(), _Locale_codecvt_create(), _Locale_ctype_create(), _setmbcp_l(), _setmbcp_nolock(), create_locinfo(), create_mbcinfo(), GetCPInfoExW(), GetKerningPairsA(), GetWindowTextLengthA(), Global_Chr(), InternalCompareStringA(), make_csconv(), ME_GetTextLengthEx(), MSVCRT__create_locale(), setSBUpLow(), START_TEST(), test_GetCPInfo(), and test_mbcp().

◆ GetCPInfoExA()

BOOL WINAPI GetCPInfoExA ( UINT  codepage,
DWORD  dwFlags,
LPCPINFOEXA  cpinfo 
)

Definition at line 2204 of file locale.c.

2205{
2206 CPINFOEXW cpinfoW;
2207
2208 if (!GetCPInfoExW( codepage, dwFlags, &cpinfoW ))
2209 return FALSE;
2210
2211 /* the layout is the same except for CodePageName */
2212 memcpy(cpinfo, &cpinfoW, sizeof(CPINFOEXA));
2213 WideCharToMultiByte(CP_ACP, 0, cpinfoW.CodePageName, -1, cpinfo->CodePageName, sizeof(cpinfo->CodePageName), NULL, NULL);
2214 return TRUE;
2215}
#define WideCharToMultiByte
Definition: compat.h:111
BOOL WINAPI GetCPInfoExW(UINT codepage, DWORD dwFlags, LPCPINFOEXW cpinfo)
Definition: locale.c:2222
CHAR CodePageName[MAX_PATH]
Definition: winnls.h:660
WCHAR CodePageName[MAX_PATH]
Definition: winnls.h:668

Referenced by init_procs(), test_CompareStringA(), and test_threadcp().

◆ GetCPInfoExW()

BOOL WINAPI GetCPInfoExW ( UINT  codepage,
DWORD  dwFlags,
LPCPINFOEXW  cpinfo 
)

Definition at line 2222 of file locale.c.

2223{
2224 if (!GetCPInfo( codepage, (LPCPINFO)cpinfo ))
2225 return FALSE;
2226
2227 switch(codepage)
2228 {
2229 case CP_UTF7:
2230 {
2231 static const WCHAR utf7[] = {'U','n','i','c','o','d','e',' ','(','U','T','F','-','7',')',0};
2232
2233 cpinfo->CodePage = CP_UTF7;
2234 cpinfo->UnicodeDefaultChar = 0x3f;
2235 strcpyW(cpinfo->CodePageName, utf7);
2236 break;
2237 }
2238
2239 case CP_UTF8:
2240 {
2241 static const WCHAR utf8[] = {'U','n','i','c','o','d','e',' ','(','U','T','F','-','8',')',0};
2242
2243 cpinfo->CodePage = CP_UTF8;
2244 cpinfo->UnicodeDefaultChar = 0x3f;
2245 strcpyW(cpinfo->CodePageName, utf8);
2246 break;
2247 }
2248
2249 default:
2250 {
2251 const union cptable *table = get_codepage_table( codepage );
2252
2253 cpinfo->CodePage = table->info.codepage;
2254 cpinfo->UnicodeDefaultChar = table->info.def_unicode_char;
2255 MultiByteToWideChar( CP_ACP, 0, table->info.name, -1, cpinfo->CodePageName,
2256 sizeof(cpinfo->CodePageName)/sizeof(WCHAR));
2257 break;
2258 }
2259 }
2260 return TRUE;
2261}
BOOL WINAPI GetCPInfo(UINT codepage, LPCPINFO cpinfo)
Definition: locale.c:2146
const WCHAR * name
#define strcpyW(d, s)
Definition: unicode.h:35

Referenced by AddCodePage(), FillCharacterSetComboList(), GetCPInfoExA(), GetSupportedCP(), ME_StreamOutRTFHeader(), and test_GetCPInfo().

◆ GetFileMUIInfo()

BOOL WINAPI GetFileMUIInfo ( DWORD  flags,
PCWSTR  path,
FILEMUIINFO info,
DWORD size 
)

Definition at line 6160 of file locale.c.

6161{
6162 FIXME("stub: %u, %s, %p, %p\n", flags, debugstr_w(path), info, size);
6163
6165 return FALSE;
6166}
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ GetFileMUIPath()

BOOL WINAPI GetFileMUIPath ( DWORD  flags,
PCWSTR  filepath,
PWSTR  language,
PULONG  languagelen,
PWSTR  muipath,
PULONG  muipathlen,
PULONGLONG  enumerator 
)

Definition at line 6145 of file locale.c.

6147{
6148 FIXME("stub: 0x%x, %s, %s, %p, %p, %p, %p\n", flags, debugstr_w(filepath),
6149 debugstr_w(language), languagelen, muipath, muipathlen, enumerator);
6150
6152
6153 return FALSE;
6154}

◆ GetGeoInfoA()

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

Definition at line 5498 of file locale.c.

5499{
5500 WCHAR *buffW;
5501 INT len;
5502
5503 TRACE("%d %d %p %d %d\n", geoid, geotype, data, data_len, lang);
5504
5505 len = GetGeoInfoW(geoid, geotype, NULL, 0, lang);
5506 if (!len)
5507 return 0;
5508
5509 buffW = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
5510 if (!buffW)
5511 return 0;
5512
5513 GetGeoInfoW(geoid, geotype, buffW, len, lang);
5514 len = WideCharToMultiByte(CP_ACP, 0, buffW, -1, NULL, 0, NULL, NULL);
5515 if (!data || !data_len) {
5516 HeapFree(GetProcessHeap(), 0, buffW);
5517 return len;
5518 }
5519
5520 len = WideCharToMultiByte(CP_ACP, 0, buffW, -1, data, data_len, NULL, NULL);
5521 HeapFree(GetProcessHeap(), 0, buffW);
5522
5523 if (data_len < len)
5525 return data_len < len ? 0 : len;
5526}
INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len, LANGID lang)
Definition: locale.c:5424
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by InitFunctionPointers().

◆ GetGeoInfoW()

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

Definition at line 5424 of file locale.c.

5425{
5426 const struct geoinfo_t *ptr;
5427 const WCHAR *str = NULL;
5428 WCHAR buffW[12];
5429 LONG val = 0;
5430 INT len;
5431
5432 TRACE("%d %d %p %d %d\n", geoid, geotype, data, data_len, lang);
5433
5434 if (!(ptr = get_geoinfo_dataptr(geoid))) {
5436 return 0;
5437 }
5438
5439 switch (geotype) {
5440 case GEO_FRIENDLYNAME:
5441 {
5442#ifdef __REACTOS__
5443 return NLS_GetGeoFriendlyName(geoid, data, data_len, lang);
5444#else
5445 return NLS_GetGeoFriendlyName(geoid, data, data_len);
5446#endif
5447 }
5448 case GEO_NATION:
5449 val = geoid;
5450 break;
5451 case GEO_ISO_UN_NUMBER:
5452 val = ptr->uncode;
5453 break;
5454 case GEO_PARENT:
5455 val = ptr->parent;
5456 break;
5457 case GEO_ISO2:
5458 case GEO_ISO3:
5459 {
5460 str = geotype == GEO_ISO2 ? ptr->iso2W : ptr->iso3W;
5461 break;
5462 }
5463 case GEO_RFC1766:
5464 case GEO_LCID:
5465 case GEO_OFFICIALNAME:
5466 case GEO_TIMEZONES:
5468 case GEO_LATITUDE:
5469 case GEO_LONGITUDE:
5470 FIXME("type %d is not supported\n", geotype);
5472 return 0;
5473 default:
5474 WARN("unrecognized type %d\n", geotype);
5476 return 0;
5477 }
5478
5479 if (val) {
5480 static const WCHAR fmtW[] = {'%','d',0};
5481 sprintfW(buffW, fmtW, val);
5482 str = buffW;
5483 }
5484
5485 len = strlenW(str) + 1;
5486 if (!data || !data_len)
5487 return len;
5488
5489 memcpy(data, str, min(len, data_len)*sizeof(WCHAR));
5490 if (data_len < len)
5492 return data_len < len ? 0 : len;
5493}
#define WARN(fmt,...)
Definition: precomp.h:61
static const struct geoinfo_t * get_geoinfo_dataptr(GEOID geoid)
Definition: locale.c:5396
GLuint GLfloat * val
Definition: glext.h:7180
long LONG
Definition: pedump.c:60
const WCHAR * str
@ GEO_ISO3
Definition: winnls.h:631
@ GEO_OFFICIALLANGUAGES
Definition: winnls.h:637
@ GEO_OFFICIALNAME
Definition: winnls.h:635
@ GEO_TIMEZONES
Definition: winnls.h:636
@ GEO_FRIENDLYNAME
Definition: winnls.h:634
@ GEO_LONGITUDE
Definition: winnls.h:629
@ GEO_ISO_UN_NUMBER
Definition: winnls.h:638
@ GEO_PARENT
Definition: winnls.h:639
@ GEO_ISO2
Definition: winnls.h:630
@ GEO_LATITUDE
Definition: winnls.h:628
@ GEO_NATION
Definition: winnls.h:627
@ GEO_LCID
Definition: winnls.h:633
@ GEO_RFC1766
Definition: winnls.h:632

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

◆ GetLocaleInfoA()

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

Definition at line 1609 of file locale.c.

1610{
1611 WCHAR *bufferW;
1612 INT lenW, ret;
1613
1614 TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d)\n", lcid, lctype, buffer, len );
1615
1616 if (len < 0 || (len && !buffer))
1617 {
1619 return 0;
1620 }
1621 if (((lctype & ~LOCALE_LOCALEINFOFLAGSMASK) == LOCALE_SSHORTTIME) ||
1623 {
1625 return 0;
1626 }
1627
1628 if (!len) buffer = NULL;
1629
1630 if (!(lenW = GetLocaleInfoW( lcid, lctype, NULL, 0 ))) return 0;
1631
1632 if (!(bufferW = HeapAlloc( GetProcessHeap(), 0, lenW * sizeof(WCHAR) )))
1633 {
1635 return 0;
1636 }
1637 if ((ret = GetLocaleInfoW( lcid, lctype, bufferW, lenW )))
1638 {
1639 if ((lctype & LOCALE_RETURN_NUMBER) ||
1641 {
1642 /* it's not an ASCII string, just bytes */
1643 ret *= sizeof(WCHAR);
1644 if (buffer)
1645 {
1646 if (ret <= len) memcpy( buffer, bufferW, ret );
1647 else
1648 {
1650 ret = 0;
1651 }
1652 }
1653 }
1654 else
1655 {
1657 if (!(lctype & LOCALE_USE_CP_ACP)) codepage = get_lcid_codepage( lcid );
1658 ret = WideCharToMultiByte( codepage, 0, bufferW, ret, buffer, len, NULL, NULL );
1659 }
1660 }
1661 HeapFree( GetProcessHeap(), 0, bufferW );
1662 return ret;
1663}
#define LOCALE_LOCALEINFOFLAGSMASK
Definition: locale.c:58
#define LOCALE_SSHORTTIME
Definition: winnls.h:170

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(), create_time_data(), 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 1675 of file locale.c.

1676{
1677 LANGID lang_id;
1678 HRSRC hrsrc;
1679 HGLOBAL hmem;
1680 INT ret;
1681 UINT lcflags;
1682 const WCHAR *p;
1683 unsigned int i;
1684
1685 if (len < 0 || (len && !buffer))
1686 {
1688 return 0;
1689 }
1690 if (lctype & LOCALE_RETURN_GENITIVE_NAMES &&
1691 !is_genitive_name_supported( lctype ))
1692 {
1694 return 0;
1695 }
1696
1697 if (!len) buffer = NULL;
1698
1699 lcid = convert_default_lcid( lcid, lctype );
1700
1701 lcflags = lctype & LOCALE_LOCALEINFOFLAGSMASK;
1702 lctype &= 0xffff;
1703
1704 TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d)\n", lcid, lctype, buffer, len );
1705
1706 /* first check for overrides in the registry */
1707
1708 if (!(lcflags & LOCALE_NOUSEROVERRIDE) &&
1710 {
1712
1713 if (value)
1714 {
1715 if (lcflags & LOCALE_RETURN_NUMBER)
1716 {
1717 WCHAR tmp[16];
1718 ret = get_registry_locale_info( value, tmp, sizeof(tmp)/sizeof(WCHAR) );
1719 if (ret > 0)
1720 {
1721 WCHAR *end;
1723 if (*end) /* invalid number */
1724 {
1726 return 0;
1727 }
1728 ret = sizeof(UINT)/sizeof(WCHAR);
1729 if (!buffer) return ret;
1730 if (ret > len)
1731 {
1733 return 0;
1734 }
1735 memcpy( buffer, &number, sizeof(number) );
1736 }
1737 }
1739
1740 if (ret != -1) return ret;
1741 }
1742 }
1743
1744 /* now load it from kernel resources */
1745
1746 lang_id = LANGIDFROMLCID( lcid );
1747
1748 /* replace SUBLANG_NEUTRAL by SUBLANG_DEFAULT */
1749 if (SUBLANGID(lang_id) == SUBLANG_NEUTRAL) lang_id = get_default_sublang( lang_id );
1750
1752 ULongToPtr((lctype >> 4) + 1), lang_id )))
1753 {
1754 SetLastError( ERROR_INVALID_FLAGS ); /* no such lctype */
1755 return 0;
1756 }
1757 if (!(hmem = LoadResource( kernel32_handle, hrsrc )))
1758 return 0;
1759
1760 p = LockResource( hmem );
1761 for (i = 0; i < (lctype & 0x0f); i++) p += *p + 1;
1762
1763 if (lcflags & LOCALE_RETURN_NUMBER) ret = sizeof(UINT)/sizeof(WCHAR);
1764 else if (is_genitive_name_supported( lctype ) && *p)
1765 {
1766 /* genitive form's stored after a null separator from a nominative */
1767 for (i = 1; i <= *p; i++) if (!p[i]) break;
1768
1769 if (i <= *p && (lcflags & LOCALE_RETURN_GENITIVE_NAMES))
1770 {
1771 ret = *p - i + 1;
1772 p += i;
1773 }
1774 else ret = i;
1775 }
1776 else
1777 ret = (lctype == LOCALE_FONTSIGNATURE) ? *p : *p + 1;
1778
1779 if (!buffer) return ret;
1780
1781 if (ret > len)
1782 {
1784 return 0;
1785 }
1786
1787 if (lcflags & LOCALE_RETURN_NUMBER)
1788 {
1789 UINT number;
1790 WCHAR *end, *tmp = HeapAlloc( GetProcessHeap(), 0, (*p + 1) * sizeof(WCHAR) );
1791 if (!tmp) return 0;
1792 memcpy( tmp, p + 1, *p * sizeof(WCHAR) );
1793 tmp[*p] = 0;
1795 if (!*end)
1796 memcpy( buffer, &number, sizeof(number) );
1797 else /* invalid number */
1798 {
1800 ret = 0;
1801 }
1802 HeapFree( GetProcessHeap(), 0, tmp );
1803
1804 TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d) returning number %d\n",
1805 lcid, lctype, buffer, len, number );
1806 }
1807 else
1808 {
1809 memcpy( buffer, p + 1, ret * sizeof(WCHAR) );
1810 if (lctype != LOCALE_FONTSIGNATURE) buffer[ret-1] = 0;
1811
1812 TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d) returning %d %s\n",
1814 }
1815 return ret;
1816}
#define ULongToPtr(ul)
Definition: basetsd.h:86
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HRSRC WINAPI FindResourceExW(HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD lang)
Definition: res.c:164
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
static struct registry_value * get_locale_registry_value(DWORD lctype)
Definition: locale.c:1461
static INT get_registry_locale_info(struct registry_value *registry_value, LPWSTR buffer, INT len)
Definition: locale.c:1477
static LCID convert_default_lcid(LCID lcid, LCTYPE lctype)
Definition: locale.c:592
static BOOL is_genitive_name_supported(LCTYPE lctype)
Definition: locale.c:743
static int get_value_base_by_lctype(LCTYPE lctype)
Definition: locale.c:1665
GLuint GLuint end
Definition: gl.h:1545
static unsigned int number
Definition: dsound.c:1479
DWORD lctype
Definition: locale.c:213
Definition: pdh_main.c:96
#define strtolW(s, e, b)
Definition: unicode.h:39

Referenced by __acrt_get_qualified_locale_downlevel(), __acrt_GetLocaleInfoEx(), __crtGetLocaleInfoW(), _WLocale_abbrev_dayofweek(), _WLocale_abbrev_monthname(), _WLocale_am_str(), _WLocale_currency_symbol(), _WLocale_decimal_point(), _WLocale_full_dayofweek(), _WLocale_full_monthname(), _WLocale_int_curr_symbol(), _WLocale_negative_sign(), _WLocale_pm_str(), _WLocale_positive_sign(), _WLocale_thousands_sep(), AboutDlgProc(), add_cert_to_list(), add_cert_to_view(), add_date_string_to_control(), AddCommasW(), AddNewKbLayoutsByLcid(), AddNewLayout(), AllSysInfo(), CConfigParser::CacheINI(), CountryEnumProc(), create_utc_string(), CreateLanguagesList(), CreateLayoutIcon(), CreateSortList(), date_parse(), date_to_string(), dateobj_to_date_string(), DATETIME_GetFieldWidth(), DATETIME_ReturnTxt(), DATETIME_SetFormatW(), detect_locale(), enum_locale_ex_proc(), enum_locales_proc(), fill_language_information(), FillMonthsComboBox(), FillNumberFmt(), fnIMultiLanguage3_GetRfc1766Info(), fnIMultiLanguage_GetRfc1766Info(), format_long_date(), format_size(), FormatInteger(), GeneralPropertyPageLocalesEnumProc(), get_countrycode(), get_date_format(), get_decimal_sep(), get_dummy_preferred_ui_language(), get_input_codepage(), get_lcid_codepage(), get_locale(), GetCalendarInfoW(), CicProfile::GetCodePageA(), GetCurrencyFormatW(), GetFileVersion(), GetFontSig(), GetHKLName(), GetKeyboardLayoutCP(), GetLocaleInfoA(), GetLocaleInfoEx(), GetLocalizedSMFolderName(), GetNumberFormatW(), CConfigParser::GetSectionString(), InatCreateIconBySize(), InitializeDefaultUserLocale(), InitLanguagesList(), InputList_Add(), InputList_Create(), Int64GetNumFormat(), IntGetCodePageEntry(), is_default_metric(), IsBiDiLocalizedSystem(), IsLayoutExists(), LangCountryEnumProc(), LanguageEnumProc(), lcid_to_rfc1766(), lcid_to_rfc1766W(), LOCALE_Init(), LOCALE_InitRegistry(), locale_update_registry(), LocaleList_Create(), LocalesEnumProc(), MONTHCAL_LButtonDown(), MONTHCAL_PaintTitle(), MONTHCAL_SetFirstDayOfWeek(), MonthCalFirstDayOfWeek(), MonthCalReload(), MSVCRT__create_locale(), NLS_EnumCalendarInfo(), NLS_EnumDateFormats(), NLS_EnumTimeFormats(), NLS_GetLocaleNumber(), NLS_GetLocaleString(), ParseDate(), ProcessCodePage(), ReadChmSystem(), SaveFontSubstitutionSettings(), SaveSystemSettings(), ScriptRecordDigitSubstitution(), SetUserLocaleName(), SH_FormatInteger(), SortEnumProc(), START_TEST(), test_EnumTimeFormatsW(), test_GetLocaleInfoEx(), test_GetLocaleInfoW(), test_GetNumberFormatA(), test_SetLocaleInfo(), test_unicode_wm_char(), test_VarWeekdayName(), TestDefaultLanguage(), 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 
)

◆ GetOEMCP()

◆ GetStringTypeA()

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

Definition at line 3212 of file locale.c.

3213{
3214 UINT cp;
3215 INT countW;
3216 LPWSTR srcW;
3217 BOOL ret = FALSE;
3218
3219 if(count == -1) count = strlen(src) + 1;
3220
3221 if (!(cp = get_lcid_codepage( locale )))
3222 {
3223 FIXME("For locale %04x using current ANSI code page\n", locale);
3224 cp = GetACP();
3225 }
3226
3227 countW = MultiByteToWideChar(cp, 0, src, count, NULL, 0);
3228 if((srcW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR))))
3229 {
3230 MultiByteToWideChar(cp, 0, src, count, srcW, countW);
3231 /*
3232 * NOTE: the target buffer has 1 word for each CHARACTER in the source
3233 * string, with multibyte characters there maybe be more bytes in count
3234 * than character space in the buffer!
3235 */
3236 ret = GetStringTypeW(type, srcW, countW, chartype);
3237 HeapFree(GetProcessHeap(), 0, srcW);
3238 }
3239 return ret;
3240}
UINT WINAPI GetACP(void)
Definition: locale.c:2023
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: locale.c:3098
unsigned int BOOL
Definition: ntddk_ex.h:94
POINT cp
Definition: magnifier.c:59

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 3259 of file locale.c.

3260{
3261 return GetStringTypeA(locale, type, src, count, chartype);
3262}
BOOL WINAPI GetStringTypeA(LCID locale, DWORD type, LPCSTR src, INT count, LPWORD chartype)
Definition: locale.c:3212

Referenced by _isctype_l().

◆ GetStringTypeExW()

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

Definition at line 3188 of file locale.c.

3189{
3190 /* locale is ignored for Unicode */
3191 return GetStringTypeW( type, src, count, chartype );
3192}

◆ GetStringTypeW()

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

Definition at line 3098 of file locale.c.

3099{
3100 static const unsigned char type2_map[16] =
3101 {
3102 C2_NOTAPPLICABLE, /* unassigned */
3103 C2_LEFTTORIGHT, /* L */
3104 C2_RIGHTTOLEFT, /* R */
3105 C2_EUROPENUMBER, /* EN */
3106 C2_EUROPESEPARATOR, /* ES */
3107 C2_EUROPETERMINATOR, /* ET */
3108 C2_ARABICNUMBER, /* AN */
3109 C2_COMMONSEPARATOR, /* CS */
3110 C2_BLOCKSEPARATOR, /* B */
3111 C2_SEGMENTSEPARATOR, /* S */
3112 C2_WHITESPACE, /* WS */
3113 C2_OTHERNEUTRAL, /* ON */
3114 C2_RIGHTTOLEFT, /* AL */
3115 C2_NOTAPPLICABLE, /* NSM */
3116 C2_NOTAPPLICABLE, /* BN */
3117 C2_OTHERNEUTRAL /* LRE, LRO, RLE, RLO, PDF */
3118 };
3119
3120 if (!src)
3121 {
3123 return FALSE;
3124 }
3125
3126 if (count == -1) count = strlenW(src) + 1;
3127 switch(type)
3128 {
3129 case CT_CTYPE1:
3130 while (count--) *chartype++ = get_char_typeW( *src++ ) & 0xfff;
3131 break;
3132 case CT_CTYPE2:
3133 while (count--) *chartype++ = type2_map[get_char_typeW( *src++ ) >> 12];
3134 break;
3135 case CT_CTYPE3:
3136 {
3137 WARN("CT_CTYPE3: semi-stub.\n");
3138 while (count--)
3139 {
3140 int c = *src;
3141 WORD type1, type3 = 0; /* C3_NOTAPPLICABLE */
3142
3143 type1 = get_char_typeW( *src++ ) & 0xfff;
3144 /* try to construct type3 from type1 */
3145 if(type1 & C1_SPACE) type3 |= C3_SYMBOL;
3146 if(type1 & C1_ALPHA) type3 |= C3_ALPHA;
3147 if ((c>=0x30A0)&&(c<=0x30FF)) type3 |= C3_KATAKANA;
3148 if ((c>=0x3040)&&(c<=0x309F)) type3 |= C3_HIRAGANA;
3149 if ((c>=0x4E00)&&(c<=0x9FAF)) type3 |= C3_IDEOGRAPH;
3150 if (c == 0x0640) type3 |= C3_KASHIDA;
3151 if ((c>=0x3000)&&(c<=0x303F)) type3 |= C3_SYMBOL;
3152
3153 if ((c>=0xD800)&&(c<=0xDBFF)) type3 |= C3_HIGHSURROGATE;
3154 if ((c>=0xDC00)&&(c<=0xDFFF)) type3 |= C3_LOWSURROGATE;
3155
3156 if ((c>=0xFF00)&&(c<=0xFF60)) type3 |= C3_FULLWIDTH;
3157 if ((c>=0xFF00)&&(c<=0xFF20)) type3 |= C3_SYMBOL;
3158 if ((c>=0xFF3B)&&(c<=0xFF40)) type3 |= C3_SYMBOL;
3159 if ((c>=0xFF5B)&&(c<=0xFF60)) type3 |= C3_SYMBOL;
3160 if ((c>=0xFF21)&&(c<=0xFF3A)) type3 |= C3_ALPHA;
3161 if ((c>=0xFF41)&&(c<=0xFF5A)) type3 |= C3_ALPHA;
3162 if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_FULLWIDTH;
3163 if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_SYMBOL;
3164
3165 if ((c>=0xFF61)&&(c<=0xFFDC)) type3 |= C3_HALFWIDTH;
3166 if ((c>=0xFF61)&&(c<=0xFF64)) type3 |= C3_SYMBOL;
3167 if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_KATAKANA;
3168 if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_ALPHA;
3169 if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_HALFWIDTH;
3170 if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_SYMBOL;
3171 *chartype++ = type3;
3172 }
3173 break;
3174 }
3175 default:
3177 return FALSE;
3178 }
3179 return TRUE;
3180}
unsigned short WORD
Definition: ntddk_ex.h:93
const GLubyte * c
Definition: glext.h:8905
#define C1_SPACE
Definition: unicode.h:34
#define C1_ALPHA
Definition: unicode.h:39
WINE_UNICODE_INLINE unsigned short get_char_typeW(WCHAR ch)
Definition: unicode.h:149
#define C2_ARABICNUMBER
Definition: winnls.h:273
#define C3_FULLWIDTH
Definition: winnls.h:287
#define C3_ALPHA
Definition: winnls.h:291
#define C2_OTHERNEUTRAL
Definition: winnls.h:278
#define C2_LEFTTORIGHT
Definition: winnls.h:268
#define CT_CTYPE2
Definition: winnls.h:256
#define C3_IDEOGRAPH
Definition: winnls.h:288
#define CT_CTYPE3
Definition: winnls.h:257
#define CT_CTYPE1
Definition: winnls.h:255
#define C3_HALFWIDTH
Definition: winnls.h:286
#define C2_EUROPENUMBER
Definition: winnls.h:270
#define C3_SYMBOL
Definition: winnls.h:283
#define C3_LOWSURROGATE
Definition: winnls.h:294
#define C2_COMMONSEPARATOR
Definition: winnls.h:274
#define C3_KATAKANA
Definition: winnls.h:284
#define C2_EUROPESEPARATOR
Definition: winnls.h:271
#define C2_EUROPETERMINATOR
Definition: winnls.h:272
#define C2_SEGMENTSEPARATOR
Definition: winnls.h:276
#define C3_KASHIDA
Definition: winnls.h:289
#define C2_RIGHTTOLEFT
Definition: winnls.h:269
#define C3_HIRAGANA
Definition: winnls.h:285
#define C2_WHITESPACE
Definition: winnls.h:277
#define C3_HIGHSURROGATE
Definition: winnls.h:293
#define C2_NOTAPPLICABLE
Definition: winnls.h:279
#define C2_BLOCKSEPARATOR
Definition: winnls.h:275

Referenced by __acrt_GetStringTypeA(), __crtGetStringTypeW(), _ismbcsymbol_l(), _iswctype_l(), _Locale_ctype_create(), _setmbcp_l(), _Success_(), _WLocale_ctype(), create_locinfo(), create_mbcinfo(), DoWordBreakProc(), get_char_script(), GetC1Type(), GetStringType3ExW(), GetStringTypeA(), GetStringTypeExW(), IsBlankLine(), IsCharBlankW(), IsCharCntrlW(), IsCharDigitW(), IsCharPunctW(), IsCharSpaceW(), IsCharXDigitW(), my_wcswidth(), my_wcwidth(), SampCheckPassword(), test_crtGetStringTypeW(), test_FoldStringW(), and test_GetStringTypeW().

◆ GetSystemDefaultLangID()

◆ GetSystemDefaultLCID()

◆ GetSystemDefaultLocaleName()

INT WINAPI GetSystemDefaultLocaleName ( LPWSTR  localename,
INT  len 
)

Definition at line 1246 of file locale.c.

1247{
1249 return LCIDToLocaleName(lcid, localename, len, 0);
1250}
int WINAPI LCIDToLocaleName(_In_ LCID Locale, _Out_writes_opt_(cchName) LPWSTR lpName, _In_ int cchName, _In_ DWORD dwFlags)

Referenced by test_ResolveLocaleName().

◆ GetSystemDefaultUILanguage()

LANGID WINAPI GetSystemDefaultUILanguage ( void  )

Definition at line 1400 of file locale.c.

1401{
1402 LANGID lang;
1404 return lang;
1405}
NTSTATUS NTAPI NtQueryInstallUILanguage(OUT LANGID *LanguageId)
Definition: locale.c:611

Referenced by LsaLookupPrivilegeDisplayName(), and SHGetWebFolderFilePathW().

◆ GetSystemPreferredUILanguages()

BOOL WINAPI GetSystemPreferredUILanguages ( DWORD  flags,
ULONG count,
WCHAR buffer,
ULONG size 
)

Definition at line 1301 of file locale.c.

1302{
1303 if (flags & ~(MUI_LANGUAGE_NAME | MUI_LANGUAGE_ID | MUI_MACHINE_LANGUAGE_SETTINGS))
1304 {
1306 return FALSE;
1307 }
1308 if ((flags & MUI_LANGUAGE_NAME) && (flags & MUI_LANGUAGE_ID))
1309 {
1311 return FALSE;
1312 }
1313 if (*size && !buffer)
1314 {
1316 return FALSE;
1317 }
1318
1320}
static BOOL get_dummy_preferred_ui_language(DWORD flags, ULONG *count, WCHAR *buffer, ULONG *size)
Definition: locale.c:1252

Referenced by InitFunctionPointers().

◆ GetThreadLocale()

◆ GetThreadPreferredUILanguages()

BOOL WINAPI GetThreadPreferredUILanguages ( DWORD  flags,
ULONG count,
WCHAR buf,
ULONG size 
)

Definition at line 1334 of file locale.c.

1335{
1336 FIXME( "%08x, %p, %p %p\n", flags, count, buf, size );
1338}

Referenced by InitFunctionPointers(), and test_GetThreadPreferredUILanguages().

◆ GetUserDefaultLangID()

◆ GetUserDefaultLCID()

◆ GetUserDefaultLocaleName()

INT WINAPI GetUserDefaultLocaleName ( LPWSTR  localename,
int  buffersize 
)

Definition at line 5578 of file locale.c.

5579{
5580 LCID userlcid;
5581
5582 TRACE("%p, %d\n", localename, buffersize);
5583
5584 userlcid = GetUserDefaultLCID();
5585 return LCIDToLocaleName(userlcid, localename, buffersize, 0);
5586}

Referenced by locale_to_sname().

◆ GetUserDefaultUILanguage()

◆ GetUserGeoID()

GEOID WINAPI GetUserGeoID ( GEOCLASS  GeoClass)

Definition at line 4770 of file locale.c.

4771{
4773 static const WCHAR geoW[] = {'G','e','o',0};
4774 static const WCHAR nationW[] = {'N','a','t','i','o','n',0};
4775 WCHAR bufferW[40], *end;
4776 DWORD count;
4777 HANDLE hkey, hSubkey = 0;
4778 UNICODE_STRING keyW;
4780 RtlInitUnicodeString( &keyW, nationW );
4781 count = sizeof(bufferW);
4782
4783 if(!(hkey = create_registry_key())) return ret;
4784
4785 switch( GeoClass ){
4786 case GEOCLASS_NATION:
4787 if ((hSubkey = NLS_RegOpenKey(hkey, geoW)))
4788 {
4789 if((NtQueryValueKey(hSubkey, &keyW, KeyValuePartialInformation,
4790 bufferW, count, &count) == STATUS_SUCCESS ) && info->DataLength)
4791 ret = strtolW((LPCWSTR)info->Data, &end, 10);
4792 }
4793 break;
4794 case GEOCLASS_REGION:
4795 FIXME("GEOCLASS_REGION not handled yet\n");
4796 break;
4797 }
4798
4799 NtClose(hkey);
4800 if (hSubkey) NtClose(hSubkey);
4801 return ret;
4802}
static HANDLE NLS_RegOpenKey(HANDLE hRootKey, LPCWSTR szKeyName)
Definition: locale.c:4285
ULONG GEOID
Definition: mui.h:28
#define GEOID_NOT_AVAILABLE
Definition: winnls.h:13

Referenced by CreateLocationsList(), GetUserDefaultGeoName(), SetUserLocaleName(), and test_geo_name().

◆ IdnToAscii()

INT WINAPI IdnToAscii ( DWORD  dwFlags,
LPCWSTR  lpUnicodeCharStr,
INT  cchUnicodeChar,
LPWSTR  lpASCIICharStr,
INT  cchASCIIChar 
)

Definition at line 5635 of file locale.c.

5637{
5638 static const WCHAR prefixW[] = {'x','n','-','-'};
5639
5640 WCHAR *norm_str;
5641 INT i, label_start, label_end, norm_len, out_label, out = 0;
5642
5643 TRACE("%x %p %d %p %d\n", dwFlags, lpUnicodeCharStr, cchUnicodeChar,
5644 lpASCIICharStr, cchASCIIChar);
5645
5646 norm_len = IdnToNameprepUnicode(dwFlags, lpUnicodeCharStr, cchUnicodeChar, NULL, 0);
5647 if(!norm_len)
5648 return 0;
5649 norm_str = HeapAlloc(GetProcessHeap(), 0, norm_len*sizeof(WCHAR));
5650 if(!norm_str) {
5652 return 0;
5653 }
5654 norm_len = IdnToNameprepUnicode(dwFlags, lpUnicodeCharStr,
5655 cchUnicodeChar, norm_str, norm_len);
5656 if(!norm_len) {
5657 HeapFree(GetProcessHeap(), 0, norm_str);
5658 return 0;
5659 }
5660
5661 for(label_start=0; label_start<norm_len;) {
5662 INT n = INIT_N, bias = INIT_BIAS;
5663 INT delta = 0, b = 0, h;
5664
5665 out_label = out;
5666 for(i=label_start; i<norm_len && norm_str[i]!='.' &&
5667 norm_str[i]!=0x3002 && norm_str[i]!='\0'; i++)
5668 if(norm_str[i] < 0x80)
5669 b++;
5670 label_end = i;
5671
5672 if(b == label_end-label_start) {
5673 if(label_end < norm_len)
5674 b++;
5675 if(!lpASCIICharStr) {
5676 out += b;
5677 }else if(out+b <= cchASCIIChar) {
5678 memcpy(lpASCIICharStr+out, norm_str+label_start, b*sizeof(WCHAR));
5679 out += b;
5680 }else {
5681 HeapFree(GetProcessHeap(), 0, norm_str);
5683 return 0;
5684 }
5685 label_start = label_end+1;
5686 continue;
5687 }
5688
5689 if(!lpASCIICharStr) {
5690 out += 5+b; /* strlen(xn--...-) */
5691 }else if(out+5+b <= cchASCIIChar) {
5692 memcpy(lpASCIICharStr+out, prefixW, sizeof(prefixW));
5693 out += 4;
5694 for(i=label_start; i<label_end; i++)
5695 if(norm_str[i] < 0x80)
5696 lpASCIICharStr[out++] = norm_str[i];
5697 lpASCIICharStr[out++] = '-';
5698 }else {
5699 HeapFree(GetProcessHeap(), 0, norm_str);
5701 return 0;
5702 }
5703 if(!b)
5704 out--;
5705
5706 for(h=b; h<label_end-label_start;) {
5707 INT m = 0xffff, q, k;
5708
5709 for(i=label_start; i<label_end; i++) {
5710 if(norm_str[i]>=n && m>norm_str[i])
5711 m = norm_str[i];
5712 }
5713 delta += (m-n)*(h+1);
5714 n = m;
5715
5716 for(i=label_start; i<label_end; i++) {
5717 if(norm_str[i] < n) {
5718 delta++;
5719 }else if(norm_str[i] == n) {
5720 for(q=delta, k=BASE; ; k+=BASE) {
5721 INT t = k<=bias ? TMIN : k>=bias+TMAX ? TMAX : k-bias;
5722 INT disp = q<t ? q : t+(q-t)%(BASE-t);
5723 if(!lpASCIICharStr) {
5724 out++;
5725 }else if(out+1 <= cchASCIIChar) {
5726 lpASCIICharStr[out++] = disp<='z'-'a' ?
5727 'a'+disp : '0'+disp-'z'+'a'-1;
5728 }else {
5729 HeapFree(GetProcessHeap(), 0, norm_str);
5731 return 0;
5732 }
5733 if(q < t)
5734 break;
5735 q = (q-t)/(BASE-t);
5736 }
5737 bias = adapt(delta, h+1, h==b);
5738 delta = 0;
5739 h++;
5740 }
5741 }
5742 delta++;
5743 n++;
5744 }
5745
5746 if(out-out_label > 63) {
5747 HeapFree(GetProcessHeap(), 0, norm_str);
5749 return 0;
5750 }
5751
5752 if(label_end < norm_len) {
5753 if(!lpASCIICharStr) {
5754 out++;
5755 }else if(out+1 <= cchASCIIChar) {
5756 lpASCIICharStr[out++] = norm_str[label_end] ? '.' : 0;
5757 }else {
5758 HeapFree(GetProcessHeap(), 0, norm_str);
5760 return 0;
5761 }
5762 }
5763 label_start = label_end+1;
5764 }
5765
5766 HeapFree(GetProcessHeap(), 0, norm_str);
5767 return out;
5768}
#define ERROR_INVALID_NAME
Definition: compat.h:103
static INT adapt(INT delta, INT numpoints, BOOL firsttime)
Definition: locale.c:5619
INT WINAPI IdnToNameprepUnicode(DWORD dwFlags, LPCWSTR lpUnicodeCharStr, INT cchUnicodeChar, LPWSTR lpNameprepCharStr, INT cchNameprepChar)
Definition: locale.c:5773
GLdouble GLdouble t
Definition: gl.h:2047
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLfloat bias
Definition: glext.h:7909
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
const GLfloat * m
Definition: glext.h:10848
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define b
Definition: ke_i.h:79
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383

Referenced by InitFunctionPointers().

◆ IdnToNameprepUnicode()

INT WINAPI IdnToNameprepUnicode ( DWORD  dwFlags,
LPCWSTR  lpUnicodeCharStr,
INT  cchUnicodeChar,
LPWSTR  lpNameprepCharStr,
INT  cchNameprepChar 
)

Definition at line 5773 of file locale.c.

5775{
5776 enum {
5777 UNASSIGNED = 0x1,
5778 PROHIBITED = 0x2,
5779 BIDI_RAL = 0x4,
5780 BIDI_L = 0x8
5781 };
5782
5783 extern const unsigned short nameprep_char_type[] DECLSPEC_HIDDEN;
5784 extern const WCHAR nameprep_mapping[] DECLSPEC_HIDDEN;
5785 const WCHAR *ptr;
5786 WORD flags;
5787 WCHAR buf[64], *map_str, norm_str[64], ch;
5788 DWORD i, map_len, norm_len, mask, label_start, label_end, out = 0;
5789 BOOL have_bidi_ral, prohibit_bidi_ral, ascii_only;
5790
5791 TRACE("%x %p %d %p %d\n", dwFlags, lpUnicodeCharStr, cchUnicodeChar,
5792 lpNameprepCharStr, cchNameprepChar);
5793
5794 if(dwFlags & ~(IDN_ALLOW_UNASSIGNED|IDN_USE_STD3_ASCII_RULES)) {
5796 return 0;
5797 }
5798
5799 if(!lpUnicodeCharStr || cchUnicodeChar<-1) {
5801 return 0;
5802 }
5803
5804 if(cchUnicodeChar == -1)
5805 cchUnicodeChar = strlenW(lpUnicodeCharStr)+1;
5806 if(!cchUnicodeChar || (cchUnicodeChar==1 && lpUnicodeCharStr[0]==0)) {
5808 return 0;
5809 }
5810
5811 for(label_start=0; label_start<cchUnicodeChar;) {
5812 ascii_only = TRUE;
5813 for(i=label_start; i<cchUnicodeChar; i++) {
5814 ch = lpUnicodeCharStr[i];
5815
5816 if(i!=cchUnicodeChar-1 && !ch) {
5818 return 0;
5819 }
5820 /* check if ch is one of label separators defined in RFC3490 */
5821 if(!ch || ch=='.' || ch==0x3002 || ch==0xff0e || ch==0xff61)
5822 break;
5823
5824 if(ch > 0x7f) {
5825 ascii_only = FALSE;
5826 continue;
5827 }
5828
5829 if((dwFlags&IDN_USE_STD3_ASCII_RULES) == 0)
5830 continue;
5831 if((ch>='a' && ch<='z') || (ch>='A' && ch<='Z')
5832 || (ch>='0' && ch<='9') || ch=='-')
5833 continue;
5834
5836 return 0;
5837 }
5838 label_end = i;
5839 /* last label may be empty */
5840 if(label_start==label_end && ch) {
5842 return 0;
5843 }
5844
5845 if((dwFlags&IDN_USE_STD3_ASCII_RULES) && (lpUnicodeCharStr[label_start]=='-' ||
5846 lpUnicodeCharStr[label_end-1]=='-')) {
5848 return 0;
5849 }
5850
5851 if(ascii_only) {
5852 /* maximal label length is 63 characters */
5853 if(label_end-label_start > 63) {
5855 return 0;
5856 }
5857 if(label_end < cchUnicodeChar)
5858 label_end++;
5859
5860 if(!lpNameprepCharStr) {
5861 out += label_end-label_start;
5862 }else if(out+label_end-label_start <= cchNameprepChar) {
5863 memcpy(lpNameprepCharStr+out, lpUnicodeCharStr+label_start,
5864 (label_end-label_start)*sizeof(WCHAR));
5865 if(lpUnicodeCharStr[label_end-1] > 0x7f)
5866 lpNameprepCharStr[out+label_end-label_start-1] = '.';
5867 out += label_end-label_start;
5868 }else {
5870 return 0;
5871 }
5872
5873 label_start = label_end;
5874 continue;
5875 }
5876
5877 map_len = 0;
5878 for(i=label_start; i<label_end; i++) {
5879 ch = lpUnicodeCharStr[i];
5881 ptr = nameprep_mapping + ptr[(ch>>4)&0x0f] + 3*(ch&0x0f);
5882
5883 if(!ptr[0]) map_len++;
5884 else if(!ptr[1]) map_len++;
5885 else if(!ptr[2]) map_len += 2;
5886 else if(ptr[0]!=0xffff || ptr[1]!=0xffff || ptr[2]!=0xffff) map_len += 3;
5887 }
5888 if(map_len*sizeof(WCHAR) > sizeof(buf)) {
5889 map_str = HeapAlloc(GetProcessHeap(), 0, map_len*sizeof(WCHAR));
5890 if(!map_str) {
5892 return 0;
5893 }
5894 }else {
5895 map_str = buf;
5896 }
5897 map_len = 0;
5898 for(i=label_start; i<label_end; i++) {
5899 ch = lpUnicodeCharStr[i];
5901 ptr = nameprep_mapping + ptr[(ch>>4)&0x0f] + 3*(ch&0x0f);
5902
5903 if(!ptr[0]) {
5904 map_str[map_len++] = ch;
5905 }else if(!ptr[1]) {
5906 map_str[map_len++] = ptr[0];
5907 }else if(!ptr[2]) {
5908 map_str[map_len++] = ptr[0];
5909 map_str[map_len++] = ptr[1];
5910 }else if(ptr[0]!=0xffff || ptr[1]!=0xffff || ptr[2]!=0xffff) {
5911 map_str[map_len++] = ptr[0];
5912 map_str[map_len++] = ptr[1];
5913 map_str[map_len++] = ptr[2];
5914 }
5915 }
5916
5917 norm_len = FoldStringW(MAP_FOLDCZONE, map_str, map_len,
5918 norm_str, sizeof(norm_str)/sizeof(WCHAR)-1);
5919 if(map_str != buf)
5920 HeapFree(GetProcessHeap(), 0, map_str);
5921 if(!norm_len) {
5924 return 0;
5925 }
5926
5927 if(label_end < cchUnicodeChar) {
5928 norm_str[norm_len++] = lpUnicodeCharStr[label_end] ? '.' : 0;
5929 label_end++;
5930 }
5931
5932 if(!lpNameprepCharStr) {
5933 out += norm_len;
5934 }else if(out+norm_len <= cchNameprepChar) {
5935 memcpy(lpNameprepCharStr+out, norm_str, norm_len*sizeof(WCHAR));
5936 out += norm_len;
5937 }else {
5939 return 0;
5940 }
5941
5942 have_bidi_ral = prohibit_bidi_ral = FALSE;
5943 mask = PROHIBITED;
5944 if((dwFlags&IDN_ALLOW_UNASSIGNED) == 0)
5945 mask |= UNASSIGNED;
5946 for(i=0; i<norm_len; i++) {
5947 ch = norm_str[i];
5949
5950 if(flags & mask) {
5951 SetLastError((flags & PROHIBITED) ? ERROR_INVALID_NAME
5953 return 0;
5954 }
5955
5956 if(flags & BIDI_RAL)
5957 have_bidi_ral = TRUE;
5958 if(flags & BIDI_L)
5959 prohibit_bidi_ral = TRUE;
5960 }
5961
5962 if(have_bidi_ral) {
5963 ch = norm_str[0];
5965 if((flags & BIDI_RAL) == 0)
5966 prohibit_bidi_ral = TRUE;
5967
5968 ch = norm_str[norm_len-1];
5970 if((flags & BIDI_RAL) == 0)
5971 prohibit_bidi_ral = TRUE;
5972 }
5973
5974 if(have_bidi_ral && prohibit_bidi_ral) {
5976 return 0;
5977 }
5978
5979 label_start = label_end;
5980 }
5981
5982 return out;
5983}
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
INT WINAPI FoldStringW(DWORD dwFlags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
Definition: locale.c:3911
static unsigned short get_table_entry(const unsigned short *table, WCHAR ch)
Definition: locale.c:277
GLenum GLint GLuint mask
Definition: glext.h:6028
const unsigned short nameprep_char_type[4432]
Definition: nameprep.c:5
const unsigned short nameprep_mapping[5856]
Definition: nameprep.c:565
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_NO_UNICODE_TRANSLATION
Definition: winerror.h:973
#define MAP_FOLDCZONE
Definition: winnls.h:231

Referenced by IdnToAscii(), and InitFunctionPointers().

◆ IdnToUnicode()

INT WINAPI IdnToUnicode ( DWORD  dwFlags,
LPCWSTR  lpASCIICharStr,
INT  cchASCIIChar,
LPWSTR  lpUnicodeCharStr,
INT  cchUnicodeChar 
)

Definition at line 5988 of file locale.c.

5990{
5991 extern const unsigned short nameprep_char_type[];
5992
5993 INT i, label_start, label_end, out_label, out = 0;
5994 WCHAR ch;
5995
5996 TRACE("%x %p %d %p %d\n", dwFlags, lpASCIICharStr, cchASCIIChar,
5997 lpUnicodeCharStr, cchUnicodeChar);
5998
5999 for(label_start=0; label_start<cchASCIIChar;) {
6000 INT n = INIT_N, pos = 0, old_pos, w, k, bias = INIT_BIAS, delim=0, digit, t;
6001
6002 out_label = out;
6003 for(i=label_start; i<cchASCIIChar; i++) {
6004 ch = lpASCIICharStr[i];
6005
6006 if(ch>0x7f || (i!=cchASCIIChar-1 && !ch)) {
6008 return 0;
6009 }
6010
6011 if(!ch || ch=='.')
6012 break;
6013 if(ch == '-')
6014 delim = i;
6015
6016 if((dwFlags&IDN_USE_STD3_ASCII_RULES) == 0)
6017 continue;
6018 if((ch>='a' && ch<='z') || (ch>='A' && ch<='Z')
6019 || (ch>='0' && ch<='9') || ch=='-')
6020 continue;
6021
6023 return 0;
6024 }
6025 label_end = i;
6026 /* last label may be empty */
6027 if(label_start==label_end && ch) {
6029 return 0;
6030 }
6031
6032 if((dwFlags&IDN_USE_STD3_ASCII_RULES) && (lpASCIICharStr[label_start]=='-' ||
6033 lpASCIICharStr[label_end-1]=='-')) {
6035 return 0;
6036 }
6037 if(label_end-label_start > 63) {
6039 return 0;
6040 }
6041
6042 if(label_end-label_start<4 ||
6043 tolowerW(lpASCIICharStr[label_start])!='x' ||
6044 tolowerW(lpASCIICharStr[label_start+1])!='n' ||
6045 lpASCIICharStr[label_start+2]!='-' || lpASCIICharStr[label_start+3]!='-') {
6046 if(label_end < cchASCIIChar)
6047 label_end++;
6048
6049 if(!lpUnicodeCharStr) {
6050 out += label_end-label_start;
6051 }else if(out+label_end-label_start <= cchUnicodeChar) {
6052 memcpy(lpUnicodeCharStr+out, lpASCIICharStr+label_start,
6053 (label_end-label_start)*sizeof(WCHAR));
6054 out += label_end-label_start;
6055 }else {
6057 return 0;
6058 }
6059
6060 label_start = label_end;
6061 continue;
6062 }
6063
6064 if(delim == label_start+3)
6065 delim++;
6066 if(!lpUnicodeCharStr) {
6067 out += delim-label_start-4;
6068 }else if(out+delim-label_start-4 <= cchUnicodeChar) {
6069 memcpy(lpUnicodeCharStr+out, lpASCIICharStr+label_start+4,
6070 (delim-label_start-4)*sizeof(WCHAR));
6071 out += delim-label_start-4;
6072 }else {
6074 return 0;
6075 }
6076 if(out != out_label)
6077 delim++;
6078
6079 for(i=delim; i<label_end;) {
6080 old_pos = pos;
6081 w = 1;
6082 for(k=BASE; ; k+=BASE) {
6083 ch = i<label_end ? tolowerW(lpASCIICharStr[i++]) : 0;
6084 if((ch<'a' || ch>'z') && (ch<'0' || ch>'9')) {
6086 return 0;
6087 }
6088 digit = ch<='9' ? ch-'0'+'z'-'a'+1 : ch-'a';
6089 pos += digit*w;
6090 t = k<=bias ? TMIN : k>=bias+TMAX ? TMAX : k-bias;
6091 if(digit < t)
6092 break;
6093 w *= BASE-t;
6094 }
6095 bias = adapt(pos-old_pos, out-out_label+1, old_pos==0);
6096 n += pos/(out-out_label+1);
6097 pos %= out-out_label+1;
6098
6099 if((dwFlags&IDN_ALLOW_UNASSIGNED)==0 &&
6100 get_table_entry(nameprep_char_type, n)==1/*UNASSIGNED*/) {
6102 return 0;
6103 }
6104 if(!lpUnicodeCharStr) {
6105 out++;
6106 }else if(out+1 <= cchASCIIChar) {
6107 memmove(lpUnicodeCharStr+out_label+pos+1,
6108 lpUnicodeCharStr+out_label+pos,
6109 (out-out_label-pos)*sizeof(WCHAR));
6110 lpUnicodeCharStr[out_label+pos] = n;
6111 out++;
6112 }else {
6114 return 0;
6115 }
6116 pos++;
6117 }
6118
6119 if(out-out_label > 63) {
6121 return 0;
6122 }
6123
6124 if(label_end < cchASCIIChar) {
6125 if(!lpUnicodeCharStr) {
6126 out++;
6127 }else if(out+1 <= cchUnicodeChar) {
6128 lpUnicodeCharStr[out++] = lpASCIICharStr[label_end];
6129 }else {
6131 return 0;
6132 }
6133 }
6134 label_start = label_end+1;
6135 }
6136
6137 return out;
6138}
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define tolowerW(n)
Definition: unicode.h:50

Referenced by InitFunctionPointers().

◆ InvalidateNLSCache()

BOOL WINAPI InvalidateNLSCache ( void  )

Definition at line 4756 of file locale.c.

4757{
4758#ifdef __REACTOS__
4760 return TRUE;
4761#else
4762 FIXME("() stub\n");
4763 return FALSE;
4764#endif
4765}
void JapaneseEra_ClearCache(void)
Definition: japanese.c:38

◆ is_genitive_name_supported()

static BOOL is_genitive_name_supported ( LCTYPE  lctype)
static

Definition at line 743 of file locale.c.

744{
745 switch(lctype & 0xffff)
746 {
760 return TRUE;
761 default:
762 return FALSE;
763 }
764}

Referenced by GetLocaleInfoW().

◆ IsDBCSLeadByte()

◆ IsDBCSLeadByteEx()

◆ IsNormalizedString()

BOOL WINAPI IsNormalizedString ( NORM_FORM  NormForm,
LPCWSTR  lpString,
INT  cwLength 
)

Definition at line 5602 of file locale.c.

5603{
5604 FIXME("%x %p %d\n", NormForm, lpString, cwLength);
5606 return FALSE;
5607}

◆ IsValidCodePage()

◆ IsValidLanguageGroup()

BOOL WINAPI IsValidLanguageGroup ( LGRPID  lgrpid,
DWORD  dwFlags 
)

Definition at line 4556 of file locale.c.

4557{
4558 static const WCHAR szFormat[] = { '%','x','\0' };
4559 WCHAR szValueName[16], szValue[2];
4560 BOOL bSupported = FALSE, bInstalled = FALSE;
4561 HANDLE hKey;
4562
4563
4564 switch (dwFlags)
4565 {
4566 case LGRPID_INSTALLED:
4567 case LGRPID_SUPPORTED:
4568
4570
4571 sprintfW( szValueName, szFormat, lgrpid );
4572
4573 if (NLS_RegGetDword( hKey, szValueName, (LPDWORD)szValue ))
4574 {
4575 bSupported = TRUE;
4576
4577 if (szValue[0] == '1')
4578 bInstalled = TRUE;
4579 }
4580
4581 if (hKey)
4582 NtClose( hKey );
4583
4584 break;
4585 }
4586
4587 if ((dwFlags == LGRPID_SUPPORTED && bSupported) ||
4588 (dwFlags == LGRPID_INSTALLED && bInstalled))
4589 return TRUE;
4590
4591 return FALSE;
4592}
static const WCHAR szLangGroupsKeyName[]
Definition: locale.c:76
static BOOL NLS_RegGetDword(HANDLE hKey, LPCWSTR szValueName, DWORD *lpVal)
Definition: locale.c:4338
FxAutoRegKey hKey
uint32_t * LPDWORD
Definition: typedefs.h:59
#define LGRPID_INSTALLED
Definition: winnls.h:502
#define LGRPID_SUPPORTED
Definition: winnls.h:503

Referenced by InitFunctionPointers().

◆ IsValidLocale()

◆ IsValidLocaleName()

BOOL WINAPI IsValidLocaleName ( LPCWSTR  locale)

Definition at line 2936 of file locale.c.

2937{
2938 struct locale_name locale_name;
2939
2940 if (!locale)
2941 return FALSE;
2942
2943 /* string parsing */
2944 parse_locale_name( locale, &locale_name );
2945
2946 TRACE( "found lcid %x for %s, matches %d\n",
2948
2949 return locale_name.matches > 0;
2950}

Referenced by InitFunctionPointers(), and locale_to_sname().

◆ LCMapStringA()

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

Definition at line 3834 of file locale.c.

3836{
3837 WCHAR *bufW = NtCurrentTeb()->StaticUnicodeBuffer;
3838 LPWSTR srcW, dstW;
3839 INT ret = 0, srclenW, dstlenW;
3840 UINT locale_cp = CP_ACP;
3841
3842 if (!src || !srclen || dstlen < 0)
3843 {
3845 return 0;
3846 }
3847
3848 if (!(flags & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage( lcid );
3849
3850 srclenW = MultiByteToWideChar(locale_cp, 0, src, srclen, bufW, 260);
3851 if (srclenW)
3852 srcW = bufW;
3853 else
3854 {
3855 srclenW = MultiByteToWideChar(locale_cp, 0, src, srclen, NULL, 0);
3856 srcW = HeapAlloc(GetProcessHeap(), 0, srclenW * sizeof(WCHAR));
3857 if (!srcW)
3858 {
3860 return 0;
3861 }
3862 MultiByteToWideChar(locale_cp, 0, src, srclen, srcW, srclenW);
3863 }
3864
3865 if (flags & LCMAP_SORTKEY)
3866 {
3867 if (src == dst)
3868 {
3870 goto map_string_exit;
3871 }
3872 ret = wine_get_sortkey(flags, srcW, srclenW, dst, dstlen);
3873 if (ret == 0)
3875 else
3876 ret++;
3877 goto map_string_exit;
3878 }
3879
3880 if (flags & SORT_STRINGSORT)
3881 {
3883 goto map_string_exit;
3884 }
3885
3886 dstlenW = LCMapStringEx(NULL, flags, srcW, srclenW, NULL, 0, NULL, NULL, 0);
3887 if (!dstlenW)
3888 goto map_string_exit;
3889
3890 dstW = HeapAlloc(GetProcessHeap(), 0, dstlenW * sizeof(WCHAR));
3891 if (!dstW)
3892 {
3894 goto map_string_exit;
3895 }
3896
3897 LCMapStringEx(NULL, flags, srcW, srclenW, dstW, dstlenW, NULL, NULL, 0);
3898 ret = WideCharToMultiByte(locale_cp, 0, dstW, dstlenW, dst, dstlen, NULL, NULL);
3899 HeapFree(GetProcessHeap(), 0, dstW);
3900
3901map_string_exit:
3902 if (srcW != bufW) HeapFree(GetProcessHeap(), 0, srcW);
3903 return ret;
3904}
int wine_get_sortkey(int flags, const WCHAR *src, int srclen, char *dst, int dstlen)
Definition: sortkey.c:33
INT WINAPI LCMapStringEx(LPCWSTR locale, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen, LPNLSVERSIONINFO version, LPVOID reserved, LPARAM handle)
Definition: locale.c:3746
#define LCMAP_SORTKEY
Definition: winnls.h:199

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

◆ LCMapStringEx()

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

Definition at line 3746 of file locale.c.

3748{
3749 if (version) FIXME("unsupported version structure %p\n", version);
3750 if (reserved) FIXME("unsupported reserved pointer %p\n", reserved);
3751 if (handle)
3752 {
3753 static int once;
3754 if (!once++) FIXME("unsupported lparam %Ix\n", handle);
3755 }
3756
3757 if (!src || !srclen || dstlen < 0)
3758 {
3760 return 0;
3761 }
3762
3763 if (srclen < 0) srclen = lstrlenW(src) + 1;
3764
3765 TRACE( "(%s,0x%08lx,%s,%d,%p,%d)\n",
3767
3768 flags &= ~LOCALE_USE_CP_ACP;
3769
3770 if (src == dst && (flags & ~(LCMAP_LOWERCASE | LCMAP_UPPERCASE)))
3771 {
3773 return 0;
3774 }
3775
3776 if (!dstlen) dst = NULL;
3777
3778 if (flags & LCMAP_SORTKEY)
3779 {
3780 INT ret;
3781
3782 if (srclen < 0)
3783 srclen = strlenW(src);
3784
3785 ret = wine_get_sortkey(flags, src, srclen, (char *)dst, dstlen);
3786 if (ret == 0)
3788 else
3789 ret++;
3790 return ret;
3791 }
3792
3793 /* SORT_STRINGSORT must be used exclusively with LCMAP_SORTKEY */
3794 if (flags & SORT_STRINGSORT)
3795 {
3797 return 0;
3798 }
3799
3800 return lcmap_string(flags, src, srclen, dst, dstlen);
3801}
static int lcmap_string(const struct sortguid *sortid, DWORD flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen)
Definition: locale.c:4134
#define debugstr_wn
Definition: kernel32.h:33
#define LCMAP_UPPERCASE
Definition: winnls.h:198
#define LCMAP_LOWERCASE
Definition: winnls.h:197

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

◆ LCMapStringW()

◆ LOCALE_Init()

void LOCALE_Init ( void  )

Definition at line 4211 of file locale.c.

4212{
4213 extern void CDECL __wine_init_codepages( const union cptable *ansi_cp, const union cptable *oem_cp,
4214 const union cptable *unix_cp );
4215
4216 UINT ansi_cp = 1252, oem_cp = 437, mac_cp = 10000, unix_cp;
4217
4218 setlocale( LC_ALL, "" );
4219
4220#ifdef __APPLE__
4221 /* MacOS doesn't set the locale environment variables so we have to do it ourselves */
4222 if (!has_env("LANG"))
4223 {
4224 const char* mac_locale = get_mac_locale();
4225
4226 setenv( "LANG", mac_locale, 1 );
4227 if (setlocale( LC_ALL, "" ))
4228 TRACE( "setting LANG to '%s'\n", mac_locale );
4229 else
4230 {
4231 /* no C library locale matching Mac locale; don't pass garbage to children */
4232 unsetenv("LANG");
4233 TRACE( "Mac locale %s is not supported by the C library\n", debugstr_a(mac_locale) );
4234 }
4235 }
4236#endif /* __APPLE__ */
4237
4240
4241#ifdef __APPLE__
4242 if (!unix_cp)
4243 unix_cp = CP_UTF8; /* default to utf-8 even if we don't get a valid locale */
4244#endif
4245
4249
4252 (LPWSTR)&mac_cp, sizeof(mac_cp)/sizeof(WCHAR) );
4254 (LPWSTR)&oem_cp, sizeof(oem_cp)/sizeof(WCHAR) );
4255 if (!unix_cp)
4257 (LPWSTR)&unix_cp, sizeof(unix_cp)/sizeof(WCHAR) );
4258
4259 if (!(ansi_cptable = wine_cp_get_table( ansi_cp )))
4261 if (!(oem_cptable = wine_cp_get_table( oem_cp )))
4263 if (!(mac_cptable = wine_cp_get_table( mac_cp )))
4264 mac_cptable = wine_cp_get_table( 10000 );
4265 if (unix_cp != CP_UTF8)
4266 {
4269 }
4270
4271 __wine_init_codepages( ansi_cptable, oem_cptable, unix_cptable );
4272
4273 TRACE( "ansi=%03d oem=%03d mac=%03d unix=%03d\n",
4274 ansi_cptable->info.codepage, oem_cptable->info.codepage,
4275 mac_cptable->info.codepage, unix_cp );
4276
4277 setlocale(LC_NUMERIC, "C"); /* FIXME: oleaut32 depends on this */
4278}
#define CDECL
Definition: compat.h:29
static const union cptable * unix_cptable
Definition: locale.c:68
static UINT setup_unix_locales(void)
Definition: locale.c:1116
static LCID lcid_LC_MESSAGES
Definition: locale.c:163
static UINT unix_cp
Definition: locale.c:305
#define LC_NUMERIC
Definition: locale.h:29
#define LC_ALL
Definition: locale.h:25
NTSTATUS NTAPI NtSetDefaultUILanguage(IN LANGID LanguageId)
Definition: locale.c:692
NTSTATUS NTAPI NtSetDefaultLocale(IN BOOLEAN UserProfile, IN LCID DefaultLocaleId)
Definition: locale.c:437

◆ LOCALE_InitRegistry()

void LOCALE_InitRegistry ( void  )

Definition at line 843 of file locale.c.

844{
845 static const WCHAR acpW[] = {'A','C','P',0};
846 static const WCHAR oemcpW[] = {'O','E','M','C','P',0};
847 static const WCHAR maccpW[] = {'M','A','C','C','P',0};
848 static const WCHAR localeW[] = {'L','o','c','a','l','e',0};
849 static const WCHAR lc_ctypeW[] = { 'L','C','_','C','T','Y','P','E',0 };
850 static const WCHAR lc_monetaryW[] = { 'L','C','_','M','O','N','E','T','A','R','Y',0 };
851 static const WCHAR lc_numericW[] = { 'L','C','_','N','U','M','E','R','I','C',0 };
852 static const WCHAR lc_timeW[] = { 'L','C','_','T','I','M','E',0 };
853 static const WCHAR lc_measurementW[] = { 'L','C','_','M','E','A','S','U','R','E','M','E','N','T',0 };
854 static const WCHAR lc_telephoneW[] = { 'L','C','_','T','E','L','E','P','H','O','N','E',0 };
855 static const WCHAR lc_paperW[] = { 'L','C','_','P','A','P','E','R',0};
856 static const struct
857 {
860 } update_cp_values[] = {
862 { oemcpW, LOCALE_IDEFAULTCODEPAGE },
864 };
865 static const LCTYPE lc_messages_values[] = {
868 LOCALE_SLIST };
869 static const LCTYPE lc_monetary_values[] = {
878 static const LCTYPE lc_numeric_values[] = {
882 LOCALE_IDIGITSUBSTITUTION,
888 static const LCTYPE lc_time_values[] = {
902 LOCALE_SYEARMONTH,
903 LOCALE_IDATE };
904 static const LCTYPE lc_measurement_values[] = { LOCALE_IMEASURE };
905 static const LCTYPE lc_telephone_values[] = { LOCALE_ICOUNTRY };
906 static const LCTYPE lc_paper_values[] = { LOCALE_IPAPERSIZE };
907
909 WCHAR bufferW[80];
910 DWORD count, i;
911 HANDLE hkey;
913
914 if (!(hkey = create_registry_key()))
915 return; /* don't do anything if we can't create the registry key */
916
917 locale_update_registry( hkey, localeW, lcid_LC_MESSAGES, lc_messages_values,
918 sizeof(lc_messages_values)/sizeof(lc_messages_values[0]) );
919 locale_update_registry( hkey, lc_monetaryW, lcid_LC_MONETARY, lc_monetary_values,
920 sizeof(lc_monetary_values)/sizeof(lc_monetary_values[0]) );
921 locale_update_registry( hkey, lc_numericW, lcid_LC_NUMERIC, lc_numeric_values,
922 sizeof(lc_numeric_values)/sizeof(lc_numeric_values[0]) );
923 locale_update_registry( hkey, lc_timeW, lcid_LC_TIME, lc_time_values,
924 sizeof(lc_time_values)/sizeof(lc_time_values[0]) );
925 locale_update_registry( hkey, lc_measurementW, lcid_LC_MEASUREMENT, lc_measurement_values,
926 sizeof(lc_measurement_values)/sizeof(lc_measurement_values[0]) );
927 locale_update_registry( hkey, lc_telephoneW, lcid_LC_TELEPHONE, lc_telephone_values,
928 sizeof(lc_telephone_values)/sizeof(lc_telephone_values[0]) );
929 locale_update_registry( hkey, lc_paperW, lcid_LC_PAPER, lc_paper_values,
930 sizeof(lc_paper_values)/sizeof(lc_paper_values[0]) );
931
932 if (locale_update_registry( hkey, lc_ctypeW, lcid_LC_CTYPE, NULL, 0 ))
933 {
934 static const WCHAR codepageW[] =
935 {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\',
936 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
937 'C','o','n','t','r','o','l','\\','N','l','s','\\','C','o','d','e','p','a','g','e',0};
938
941 DWORD len = 14;
942
943 RtlInitUnicodeString( &nameW, codepageW );
945 while (codepageW[len])
946 {
947 nameW.Length = len * sizeof(WCHAR);
948 if (NtCreateKey( &nls_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) break;
949 NtClose( nls_key );
950 len++;
951 while (codepageW[len] && codepageW[len] != '\\') len++;
952 }
953 nameW.Length = len * sizeof(WCHAR);
954 if (!NtCreateKey( &nls_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
955 {
956 for (i = 0; i < sizeof(update_cp_values)/sizeof(update_cp_values[0]); i++)
957 {
958 count = GetLocaleInfoW( lcid, update_cp_values[i].value | LOCALE_NOUSEROVERRIDE,
959 bufferW, sizeof(bufferW)/sizeof(WCHAR) );
960 RtlInitUnicodeString( &nameW, update_cp_values[i].name );
961 NtSetValueKey( nls_key, &nameW, 0, REG_SZ, bufferW, count * sizeof(WCHAR) );
962 }
963 NtClose( nls_key );
964 }
965 }
966
967 NtClose( hkey );
968}
static BOOL locale_update_registry(HKEY hkey, const WCHAR *name, LCID lcid, const LCTYPE *values, UINT nb_values)
Definition: locale.c:804
#define REG_SZ
Definition: locale.c:45
static HKEY nls_key
Definition: locale.c:309
static const WCHAR localeW[]
Definition: locale.c:49
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
unsigned short USHORT
Definition: pedump.c:61
Definition: name.c:39
#define LOCALE_SCOUNTRY
Definition: winnls.h:37
#define LOCALE_SABBREVLANGNAME
Definition: winnls.h:34
#define LOCALE_SLIST
Definition: winnls.h:47

◆ locale_update_registry()

static BOOL locale_update_registry ( HKEY  hkey,
const WCHAR name,
LCID  lcid,
const LCTYPE values,
UINT  nb_values 
)
static

Definition at line 804 of file locale.c.

806{
807 static const WCHAR formatW[] = { '%','0','8','x',0 };
808 WCHAR bufferW[40];
810 DWORD count, i;
811
813 count = sizeof(bufferW);
815 {
817 LPCWSTR text = (LPCWSTR)info->Data;
818
819 if (strtoulW( text, NULL, 16 ) == lcid) return FALSE; /* already set correctly */
820 TRACE( "updating registry, locale %s changed %s -> %08x\n",
822 }
823 else TRACE( "updating registry, locale %s changed none -> %08x\n", debugstr_w(name), lcid );
824 sprintfW( bufferW, formatW, lcid );
825 NtSetValueKey( hkey, &nameW, 0, REG_SZ, bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR) );
826
827 for (i = 0; i < nb_values; i++)
828 {
830 sizeof(bufferW)/sizeof(WCHAR) );
831 SetLocaleInfoW( lcid, values[i], bufferW );
832 }
833 return TRUE;
834}
BOOL WINAPI SetLocaleInfoW(LCID lcid, LCTYPE lctype, LPCWSTR data)
Definition: locale.c:1923
const WCHAR * text
Definition: package.c:1794
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
if(dx< 0)
Definition: linetemp.h:194
#define strtoulW(s1, s2, b)
Definition: unicode.h:47

Referenced by LOCALE_InitRegistry().

◆ lstrcmpA()

int WINAPI lstrcmpA ( LPCSTR  str1,
LPCSTR  str2 
)

Definition at line 4127 of file locale.c.

4128{
4129 int ret;
4130
4131 if ((str1 == NULL) && (str2 == NULL)) return 0;
4132 if (str1 == NULL) return -1;
4133 if (str2 == NULL) return 1;
4134
4136 if (ret) ret -= 2;
4137
4138 return ret;
4139}
LCID WINAPI GetThreadLocale(void)
Definition: locale.c:2803
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
Definition: locale.c:4015

Referenced by check_font(), check_list(), check_reg_str(), check_wellknown_name(), compare_string1(), CryptFindOIDInfo(), dde_msg_client_wndproc(), dde_server_wndproc(), dde_server_wndprocA(), dde_server_wndprocW(), DoStepCheck(), eto_emf_enum_proc(), expect_shim_imp(), external_entity_loader(), file_matches(), find_prop_in_property(), FindTest(), hook_WaitForInputIdle(), is_prefix_wa(), JustDoIt(), LPropCompareProp(), main(), match_emf_record(), mdi_child_wnd_proc_1(), mdi_child_wnd_proc_2(), mdr_GetValue(), notify_datetime_handler(), notify_generic_text_handler(), notify_tooltip_handler(), option_equal(), parse_clr_metadata(), PathMatchSpecA(), PathMatchSpecExA(), PRINTDLG_ChangePrinterA(), PropertyStorage_PropNameCompare(), proppage_callback_a(), PropVariantCompareEx(), PropVariantToBoolean(), server_ddeml_callback(), server_end_to_end_callback(), START_TEST(), str_eq_wa(), strcmp_wa(), strcmp_ww(), StrCmpCA(), test_32bit_win(), test__get_narrow_winmain_command_line(), test_appsearch_complocator(), test_appsearch_drlocator(), test_appsearch_inilocator(), test_appsearch_reglocator(), test_authentication(), test_binary(), test_binary_import(), test_BstrCopy(), test_ccpsearch(), test_collation(), test_CompareStringA(), test_complocator(), test_ConvertINetUnicodeToMultiByte(), test_CreateAssemblyNameObject(), test_CreateFontIndirect(), test_CredMarshalCredentialA(), test_CryptCATAdminAddRemoveCatalog(), test_db(), test_dbmerge(), test_dbtopackage(), test_DdeCreateDataHandle(), test_DdeCreateStringHandleW(), test_ddeml_client(), test_destination_buffer(), test_DoEnvironmentSubst(), test_EM_GETHANDLE(), test_EM_SETTEXTEX(), test_emptypackage(), test_EnumDateFormatsA(), test_enumerate(), test_enumerate_name(), test_EnumTimeFormatsA(), test_Extract(), test_fieldzero(), test_FoldStringA(), test_font_substitution(), test_forcecodepage(), test_formatrecord(), test_formatrecord_package(), test_formatrecord_tables(), test_fullname(), test_fullname2_helper(), test_GetAcceptLanguagesA(), test_GetDisplayName(), test_GetFullPathNameA(), test_GetLocaleInfoA(), test_GetPrivateProfileString(), test_GetPtrAW(), test_GetRfc1766FromLcid(), test_GetRfc1766Info(), test_GetSetConsoleInputExeName(), test_GetSetEnvironmentVariableA(), test_GetSetEnvironmentVariableAW(), test_getstring(), test_GetSystemDirectoryA(), test_GetTextFace(), test_GetUrlCacheConfigInfo(), test_GetWindowsDirectoryA(), test_IMultiLanguage2_ConvertStringFromUnicode(), test_inffilelistA(), test_initialization(), test_Installer_InstallProduct(), test_installprops(), test_InternetCanonicalizeUrlA(), test_interthread_messages(), test_kerberos(), test_lastusedsource(), test_LcidToRfc1766(), test_LCMapStringA(), test_LookupAccountName(), test_LookupAccountSid(), test_LZOpenFileA(), test_LZOpenFileA_existing_compressed(), test_LZOpenFileA_nonexisting_compressed(), test_LZOpenFileW(), test_LZOpenFileW_existing_compressed(), test_LZOpenFileW_nonexisting_compressed(), test_MoveFileA(), test_MsiDatabaseCommit(), test_MsiEnumClients(), test_MsiEnumPatches(), test_MsiEnumPatchesEx(), test_MsiEnumPatchesEx_machine(), test_MsiEnumPatchesEx_usermanaged(), test_MsiEnumPatchesEx_userunmanaged(), test_msiexport(), test_MsiGetComponentPath(), test_MsiGetComponentPathEx(), test_MsiGetFileVersion(), test_MsiGetPatchInfo(), test_MsiGetPatchInfoEx(), test_MsiGetProductCode(), test_MsiGetProductInfoEx(), test_MsiGetProductProperty(), test_MsiGetSourcePath(), test_MsiGetUserInfo(), test_MsiInstallProduct(), test_MsiOpenProduct(), test_MsiProvideQualifiedComponentEx(), test_MsiRecordGetString(), test_MsiSetProperty(), test_MsiSourceListAddSourceEx(), test_MsiSourceListEnumMediaDisks(), test_MsiSourceListEnumSources(), test_MsiSourceListGetInfo(), test_multibyte_to_unicode_translations(), test_negative_dest_length(), test_negative_source_length(), test_norecompute(), test_notify_generic_text_helper(), test_notify_proc(), test_oemcharset(), test_Option_PerConnectionOptionA(), test_ParseURLFromOutsideSourceA(), test_ParseURLFromOutsideSourceW(), test_PathAddBackslash(), test_PathAppendA(), test_PathBuildRootA(), test_PathCanonicalizeA(), test_PathCombineA(), test_PathCommonPrefixA(), test_PathFindExtensionA(), test_PathNameA(), test_PdhLookupPerfNameByIndexA(), test_process_components(), test_PropCopyMore(), test_property_table(), test_pSetupGetField(), test_publish_sourcelist(), test_queryreader(), test_readwrite(), test_reg_query_value(), test_RegisterClipboardFormatA(), test_RtlGetFullPathName_U(), test_ScriptGetFontProperties(), test_SetDefaultPrinter(), test_settargetpath(), test_SetupGetFileCompressionInfo(), test_SetupGetFileCompressionInfoEx(), test_SetupGetSourceFileLocation(), test_SetupGetSourceInfo(), test_SHCreateWorkerWindowA(), test_SHFormatDateTimeA(), test_SHGetFolderPathAndSubDirA(), test_SHGetObjectCompatFlags(), test_shortlongsource(), test_sorting(), test_sourcedir(), test_storages_table(), test_streamtable(), test_summary_binary(), test_SysAllocStringByteLen(), test_try_transform(), test_UDS_SETBUDDYINT(), test_updown_base(), test_UrlApplyScheme(), test_urlcacheW(), test_XcvDataPort_ConfigureLPTPortCommandOK(), testAuth(), testGetValidUsages(), testPropsHelper(), testScreenBuffer(), verify_shima_imp(), WorkerThread(), and wsprintfATest().

◆ lstrcmpiA()

int WINAPI lstrcmpiA ( LPCSTR  str1,
LPCSTR  str2 
)

Definition at line 4156 of file locale.c.

4157{
4158 int ret;
4159
4160 if ((str1 == NULL) && (str2 == NULL)) return 0;
4161 if (str1 == NULL) return -1;
4162 if (str2 == NULL) return 1;
4163
4165 if (ret) ret -= 2;
4166
4167 return ret;
4168}

Referenced by __ConvertName(), __GetLCIDFromName(), cbt_global_hook_proc(), check_info_filename(), check_lnk_(), check_reg_str(), cmp_mru_strA(), create_sub_body(), dns_strcmpX(), DoTestEntry(), enum_all_fonts_proc(), EnumLocalesProcA(), fdi_decomp(), file_in_list(), find_default_prop(), find_prop(), FindImportDescriptor(), get_window_attributes(), hook_WaitForInputIdle(), IntGetImageBase(), CFindFolderContextMenu::InvokeCommand(), CFontBackgroundMenu::InvokeCommand(), CCopyMoveToMenu::InvokeCommand(), is_local_machineA(), is_our_logged_class(), is_stub_dll(), MACRO_CloseSecondarys(), MACRO_CloseWindow(), MACRO_FocusWindow(), MACRO_HelpOnTop(), MACRO_LookupButton(), main(), MapVerbToCmdId(), MapVerbToDfmCmd(), matchSpecialFolderPathToEnv(), MD_GetNotifyCode(), MD_msgdump(), MD_msgresult(), MimeBody_DeleteProp(), MimeBody_GetProp(), MimeBody_IsContentType(), MimeBody_SetProp(), MimeInternat_FindCharset(), okChildString_(), path_hook_proc(), PathIsExeA(), PropertyStorage_PropNameCompare(), PropVariantCompareEx(), PropVariantToBoolean(), read_prop(), RedirectIat(), scan_subkeys(), SHADD_compare_mru(), SHELL_IsVerb(), SHELL_MapContextMenuVerbToCmdId(), SHLWAPI_DoesModuleVersionMatch(), SHLWAPI_InitAppCompat(), SHRegGetBoolUSValueA(), START_TEST(), StrCmpICA(), stricmp_wa(), Test2(), test_appsearch_drlocator(), TEST_AssocQueryStringA(), test_bitmap_font_glyph_index(), test_CompareStringA(), test_CurrentDirectoryA(), test_enum_sections(), test_enumdisplaydevices_monitor(), test_filenames(), test_FindFirstFileA(), test_FunnyChars(), test_get_displayname(), test_get_file_info(), test_get_servicekeyname(), test_get_set(), test_GetFinalPathNameByHandleA(), test_GetIconLocation(), test_GetLongPathNameA(), test_GetProcessImageFileNameA(), test_GetStandardColorSpaceProfileA(), test_GetStandardColorSpaceProfileW(), test_GetTempFileNameA(), test_GetTempPathA(), test_handles(), test_hwnd_message(), test_IME(), test_InitPathA(), test_LoadLibraryEx_search_flags(), test_LongtoShortA(), test_LookupAccountName(), test_module(), test_nonexistent_font(), test_open_svc(), test_OpenFile(), test_PathCreateFromUrl(), test_PathNameA(), test_PrintDlgA(), test_process_components(), test_QueryFullProcessImageNameA(), test_readwrite(), test_registerDefaultOIDFunction(), test_setdir(), test_SetSearchPathMode(), test_settargetpath(), test_SetupGetTargetPath(), test_sh_new_link_info(), test_SHGetFolderPathA(), test_urlcacheA(), test_UrlCreateFromPath(), test_ValidPathA(), testing_status_routine(), testSystemDir(), testWinDir(), TF_CUASAppFix(), translateinfstringex_test(), TTIsEmbeddingEnabledForFacename(), VerInstallFileA(), WDML_ClientProc(), WDML_ServerNameProc(), win_event_global_hook_proc(), WINHELP_CreateHelpWindow(), WINHELP_DeleteWindow(), and WINHELP_GetWindowInfo().

◆ lstrcmpiW()

int WINAPI lstrcmpiW ( LPCWSTR  str1,
LPCWSTR  str2 
)

Definition at line 4194 of file locale.c.

4195{
4196 int ret;
4197
4198 if ((str1 == NULL) && (str2 == NULL)) return 0;
4199 if (str1 == NULL) return -1;
4200 if (str2 == NULL) return 1;
4201
4203 if (ret) ret -= 2;
4204
4205 return ret;
4206}
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: locale.c:3946

Referenced by ActivateContentTopic(), add_favs_to_menu(), add_font(), AviMux_FindPin(), BaseRendererImpl_FindPin(), bstr_to_dt(), CFn_WMCommand(), CFSExtractIcon_CreateInstance(), CloseNotepad(), CCabFolder::CompareID(), CompareIDs(), compareUrlArray(), copy_files(), count_moniker_matches(), CountMenuWndProc(), CRYPT_FileNameOpenStoreW(), CRYPT_FindStringInMultiString(), CRYPT_SysRegOpenStoreW(), CryptFindLocalizedName(), DdeCmpStringHandles(), DEVENUM_IMediaCatMoniker_IsEqual(), DispatchEx_GetDispID(), dns_name_matches(), dns_strcmpX(), do_process_key(), ATL::CRegObject::do_process_key(), do_process_root_key(), ATL::CRegObject::do_process_root_key(), DoEntry(), DoInitAutoCompleteWithCWD(), domain_name_matches(), domdoc_getProperty(), domdoc_setProperty(), domimpl_hasFeature(), DoSync(), DoTestComputerName(), DoTestEntry(), EditTypeDlg_OnCommand(), EditTypeDlg_OnDrawItem(), EnableCommandIfVerbExistsProc(), CDirectoryItem::EqualPath(), extract_cab_cb(), ExtractFilesCallback(), FILEDLG95_FILETYPE_SearchExt(), FILEDLG95_OnOpen(), FileMonikerImpl_CommonPrefixWith(), FileMonikerImpl_IsEqual(), FileMonikerImpl_RelativePathTo(), CMenuSFToolbar::FillToolbar(), find_control(), find_installed_ports(), find_portinfo2(), find_top_window(), FindExeCplClass(), CEnumIDList::FindNamedItem(), fnIMultiLanguage3_GetCharsetInfo(), format_filelist_filename(), func_name_cmp(), GdipGetSupportedFileExtensions(), get_operation(), GetBinaryTypeW(), CRegTreeOptions::GetCheckState(), GetFileTypeIconsEx(), CShellDispatch::GetSystemInformation(), HTMLFormElement_put_encoding(), HTMLFormElement_put_method(), IAssemblyCacheImpl_InstallAssembly(), Imm32IsRunningInMsoobe(), CACLCustomMRU::Initialize(), CVfdShExt::InvokeCommand(), IsPidlPrograms(), IsSwitch(), ITypeComp_fnBind(), ITypeInfo_fnGetIDsOfNames(), JapaneseEra_IsFirstYearGannen(), ldr_enum_callback(), ldr_notify_callback1(), ldr_notify_callback_imports(), load_mapi_provider(), LocalmonAddPortEx(), map_image_section(), ModifyShellContextMenu(), MSSTYLES_FindClass(), MSSTYLES_GetActiveThemeIni(), MSSTYLES_GetFont(), MSSTYLES_LoadBitmap(), MSSTYLES_LookupEnum(), MSSTYLES_LookupPartState(), MSSTYLES_LookupProperty(), MSSTYLES_OpenThemeFile(), MSSTYLES_ParseThemeIni(), MSTASK_ITaskScheduler_SetTargetComputer(), ok_child_stringWA(), CDefView::OnSettingChange(), CDesktopBrowser::OnSettingChange(), CTrayWindow::OnSettingChanged(), parse_display_name(), parse_encoding_name(), parse_procarch(), parse_pubkey(), ParseDisplayName(), PathIsDosDevice(), PickIconProc(), PrintOSVersion(), PropertyStorage_PropNameCompare(), PropStgNameToFmtId(), PropVariantCompareEx(), PropVariantToBoolean(), pSetupStringTableAddString(), pSetupStringTableAddStringEx(), pSetupStringTableLookUpString(), pSetupStringTableLookUpStringEx(), CDummyPropertyBag::Read(), realize_font(), reg_add(), reg_copy(), reg_delete(), reg_export(), reg_import(), reg_mui_cache_get(), reg_query(), registry_set_filelist(), rfc822_name_matches(), SampleGrabber_IBaseFilter_FindPin(), SECUR32_findPackageW(), ServiceStarter(), set_ldids(), SHADD_compare_mru(), SHAddToRecentDocs(), SHCreatePropertyBagOnProfileSection(), SHELL32_GetFSItemAttributes(), SHELL_GetIconUnderlineMode(), SHELL_IsVerb(), shellex_run_context_menu_default(), SHGetSpecialFolderID(), SHRegGetBoolUSValueW(), SHSettingsChanged(), START_TEST(), StrCmpICW(), SvcRegisterStopCallback(), TEST_AssocQueryStringW(), test_createfont(), test_detailed_info(), TEST_DoTestEntryStruct(), test_EnumCodePages(), test_file_all_name_information(), test_file_info(), test_file_link_information(), test_file_name_information(), test_file_rename_information(), test_FolderCollection(), test_FolderShortcut(), test_fontfamily(), test_GetAbsolutePathName(), test_GetDisplayName(), test_GetFile(), test_GetFinalPathNameByHandleW(), Test_GetFontResourceInfoW_case1(), Test_GetFontResourceInfoW_case2(), Test_GetFontResourceInfoW_case4(), test_getgenerics(), test_GetSpecialFolder(), test_getstring_bad(), test_GetTempPathW(), test_hash_links(), test_info_in_assembly(), test_knownFolders(), test_LdrGetDllFullName(), test_LocalizedNames(), test_namespace(), test_ParseDisplayNamePBC(), test_PathCreateFromUrl(), test_PathSearchAndQualify(), test_ProgIDFromCLSID(), test_QueryFullProcessImageNameW(), test_realization(), test_RtlStringFromGUID(), test_SetApplicationName_GetApplicationName(), test_SetTargetComputer(), test_SHGetFolderPathEx(), test_SHGetPathFromIDList(), test_SHGetSetFolderCustomSettings(), TEST_Start(), test_streamenum(), test_StringFromGUID2(), test_StringTableStringFromId(), test_type_info(), test_typelib(), test_UrlCreateFromPath(), test_Win32_ComputerSystem(), TestCommandLine(), ThemeDlgPostWindowProc(), TLB_get_typeinfo_by_name(), TLB_get_vardesc_by_name(), TREEVIEW_SortOnName(), UPDOWN_SetBuddy(), UPDOWN_SetBuddyInt(), URLMoniker_IsEqual(), UXTHEME_FormatParseMessage(), Validate_EmptyShimData_Win10(), Validate_EmptyShimData_Win8(), validate_envW(), validate_operation(), Validate_ShimData_Win10(), Validate_ShimData_Win8(), WDML_BroadcastEnumProc(), WDML_ClientProc(), WDML_ServerNameProc(), WICMapShortNameToGuid(), CDummyPropertyBag::Write(), write_registry_values(), wWinMain(), and xmlelem_getAttribute().

◆ lstrcmpW()

int WINAPI lstrcmpW ( LPCWSTR  str1,
LPCWSTR  str2 
)

Definition at line 4175 of file locale.c.

4176{
4177 int ret;
4178
4179 if ((str1 == NULL) && (str2 == NULL)) return 0;
4180 if (str1 == NULL) return -1;
4181 if (str2 == NULL) return 1;
4182
4183 ret = CompareStringW(GetThreadLocale(), 0, str1, -1, str2, -1);
4184 if (ret) ret -= 2;
4185
4186 return ret;
4187}

Referenced by _check_default_props(), _check_set_props(), _findProviderIndexW(), _test_doc_load_from_path(), _test_GetCurMoniker(), _test_language_string(), ActiveScript_AddNamedItem(), ActiveScriptSite_GetItemInfo(), add_favs_to_menu(), ADVAPI_IsLocalComputer(), AVIBuildFilterW(), cert_mgr_sort_by_text(), check_display_name_(), check_dropdown_(), check_known_folder(), ClassTest(), compare_addrinfow(), compare_export_(), compare_font(), compare_items(), compare_metadata(), compareAltNameEntry(), CRegistryFolder::CompareIDs(), ConfigFileHandler_startElement(), cpinfo_cmp(), CredDialogFillUsernameCombo(), CredUIConfirmCredentialsW(), CredUIPromptForCredentialsW(), CRYPT_RegReadSerializedFromReg(), CryptFindOIDInfo(), dde_server_wndprocA(), dde_server_wndprocW(), DELNODE_recurse_dirtree(), DEVENUM_IPropertyBag_Read(), dispex_GetDispID(), DoEntry(), DoGetProductType(), dom_pi_put_xml_decl(), DoTestComputerName(), DoTestEntry(), DSPROPERTY_WaveDeviceMappingW(), EditTypeDlg_WriteClass(), enum_find_filter(), enum_gac_assemblies(), enum_stream_names(), enumeration_callback(), EnumJoysticks(), DownloadInfo::Equal(), export_password_dlg_proc(), FEqualNames(), find_existing_credential(), find_property_index(), find_window(), find_window_callback(), FindDll(), general_on_notify(), get_dest_dir(), get_encoder_clsid(), GetFileTypeIconsEx(), getstring_test(), GetTypeFromName(), HlinkBrowseContext_GetObject(), hls_site_Moniker_ComposeWith(), HttpNegotiate_BeginningTransaction(), IAssemblyNameImpl_IsEqual(), IDxDiagContainerImpl_GetChildContainerInternal(), IDxDiagContainerImpl_GetProp(), iframe_onreadystatechange(), Imm32UnitTest(), InitPropertyBag_IPropertyBag_Read(), InPlaceFrame_SetActiveObject(), InPlaceUIWindow_SetActiveObject(), inst_func2(), InstallColorProfileW(), InternetProtocolInfo_CombineUrl(), InternetProtocolInfo_ParseUrl(), is_expected_variant(), is_ime_window_proc(), is_in_strarray(), is_netmeeting_running(), JustDoIt(), ldap_parse_page_controlW(), LISTBOX_Directory(), LISTVIEW_EndEditLabelT(), LISTVIEW_FindItemW(), LPK_ApplyMirroring(), LPropCompareProp(), LsapIsLocalComputer(), MimeProtocol_Start(), mixer_test_deviceW(), MMDevEnum_GetDevice(), MNLS_lstrcmpW(), MonikerProp_PutProperty(), MSACM_FillFormatTagsCB(), MsgConversionProcW(), notify_generic_text_handler(), notify_if_changed(), ok_child_stringWA(), on_default_action(), on_fontlist_modified(), on_mime_message_available(), on_sizelist_modified(), pagesetup_set_devnames(), parse_file_header(), parse_hhindex(), ParseDisplayName_ParseDisplayName(), PathMatchSpecExW(), PathMatchSpecW(), PB_Read(), PerformRegAction(), pointer_tests(), PRINTDLG_ChangePrinterW(), PRINTDLG_CreateDevNamesW(), process_arguments(), ProcessDirStatsItem(), PropertyNotifySink_OnChanged(), proppage_callback_w(), PropVariantCompareEx(), PropVariantToBoolean(), Protocol_Continue(), Protocol_Start(), protocol_start(), ProtocolSink_ReportProgress(), pSetupStringTableAddString(), pSetupStringTableAddStringEx(), pSetupStringTableLookUpString(), pSetupStringTableLookUpStringEx(), r_getMonikerRef(), r_getStringRef(), r_verify_pidl(), REBAR_MoveChildWindows(), REBAR_strdifW(), REGPROC_open_export_file(), res_sec_url_cmp(), resource_strcmp(), RtlAtomTestThread(), run_get_comp_name_tests(), run_test(), run_usergetinfo_tests(), run_wkstausergetinfo_tests(), scriptinfo_cmp(), search_dll_path(), server_end_to_end_callback(), set_up_attribute_test(), SetupQuerySpaceRequiredOnDriveW(), SHGetFileInfoW(), should_enumerate_device(), simple_callbackW(), site_GetItemInfo(), SmartTeeFilter_FindPin(), START_TEST(), STATUSBAR_SetTextT(), statusclb_OnDataAvailable(), statusclb_OnProgress(), Storage_CreateStream(), Storage_OpenStream(), strcmp_aw(), strcmp_wa(), StrCmpCW(), subtest_InsertObject(), tear_down_attribute_test(), test_32bit_win(), test_about_protocol(), test_aclist_expand(), test_assembly_name_props_line(), test_aw_conversion_dlgproc(), test_aw_conversion_dlgprocA(), test_aw_conversion_dlgprocW(), test_aw_conversion_wndproc(), test_bad_header(), test_basics(), test_BindToObject(), test_BindToStorage(), test_bstr_cache(), test_BuildPath(), test_button_class(), test_catalog_properties(), test_CertRDNValueToStrW(), test_CharToOem_OemToChar(), test_chunked_read(), Test_ClassAtoms(), test_cloneNode(), test_codec(), test_CoInternetCombineIUri_Pluggable(), test_CoInternetCombineUrlEx_Pluggable(), test_CoInternetParseIUri_InvalidArgs(), test_CoInternetParseIUri_Pluggable(), test_CoInternetParseUrl(), test_collation(), test_commandline2argv(), test_convert(), test_cookies(), test_copy(), test_CopyStgMedium(), test_costs(), test_create(), test_create_attribute(), test_create_catalog_file(), test_createNode(), test_createProcessingInstruction(), test_CreateTextFile(), test_CreateTypeLib(), test_CredUnmarshalCredentialA(), test_cryptunprotectdata(), test_cue_banner(), test_custom_source(), test_customize(), test_customize_onfolderchange(), test_datalink(), test_DavGetHTTPFromUNCPath(), test_DavGetUNCFromHTTPPath(), test_ddag_node(), test_DdeCreateStringHandleW(), test_decodeAltName(), test_decodeAuthorityKeyId2(), test_decodeCatMemberInfo(), test_decodeCatNameValue(), test_decodeCRLDistPoints(), test_decodePolicyQualifierUserNotice(), test_decoder_info(), test_decodeSPCLink(), test_decodeSPCPEImage(), test_decodeSpOpusInfo(), test_default_client_accessible_object(), test_default_format(), test_default_handler(), test_default_properties(), test_desktop_displaynameof(), test_directory_sort(), test_directshow_filter(), test_dmo(), test_DoEnvironmentSubst(), test_domdoc(), test_domnode(), test_DsClientMakeSpnForTargetServer(), test_DsMakeSpn(), test_dsound(), test_EM_GETHANDLE(), test_EM_GETLINE(), test_EM_SETTEXTEX(), test_EnumTimeFormatsW(), test_exec_fontname(), test_FileCollection(), test_filename_opendlg_(), test_filename_savedlg_(), test_filesourcefilter(), test_find_com_redirection(), test_find_surrogate(), test_find_window_class(), test_FindName(), test_findOIDInfo(), test_fm2_enummatchingfilters(), test_FolderCollection(), test_font_events_disp(), test_format_record(), test_FormattingXML(), test_geo_name(), test_get_attributes(), test_get_childNodes(), test_get_doctype(), test_get_firstChild(), test_get_lastChild(), test_get_namespaces(), test_get_nodeTypeString(), test_get_prefix(), test_get_tagName(), test_get_text(), test_getAttribute(), test_GetBaseName(), test_GetCachePath(), test_GetCharsetInfo_other(), test_GetCodePageInfo(), test_GetDisplayName(), test_GetDrive(), test_GetDriveName(), test_GetDynamicTimeZoneInformation(), test_GetExtensionName(), test_GetFileName(), test_GetFullPathNameW(), test_GetLocaleInfoEx(), test_GetLocaleInfoW(), test_GetLocalName(), test_GetName(), test_GetParentFolderName(), test_GetRemoteName(), test_GetRfc1766Info(), test_getruntime(), test_GetSetEnvironmentVariableAW(), test_GetSetEnvironmentVariableW(), test_getstring(), test_GetSystemDirectoryW(), test_GetText(), test_GetTextFace(), test_GetTimeZoneInformationForYear(), test_getuserobjectinformation(), test_GetWindowsDirectoryW(), test_Global(), test_globalness(), test_HlinkClone(), test_HlinkCreateExtensionServices(), test_HlinkGetSetMonikerReference(), test_HlinkGetSetStringReference(), test_HlinkParseDisplayName(), test_HttpOptions(), test_IActiveScriptError(), test_ICInfo(), test_indent(), test_inffilelist(), test_info_in_assembly(), test_InitPropVariantFromGUIDAsString(), test_insertBefore(), test_Installer_Products(), test_Installer_RegistryValue(), test_internal_structure(), test_InternetGetSecurityUrl(), test_ITEMIDLIST_format(), test_items(), test_ITextDocument_Open(), test_ITextFont(), test_IUriBuilder_GetFragment(), test_IUriBuilder_GetHost(), test_IUriBuilder_GetPassword(), test_IUriBuilder_GetPath(), test_IUriBuilder_GetQuery(), test_IUriBuilder_GetSchemeName(), test_IUriBuilder_GetUserName(), test_IUriBuilder_HasBeenModified(), test_IWbemPath_GetClassName(), test_IWbemPath_GetNamespaceAt(), test_IWbemPath_GetServer(), test_IWbemPath_GetText(), test_IWbemPath_RemoveNamespaceAt(), test_IWbemPath_SetClassName(), test_IWbemPath_SetNamespaceAt(), test_IWbemPath_SetServer(), test_IWbemPath_SetText(), test_knownFolders(), test_lcmapstring_unicode(), test_LCMapStringEx(), test_LdrGetDllFullName(), test_LdrGetDllPath(), test_legacy_filter(), test_legacy_filter_registration(), test_load(), test_LocaleNameToLCID(), test_marshal_array(), test_marshal_SNB(), test_media_streams(), test_mediadet(), test_menu_add_string(), test_message_allocate_buffer_wide(), test_message_from_64bit_number(), test_message_from_string_wide(), test_message_ignore_inserts_wide(), test_message_insufficient_buffer_wide(), test_message_invalid_flags_wide(), test_MessageBoxFontTest(), test_MessageSetProp(), test_metadata_APE(), test_metadata_cHRM(), test_metadata_gAMA(), test_metadata_GCE(), test_metadata_gif(), test_metadata_GIF_comment(), test_metadata_hIST(), test_metadata_IMD(), test_metadata_LSD(), test_midiout(), test_MkParseDisplayNameEx(), test_moniker(), test_mouse_keyboard(), test_MsiGetProductProperty(), test_multibyte_to_unicode_translations(), test_mxattr_addAttribute(), test_mxattr_clear(), test_mxnamespacemanager(), test_mxnamespacemanager_override(), test_mxwriter_cdata(), test_mxwriter_characters(), test_mxwriter_comment(), test_mxwriter_default_properties(), test_mxwriter_domdoc(), test_mxwriter_dtd(), test_mxwriter_encoding(), test_mxwriter_ignorablespaces(), test_mxwriter_indent(), test_mxwriter_pi(), test_mxwriter_properties(), test_mxwriter_startenddocument(), test_mxwriter_startendelement(), test_mxwriter_startendelement_batch(), test_mxwriter_startendelement_batch2(), test_mxwriter_stream(), test_namedmap_newenum(), test_namespace(), test_namespaces_as_attributes(), test_namespaces_basic(), test_namespaces_change(), test_negative_source_length(), test_NetFwAuthorizedApplication(), test_new_screen_buffer_properties(), test_newline_normalization(), test_nodeTypedValue(), test_nodeValue(), test_note(), test_notify_proc(), test_NtAtom(), test_NtIntAtom(), test_null(), test_OleRegGetUserType(), test_OleUIAddVerbMenu(), test_one_cmdline(), test_Option_PerConnectionOption(), test_overwrite(), test_PackageIdFromFullName(), test_para_numbering(), test_ParseDisplayName(), test_passport_auth(), test_PathUnExpandEnvStrings(), test_PathUnquoteSpaces(), test_PathYetAnotherMakeUniqueName(), test_prefix_filtering(), test_preserve_charref(), test_printf_natural_string(), test_profile_string(), test_propertybag_getpropertyinfo(), test_propertytovariant(), test_props(), test_PropVariantChangeType_LPWSTR(), test_PropVariantToString(), test_PropVariantToStringAlloc(), test_PropVariantToStringWithDefault(), test_proxy_direct(), test_pSetupGetField(), test_put_data(), test_put_nodeTypedValue(), test_put_nodeValue(), test_QueryAssemblyInfo(), test_queryconfig2(), test_QueryPathOfRegTypeLib(), test_queryreader(), test_Read(), test_read_attribute(), test_read_charref(), test_read_element(), test_read_pi(), test_read_public_dtd(), test_read_system_dtd(), test_read_xmldeclaration(), test_ReadAll(), test_recinfo(), test_reference(), test_reg_query_value(), test_registry(), test_registry_property_w(), test_RegQueryValueExPerformanceData(), test_root_children(), test_RtlGetFullPathName_U(), test_RtlInitUnicodeString(), test_RtlQueryPackageIdentity(), test_save(), test_saxreader_properties(), test_Sdb(), test_SdbTagToString(), test_SearchPathW(), test_selection(), test_Session(), test_SetAccountInformation_GetAccountInformation(), test_setAttributeNode(), test_SetComment_GetComment(), test_SetInitialHlink(), test_SetParameters_GetParameters(), test_settings(), test_SetupPromptForDiskW(), test_SHCreateShellItem(), test_SHCreateShellItemArray(), test_SHFormatDateTimeW(), test_SHGetIniString(), test_SHGetNameFromIDList(), test_SHGetPathFromIDList(), test_SQLGetPrivateProfileStringW(), test_SspiEncodeStringsAsAuthIdentity(), test_SspiPrepareForCredWrite(), test_StdHlink(), test_SysAllocString(), test_SysAllocStringByteLen(), test_SysAllocStringLen(), test_SysReAllocString(), test_SysReAllocStringLen(), test_targetpath(), test_textfont_global_defaults(), test_thread_description(), test_ToUnicode(), test_TxGetText(), test_typelibmarshal(), test_urlcacheW(), test_UrlEscapeW(), test_VarDateChangeTypeEx(), test_vfw(), test_vsnwprintf_s(), test_wavein(), test_waveout(), test_WICMapGuidToShortName(), test_WICMapSchemaToName(), test_Win32_Service(), test_WinHttpSendRequest(), test_wm_notify_comboboxex(), test_wm_notify_datetime(), test_wm_notify_tooltip(), test_wndclass_section(), test_WriteLine(), test_WTSEnumerateProcessesW(), test_XDR_datatypes(), test_xmldoc(), test_xmlelem(), test_xmlelem_collection(), test_XMLHTTP(), test_xmlns_attribute(), test_xmlTypes(), test_XPath(), test_xsltext(), testAddCertificateLink(), testCreateSelfSignCert(), testExpand(), testKeyProvInfo(), testQuery(), testScreenBuffer(), testSetHelper(), textcmpWT(), TREEVIEW_EndEditLabelNow(), TREEVIEW_InsertItemT(), update_font_list(), update_size_list(), UrlCompareW(), validate_endptr(), Validate_ShimData_Win2k3(), Validate_ShimData_Win7(), Validate_ShimData_WinVista(), variant_func2(), verify_shimw_imp(), Widget_complex_struct(), Widget_VarArg_Ref_Run(), Widget_VarArg_Run(), Widget_variant(), Widget_variant_array(), WinHttpCrackUrl_test(), WinHttpCreateUrl_test(), winproc_convW(), WNetOpenEnumW(), WorkerThread(), wsprintfWTest(), and XCOPY_DoCopy().

◆ MultiByteToWideChar()

INT WINAPI MultiByteToWideChar ( UINT  page,
DWORD  flags,
LPCSTR  src,
INT  srclen,
LPWSTR  dst,
INT  dstlen 
)

Definition at line 2468 of file locale.c.

2470{
2471 const union cptable *table;
2472 int ret;
2473
2474 if (!src || !srclen || (!dst && dstlen) || dstlen < 0)
2475 {
2477 return 0;
2478 }
2479
2480 if (srclen < 0) srclen = strlen(src) + 1;
2481
2482 switch(page)
2483 {
2484 case CP_SYMBOL:
2485 if (flags)
2486 {
2488 return 0;
2489 }
2491 break;
2492 case CP_UTF7:
2493 if (flags)
2494 {
2496 return 0;
2497 }
2499 break;
2500 case CP_UNIXCP:
2501 if (unix_cptable)
2502 {
2504 break;
2505 }
2506#ifdef __APPLE__
2507 flags |= MB_COMPOSITE; /* work around broken Mac OS X filesystem that enforces decomposed Unicode */
2508#endif
2509 /* fall through */
2510 case CP_UTF8:
2511 if (flags & ~MB_FLAGSMASK)
2512 {
2514 return 0;
2515 }
2517 break;
2518 default:
2519 if (!(table = get_codepage_table( page )))
2520 {
2522 return 0;
2523 }
2524 if (flags & ~MB_FLAGSMASK)
2525 {
2527 return 0;
2528 }
2530 break;
2531 }
2532
2533 if (ret < 0)
2534 {
2535 switch(ret)
2536 {
2537 case -1: SetLastError( ERROR_INSUFFICIENT_BUFFER ); break;
2538 case -2: SetLastError( ERROR_NO_UNICODE_TRANSLATION ); break;
2539 }
2540 ret = 0;
2541 }
2542 TRACE("cp %d %s -> %s, ret = %d\n",
2544 return ret;
2545}
#define CP_UNIXCP
Definition: compat.h:79
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
#define MB_FLAGSMASK
Definition: locale.c:60
static int utf7_mbstowcs(const char *src, int srclen, WCHAR *dst, int dstlen)
Definition: locale.c:2352
#define MB_COMPOSITE
Definition: unicode.h:40
int wine_cpsymbol_mbstowcs(const char *src, int srclen, WCHAR *dst, int dstlen)
int wine_cp_mbstowcs(const union cptable *table, int flags, const char *src, int srclen, WCHAR *dst, int dstlen)
Definition: mbtowc.c:265
int wine_utf8_mbstowcs(int flags, const char *src, int srclen, WCHAR *dst, int dstlen)
Definition: utf8.c:304
#define CP_SYMBOL
Definition: winnls.h:252

◆ NLS_EnumLanguageGroupLocales()

static BOOL NLS_EnumLanguageGroupLocales ( ENUMLANGUAGEGROUPLOCALE_CALLBACKS lpProcs)
static

Definition at line 4605 of file locale.c.

4606{
4607 static const WCHAR szAlternateSortsKeyName[] = {
4608 'A','l','t','e','r','n','a','t','e',' ','S','o','r','t','s','\0'
4609 };
4610 WCHAR szNumber[10], szValue[4];
4611 HANDLE hKey;
4612 BOOL bContinue = TRUE, bAlternate = FALSE;
4613 LGRPID lgrpid;
4614 ULONG ulIndex = 1; /* Ignore default entry of 1st key */
4615
4616 if (!lpProcs || !lpProcs->lgrpid || lpProcs->lgrpid > LGRPID_ARMENIAN)
4617 {
4619 return FALSE;
4620 }
4621
4622 if (lpProcs->dwFlags)
4623 {
4625 return FALSE;
4626 }
4627
4629
4630 if (!hKey)
4631 WARN("NLS registry key not found. Please apply the default registry file 'wine.inf'\n");
4632
4633 while (bContinue)
4634 {
4635 if (NLS_RegEnumValue( hKey, ulIndex, szNumber, sizeof(szNumber),
4636 szValue, sizeof(szValue) ))
4637 {
4638 lgrpid = strtoulW( szValue, NULL, 16 );
4639
4640 TRACE("lcid %s, grpid %d (%smatched)\n", debugstr_w(szNumber),
4641 lgrpid, lgrpid == lpProcs->lgrpid ? "" : "not ");
4642
4643 if (lgrpid == lpProcs->lgrpid)
4644 {
4645 LCID lcid;
4646
4647 lcid = strtoulW( szNumber, NULL, 16 );
4648
4649 /* FIXME: native returns extra text for a few (17/150) locales, e.g:
4650 * '00000437 ;Georgian'
4651 * At present we only pass the LCID string.
4652 */
4653
4654 if (lpProcs->procW)
4655 bContinue = lpProcs->procW( lgrpid, lcid, szNumber, lpProcs->lParam );
4656 else
4657 {
4658 char szNumberA[sizeof(szNumber)/sizeof(WCHAR)];
4659
4660 WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0);
4661
4662 bContinue = lpProcs->procA( lgrpid, lcid, szNumberA, lpProcs->lParam );
4663 }
4664 }
4665
4666 ulIndex++;
4667 }
4668 else
4669 {
4670 /* Finished enumerating this key */
4671 if (!bAlternate)
4672 {
4673 /* Enumerate alternate sorts also */
4674 hKey = NLS_RegOpenKey( hKey, szAlternateSortsKeyName );
4675 bAlternate = TRUE;
4676 ulIndex = 0;
4677 }
4678 else
4679 bContinue = FALSE; /* Finished both keys */
4680 }
4681
4682 if (!bContinue)
4683 break;
4684 }
4685
4686 if (hKey)
4687 NtClose( hKey );
4688
4689 return TRUE;
4690}
static const WCHAR szLocaleKeyName[]
Definition: locale.c:70
static BOOL NLS_RegEnumValue(HANDLE hKey, UINT ulIndex, LPWSTR szValueName, ULONG valueNameSize, LPWSTR szValueData, ULONG valueDataSize)
Definition: locale.c:4310
uint32_t ULONG
Definition: typedefs.h:59
DWORD LGRPID
Definition: winnls.h:584
#define LGRPID_ARMENIAN
Definition: winnls.h:520

Referenced by EnumLanguageGroupLocalesA(), and EnumLanguageGroupLocalesW().

◆ NLS_EnumSystemLanguageGroups()

static BOOL NLS_EnumSystemLanguageGroups ( ENUMLANGUAGEGROUP_CALLBACKS lpProcs)
static

Definition at line 4409 of file locale.c.

4410{
4411 WCHAR szNumber[10], szValue[4];
4412 HANDLE hKey;
4413 BOOL bContinue = TRUE;
4414 ULONG ulIndex = 0;
4415
4416 if (!lpProcs)
4417 {
4419 return FALSE;
4420 }
4421
4422 switch (lpProcs->dwFlags)
4423 {
4424 case 0:
4425 /* Default to LGRPID_INSTALLED */
4426 lpProcs->dwFlags = LGRPID_INSTALLED;
4427 /* Fall through... */
4428 case LGRPID_INSTALLED:
4429 case LGRPID_SUPPORTED:
4430 break;
4431 default:
4433 return FALSE;
4434 }
4435
4437
4438 if (!hKey)
4439 FIXME("NLS registry key not found. Please apply the default registry file 'wine.inf'\n");
4440
4441 while (bContinue)
4442 {
4443 if (NLS_RegEnumValue( hKey, ulIndex, szNumber, sizeof(szNumber),
4444 szValue, sizeof(szValue) ))
4445 {
4446 BOOL bInstalled = szValue[0] == '1';
4447 LGRPID lgrpid = strtoulW( szNumber, NULL, 16 );
4448
4449 TRACE("grpid %s (%sinstalled)\n", debugstr_w(szNumber),
4450 bInstalled ? "" : "not ");
4451
4452 if (lpProcs->dwFlags == LGRPID_SUPPORTED || bInstalled)
4453 {
4454 WCHAR szGrpName[48];
4455
4456 if (!NLS_GetLanguageGroupName( lgrpid, szGrpName, sizeof(szGrpName) / sizeof(WCHAR) ))
4457 szGrpName[0] = '\0';
4458
4459 if (lpProcs->procW)
4460 bContinue = lpProcs->procW( lgrpid, szNumber, szGrpName, lpProcs->dwFlags,
4461 lpProcs->lParam );
4462 else
4463 {
4464 char szNumberA[sizeof(szNumber)/sizeof(WCHAR)];
4465 char szGrpNameA[48];
4466
4467 /* FIXME: MSDN doesn't say which code page the W->A translation uses,
4468 * or whether the language names are ever localised. Assume CP_ACP.
4469 */
4470
4471 WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0);
4472 WideCharToMultiByte(CP_ACP, 0, szGrpName, -1, szGrpNameA, sizeof(szGrpNameA), 0, 0);
4473
4474 bContinue = lpProcs->procA( lgrpid, szNumberA, szGrpNameA, lpProcs->dwFlags,
4475 lpProcs->lParam );
4476 }
4477 }
4478
4479 ulIndex++;
4480 }
4481 else
4482 bContinue = FALSE;
4483
4484 if (!bContinue)
4485 break;
4486 }
4487
4488 if (hKey)
4489 NtClose( hKey );
4490
4491 return TRUE;
4492}
static BOOL NLS_GetLanguageGroupName(LGRPID lgrpid, LPWSTR szName, ULONG nameSize)
Definition: locale.c:4359

Referenced by EnumSystemLanguageGroupsA(), and EnumSystemLanguageGroupsW().

◆ NLS_GetLanguageGroupName()

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

Definition at line 4359 of file locale.c.

4360{
4361 LANGID langId;
4362 LPCWSTR szResourceName = MAKEINTRESOURCEW(((lgrpid + 0x2000) >> 4) + 1);
4363 HRSRC hResource;
4364 BOOL bRet = FALSE;
4365
4366 /* FIXME: Is it correct to use the system default langid? */
4367 langId = GetSystemDefaultLangID();
4368
4369 if (SUBLANGID(langId) == SUBLANG_NEUTRAL) langId = get_default_sublang( langId );
4370
4371 hResource = FindResourceExW( kernel32_handle, (LPWSTR)RT_STRING, szResourceName, langId );
4372
4373 if (hResource)
4374 {
4375 HGLOBAL hResDir = LoadResource( kernel32_handle, hResource );
4376
4377 if (hResDir)
4378 {
4379 ULONG iResourceIndex = lgrpid & 0xf;
4380 LPCWSTR lpResEntry = LockResource( hResDir );
4381 ULONG i;
4382
4383 for (i = 0; i < iResourceIndex; i++)
4384 lpResEntry += *lpResEntry + 1;
4385
4386 if (*lpResEntry < nameSize)
4387 {
4388 memcpy( szName, lpResEntry + 1, *lpResEntry * sizeof(WCHAR) );
4389 szName[*lpResEntry] = '\0';
4390 bRet = TRUE;
4391 }
4392
4393 }
4394 FreeResource( hResource );
4395 }
4396 return bRet;
4397}
BOOL WINAPI FreeResource(HGLOBAL handle)
Definition: res.c:559
LANGID WINAPI GetSystemDefaultLangID(void)
Definition: locale.c:1199
static const WCHAR szName[]
Definition: powrprof.c:45
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by NLS_EnumSystemLanguageGroups().

◆ NLS_RegEnumValue()

static BOOL NLS_RegEnumValue ( HANDLE  hKey,
UINT  ulIndex,
LPWSTR  szValueName,
ULONG  valueNameSize,
LPWSTR  szValueData,
ULONG  valueDataSize 
)
static

Definition at line 4310 of file locale.c.

4314{
4315 BYTE buffer[80];
4317 DWORD dwLen;
4318
4320 buffer, sizeof(buffer), &dwLen ) != STATUS_SUCCESS ||
4321 info->NameLength > valueNameSize ||
4322 info->DataLength > valueDataSize)
4323 {
4324 return FALSE;
4325 }
4326
4327 TRACE("info->Name %s info->DataLength %d\n", debugstr_w(info->Name), info->DataLength);
4328
4329 memcpy( szValueName, info->Name, info->NameLength);
4330 szValueName[info->NameLength / sizeof(WCHAR)] = '\0';
4331 memcpy( szValueData, buffer + info->DataOffset, info->DataLength );
4332 szValueData[info->DataLength / sizeof(WCHAR)] = '\0';
4333
4334 TRACE("returning %s %s\n", debugstr_w(szValueName), debugstr_w(szValueData));
4335 return TRUE;
4336}
@ KeyValueFullInformation
Definition: nt_native.h:1184
NTSTATUS NTAPI NtEnumerateValueKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, OUT PVOID KeyValueInformation, IN ULONG Length, OUT PULONG ResultLength)
Definition: ntapi.c:542
unsigned char BYTE
Definition: xxhash.c:193

Referenced by NLS_EnumLanguageGroupLocales(), and NLS_EnumSystemLanguageGroups().

◆ NLS_RegGetDword()

static BOOL NLS_RegGetDword ( HANDLE  hKey,
LPCWSTR  szValueName,
DWORD lpVal 
)
static

Definition at line 4338 of file locale.c.

4339{
4340 BYTE buffer[128];
4342 DWORD dwSize = sizeof(buffer);
4343 UNICODE_STRING valueName;
4344
4345 RtlInitUnicodeString( &valueName, szValueName );
4346
4347 TRACE("%p, %s\n", hKey, debugstr_w(szValueName));
4350 info->DataLength == sizeof(DWORD))
4351 {
4352 memcpy(lpVal, info->Data, sizeof(DWORD));
4353 return TRUE;
4354 }
4355
4356 return FALSE;
4357}
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by IsValidLanguageGroup().

◆ NLS_RegOpenKey()

static HANDLE NLS_RegOpenKey ( HANDLE  hRootKey,
LPCWSTR  szKeyName 
)
static

Definition at line 4285 of file locale.c.

4287{
4288 UNICODE_STRING keyName;
4290 HANDLE hkey;
4291
4292 RtlInitUnicodeString( &keyName, szKeyName );
4293#ifdef __REACTOS__
4295#else
4296 InitializeObjectAttributes(&attr, &keyName, 0, hRootKey, NULL);
4297#endif
4298
4299 if (NtOpenKey( &hkey, KEY_READ, &attr ) != STATUS_SUCCESS)
4300 hkey = 0;
4301
4302 return hkey;
4303}
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define KEY_READ
Definition: nt_native.h:1026

Referenced by GetUserGeoID(), IsValidLanguageGroup(), NLS_EnumLanguageGroupLocales(), and NLS_EnumSystemLanguageGroups().

◆ NormalizeString()

INT WINAPI NormalizeString ( NORM_FORM  NormForm,
LPCWSTR  lpSrcString,
INT  cwSrcLength,
LPWSTR  lpDstString,
INT  cwDstLength 
)

Definition at line 5591 of file locale.c.

5593{
5594 FIXME("%x %p %d %p %d\n", NormForm, lpSrcString, cwSrcLength, lpDstString, cwDstLength);
5596 return 0;
5597}

Referenced by InitFunctionPointers().

◆ ResolveLocaleName()

INT WINAPI ResolveLocaleName ( LPCWSTR  name,
LPWSTR  localename,
INT  len 
)

Definition at line 6172 of file locale.c.

6173{
6174 FIXME("stub: %s, %p, %d\n", wine_dbgstr_w(name), localename, len);
6175
6177 return 0;
6178}
#define wine_dbgstr_w
Definition: kernel32.h:34

Referenced by InitFunctionPointers().

◆ SetCPGlobal()

UINT WINAPI SetCPGlobal ( UINT  acp)

Definition at line 2041 of file locale.c.

2042{
2043 UINT ret = GetACP();
2044 const union cptable *new_cptable = wine_cp_get_table( acp );
2045
2046 if (new_cptable) ansi_cptable = new_cptable;
2047 return ret;
2048}

◆ SetLocaleInfoA()

BOOL WINAPI SetLocaleInfoA ( LCID  lcid,
LCTYPE  lctype,
LPCSTR  data 
)

Definition at line 1891 of file locale.c.

1892{
1894 WCHAR *strW;
1895 DWORD len;
1896 BOOL ret;
1897
1898 if (!(lctype & LOCALE_USE_CP_ACP)) codepage = get_lcid_codepage( lcid );
1899
1900 if (!data)
1901 {
1903 return FALSE;
1904 }
1905 len = MultiByteToWideChar( codepage, 0, data, -1, NULL, 0 );
1906 if (!(strW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
1907 {
1909 return FALSE;
1910 }
1912 ret = SetLocaleInfoW( lcid, lctype, strW );
1913 HeapFree( GetProcessHeap(), 0, strW );
1914 return ret;
1915}
WCHAR strW[12]
Definition: clipboard.c:2025

Referenced by test_GetNumberFormatA(), test_SetLocaleInfo(), and test_VarCat().

◆ SetLocaleInfoW()

BOOL WINAPI SetLocaleInfoW ( LCID  lcid,
LCTYPE  lctype,
LPCWSTR  data 
)

Definition at line 1923 of file locale.c.

1924{
1925 struct registry_value *value;
1926 static const WCHAR intlW[] = {'i','n','t','l',0 };
1929 HANDLE hkey;
1930
1931 lctype &= 0xffff;
1933
1934 if (!data || !value)
1935 {
1937 return FALSE;
1938 }
1939
1941 {
1943 return FALSE;
1944 }
1945
1946 TRACE("setting %x (%s) to %s\n", lctype, debugstr_w(value->name), debugstr_w(data) );
1947
1948 /* FIXME: should check that data to set is sane */
1949
1950 /* FIXME: profile functions should map to registry */
1951 WriteProfileStringW( intlW, value->name, data );
1952
1953 if (!(hkey = create_registry_key())) return FALSE;
1955 status = NtSetValueKey( hkey, &valueW, 0, REG_SZ, (PVOID)data, (strlenW(data)+1)*sizeof(WCHAR) );
1956
1958 HeapFree( GetProcessHeap(), 0, value->cached_value );
1959 value->cached_value = NULL;
1961
1963 {
1964 /* Set I-value from S value */
1965 WCHAR *lpD, *lpM, *lpY;
1966 WCHAR szBuff[2];
1967
1968 lpD = strrchrW(data, 'd');
1969 lpM = strrchrW(data, 'M');
1970 lpY = strrchrW(data, 'y');
1971
1972 if (lpD <= lpM)
1973 {
1974 szBuff[0] = '1'; /* D-M-Y */
1975 }
1976 else
1977 {
1978 if (lpY <= lpM)
1979 szBuff[0] = '2'; /* Y-M-D */
1980 else
1981 szBuff[0] = '0'; /* M-D-Y */
1982 }
1983
1984 szBuff[1] = '\0';
1985
1988 else
1990
1992
1993 WriteProfileStringW( intlW, value->name, szBuff );
1994
1996 status = NtSetValueKey( hkey, &valueW, 0, REG_SZ, szBuff, sizeof(szBuff) );
1997
1999 HeapFree( GetProcessHeap(), 0, value->cached_value );
2000 value->cached_value = NULL;
2002 }
2003
2004 NtClose( hkey );
2005
2007 return !status;
2008}
static const WCHAR valueW[]
Definition: object.c:48
BOOL WINAPI WriteProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR string)
Definition: profile.c:1287
#define strrchrW(s, c)
Definition: unicode.h:41

Referenced by locale_update_registry(), SetLocaleInfoA(), test_GetNumberFormatA(), and test_SetLocaleInfo().

◆ SetThreadLocale()

BOOL WINAPI SetThreadLocale ( LCID  lcid)

Definition at line 2822 of file locale.c.

2823{
2824 TRACE("(0x%04X)\n", lcid);
2825
2827
2828 if (lcid != GetThreadLocale())
2829 {
2831 {
2833 return FALSE;
2834 }
2835
2836 NtCurrentTeb()->CurrentLocale = lcid;
2837 }
2838 return TRUE;
2839}
BOOL WINAPI IsValidLocale(LCID lcid, DWORD flags)
Definition: locale.c:2925
#define LCID_SUPPORTED
Definition: winnls.h:215

Referenced by enum_proc(), LocaleDlgProc(), SetLocale(), SetTEBLangID(), SetupOpenInfFileExW(), and test_threadcp().

◆ SetThreadPreferredUILanguages()

BOOL WINAPI SetThreadPreferredUILanguages ( DWORD  flags,
PCZZWSTR  buffer,
PULONG  count 
)

Definition at line 1325 of file locale.c.

1326{
1327 FIXME( "%u, %p, %p\n", flags, buffer, count );
1328 return TRUE;
1329}

◆ SetThreadUILanguage()

LANGID WINAPI SetThreadUILanguage ( LANGID  langid)

Definition at line 2857 of file locale.c.

2858{
2859 TRACE("(0x%04x) stub - returning success\n", langid);
2860 return langid;
2861}

Referenced by InitFunctionPointers().

◆ setup_unix_locales()

static UINT setup_unix_locales ( void  )
static

Definition at line 1116 of file locale.c.

1117{
1118 struct locale_name locale_name;
1119 WCHAR buffer[128], ctype_buff[128];
1120 const char *locale;
1121 UINT unix_cp = 0;
1122
1123 if ((locale = get_locale( LC_CTYPE, "LC_CTYPE" )))
1124 {
1125 strcpynAtoW( ctype_buff, locale, sizeof(ctype_buff)/sizeof(WCHAR) );
1126 parse_locale_name( ctype_buff, &locale_name );
1129 }
1130 if (!lcid_LC_CTYPE) /* this one needs a default value */
1132
1133 TRACE( "got lcid %04x (%d matches) for LC_CTYPE=%s\n",
1135
1136#define GET_UNIX_LOCALE(cat) do \
1137 if ((locale = get_locale( cat, #cat ))) \
1138 { \
1139 strcpynAtoW( buffer, locale, sizeof(buffer)/sizeof(WCHAR) ); \
1140 if (!strcmpW( buffer, ctype_buff )) lcid_##cat = lcid_LC_CTYPE; \
1141 else { \
1142 parse_locale_name( buffer, &locale_name ); \
1143 lcid_##cat = locale_name.lcid; \
1144 TRACE( "got lcid %04x (%d matches) for " #cat "=%s\n", \
1145 locale_name.lcid, locale_name.matches, debugstr_a(locale) ); \
1146 } \
1147 } while (0)
1148
1150 GET_UNIX_LOCALE( LC_MESSAGES );
1154#ifdef LC_PAPER
1155 GET_UNIX_LOCALE( LC_PAPER );
1156#endif
1157#ifdef LC_MEASUREMENT
1158 GET_UNIX_LOCALE( LC_MEASUREMENT );
1159#endif
1160#ifdef LC_TELEPHONE
1161 GET_UNIX_LOCALE( LC_TELEPHONE );
1162#endif
1163
1164#undef GET_UNIX_LOCALE
1165
1166 return unix_cp;
1167}
static void strcpynAtoW(WCHAR *dst, const char *src, size_t n)
Definition: locale.c:267
#define GET_UNIX_LOCALE(cat)
#define LC_MONETARY
Definition: locale.h:28
#define LC_TIME
Definition: locale.h:30
#define LC_COLLATE
Definition: locale.h:26
#define SORT_DEFAULT
#define LANG_ENGLISH
Definition: nls.h:52
UINT codepage
Definition: locale.c:157

Referenced by LOCALE_Init().

◆ SetUserGeoID()

BOOL WINAPI SetUserGeoID ( GEOID  GeoID)

Definition at line 4807 of file locale.c.

4808{
4809 static const WCHAR geoW[] = {'G','e','o',0};
4810 static const WCHAR nationW[] = {'N','a','t','i','o','n',0};
4811 static const WCHAR formatW[] = {'%','i',0};
4812 UNICODE_STRING nameW,keyW;
4813 WCHAR bufferW[10];
4815 HANDLE hkey;
4816
4817 if(!(hkey = create_registry_key())) return FALSE;
4818
4819 attr.Length = sizeof(attr);
4820 attr.RootDirectory = hkey;
4821 attr.ObjectName = &nameW;
4822 attr.Attributes = 0;
4823 attr.SecurityDescriptor = NULL;
4824 attr.SecurityQualityOfService = NULL;
4825 RtlInitUnicodeString( &nameW, geoW );
4826 RtlInitUnicodeString( &keyW, nationW );
4827
4828 if (NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ) != STATUS_SUCCESS)
4829
4830 {
4831 NtClose(attr.RootDirectory);
4832 return FALSE;
4833 }
4834
4835 sprintfW(bufferW, formatW, GeoID);
4836 NtSetValueKey(hkey, &keyW, 0, REG_SZ, bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR));
4837 NtClose(attr.RootDirectory);
4838 NtClose(hkey);
4839 return TRUE;
4840}

Referenced by SetUserGeoName(), test_geo_name(), and update_locale_registry().

◆ strcpynAtoW()

static void strcpynAtoW ( WCHAR dst,
const char src,
size_t  n 
)
inlinestatic

Definition at line 267 of file locale.c.

268{
269 while (n > 1 && *src)
270 {
271 *dst++ = (unsigned char)*src++;
272 n--;
273 }
274 if (n) *dst = 0;
275}
unsigned char
Definition: typeof.h:29

Referenced by setup_unix_locales().

◆ utf7_can_directly_encode()

static BOOL utf7_can_directly_encode ( WCHAR  codepoint)
inlinestatic

Definition at line 2553 of file locale.c.

2554{
2555 static const BOOL directly_encodable_table[] =
2556 {
2557 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, /* 0x00 - 0x0F */
2558 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1F */
2559 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, /* 0x20 - 0x2F */
2560 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /* 0x30 - 0x3F */
2561 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4F */
2562 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 0x50 - 0x5F */
2563 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6F */
2564 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /* 0x70 - 0x7A */
2565 };
2566
2567 return codepoint <= 0x7A ? directly_encodable_table[codepoint] : FALSE;
2568}

Referenced by utf7_wcstombs().

◆ utf7_mbstowcs()

static int utf7_mbstowcs ( const char src,
int  srclen,
WCHAR dst,
int  dstlen 
)
static

Definition at line 2352 of file locale.c.

2353{
2354 static const signed char base64_decoding_table[] =
2355 {
2356 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x00-0x0F */
2357 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x10-0x1F */
2358 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, /* 0x20-0x2F */
2359 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, /* 0x30-0x3F */
2360 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, /* 0x40-0x4F */
2361 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, /* 0x50-0x5F */
2362 -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, /* 0x60-0x6F */
2363 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 /* 0x70-0x7F */
2364 };
2365
2366 const char *source_end = src + srclen;
2367 int dest_index = 0;
2368
2369 DWORD byte_pair = 0;
2370 short offset = 0;
2371
2372 while (src < source_end)
2373 {
2374 if (*src == '+')
2375 {
2376 src++;
2377 if (src >= source_end)
2378 break;
2379
2380 if (*src == '-')
2381 {
2382 /* just a plus sign escaped as +- */
2383 if (!utf7_write_w(dst, dstlen, &dest_index, '+'))
2384 return -1;
2385 src++;
2386 continue;
2387 }
2388
2389 do
2390 {
2391 signed char sextet = *src;
2392 if (sextet == '-')
2393 {
2394 /* skip over the dash and end base64 decoding
2395 * the current, unfinished byte pair is discarded */
2396 src++;
2397 offset = 0;
2398 break;
2399 }
2400 if (sextet < 0)
2401 {
2402 /* the next character of src is < 0 and therefore not part of a base64 sequence
2403 * the current, unfinished byte pair is NOT discarded in this case
2404 * this is probably a bug in Windows */
2405 break;
2406 }
2407
2408 sextet = base64_decoding_table[sextet];
2409 if (sextet == -1)
2410 {
2411 /* -1 means that the next character of src is not part of a base64 sequence
2412 * in other words, all sextets in this base64 sequence have been processed
2413 * the current, unfinished byte pair is discarded */
2414 offset = 0;
2415 break;
2416 }
2417
2418 byte_pair = (byte_pair << 6) | sextet;
2419 offset += 6;
2420
2421 if (offset >= 16)
2422 {
2423 /* this byte pair is done */
2424 if (!utf7_write_w(dst, dstlen, &dest_index, (byte_pair >> (offset - 16)) & 0xFFFF))
2425 return -1;
2426 offset -= 16;
2427 }
2428
2429 src++;
2430 }
2431 while (src < source_end);
2432 }
2433 else
2434 {
2435 /* we have to convert to unsigned char in case *src < 0 */
2436 if (!utf7_write_w(dst, dstlen, &dest_index, (unsigned char)*src))
2437 return -1;
2438 src++;
2439 }
2440 }
2441
2442 return dest_index;
2443}
static BOOL utf7_write_w(WCHAR *dst, int dstlen, int *index, WCHAR character)
Definition: locale.c:2328
GLintptr offset
Definition: glext.h:5920

Referenced by MultiByteToWideChar().

◆ utf7_wcstombs()

static int utf7_wcstombs ( const WCHAR src,
int  srclen,
char dst,
int  dstlen 
)
static

Definition at line 2602 of file locale.c.

2603{
2604 static const char base64_encoding_table[] =
2605 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2606
2607 const WCHAR *source_end = src + srclen;
2608 int dest_index = 0;
2609
2610 while (src < source_end)
2611 {
2612 if (*src == '+')
2613 {
2614 if (!utf7_write_c(dst, dstlen, &dest_index, '+'))
2615 return -1;
2616 if (!utf7_write_c(dst, dstlen, &dest_index, '-'))
2617 return -1;
2618 src++;
2619 }
2620 else if (utf7_can_directly_encode(*src))
2621 {
2622 if (!utf7_write_c(dst, dstlen, &dest_index, *src))
2623 return -1;
2624 src++;
2625 }
2626 else
2627 {
2628 unsigned int offset = 0;
2629 DWORD byte_pair = 0;
2630
2631 if (!utf7_write_c(dst, dstlen, &dest_index, '+'))
2632 return -1;
2633
2634 while (src < source_end && !utf7_can_directly_encode(*src))
2635 {
2636 byte_pair = (byte_pair << 16) | *src;
2637 offset += 16;
2638 while (offset >= 6)
2639 {
2640 if (!utf7_write_c(dst, dstlen, &dest_index, base64_encoding_table[(byte_pair >> (offset - 6)) & 0x3F]))
2641 return -1;
2642 offset -= 6;
2643 }
2644 src++;
2645 }
2646
2647 if (offset)
2648 {
2649 /* Windows won't create a padded base64 character if there's no room for the - sign
2650 * as well ; this is probably a bug in Windows */
2651 if (dstlen > 0 && dest_index + 1 >= dstlen)
2652 return -1;
2653
2654 byte_pair <<= (6 - offset);
2655 if (!utf7_write_c(dst, dstlen, &dest_index, base64_encoding_table[byte_pair & 0x3F]))
2656 return -1;
2657 }
2658
2659 /* Windows always explicitly terminates the base64 sequence
2660 even though RFC 2152 (page 3, rule 2) does not require this */
2661 if (!utf7_write_c(dst, dstlen, &dest_index, '-'))
2662 return -1;
2663 }
2664 }
2665
2666 return dest_index;
2667}
static BOOL utf7_can_directly_encode(WCHAR codepoint)
Definition: locale.c:2553
static BOOL utf7_write_c(char *dst, int dstlen, int *index, char character)
Definition: locale.c:2578

Referenced by WideCharToMultiByte().

◆ utf7_write_c()

static BOOL utf7_write_c ( char dst,
int  dstlen,
int index,
char  character 
)
inlinestatic

Definition at line 2578 of file locale.c.

2579{
2580 if (dstlen > 0)
2581 {
2582 if (*index >= dstlen)
2583 return FALSE;
2584
2585 dst[*index] = character;
2586 }
2587
2588 (*index)++;
2589
2590 return TRUE;
2591}
#define index(s, c)
Definition: various.h:29

Referenced by utf7_wcstombs().

◆ utf7_write_w()

static BOOL utf7_write_w ( WCHAR dst,
int  dstlen,
int index,
WCHAR  character 
)
inlinestatic

Definition at line 2328 of file locale.c.

2329{
2330 if (dstlen > 0)
2331 {
2332 if (*index >= dstlen)
2333 return FALSE;
2334
2335 dst[*index] = character;
2336 }
2337
2338 (*index)++;
2339
2340 return TRUE;
2341}

Referenced by utf7_mbstowcs().

◆ VerLanguageNameA()

DWORD WINAPI VerLanguageNameA ( DWORD  wLang,
LPSTR  szLang,
DWORD  nSize 
)

Definition at line 3076 of file locale.c.

3077{
3078 return GetLocaleInfoA( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
3079}
INT WINAPI GetLocaleInfoA(LCID lcid, LCTYPE lctype, LPSTR buffer, INT len)
Definition: locale.c:1609
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:1834
#define LOCALE_SENGLANGUAGE
Definition: winnls.h:32

◆ VerLanguageNameW()

DWORD WINAPI VerLanguageNameW ( DWORD  wLang,
LPWSTR  szLang,
DWORD  nSize 
)

Definition at line 3087 of file locale.c.

3088{
3089 return GetLocaleInfoW( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize );
3090}

Referenced by CFileVersionInfo::GetLangName().

◆ WideCharToMultiByte()

INT WINAPI WideCharToMultiByte ( UINT  page,
DWORD  flags,
LPCWSTR  src,
INT  srclen,
LPSTR  dst,
INT  dstlen,
LPCSTR  defchar,
BOOL used 
)

Definition at line 2694 of file locale.c.

2696{
2697 const union cptable *table;
2698 int ret, used_tmp;
2699
2700 if (!src || !srclen || (!dst && dstlen) || dstlen < 0)
2701 {
2703 return 0;
2704 }
2705
2706 if (srclen < 0) srclen = strlenW(src) + 1;
2707
2708 switch(page)
2709 {
2710 case CP_SYMBOL:
2711 /* when using CP_SYMBOL, ERROR_INVALID_FLAGS takes precedence */
2712 if (flags)
2713 {
2715 return 0;
2716 }
2717 if (defchar || used)
2718 {
2720 return 0;
2721 }
2723 break;
2724 case CP_UTF7:
2725 /* when using CP_UTF7, ERROR_INVALID_PARAMETER takes precedence */
2726 if (defchar || used)
2727 {
2729 return 0;
2730 }
2731 if (flags)
2732 {
2734 return 0;
2735 }
2737 break;
2738 case CP_UNIXCP:
2739 if (unix_cptable)
2740 {
2742 defchar, used ? &used_tmp : NULL );
2743 break;
2744 }
2745 /* fall through */
2746 case CP_UTF8:
2747 if (defchar || used)
2748 {
2750 return 0;
2751 }
2752 if (flags & ~WC_FLAGSMASK)
2753 {
2755 return 0;
2756 }
2758 break;
2759 default:
2760 if (!(table = get_codepage_table( page )))
2761 {
2763 return 0;
2764 }
2765 if (flags & ~WC_FLAGSMASK)
2766 {
2768 return 0;
2769 }
2771 defchar, used ? &used_tmp : NULL );
2772 if (used) *used = used_tmp;
2773 break;
2774 }
2775
2776 if (ret < 0)
2777 {
2778 switch(ret)
2779 {
2780 case -1: SetLastError( ERROR_INSUFFICIENT_BUFFER ); break;
2781 case -2: SetLastError( ERROR_NO_UNICODE_TRANSLATION ); break;
2782 }
2783 ret = 0;
2784 }
2785 TRACE("cp %d %s -> %s, ret = %d\n",
2787 return ret;
2788}
static int used
Definition: adh-main.c:39
#define WC_FLAGSMASK
Definition: locale.c:61
static int utf7_wcstombs(const WCHAR *src, int srclen, char *dst, int dstlen)
Definition: locale.c:2602
int wine_cpsymbol_wcstombs(const WCHAR *src, int srclen, char *dst, int dstlen)
int wine_utf8_wcstombs(int flags, const WCHAR *src, int srclen, char *dst, int dstlen)
Definition: utf8.c:98
int wine_cp_wcstombs(const union cptable *table, int flags, const WCHAR *src, int srclen, char *dst, int dstlen, const char *defchar, int *used)
Definition: wctomb.c:411

◆ wine_compare_string()

int wine_compare_string ( int  flags,
const WCHAR str1,
int  len1,
const WCHAR str2,
int  len2 
)

Definition at line 358 of file sortkey.c.

360{
361 int ret;
362
363 ret = compare_unicode_weights(flags, str1, len1, str2, len2);
364 if (!ret)
365 {
366 if (!(flags & NORM_IGNORENONSPACE))
368 if (!ret && !(flags & NORM_IGNORECASE))
369 ret = compare_case_weights(flags, str1, len1, str2, len2);
370 }
371 return ret;
372}
static int compare_case_weights(int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2)
Definition: sortkey.c:299
static int compare_diacritic_weights(int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2)
Definition: sortkey.c:240
static int compare_unicode_weights(int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2)
Definition: sortkey.c:159

Referenced by CompareStringEx().

◆ wine_fold_string()

int wine_fold_string ( int  flags,
const WCHAR src,
int  srclen,
WCHAR dst,
int  dstlen 
)

Definition at line 118 of file fold.c.

119{
120 WCHAR *dstbase = dst;
121 const WCHAR *expand;
122 int i;
123
124 if (srclen == -1)
125 srclen = strlenW(src) + 1; /* Include terminating NUL in count */
126
127 if (!dstlen)
128 {
129 /* Calculate the required size for dst */
130 dstlen = srclen;
131
132 if (flags & MAP_EXPAND_LIGATURES)
133 {
134 while (srclen--)
135 {
137 src++;
138 }
139 }
140 else if (flags & MAP_COMPOSITE)
141 {
142 /* FIXME */
143 }
144 else if (flags & MAP_PRECOMPOSED)
145 {
146 /* FIXME */
147 }
148 return dstlen;
149 }
150
151 if (srclen > dstlen)
152 return 0;
153
154 dstlen -= srclen;
155
156 /* Actually perform the mapping(s) specified */
157 for (i = 0; i < srclen; i++)
158 {
159 WCHAR ch = *src;
160
161 if (flags & MAP_EXPAND_LIGATURES)
162 {
164 if (expand[0])
165 {
166 if (!dstlen--)
167 return 0;
168 dst[0] = expand[0];
169 if (expand[2])
170 {
171 if (!dstlen--)
172 return 0;
173 *++dst = expand[1];
174 ch = expand[2];
175 }
176 else
177 ch = expand[1];
178 dst++;
179 }
180 }
181 else if (flags & MAP_COMPOSITE)
182 {
183 /* FIXME */
184 }
185 else if (flags & MAP_PRECOMPOSED)
186 {
187 /* FIXME */
188 }
189 if (flags & MAP_FOLDDIGITS)
191 if (flags & MAP_FOLDCZONE)
193
194 *dst++ = ch;
195 src++;
196 }
197 return dst - dstbase;
198}
static BOOL expand(LPINT ac, LPTSTR **arg, LPCTSTR pattern)
Definition: misc.c:228
static WCHAR to_unicode_digit(WCHAR ch)
Definition: fold.c:23
static WCHAR to_unicode_native(WCHAR ch)
Definition: fold.c:29
static const WCHAR * get_ligature(WCHAR wc)
Definition: fold.c:100
static int get_ligature_len(WCHAR wc)
Definition: fold.c:84
#define MAP_FOLDDIGITS
Definition: winnls.h:232

Referenced by FoldStringW().

◆ wine_get_sortkey()

int wine_get_sortkey ( int  flags,
const WCHAR src,
int  srclen,
char dst,
int  dstlen 
)

Definition at line 33 of file sortkey.c.

34{
35 WCHAR dummy[4]; /* no decomposition is larger than 4 chars */
36 int key_len[4];
37 char *key_ptr[4];
38 const WCHAR *src_save = src;
39 int srclen_save = srclen;
40
41 key_len[0] = key_len[1] = key_len[2] = key_len[3] = 0;
42 for (; srclen; srclen--, src++)
43 {
44 unsigned int i, decomposed_len = 1;/*wine_decompose(*src, dummy, 4);*/
45 dummy[0] = *src;
46 if (decomposed_len)
47 {
48 for (i = 0; i < decomposed_len; i++)
49 {
50 WCHAR wch = dummy[i];
51 unsigned int ce;
52
53 /* tests show that win2k just ignores NORM_IGNORENONSPACE,
54 * and skips white space and punctuation characters for
55 * NORM_IGNORESYMBOLS.
56 */
58 continue;
59
60 if (flags & NORM_IGNORECASE) wch = tolowerW(wch);
61
62 ce = collation_table[collation_table[wch >> 8] + (wch & 0xff)];
63 if (ce != (unsigned int)-1)
64 {
65 if (ce >> 16) key_len[0] += 2;
66 if ((ce >> 8) & 0xff) key_len[1]++;
67 if ((ce >> 4) & 0x0f) key_len[2]++;
68 if (ce & 1)
69 {
70 if (wch >> 8) key_len[3]++;
71 key_len[3]++;
72 }
73 }
74 else
75 {
76 key_len[0] += 2;
77 if (wch >> 8) key_len[0]++;
78 if (wch & 0xff) key_len[0]++;
79 }
80 }
81 }
82 }
83
84 if (!dstlen) /* compute length */
85 /* 4 * '\1' + 1 * '\0' + key length */
86 return key_len[0] + key_len[1] + key_len[2] + key_len[3] + 4 + 1;
87
88 if (dstlen < key_len[0] + key_len[1] + key_len[2] + key_len[3] + 4 + 1)
89 return 0; /* overflow */
90
91 src = src_save;
92 srclen = srclen_save;
93
94 key_ptr[0] = dst;
95 key_ptr[1] = key_ptr[0] + key_len[0] + 1;
96 key_ptr[2] = key_ptr[1] + key_len[1] + 1;
97 key_ptr[3] = key_ptr[2] + key_len[2] + 1;
98
99 for (; srclen; srclen--, src++)
100 {
101 unsigned int i, decomposed_len = 1;/*wine_decompose(*src, dummy, 4);*/
102 dummy[0] = *src;
103 if (decomposed_len)
104 {
105 for (i = 0; i < decomposed_len; i++)
106 {
107 WCHAR wch = dummy[i];
108 unsigned int ce;
109
110 /* tests show that win2k just ignores NORM_IGNORENONSPACE,
111 * and skips white space and punctuation characters for
112 * NORM_IGNORESYMBOLS.
113 */
115 continue;
116
117 if (flags & NORM_IGNORECASE) wch = tolowerW(wch);
118
119 ce = collation_table[collation_table[wch >> 8] + (wch & 0xff)];
120 if (ce != (unsigned int)-1)
121 {
122 WCHAR key;
123 if ((key = ce >> 16))
124 {
125 *key_ptr[0]++ = key >> 8;
126 *key_ptr[0]++ = key & 0xff;
127 }
128 /* make key 1 start from 2 */
129 if ((key = (ce >> 8) & 0xff)) *key_ptr[1]++ = key + 1;
130 /* make key 2 start from 2 */
131 if ((key = (ce >> 4) & 0x0f)) *key_ptr[2]++ = key + 1;
132 /* key 3 is always a character code */
133 if (ce & 1)
134 {
135 if (wch >> 8) *key_ptr[3]++ = wch >> 8;
136 if (wch & 0xff) *key_ptr[3]++ = wch & 0xff;
137 }
138 }
139 else
140 {
141 *key_ptr[0]++ = 0xff;
142 *key_ptr[0]++ = 0xfe;
143 if (wch >> 8) *key_ptr[0]++ = wch >> 8;
144 if (wch & 0xff) *key_ptr[0]++ = wch & 0xff;
145 }
146 }
147 }
148 }
149
150 *key_ptr[0] = '\1';
151 *key_ptr[1] = '\1';
152 *key_ptr[2] = '\1';
153 *key_ptr[3]++ = '\1';
154 *key_ptr[3] = 0;
155
156 return key_ptr[3] - dst;
157}
const unsigned int collation_table[]
Definition: collation.c:5
#define C1_PUNCT
Definition: unicode.h:35
Definition: copy.c:22

Referenced by LCMapStringA(), and LCMapStringEx().

Variable Documentation

◆ ansi_cptable

const union cptable* ansi_cptable
static

Definition at line 65 of file locale.c.

Referenced by get_codepage_table(), GetACP(), IsDBCSLeadByte(), LOCALE_Init(), and SetCPGlobal().

◆ cache_section

RTL_CRITICAL_SECTION cache_section = { NULL, -1, 0, 0, 0, 0 }
static

Definition at line 263 of file locale.c.

Referenced by get_registry_locale_info(), and SetLocaleInfoW().

◆ geoinfodata

const struct geoinfo_t geoinfodata[]
static

Definition at line 4946 of file locale.c.

Referenced by EnumSystemGeoID(), and get_geoinfo_dataptr().

◆ iCalendarTypeW

const WCHAR iCalendarTypeW[] = {'i','C','a','l','e','n','d','a','r','T','y','p','e',0}
static

Definition at line 171 of file locale.c.

◆ iCountryW

const WCHAR iCountryW[] = {'i','C','o','u','n','t','r','y',0}
static

Definition at line 172 of file locale.c.

◆ iCurrDigitsW

const WCHAR iCurrDigitsW[] = {'i','C','u','r','r','D','i','g','i','t','s',0}
static

Definition at line 173 of file locale.c.

◆ iCurrencyW

const WCHAR iCurrencyW[] = {'i','C','u','r','r','e','n','c','y',0}
static

Definition at line 174 of file locale.c.

◆ iDateW

const WCHAR iDateW[] = {'i','D','a','t','e',0}
static

Definition at line 175 of file locale.c.

◆ iDigitsW

const WCHAR iDigitsW[] = {'i','D','i','g','i','t','s',0}
static

Definition at line 176 of file locale.c.

◆ iFirstDayOfWeekW

const WCHAR iFirstDayOfWeekW[] = {'i','F','i','r','s','t','D','a','y','O','f','W','e','e','k',0}
static

Definition at line 177 of file locale.c.

◆ iFirstWeekOfYearW

const WCHAR iFirstWeekOfYearW[] = {'i','F','i','r','s','t','W','e','e','k','O','f','Y','e','a','r',0}
static

Definition at line 178 of file locale.c.

◆ iLDateW

const WCHAR iLDateW[] = {'i','L','D','a','t','e',0}
static

Definition at line 179 of file locale.c.

◆ iLZeroW

const WCHAR iLZeroW[] = {'i','L','Z','e','r','o',0}
static

Definition at line 180 of file locale.c.

◆ iMeasureW

const WCHAR iMeasureW[] = {'i','M','e','a','s','u','r','e',0}
static

Definition at line 181 of file locale.c.

◆ iNegCurrW

const WCHAR iNegCurrW[] = {'i','N','e','g','C','u','r','r',0}
static

Definition at line 182 of file locale.c.

◆ iNegNumberW

const WCHAR iNegNumberW[] = {'i','N','e','g','N','u','m','b','e','r',0}
static

Definition at line 183 of file locale.c.

◆ iPaperSizeW

const WCHAR iPaperSizeW[] = {'i','P','a','p','e','r','S','i','z','e',0}
static

Definition at line 184 of file locale.c.

◆ iTimePrefixW

const WCHAR iTimePrefixW[] = {'i','T','i','m','e','P','r','e','f','i','x',0}
static

Definition at line 186 of file locale.c.

◆ iTimeW

const WCHAR iTimeW[] = {'i','T','i','m','e',0}
static

Definition at line 187 of file locale.c.

◆ iTLZeroW

const WCHAR iTLZeroW[] = {'i','T','L','Z','e','r','o',0}
static

Definition at line 185 of file locale.c.

◆ kernel32_handle

◆ lcid_LC_COLLATE

LCID lcid_LC_COLLATE
static

Definition at line 161 of file locale.c.

Referenced by convert_default_lcid().

◆ lcid_LC_CTYPE

LCID lcid_LC_CTYPE
static

◆ lcid_LC_MEASUREMENT

LCID lcid_LC_MEASUREMENT
static

Definition at line 168 of file locale.c.

Referenced by convert_default_lcid(), and LOCALE_InitRegistry().

◆ lcid_LC_MESSAGES

LCID lcid_LC_MESSAGES
static

Definition at line 163 of file locale.c.

Referenced by LOCALE_Init(), and LOCALE_InitRegistry().

◆ lcid_LC_MONETARY

LCID lcid_LC_MONETARY
static

Definition at line 164 of file locale.c.

Referenced by convert_default_lcid(), and LOCALE_InitRegistry().

◆ lcid_LC_NUMERIC

LCID lcid_LC_NUMERIC
static

Definition at line 165 of file locale.c.

Referenced by convert_default_lcid(), and LOCALE_InitRegistry().

◆ lcid_LC_PAPER

LCID lcid_LC_PAPER
static

Definition at line 167 of file locale.c.

Referenced by convert_default_lcid(), and LOCALE_InitRegistry().

◆ lcid_LC_TELEPHONE

LCID lcid_LC_TELEPHONE
static

Definition at line 169 of file locale.c.

Referenced by convert_default_lcid(), and LOCALE_InitRegistry().

◆ lcid_LC_TIME

LCID lcid_LC_TIME
static

Definition at line 166 of file locale.c.

Referenced by convert_default_lcid(), and LOCALE_InitRegistry().

◆ mac_cptable

const union cptable* mac_cptable
static

Definition at line 67 of file locale.c.

Referenced by get_codepage_table(), and LOCALE_Init().

◆ NumShapeW

const WCHAR NumShapeW[] = {'N','u','m','s','h','a','p','e',0}
static

Definition at line 209 of file locale.c.

◆ oem_cptable

const union cptable* oem_cptable
static

Definition at line 66 of file locale.c.

Referenced by get_codepage_table(), GetOEMCP(), and LOCALE_Init().

◆ registry_values

struct registry_value registry_values[]
static

◆ s1159W

const WCHAR s1159W[] = {'s','1','1','5','9',0}
static

Definition at line 188 of file locale.c.

◆ s2359W

const WCHAR s2359W[] = {'s','2','3','5','9',0}
static

Definition at line 189 of file locale.c.

◆ sCountryW

const WCHAR sCountryW[] = {'s','C','o','u','n','t','r','y',0}
static

Definition at line 190 of file locale.c.

◆ sCurrencyW

const WCHAR sCurrencyW[] = {'s','C','u','r','r','e','n','c','y',0}
static

Definition at line 191 of file locale.c.

◆ sDateW

const WCHAR sDateW[] = {'s','D','a','t','e',0}
static

Definition at line 192 of file locale.c.

◆ sDecimalW

const WCHAR sDecimalW[] = {'s','D','e','c','i','m','a','l',0}
static

Definition at line 193 of file locale.c.

◆ sGroupingW

const WCHAR sGroupingW[] = {'s','G','r','o','u','p','i','n','g',0}
static

Definition at line 194 of file locale.c.

◆ sLanguageW

const WCHAR sLanguageW[] = {'s','L','a','n','g','u','a','g','e',0}
static

Definition at line 195 of file locale.c.

◆ sListW

const WCHAR sListW[] = {'s','L','i','s','t',0}
static

Definition at line 196 of file locale.c.

◆ sLongDateW

const WCHAR sLongDateW[] = {'s','L','o','n','g','D','a','t','e',0}
static

Definition at line 197 of file locale.c.

◆ sMonDecimalSepW

const WCHAR sMonDecimalSepW[] = {'s','M','o','n','D','e','c','i','m','a','l','S','e','p',0}
static

Definition at line 198 of file locale.c.

◆ sMonGroupingW

const WCHAR sMonGroupingW[] = {'s','M','o','n','G','r','o','u','p','i','n','g',0}
static

Definition at line 199 of file locale.c.

◆ sMonThousandSepW

const WCHAR sMonThousandSepW[] = {'s','M','o','n','T','h','o','u','s','a','n','d','S','e','p',0}
static

Definition at line 200 of file locale.c.

◆ sNativeDigitsW

const WCHAR sNativeDigitsW[] = {'s','N','a','t','i','v','e','D','i','g','i','t','s',0}
static

Definition at line 201 of file locale.c.

◆ sNegativeSignW

const WCHAR sNegativeSignW[] = {'s','N','e','g','a','t','i','v','e','S','i','g','n',0}
static

Definition at line 202 of file locale.c.

◆ sPositiveSignW

const WCHAR sPositiveSignW[] = {'s','P','o','s','i','t','i','v','e','S','i','g','n',0}
static

Definition at line 203 of file locale.c.

◆ sShortDateW

const WCHAR sShortDateW[] = {'s','S','h','o','r','t','D','a','t','e',0}
static

Definition at line 204 of file locale.c.

◆ sThousandW

const WCHAR sThousandW[] = {'s','T','h','o','u','s','a','n','d',0}
static

Definition at line 205 of file locale.c.

◆ sTimeFormatW

const WCHAR sTimeFormatW[] = {'s','T','i','m','e','F','o','r','m','a','t',0}
static

Definition at line 206 of file locale.c.

◆ sTimeW

const WCHAR sTimeW[] = {'s','T','i','m','e',0}
static

Definition at line 207 of file locale.c.

◆ sYearMonthW

const WCHAR sYearMonthW[] = {'s','Y','e','a','r','M','o','n','t','h',0}
static

Definition at line 208 of file locale.c.

◆ szLangGroupsKeyName

const WCHAR szLangGroupsKeyName[]
static
Initial value:
= {
'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\',
'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
'C','o','n','t','r','o','l','\\','N','l','s','\\',
'L','a','n','g','u','a','g','e',' ','G','r','o','u','p','s',0
}

Definition at line 76 of file locale.c.

Referenced by IsValidLanguageGroup(), and NLS_EnumSystemLanguageGroups().

◆ szLocaleKeyName

const WCHAR szLocaleKeyName[]
static
Initial value:
= {
'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\',
'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
'C','o','n','t','r','o','l','\\','N','l','s','\\','L','o','c','a','l','e',0
}

Definition at line 70 of file locale.c.

Referenced by NLS_EnumLanguageGroupLocales().

◆ unix_cptable

const union cptable* unix_cptable
static

Definition at line 68 of file locale.c.

Referenced by LOCALE_Init(), MultiByteToWideChar(), and WideCharToMultiByte().