/src/FreeRDP/libfreerdp/locale/keyboard_layout.c
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /**  | 
2  |  |  * FreeRDP: A Remote Desktop Protocol Implementation  | 
3  |  |  * Keyboard Layouts  | 
4  |  |  *  | 
5  |  |  * Copyright 2009-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>  | 
6  |  |  *  | 
7  |  |  * Licensed under the Apache License, Version 2.0 (the "License");  | 
8  |  |  * you may not use this file except in compliance with the License.  | 
9  |  |  * You may obtain a copy of the License at  | 
10  |  |  *  | 
11  |  |  *     http://www.apache.org/licenses/LICENSE-2.0  | 
12  |  |  *  | 
13  |  |  * Unless required by applicable law or agreed to in writing, software  | 
14  |  |  * distributed under the License is distributed on an "AS IS" BASIS,  | 
15  |  |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  | 
16  |  |  * See the License for the specific language governing permissions and  | 
17  |  |  * limitations under the License.  | 
18  |  |  */  | 
19  |  |  | 
20  |  | #include <freerdp/config.h>  | 
21  |  |  | 
22  |  | #include <stdio.h>  | 
23  |  | #include <stdlib.h>  | 
24  |  | #include <string.h>  | 
25  |  |  | 
26  |  | #include <winpr/crt.h>  | 
27  |  |  | 
28  |  | #include "liblocale.h"  | 
29  |  |  | 
30  |  | #include <freerdp/types.h>  | 
31  |  | #include <freerdp/scancode.h>  | 
32  |  | #include <freerdp/locale/keyboard.h>  | 
33  |  |  | 
34  |  | struct LanguageIdentifier  | 
35  |  | { | 
36  |  |   /* LanguageIdentifier = (SublangaugeIdentifier<<2) | PrimaryLanguageIdentifier  | 
37  |  |    * The table at  | 
38  |  |    * https://docs.microsoft.com/en-us/windows/win32/intl/language-identifier-constants-and-strings  | 
39  |  |    * is sometimes missing one or both of the entries.  | 
40  |  |    */  | 
41  |  |   const char* locale; /* en_US type strings for the locale */  | 
42  |  |   UINT16 LanguageIdentifier;  | 
43  |  |   const char* PrimaryLanguage;  | 
44  |  |   UINT8 PrimaryLanguageIdentifier;  | 
45  |  |   const char* PrimaryLanguageSymbol;  | 
46  |  |   const char* Sublanguage;  | 
47  |  |   UINT8 SublangaugeIdentifier;  | 
48  |  |   const char* SublanguageSymbol;  | 
49  |  | };  | 
50  |  |  | 
51  |  | static const struct LanguageIdentifier language_identifiers[] = { | 
52  |  |   /*  [Language identifier]   [Primary language]    [Prim. lang. identifier]    [Prim.  | 
53  |  |      lang. symbol]    [Sublanguage]   [Sublang. identifier]   [Sublang. symbol] */  | 
54  |  |   { "", 0xc00, "Default custom locale language", 0x0, "LANG_NEUTRAL", | 
55  |  |     "Default custom sublanguage", 0x3, "SUBLANG_CUSTOM_DEFAULT" },  | 
56  |  |   { "", 0x1400, "Default custom MUI locale language", 0x0, "LANG_NEUTRAL", | 
57  |  |     "Default custom MUI sublanguage", 0x5, "SUBLANG_UI_CUSTOM_DEFAULT" },  | 
58  |  |   { "", 0x7f, "Invariant locale language", 0x7f, "LANG_INVARIANT", "Invariant sublanguage", 0x0, | 
59  |  |     "SUBLANG_NEUTRAL" },  | 
60  |  |   { "", 0x0, "Neutral locale language", 0x0, "LANG_NEUTRAL", "Neutral sublanguage", 0x0, | 
61  |  |     "SUBLANG_NEUTRAL" },  | 
62  |  |   { "", 0x800, "System default locale language", 0x2, "LANG_SYSTEM_DEFAULT", | 
63  |  |     "System default sublanguage", 0x2, "SUBLANG_SYS_DEFAULT" },  | 
64  |  |   { "", 0x1000, "Unspecified custom locale language", 0x0, "LANG_NEUTRAL", | 
65  |  |     "Unspecified custom sublanguage", 0x4, "SUBLANG_CUSTOM_UNSPECIFIED" },  | 
66  |  |   { "", 0x400, "User default locale language", 0x0, "LANG_USER_DEFAULT", | 
67  |  |     "User default sublanguage", 0x1, "SUBLANG_DEFAULT" },  | 
68  |  |   { "af_ZA", 0x436, "Afrikaans (af)", 0x36, "LANG_AFRIKAANS", "South Africa (ZA)", 0x1, | 
69  |  |     "SUBLANG_AFRIKAANS_SOUTH_AFRICA" },  | 
70  |  |   { "sq_AL", 0x41c, "Albanian (sq)", 0x1c, "LANG_ALBANIAN", "Albania (AL)", 0x1, | 
71  |  |     "SUBLANG_ALBANIAN_ALBANIA" },  | 
72  |  |   { "gsw_FR", 0x484, "Alsatian (gsw)", 0x84, "LANG_ALSATIAN", "France (FR)", 0x1, | 
73  |  |     "SUBLANG_ALSATIAN_FRANCE" },  | 
74  |  |   { "am_ET", 0x45e, "Amharic (am)", 0x5e, "LANG_AMHARIC", "Ethiopia (ET)", 0x1, | 
75  |  |     "SUBLANG_AMHARIC_ETHIOPIA" },  | 
76  |  |   { "ar_DZ", 0x1401, "Arabic (ar)", 0x1, "LANG_ARABIC", "Algeria (DZ)", 0x5, | 
77  |  |     "SUBLANG_ARABIC_ALGERIA" },  | 
78  |  |   { "ar_BH", 0x3c01, "Arabic (ar)", 0x01, "LANG_ARABIC", "Bahrain (BH)", 0xf, | 
79  |  |     "SUBLANG_ARABIC_BAHRAIN" },  | 
80  |  |   { "ar_EG", 0xc01, "Arabic (ar)", 0x01, "LANG_ARABIC", "Egypt (EG)", 0x3, | 
81  |  |     "SUBLANG_ARABIC_EGYPT" },  | 
82  |  |   { "ar_IQ", 0x801, "Arabic (ar)", 0x01, "LANG_ARABIC", "Iraq (IQ)", 0x2, "SUBLANG_ARABIC_IRAQ" }, | 
83  |  |   { "ar_JO", 0x2c01, "Arabic (ar)", 0x01, "LANG_ARABIC", "Jordan (JO)", 0xb, | 
84  |  |     "SUBLANG_ARABIC_JORDAN" },  | 
85  |  |   { "ar_KW", 0x3401, "Arabic (ar)", 0x01, "LANG_ARABIC", "Kuwait (KW)", 0xd, | 
86  |  |     "SUBLANG_ARABIC_KUWAIT" },  | 
87  |  |   { "ar_LB", 0x3001, "Arabic (ar)", 0x01, "LANG_ARABIC", "Lebanon (LB)", 0xc, | 
88  |  |     "SUBLANG_ARABIC_LEBANON" },  | 
89  |  |   { "ar_LY", 0x1001, "Arabic (ar)", 0x01, "LANG_ARABIC", "Libya (LY)", 0x4, | 
90  |  |     "SUBLANG_ARABIC_LIBYA" },  | 
91  |  |   { "ar_MA", 0x1801, "Arabic (ar)", 0x01, "LANG_ARABIC", "Morocco (MA)", 0x6, | 
92  |  |     "SUBLANG_ARABIC_MOROCCO" },  | 
93  |  |   { "ar_OM", 0x2001, "Arabic (ar)", 0x01, "LANG_ARABIC", "Oman (OM)", 0x8, | 
94  |  |     "SUBLANG_ARABIC_OMAN" },  | 
95  |  |   { "ar_QA", 0x4001, "Arabic (ar)", 0x01, "LANG_ARABIC", "Qatar (QA)", 0x10, | 
96  |  |     "SUBLANG_ARABIC_QATAR" },  | 
97  |  |   { "ar_SA", 0x401, "Arabic (ar)", 0x01, "LANG_ARABIC", "Saudi Arabia (SA)", 0x1, | 
98  |  |     "SUBLANG_ARABIC_SAUDI_ARABIA" },  | 
99  |  |   { "ar_SY", 0x2801, "Arabic (ar)", 0x01, "LANG_ARABIC", "Syria (SY)", 0xa, | 
100  |  |     "SUBLANG_ARABIC_SYRIA" },  | 
101  |  |   { "ar_TN", 0x1c01, "Arabic (ar)", 0x01, "LANG_ARABIC", "Tunisia (TN)", 0x7, | 
102  |  |     "SUBLANG_ARABIC_TUNISIA" },  | 
103  |  |   { "ar_AE", 0x3801, "Arabic (ar)", 0x01, "LANG_ARABIC", "U.A.E. (AE)", 0xe, | 
104  |  |     "SUBLANG_ARABIC_UAE" },  | 
105  |  |   { "ar_YE", 0x2401, "Arabic (ar)", 0x01, "LANG_ARABIC", "Yemen (YE)", 0x9, | 
106  |  |     "SUBLANG_ARABIC_YEMEN" },  | 
107  |  |   { "hy_AM", 0x42b, "Armenian (hy)", 0x2b, "LANG_ARMENIAN", "Armenia (AM)", 0x1, | 
108  |  |     "SUBLANG_ARMENIAN_ARMENIA" },  | 
109  |  |   { "as_IN", 0x44d, "Assamese (as)", 0x4d, "LANG_ASSAMESE", "India (IN)", 0x1, | 
110  |  |     "SUBLANG_ASSAMESE_INDIA" },  | 
111  |  |   { "az_AZ", 0x82c, "Azerbaijani (az)", 0x2c, "LANG_AZERI", "Azerbaijan, Cyrillic (AZ)", 0x2, | 
112  |  |     "SUBLANG_AZERI_CYRILLIC" },  | 
113  |  |   { "az_AZ", 0x42c, "Azerbaijani (az)", 0x2c, "LANG_AZERI", "Azerbaijan, Latin (AZ)", 0x1, | 
114  |  |     "SUBLANG_AZERI_LATIN" },  | 
115  |  |   { "bn_BD", 0x445, "Bangla (bn)", 0x45, "LANG_BANGLA", "Bangladesh (BD)", 0x2, | 
116  |  |     "SUBLANG_BANGLA_BANGLADESH" },  | 
117  |  |   { "bn_IN", 0x445, "Bangla (bn)", 0x45, "LANG_BANGLA", "India (IN)", 0x1, | 
118  |  |     "SUBLANG_BANGLA_INDIA" },  | 
119  |  |   { "ba_RU", 0x46d, "Bashkir (ba)", 0x6d, "LANG_BASHKIR", "Russia (RU)", 0x1, | 
120  |  |     "SUBLANG_BASHKIR_RUSSIA" },  | 
121  |  |   { "", 0x42d, "Basque (Basque)", 0x2d, "LANG_BASQUE", "Basque (Basque)", 0x1, | 
122  |  |     "SUBLANG_BASQUE_BASQUE" },  | 
123  |  |   { "be_BY", 0x423, "Belarusian (be)", 0x23, "LANG_BELARUSIAN", "Belarus (BY)", 0x1, | 
124  |  |     "SUBLANG_BELARUSIAN_BELARUS" },  | 
125  |  |   { "bs", 0x781a, "Bosnian (bs)", 0x1a, "LANG_BOSNIAN_NEUTRAL", "Neutral", 0x1E, "" }, | 
126  |  |   { "bs_BA", 0x201a, "Bosnian (bs)", 0x1a, "LANG_BOSNIAN", | 
127  |  |     "Bosnia and Herzegovina, Cyrillic (BA)", 0x8, "SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC" },  | 
128  |  |   { "bs_BA", 0x141a, "Bosnian (bs)", 0x1a, "LANG_BOSNIAN", "Bosnia and Herzegovina, Latin (BA)", | 
129  |  |     0x5, "SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN" },  | 
130  |  |   { "br_FR", 0x47e, "Breton (br)", 0x7e, "LANG_BRETON", "France (FR)", 0x1, | 
131  |  |     "SUBLANG_BRETON_FRANCE" },  | 
132  |  |   { "bg_BG", 0x402, "Bulgarian (bg)", 0x2, "LANG_BULGARIAN", "Bulgaria (BG)", 0x1, | 
133  |  |     "SUBLANG_BULGARIAN_BULGARIA" },  | 
134  |  |   { "ku_IQ", 0x492, "Central Kurdish (ku)", 0x92, "LANG_CENTRAL_KURDISH", "Iraq (IQ)", 0x1, | 
135  |  |     "SUBLANG_CENTRAL_KURDISH_IRAQ" },  | 
136  |  |   { "chr_US", 0x45c, "Cherokee (chr)", 0x5c, "LANG_CHEROKEE", "Cherokee (Cher)", 0x1, | 
137  |  |     "SUBLANG_CHEROKEE_CHEROKEE" },  | 
138  |  |   { "ca_ES", 0x403, "Catalan (ca)", 0x3, "LANG_CATALAN", "Spain (ES)", 0x1, | 
139  |  |     "SUBLANG_CATALAN_CATALAN" },  | 
140  |  |   { "zh_HK", 0xc04, "Chinese (zh)", 0x04, "LANG_CHINESE", "Hong Kong SAR, PRC (HK)", 0x3, | 
141  |  |     "SUBLANG_CHINESE_HONGKONG" },  | 
142  |  |   { "zh_MO", 0x1404, "Chinese (zh)", 0x04, "LANG_CHINESE", "Macao SAR (MO)", 0x5, | 
143  |  |     "SUBLANG_CHINESE_MACAU" },  | 
144  |  |   { "zh_SG", 0x1004, "Chinese (zh)", 0x04, "LANG_CHINESE", "Singapore (SG)", 0x4, | 
145  |  |     "SUBLANG_CHINESE_SINGAPORE" },  | 
146  |  |   { "zh_CN", 0x4, "Chinese (zh)", 0x4, "LANG_CHINESE_SIMPLIFIED", "Simplified (Hans)", 0x2, | 
147  |  |     "SUBLANG_CHINESE_SIMPLIFIED" },  | 
148  |  |   { "zh_CN", 0x7c04, "Chinese (zh)", 0x04, "LANG_CHINESE_TRADITIONAL", "Traditional (Hant)", 0x1, | 
149  |  |     "SUBLANG_CHINESE_TRADITIONAL" },  | 
150  |  |   { "co_FR", 0x483, "Corsican (co)", 0x83, "LANG_CORSICAN", "France (FR)", 0x1, | 
151  |  |     "SUBLANG_CORSICAN_FRANCE" },  | 
152  |  |   { "hr", 0x1a, "Croatian (hr)", 0x1a, "LANG_CROATIAN", "Neutral", 0x00, "" }, | 
153  |  |   { "hr_BA", 0x101a, "Croatian (hr)", 0x1a, "LANG_CROATIAN", "Bosnia and Herzegovina, Latin (BA)", | 
154  |  |     0x4, "SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN" },  | 
155  |  |   { "hr_HR", 0x41a, "Croatian (hr)", 0x1a, "LANG_CROATIAN", "Croatia (HR)", 0x1, | 
156  |  |     "SUBLANG_CROATIAN_CROATIA" },  | 
157  |  |   { "cs_CZ", 0x405, "Czech (cs)", 0x5, "LANG_CZECH", "Czech Republic (CZ)", 0x1, | 
158  |  |     "SUBLANG_CZECH_CZECH_REPUBLIC" },  | 
159  |  |   { "da_DK", 0x406, "Danish (da)", 0x6, "LANG_DANISH", "Denmark (DK)", 0x1, | 
160  |  |     "SUBLANG_DANISH_DENMARK" },  | 
161  |  |   { "prs_AF", 0x48c, "Dari (prs)", 0x8c, "LANG_DARI", "Afghanistan (AF)", 0x1, | 
162  |  |     "SUBLANG_DARI_AFGHANISTAN" },  | 
163  |  |   { "dv_MV", 0x465, "Divehi (dv)", 0x65, "LANG_DIVEHI", "Maldives (MV)", 0x1, | 
164  |  |     "SUBLANG_DIVEHI_MALDIVES" },  | 
165  |  |   { "nl_BE", 0x813, "Dutch (nl)", 0x13, "LANG_DUTCH", "Belgium (BE)", 0x2, | 
166  |  |     "SUBLANG_DUTCH_BELGIAN" },  | 
167  |  |   { "nl_NL", 0x413, "Dutch (nl)", 0x13, "LANG_DUTCH", "Netherlands (NL)", 0x1, "SUBLANG_DUTCH" }, | 
168  |  |   { "en_AU", 0xc09, "English (en)", 0x9, "LANG_ENGLISH", "Australia (AU)", 0x3, | 
169  |  |     "SUBLANG_ENGLISH_AUS" },  | 
170  |  |   { "en_BZ", 0x2809, "English (en)", 0x09, "LANG_ENGLISH", "Belize (BZ)", 0xa, | 
171  |  |     "SUBLANG_ENGLISH_BELIZE" },  | 
172  |  |   { "en_CA", 0x1009, "English (en)", 0x09, "LANG_ENGLISH", "Canada (CA)", 0x4, | 
173  |  |     "SUBLANG_ENGLISH_CAN" },  | 
174  |  |   { "en_CB", 0x2409, "English (en)", 0x09, "LANG_ENGLISH", "Caribbean (029)", 0x9, | 
175  |  |     "SUBLANG_ENGLISH_CARIBBEAN" },  | 
176  |  |   { "en_IN", 0x4009, "English (en)", 0x09, "LANG_ENGLISH", "India (IN)", 0x10, | 
177  |  |     "SUBLANG_ENGLISH_INDIA" },  | 
178  |  |   { "en_IE", 0x1809, "English (en)", 0x09, "LANG_ENGLISH", "Ireland (IE)", 0x6, | 
179  |  |     "SUBLANG_ENGLISH_EIRE" },  | 
180  |  |   { "en_IE", 0x1809, "English (en)", 0x09, "LANG_ENGLISH", "Ireland (IE)", 0x6, | 
181  |  |     "SUBLANG_ENGLISH_IRELAND" },  | 
182  |  |   { "en_JM", 0x2009, "English (en)", 0x09, "LANG_ENGLISH", "Jamaica (JM)", 0x8, | 
183  |  |     "SUBLANG_ENGLISH_JAMAICA" },  | 
184  |  |   { "en_MY", 0x4409, "English (en)", 0x09, "LANG_ENGLISH", "Malaysia (MY)", 0x11, | 
185  |  |     "SUBLANG_ENGLISH_MALAYSIA" },  | 
186  |  |   { "en_NZ", 0x1409, "English (en)", 0x09, "LANG_ENGLISH", "New Zealand (NZ)", 0x5, | 
187  |  |     "SUBLANG_ENGLISH_NZ" },  | 
188  |  |   { "en_PH", 0x3409, "English (en)", 0x09, "LANG_ENGLISH", "Philippines (PH)", 0xd, | 
189  |  |     "SUBLANG_ENGLISH_PHILIPPINES" },  | 
190  |  |   { "en_SG", 0x4809, "English (en)", 0x09, "LANG_ENGLISH", "Singapore (SG)", 0x12, | 
191  |  |     "SUBLANG_ENGLISH_SINGAPORE" },  | 
192  |  |   { "en_ZA", 0x1c09, "English (en)", 0x09, "LANG_ENGLISH", "South Africa (ZA)", 0x7, | 
193  |  |     "SUBLANG_ENGLISH_SOUTH_AFRICA" },  | 
194  |  |   { "en_TT", 0x2c09, "English (en)", 0x09, "LANG_ENGLISH", "Trinidad and Tobago (TT)", 0xb, | 
195  |  |     "SUBLANG_ENGLISH_TRINIDAD" },  | 
196  |  |   { "en_GB", 0x809, "English (en)", 0x09, "LANG_ENGLISH", "United Kingdom (GB)", 0x2, | 
197  |  |     "SUBLANG_ENGLISH_UK" },  | 
198  |  |   { "en_US", 0x409, "English (en)", 0x09, "LANG_ENGLISH", "United States (US)", 0x1, | 
199  |  |     "SUBLANG_ENGLISH_US" },  | 
200  |  |   { "en_ZW", 0x3009, "English (en)", 0x09, "LANG_ENGLISH", "Zimbabwe (ZW)", 0xc, | 
201  |  |     "SUBLANG_ENGLISH_ZIMBABWE" },  | 
202  |  |   { "et_EE", 0x425, "Estonian (et)", 0x25, "LANG_ESTONIAN", "Estonia (EE)", 0x1, | 
203  |  |     "SUBLANG_ESTONIAN_ESTONIA" },  | 
204  |  |   { "fo_FO", 0x438, "Faroese (fo)", 0x38, "LANG_FAEROESE", "Faroe Islands (FO)", 0x1, | 
205  |  |     "SUBLANG_FAEROESE_FAROE_ISLANDS" },  | 
206  |  |   { "fil_PH", 0x464, "Filipino (fil)", 0x64, "LANG_FILIPINO", "Philippines (PH)", 0x1, | 
207  |  |     "SUBLANG_FILIPINO_PHILIPPINES" },  | 
208  |  |   { "fi_FI", 0x40b, "Finnish (fi)", 0xb, "LANG_FINNISH", "Finland (FI)", 0x1, | 
209  |  |     "SUBLANG_FINNISH_FINLAND" },  | 
210  |  |   { "fr_BE", 0x80c, "French (fr)", 0xc, "LANG_FRENCH", "Belgium (BE)", 0x2, | 
211  |  |     "SUBLANG_FRENCH_BELGIAN" },  | 
212  |  |   { "fr_CA", 0xc0c, "French (fr)", 0x0c, "LANG_FRENCH", "Canada (CA)", 0x3, | 
213  |  |     "SUBLANG_FRENCH_CANADIAN" },  | 
214  |  |   { "fr_FR", 0x40c, "French (fr)", 0x0c, "LANG_FRENCH", "France (FR)", 0x1, "SUBLANG_FRENCH" }, | 
215  |  |   { "fr_LU", 0x140c, "French (fr)", 0x0c, "LANG_FRENCH", "Luxembourg (LU)", 0x5, | 
216  |  |     "SUBLANG_FRENCH_LUXEMBOURG" },  | 
217  |  |   { "fr_MC", 0x180c, "French (fr)", 0x0c, "LANG_FRENCH", "Monaco (MC)", 0x6, | 
218  |  |     "SUBLANG_FRENCH_MONACO" },  | 
219  |  |   { "fr_CH", 0x100c, "French (fr)", 0x0c, "LANG_FRENCH", "Switzerland (CH)", 0x4, | 
220  |  |     "SUBLANG_FRENCH_SWISS" },  | 
221  |  |   { "fy_NL", 0x462, "Frisian (fy)", 0x62, "LANG_FRISIAN", "Netherlands (NL)", 0x1, | 
222  |  |     "SUBLANG_FRISIAN_NETHERLANDS" },  | 
223  |  |   { "gl_ES", 0x456, "Galician (gl)", 0x56, "LANG_GALICIAN", "Spain (ES)", 0x1, | 
224  |  |     "SUBLANG_GALICIAN_GALICIAN" },  | 
225  |  |   { "ka_GE", 0x437, "Georgian (ka)", 0x37, "LANG_GEORGIAN", "Georgia (GE)", 0x1, | 
226  |  |     "SUBLANG_GEORGIAN_GEORGIA" },  | 
227  |  |   { "de_AT", 0xc07, "German (de)", 0x7, "LANG_GERMAN", "Austria (AT)", 0x3, | 
228  |  |     "SUBLANG_GERMAN_AUSTRIAN" },  | 
229  |  |   { "de_DE", 0x407, "German (de)", 0x07, "LANG_GERMAN", "Germany (DE)", 0x1, "SUBLANG_GERMAN" }, | 
230  |  |   { "de_LI", 0x1407, "German (de)", 0x07, "LANG_GERMAN", "Liechtenstein (LI)", 0x5, | 
231  |  |     "SUBLANG_GERMAN_LIECHTENSTEIN" },  | 
232  |  |   { "de_LU", 0x1007, "German (de)", 0x07, "LANG_GERMAN", "Luxembourg (LU)", 0x4, | 
233  |  |     "SUBLANG_GERMAN_LUXEMBOURG" },  | 
234  |  |   { "de_CH", 0x807, "German (de)", 0x07, "LANG_GERMAN", "Switzerland (CH)", 0x2, | 
235  |  |     "SUBLANG_GERMAN_SWISS" },  | 
236  |  |   { "el_GR", 0x408, "Greek (el)", 0x8, "LANG_GREEK", "Greece (GR)", 0x1, "SUBLANG_GREEK_GREECE" }, | 
237  |  |   { "kl_GL", 0x46f, "Greenlandic (kl)", 0x6f, "LANG_GREENLANDIC", "Greenland (GL)", 0x1, | 
238  |  |     "SUBLANG_GREENLANDIC_GREENLAND" },  | 
239  |  |   { "gu_IN", 0x447, "Gujarati (gu)", 0x47, "LANG_GUJARATI", "India (IN)", 0x1, | 
240  |  |     "SUBLANG_GUJARATI_INDIA" },  | 
241  |  |   { "ha_NG", 0x468, "Hausa (ha)", 0x68, "LANG_HAUSA", "Nigeria (NG)", 0x1, | 
242  |  |     "SUBLANG_HAUSA_NIGERIA_LATIN" },  | 
243  |  |   { "haw_US", 0x475, "Hawiian (haw)", 0x75, "LANG_HAWAIIAN", "United States (US)", 0x1, | 
244  |  |     "SUBLANG_HAWAIIAN_US" },  | 
245  |  |   { "he_IL", 0x40d, "Hebrew (he)", 0xd, "LANG_HEBREW", "Israel (IL)", 0x1, | 
246  |  |     "SUBLANG_HEBREW_ISRAEL" },  | 
247  |  |   { "hi_IN", 0x439, "Hindi (hi)", 0x39, "LANG_HINDI", "India (IN)", 0x1, "SUBLANG_HINDI_INDIA" }, | 
248  |  |   { "hu_HU", 0x40e, "Hungarian (hu)", 0xe, "LANG_HUNGARIAN", "Hungary (HU)", 0x1, | 
249  |  |     "SUBLANG_HUNGARIAN_HUNGARY" },  | 
250  |  |   { "is_IS", 0x40f, "Icelandic (is)", 0xf, "LANG_ICELANDIC", "Iceland (IS)", 0x1, | 
251  |  |     "SUBLANG_ICELANDIC_ICELAND" },  | 
252  |  |   { "ig_NG", 0x470, "Igbo (ig)", 0x70, "LANG_IGBO", "Nigeria (NG)", 0x1, "SUBLANG_IGBO_NIGERIA" }, | 
253  |  |   { "id_ID", 0x421, "Indonesian (id)", 0x21, "LANG_INDONESIAN", "Indonesia (ID)", 0x1, | 
254  |  |     "SUBLANG_INDONESIAN_INDONESIA" },  | 
255  |  |   { "iu_CA", 0x85d, "Inuktitut (iu)", 0x5d, "LANG_INUKTITUT", "Canada (CA), Latin", 0x2, | 
256  |  |     "SUBLANG_INUKTITUT_CANADA_LATIN" },  | 
257  |  |   { "iu_CA", 0x45d, "Inuktitut (iu)", 0x5d, "LANG_INUKTITUT", "Canada (CA), Canadian Syllabics", | 
258  |  |     0x1, "SUBLANG_INUKTITUT_CANADA" },  | 
259  |  |   { "ga_IE", 0x83c, "Irish (ga)", 0x3c, "LANG_IRISH", "Ireland (IE)", 0x2, | 
260  |  |     "SUBLANG_IRISH_IRELAND" },  | 
261  |  |   { "xh_ZA", 0x434, "isiXhosa (xh)", 0x34, "LANG_XHOSA", "South Africa (ZA)", 0x1, | 
262  |  |     "SUBLANG_XHOSA_SOUTH_AFRICA" },  | 
263  |  |   { "zu_ZA", 0x435, "isiZulu (zu)", 0x35, "LANG_ZULU", "South Africa (ZA)", 0x1, | 
264  |  |     "SUBLANG_ZULU_SOUTH_AFRICA" },  | 
265  |  |   { "it_IT", 0x410, "Italian (it)", 0x10, "LANG_ITALIAN", "Italy (IT)", 0x1, "SUBLANG_ITALIAN" }, | 
266  |  |   { "it_CH", 0x810, "Italian (it)", 0x10, "LANG_ITALIAN", "Switzerland (CH)", 0x2, | 
267  |  |     "SUBLANG_ITALIAN_SWISS" },  | 
268  |  |   { "ja_JP", 0x411, "Japanese (ja)", 0x11, "LANG_JAPANESE", "Japan (JP)", 0x1, | 
269  |  |     "SUBLANG_JAPANESE_JAPAN" },  | 
270  |  |   { "kn_IN", 0x44b, "Kannada (kn)", 0x4b, "LANG_KANNADA", "India (IN)", 0x1, | 
271  |  |     "SUBLANG_KANNADA_INDIA" },  | 
272  |  |   { "kk_KZ", 0x43f, "Kazakh (kk)", 0x3f, "LANG_KAZAK", "Kazakhstan (KZ)", 0x1, | 
273  |  |     "SUBLANG_KAZAK_KAZAKHSTAN" },  | 
274  |  |   { "kh_KH", 0x453, "Khmer (kh)", 0x53, "LANG_KHMER", "Cambodia (KH)", 0x1, | 
275  |  |     "SUBLANG_KHMER_CAMBODIA" },  | 
276  |  |   { "qut_GT", 0x486, "K'iche (qut)", 0x86, "LANG_KICHE", "Guatemala (GT)", 0x1, | 
277  |  |     "SUBLANG_KICHE_GUATEMALA" },  | 
278  |  |   { "rw_RW", 0x487, "Kinyarwanda (rw)", 0x87, "LANG_KINYARWANDA", "Rwanda (RW)", 0x1, | 
279  |  |     "SUBLANG_KINYARWANDA_RWANDA" },  | 
280  |  |   { "kok_IN", 0x457, "Konkani (kok)", 0x57, "LANG_KONKANI", "India (IN)", 0x1, | 
281  |  |     "SUBLANG_KONKANI_INDIA" },  | 
282  |  |   { "ko_KR", 0x412, "Korean (ko)", 0x12, "LANG_KOREAN", "Korea (KR)", 0x1, "SUBLANG_KOREAN" }, | 
283  |  |   { "ky_KG", 0x440, "Kyrgyz (ky)", 0x40, "LANG_KYRGYZ", "Kyrgyzstan (KG)", 0x1, | 
284  |  |     "SUBLANG_KYRGYZ_KYRGYZSTAN" },  | 
285  |  |   { "lo_LA", 0x454, "Lao (lo)", 0x54, "LANG_LAO", "Lao PDR (LA)", 0x1, "SUBLANG_LAO_LAO" }, | 
286  |  |   { "lv_LV", 0x426, "Latvian (lv)", 0x26, "LANG_LATVIAN", "Latvia (LV)", 0x1, | 
287  |  |     "SUBLANG_LATVIAN_LATVIA" },  | 
288  |  |   { "lt_LT", 0x427, "Lithuanian (lt)", 0x27, "LANG_LITHUANIAN", "Lithuanian (LT)", 0x1, | 
289  |  |     "SUBLANG_LITHUANIAN_LITHUANIA" },  | 
290  |  |   { "dsb_DE", 0x82e, "Lower Sorbian (dsb)", 0x2e, "LANG_LOWER_SORBIAN", "Germany (DE)", 0x2, | 
291  |  |     "SUBLANG_LOWER_SORBIAN_GERMANY" },  | 
292  |  |   { "lb_LU", 0x46e, "Luxembourgish (lb)", 0x6e, "LANG_LUXEMBOURGISH", "Luxembourg (LU)", 0x1, | 
293  |  |     "SUBLANG_LUXEMBOURGISH_LUXEMBOURG" },  | 
294  |  |   { "mk_MK", 0x42f, "Macedonian (mk)", 0x2f, "LANG_MACEDONIAN", "Macedonia (FYROM) (MK)", 0x1, | 
295  |  |     "SUBLANG_MACEDONIAN_MACEDONIA" },  | 
296  |  |   { "ms_BN", 0x83e, "Malay (ms)", 0x3e, "LANG_MALAY", "Brunei Darassalam (BN)", 0x2, | 
297  |  |     "SUBLANG_MALAY_BRUNEI_DARUSSALAM" },  | 
298  |  |   { "ms_MY", 0x43e, "Malay (ms)", 0x3e, "LANG_MALAY", "Malaysia (MY)", 0x1, | 
299  |  |     "SUBLANG_MALAY_MALAYSIA" },  | 
300  |  |   { "ml_IN", 0x44c, "Malayalam (ml)", 0x4c, "LANG_MALAYALAM", "India (IN)", 0x1, | 
301  |  |     "SUBLANG_MALAYALAM_INDIA" },  | 
302  |  |   { "mt_MT", 0x43a, "Maltese (mt)", 0x3a, "LANG_MALTESE", "Malta (MT)", 0x1, | 
303  |  |     "SUBLANG_MALTESE_MALTA" },  | 
304  |  |   { "mi_NZ", 0x481, "Maori (mi)", 0x81, "LANG_MAORI", "New Zealand (NZ)", 0x1, | 
305  |  |     "SUBLANG_MAORI_NEW_ZEALAND" },  | 
306  |  |   { "arn_CL", 0x47a, "Mapudungun (arn)", 0x7a, "LANG_MAPUDUNGUN", "Chile (CL)", 0x1, | 
307  |  |     "SUBLANG_MAPUDUNGUN_CHILE" },  | 
308  |  |   { "mr_IN", 0x44e, "Marathi (mr)", 0x4e, "LANG_MARATHI", "India (IN)", 0x1, | 
309  |  |     "SUBLANG_MARATHI_INDIA" },  | 
310  |  |   { "moh_CA", 0x47c, "Mohawk (moh)", 0x7c, "LANG_MOHAWK", "Canada (CA)", 0x1, | 
311  |  |     "SUBLANG_MOHAWK_MOHAWK" },  | 
312  |  |   { "mn_MN", 0x450, "Mongolian (mn)", 0x50, "LANG_MONGOLIAN", "Mongolia, Cyrillic (MN)", 0x1, | 
313  |  |     "SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA" },  | 
314  |  |   { "mn_MN", 0x850, "Mongolian (mn)", 0x50, "LANG_MONGOLIAN", "Mongolia, Mong (MN)", 0x2, | 
315  |  |     "SUBLANG_MONGOLIAN_PRC" },  | 
316  |  |   { "ne_NP", 0x461, "Nepali (ne)", 0x61, "LANG_NEPALI", "Nepal (NP)", 0x1, | 
317  |  |     "SUBLANG_NEPALI_NEPAL" },  | 
318  |  |   { "ne_IN", 0x861, "Nepali (ne)", 0x61, "LANG_NEPALI", "India (IN)", 0x2, | 
319  |  |     "SUBLANG_NEPALI_INDIA" },  | 
320  |  |   { "no_NO", 0x414, "Norwegian (no)", 0x14, "LANG_NORWEGIAN", "Bokmål, Norway (NO)", 0x1, | 
321  |  |     "SUBLANG_NORWEGIAN_BOKMAL" },  | 
322  |  |   { "no_NO", 0x814, "Norwegian (no)", 0x14, "LANG_NORWEGIAN", "Nynorsk, Norway (NO)", 0x2, | 
323  |  |     "SUBLANG_NORWEGIAN_NYNORSK" },  | 
324  |  |   { "oc_FR", 0x482, "Occitan (oc)", 0x82, "LANG_OCCITAN", "France (FR)", 0x1, | 
325  |  |     "SUBLANG_OCCITAN_FRANCE" },  | 
326  |  |   { "or_IN", 0x448, "Odia (or)", 0x48, "LANG_ORIYA", "India (IN)", 0x1, "SUBLANG_ORIYA_INDIA" }, | 
327  |  |   { "ps_AF", 0x463, "Pashto (ps)", 0x63, "LANG_PASHTO", "Afghanistan (AF)", 0x1, | 
328  |  |     "SUBLANG_PASHTO_AFGHANISTAN" },  | 
329  |  |   { "fa_IR", 0x429, "Persian (fa)", 0x29, "LANG_PERSIAN", "Iran (IR)", 0x1, | 
330  |  |     "SUBLANG_PERSIAN_IRAN" },  | 
331  |  |   { "pl_PL", 0x415, "Polish (pl)", 0x15, "LANG_POLISH", "Poland (PL)", 0x1, | 
332  |  |     "SUBLANG_POLISH_POLAND" },  | 
333  |  |   { "pt_BR", 0x416, "Portuguese (pt)", 0x16, "LANG_PORTUGUESE", "Brazil (BR)", 0x1, | 
334  |  |     "SUBLANG_PORTUGUESE_BRAZILIAN" },  | 
335  |  |   { "pt_PT", 0x816, "Portuguese (pt)", 0x16, "LANG_PORTUGUESE", "Portugal (PT)", 0x2, | 
336  |  |     "SUBLANG_PORTUGUESE" },  | 
337  |  |   { "ff_SN", 0x867, "Pular (ff)", 0x67, "LANG_PULAR", "Senegal (SN)", 0x2, | 
338  |  |     "SUBLANG_PULAR_SENEGAL" },  | 
339  |  |   { "pa_IN", 0x446, "Punjabi (pa)", 0x46, "LANG_PUNJABI", "India, Gurmukhi script (IN)", 0x1, | 
340  |  |     "SUBLANG_PUNJABI_INDIA" },  | 
341  |  |   { "pa_PK", 0x846, "Punjabi (pa)", 0x46, "LANG_PUNJABI", "Pakistan, Arabic script(PK)", 0x2, | 
342  |  |     "SUBLANG_PUNJABI_PAKISTAN" },  | 
343  |  |   { "quz_BO", 0x46b, "Quechua (quz)", 0x6b, "LANG_QUECHUA", "Bolivia (BO)", 0x1, | 
344  |  |     "SUBLANG_QUECHUA_BOLIVIA" },  | 
345  |  |   { "quz_EC", 0x86b, "Quechua (quz)", 0x6b, "LANG_QUECHUA", "Ecuador (EC)", 0x2, | 
346  |  |     "SUBLANG_QUECHUA_ECUADOR" },  | 
347  |  |   { "quz_PE", 0xc6b, "Quechua (quz)", 0x6b, "LANG_QUECHUA", "Peru (PE)", 0x3, | 
348  |  |     "SUBLANG_QUECHUA_PERU" },  | 
349  |  |   { "ro_RO", 0x418, "Romanian (ro)", 0x18, "LANG_ROMANIAN", "Romania (RO)", 0x1, | 
350  |  |     "SUBLANG_ROMANIAN_ROMANIA" },  | 
351  |  |   { "rm_CH", 0x417, "Romansh (rm)", 0x17, "LANG_ROMANSH", "Switzerland (CH)", 0x1, | 
352  |  |     "SUBLANG_ROMANSH_SWITZERLAND" },  | 
353  |  |   { "ru_RU", 0x419, "Russian (ru)", 0x19, "LANG_RUSSIAN", "Russia (RU)", 0x1, | 
354  |  |     "SUBLANG_RUSSIAN_RUSSIA" },  | 
355  |  |   { "sah_RU", 0x485, "Sakha (sah)", 0x85, "LANG_SAKHA", "Russia (RU)", 0x1, | 
356  |  |     "SUBLANG_SAKHA_RUSSIA" },  | 
357  |  |   { "smn_FI", 0x243b, "Sami (smn)", 0x3b, "LANG_SAMI", "Inari, Finland (FI)", 0x9, | 
358  |  |     "SUBLANG_SAMI_INARI_FINLAND" },  | 
359  |  |   { "smj_NO", 0x103b, "Sami (smj)", 0x3b, "LANG_SAMI", "Lule, Norway (NO)", 0x4, | 
360  |  |     "SUBLANG_SAMI_LULE_NORWAY" },  | 
361  |  |   { "smj_SE", 0x143b, "Sami (smj)", 0x3b, "LANG_SAMI", "Lule, Sweden (SE)", 0x5, | 
362  |  |     "SUBLANG_SAMI_LULE_SWEDEN" },  | 
363  |  |   { "se_FI", 0xc3b, "Sami (se)", 0x3b, "LANG_SAMI", "Northern, Finland (FI)", 0x3, | 
364  |  |     "SUBLANG_SAMI_NORTHERN_FINLAND" },  | 
365  |  |   { "se_NO", 0x43b, "Sami (se)", 0x3b, "LANG_SAMI", "Northern, Norway (NO)", 0x1, | 
366  |  |     "SUBLANG_SAMI_NORTHERN_NORWAY" },  | 
367  |  |   { "se_SE", 0x83b, "Sami (se)", 0x3b, "LANG_SAMI", "Northern, Sweden (SE)", 0x2, | 
368  |  |     "SUBLANG_SAMI_NORTHERN_SWEDEN" },  | 
369  |  |   { "sms_FI", 0x203b, "Sami (sms)", 0x3b, "LANG_SAMI", "Skolt, Finland (FI)", 0x8, | 
370  |  |     "SUBLANG_SAMI_SKOLT_FINLAND" },  | 
371  |  |   { "sma_NO", 0x183b, "Sami (sma)", 0x3b, "LANG_SAMI", "Southern, Norway (NO)", 0x6, | 
372  |  |     "SUBLANG_SAMI_SOUTHERN_NORWAY" },  | 
373  |  |   { "sma_SE", 0x1c3b, "Sami (sma)", 0x3b, "LANG_SAMI", "Southern, Sweden (SE)", 0x7, | 
374  |  |     "SUBLANG_SAMI_SOUTHERN_SWEDEN" },  | 
375  |  |   { "sa_IN", 0x44f, "Sanskrit (sa)", 0x4f, "LANG_SANSKRIT", "India (IN)", 0x1, | 
376  |  |     "SUBLANG_SANSKRIT_INDIA" },  | 
377  |  |   { "sr", 0x7c1a, "Serbian (sr)", 0x1a, "LANG_SERBIAN_NEUTRAL", "Neutral", 0x00, "" }, | 
378  |  |   { "sr_BA", 0x1c1a, "Serbian (sr)", 0x1a, "LANG_SERBIAN", | 
379  |  |     "Bosnia and Herzegovina, Cyrillic (BA)", 0x7, "SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC" },  | 
380  |  |   { "sr_BA", 0x181a, "Serbian (sr)", 0x1a, "LANG_SERBIAN", "Bosnia and Herzegovina, Latin (BA)", | 
381  |  |     0x6, "SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN" },  | 
382  |  |   { "sr_HR", 0x41a, "Serbian (sr)", 0x1a, "LANG_SERBIAN", "Croatia (HR)", 0x1, | 
383  |  |     "SUBLANG_SERBIAN_CROATIA" },  | 
384  |  |   { "sr_CS", 0xc1a, "Serbian (sr)", 0x1a, "LANG_SERBIAN", | 
385  |  |     "Serbia and Montenegro (former), Cyrillic (CS)", 0x3, "SUBLANG_SERBIAN_CYRILLIC" },  | 
386  |  |   { "sr_CS", 0x81a, "Serbian (sr)", 0x1a, "LANG_SERBIAN", | 
387  |  |     "Serbia and Montenegro (former), Latin (CS)", 0x2, "SUBLANG_SERBIAN_LATIN" },  | 
388  |  |   { "nso_ZA", 0x46c, "Sesotho sa Leboa (nso)", 0x6c, "LANG_SOTHO", "South Africa (ZA)", 0x1, | 
389  |  |     "SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA" },  | 
390  |  |   { "tn_BW", 0x832, "Setswana / Tswana (tn)", 0x32, "LANG_TSWANA", "Botswana (BW)", 0x2, | 
391  |  |     "SUBLANG_TSWANA_BOTSWANA" },  | 
392  |  |   { "tn_ZA", 0x432, "Setswana / Tswana (tn)", 0x32, "LANG_TSWANA", "South Africa (ZA)", 0x1, | 
393  |  |     "SUBLANG_TSWANA_SOUTH_AFRICA" },  | 
394  |  |   { "", 0x859, "(reserved)", 0x59, "LANG_SINDHI", "(reserved)", 0x2, | 
395  |  |     "SUBLANG_SINDHI_AFGHANISTAN" },  | 
396  |  |   { "", 0x459, "(reserved)", 0x59, "LANG_SINDHI", "(reserved)", 0x1, "SUBLANG_SINDHI_INDIA" }, | 
397  |  |   { "sd_PK", 0x859, "Sindhi (sd)", 0x59, "LANG_SINDHI", "Pakistan (PK)", 0x2, | 
398  |  |     "SUBLANG_SINDHI_PAKISTAN" },  | 
399  |  |   { "si_LK", 0x45b, "Sinhala (si)", 0x5b, "LANG_SINHALESE", "Sri Lanka (LK)", 0x1, | 
400  |  |     "SUBLANG_SINHALESE_SRI_LANKA" },  | 
401  |  |   { "sk_SK", 0x41b, "Slovak (sk)", 0x1b, "LANG_SLOVAK", "Slovakia (SK)", 0x1, | 
402  |  |     "SUBLANG_SLOVAK_SLOVAKIA" },  | 
403  |  |   { "sl_SI", 0x424, "Slovenian (sl)", 0x24, "LANG_SLOVENIAN", "Slovenia (SI)", 0x1, | 
404  |  |     "SUBLANG_SLOVENIAN_SLOVENIA" },  | 
405  |  |   { "es_AR", 0x2c0a, "Spanish (es)", 0xa, "LANG_SPANISH", "Argentina (AR)", 0xb, | 
406  |  |     "SUBLANG_SPANISH_ARGENTINA" },  | 
407  |  |   { "es_BO", 0x400a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Bolivia (BO)", 0x10, | 
408  |  |     "SUBLANG_SPANISH_BOLIVIA" },  | 
409  |  |   { "es_CL", 0x340a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Chile (CL)", 0xd, | 
410  |  |     "SUBLANG_SPANISH_CHILE" },  | 
411  |  |   { "es_CO", 0x240a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Colombia (CO)", 0x9, | 
412  |  |     "SUBLANG_SPANISH_COLOMBIA" },  | 
413  |  |   { "es_CR", 0x140a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Costa Rica (CR)", 0x5, | 
414  |  |     "SUBLANG_SPANISH_COSTA_RICA" },  | 
415  |  |   { "es_DO", 0x1c0a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Dominican Republic (DO)", 0x7, | 
416  |  |     "SUBLANG_SPANISH_DOMINICAN_REPUBLIC" },  | 
417  |  |   { "es_EC", 0x300a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Ecuador (EC)", 0xc, | 
418  |  |     "SUBLANG_SPANISH_ECUADOR" },  | 
419  |  |   { "es_SV", 0x440a, "Spanish (es)", 0x0a, "LANG_SPANISH", "El Salvador (SV)", 0x11, | 
420  |  |     "SUBLANG_SPANISH_EL_SALVADOR" },  | 
421  |  |   { "es_GT", 0x100a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Guatemala (GT)", 0x4, | 
422  |  |     "SUBLANG_SPANISH_GUATEMALA" },  | 
423  |  |   { "es_HN", 0x480a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Honduras (HN)", 0x12, | 
424  |  |     "SUBLANG_SPANISH_HONDURAS" },  | 
425  |  |   { "es_MX", 0x80a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Mexico (MX)", 0x2, | 
426  |  |     "SUBLANG_SPANISH_MEXICAN" },  | 
427  |  |   { "es_NI", 0x4c0a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Nicaragua (NI)", 0x13, | 
428  |  |     "SUBLANG_SPANISH_NICARAGUA" },  | 
429  |  |   { "es_PA", 0x180a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Panama (PA)", 0x6, | 
430  |  |     "SUBLANG_SPANISH_PANAMA" },  | 
431  |  |   { "es_PY", 0x3c0a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Paraguay (PY)", 0xf, | 
432  |  |     "SUBLANG_SPANISH_PARAGUAY" },  | 
433  |  |   { "es_PE", 0x280a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Peru (PE)", 0xa, | 
434  |  |     "SUBLANG_SPANISH_PERU" },  | 
435  |  |   { "es_PR", 0x500a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Puerto Rico (PR)", 0x14, | 
436  |  |     "SUBLANG_SPANISH_PUERTO_RICO" },  | 
437  |  |   { "es_ES", 0xc0a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Spain, Modern Sort (ES)", 0x3, | 
438  |  |     "SUBLANG_SPANISH_MODERN" },  | 
439  |  |   { "es_ES", 0x40a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Spain, Traditional Sort (ES)", 0x1, | 
440  |  |     "SUBLANG_SPANISH" },  | 
441  |  |   { "es_US", 0x540a, "Spanish (es)", 0x0a, "LANG_SPANISH", "United States (US)", 0x15, | 
442  |  |     "SUBLANG_SPANISH_US" },  | 
443  |  |   { "es_UY", 0x380a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Uruguay (UY)", 0xe, | 
444  |  |     "SUBLANG_SPANISH_URUGUAY" },  | 
445  |  |   { "es_VE", 0x200a, "Spanish (es)", 0x0a, "LANG_SPANISH", "Venezuela (VE)", 0x8, | 
446  |  |     "SUBLANG_SPANISH_VENEZUELA" },  | 
447  |  |   { "sw_KE", 0x441, "Swahili (sw)", 0x41, "LANG_SWAHILI", "Kenya (KE)", 0x1, "SUBLANG_SWAHILI" }, | 
448  |  |   { "sv_FI", 0x81d, "Swedish (sv)", 0x1d, "LANG_SWEDISH", "Finland (FI)", 0x2, | 
449  |  |     "SUBLANG_SWEDISH_FINLAND" },  | 
450  |  |   { "sv_SE", 0x41d, "Swedish (sv)", 0x1d, "LANG_SWEDISH", "Sweden (SE);", 0x1, | 
451  |  |     "SUBLANG_SWEDISH" },  | 
452  |  |   { "sv_SE", 0x41d, "Swedish (sv)", 0x1d, "LANG_SWEDISH", "Sweden (SE);", 0x1, | 
453  |  |     "SUBLANG_SWEDISH_SWEDEN" },  | 
454  |  |   { "syr_SY", 0x45a, "Syriac (syr)", 0x5a, "LANG_SYRIAC", "Syria (SY)", 0x1, "SUBLANG_SYRIAC" }, | 
455  |  |   { "tg_TJ", 0x428, "Tajik (tg)", 0x28, "LANG_TAJIK", "Tajikistan, Cyrillic (TJ)", 0x1, | 
456  |  |     "SUBLANG_TAJIK_TAJIKISTAN" },  | 
457  |  |   { "tzm_DZ", 0x85f, "Tamazight (tzm)", 0x5f, "LANG_TAMAZIGHT", "Algeria, Latin (DZ)", 0x2, | 
458  |  |     "SUBLANG_TAMAZIGHT_ALGERIA_LATIN" },  | 
459  |  |   { "ta_IN", 0x449, "Tamil (ta)", 0x49, "LANG_TAMIL", "India (IN)", 0x1, "SUBLANG_TAMIL_INDIA" }, | 
460  |  |   { "ta_LK", 0x849, "Tamil (ta)", 0x49, "LANG_TAMIL", "Sri Lanka (LK)", 0x2, | 
461  |  |     "SUBLANG_TAMIL_SRI_LANKA" },  | 
462  |  |   { "tt_RU", 0x444, "Tatar (tt)", 0x44, "LANG_TATAR", "Russia (RU)", 0x1, | 
463  |  |     "SUBLANG_TATAR_RUSSIA" },  | 
464  |  |   { "te_IN", 0x44a, "Telugu (te)", 0x4a, "LANG_TELUGU", "India (IN)", 0x1, | 
465  |  |     "SUBLANG_TELUGU_INDIA" },  | 
466  |  |   { "th_TH", 0x41e, "Thai (th)", 0x1e, "LANG_THAI", "Thailand (TH)", 0x1, | 
467  |  |     "SUBLANG_THAI_THAILAND" },  | 
468  |  |   { "bo_CN", 0x451, "Tibetan (bo)", 0x51, "LANG_TIBETAN", "PRC (CN)", 0x1, | 
469  |  |     "SUBLANG_TIBETAN_PRC" },  | 
470  |  |   { "ti_ER", 0x873, "Tigrinya (ti)", 0x73, "LANG_TIGRINYA", "Eritrea (ER)", 0x2, | 
471  |  |     "SUBLANG_TIGRINYA_ERITREA" },  | 
472  |  |   { "ti_ET", 0x473, "Tigrinya (ti)", 0x73, "LANG_TIGRIGNA", "Ethiopia (ET)", 0x1, | 
473  |  |     "SUBLANG_TIGRINYA_ETHIOPIA" },  | 
474  |  |   { "tr_TR", 0x41f, "Turkish (tr)", 0x1f, "LANG_TURKISH", "Turkey (TR)", 0x1, | 
475  |  |     "SUBLANG_TURKISH_TURKEY" },  | 
476  |  |   { "tk_KM", 0x442, "Turkmen (tk)", 0x42, "LANG_TURKMEN", "Turkmenistan (TM)", 0x1, | 
477  |  |     "SUBLANG_TURKMEN_TURKMENISTAN" },  | 
478  |  |   { "uk_UA", 0x422, "Ukrainian (uk)", 0x22, "LANG_UKRAINIAN", "Ukraine (UA)", 0x1, | 
479  |  |     "SUBLANG_UKRAINIAN_UKRAINE" },  | 
480  |  |   { "hsb_DE", 0x42e, "Upper Sorbian (hsb)", 0x2e, "LANG_UPPER_SORBIAN", "Germany (DE)", 0x1, | 
481  |  |     "SUBLANG_UPPER_SORBIAN_GERMANY" },  | 
482  |  |   { "ur", 0x820, "Urdu (ur)", 0x20, "LANG_URDU", "(reserved)", 0x2, "SUBLANG_URDU_INDIA" }, | 
483  |  |   { "ur_PK", 0x420, "Urdu (ur)", 0x20, "LANG_URDU", "Pakistan (PK)", 0x1, | 
484  |  |     "SUBLANG_URDU_PAKISTAN" },  | 
485  |  |   { "ug_CN", 0x480, "Uyghur (ug)", 0x80, "LANG_UIGHUR", "PRC (CN)", 0x1, "SUBLANG_UIGHUR_PRC" }, | 
486  |  |   { "uz_UZ", 0x843, "Uzbek (uz)", 0x43, "LANG_UZBEK", "Uzbekistan, Cyrillic (UZ)", 0x2, | 
487  |  |     "SUBLANG_UZBEK_CYRILLIC" },  | 
488  |  |   { "uz_UZ", 0x443, "Uzbek (uz)", 0x43, "LANG_UZBEK", "Uzbekistan, Latin (UZ)", 0x1, | 
489  |  |     "SUBLANG_UZBEK_LATIN" },  | 
490  |  |   { "ca", 0x803, "Valencian (ca)", 0x3, "LANG_VALENCIAN", "Valencia (ES-Valencia)", 0x2, | 
491  |  |     "SUBLANG_VALENCIAN_VALENCIA" },  | 
492  |  |   { "vi_VN", 0x42a, "Vietnamese (vi)", 0x2a, "LANG_VIETNAMESE", "Vietnam (VN)", 0x1, | 
493  |  |     "SUBLANG_VIETNAMESE_VIETNAM" },  | 
494  |  |   { "cy_GB", 0x452, "Welsh (cy)", 0x52, "LANG_WELSH", "United Kingdom (GB)", 0x1, | 
495  |  |     "SUBLANG_WELSH_UNITED_KINGDOM" },  | 
496  |  |   { "wo_SN", 0x488, "Wolof (wo)", 0x88, "LANG_WOLOF", "Senegal (SN)", 0x1, | 
497  |  |     "SUBLANG_WOLOF_SENEGAL" },  | 
498  |  |   { "ii_CN", 0x478, "Yi (ii)", 0x78, "LANG_YI", "PRC (CN)", 0x1, "SUBLANG_YI_PRC" }, | 
499  |  |   { "yu_NG", 0x46a, "Yoruba (yo)", 0x6a, "LANG_YORUBA", "Nigeria (NG)", 0x1, | 
500  |  |     "SUBLANG_YORUBA_NIGERIA" },  | 
501  |  | };  | 
502  |  |  | 
503  |  | /*  | 
504  |  |  * In Windows XP, this information is available in the system registry at  | 
505  |  |  * HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet001/Control/Keyboard Layouts/  | 
506  |  |  * https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-language-pack-default-values  | 
507  |  |  */  | 
508  |  | static const RDP_KEYBOARD_LAYOUT RDP_KEYBOARD_LAYOUT_TABLE[] = { | 
509  |  |   { 0x0000041c, "Albanian" }, | 
510  |  |   { 0x00000401, "Arabic (101)" }, | 
511  |  |   { 0x00010401, "Arabic (102)" }, | 
512  |  |   { 0x00020401, "Arabic (102) AZERTY" }, | 
513  |  |   { 0x0000042b, "Armenian Eastern" }, | 
514  |  |   { 0x0002042b, "Armenian Phonetic" }, | 
515  |  |   { 0x0003042b, "Armenian Typewriter" }, | 
516  |  |   { 0x0001042b, "Armenian Western" }, | 
517  |  |   { 0x0000044d, "Assamese - Inscript" }, | 
518  |  |   { 0x0001042c, "Azerbaijani (Standard)" }, | 
519  |  |   { 0x0000082c, "Azerbaijani Cyrillic" }, | 
520  |  |   { 0x0000042c, "Azerbaijani Latin" }, | 
521  |  |   { 0x0000046d, "Bashkir" }, | 
522  |  |   { 0x00000423, "Belarusian" }, | 
523  |  |   { 0x0001080c, "Belgian (Comma)" }, | 
524  |  |   { 0x00000813, "Belgian (Period)" }, | 
525  |  |   { 0x0000080c, "Belgian French" }, | 
526  |  |   { 0x00000445, "Bangla (Bangladesh)" }, | 
527  |  |   { 0x00020445, "Bangla (India)" }, | 
528  |  |   { 0x00010445, "Bangla (India - Legacy)" }, | 
529  |  |   { 0x0000201a, "Bosnian (Cyrillic)" }, | 
530  |  |   { 0x000b0c00, "Buginese" }, | 
531  |  |   { 0x00030402, "Bulgarian" }, | 
532  |  |   { 0x00010402, "Bulgarian (Latin)" }, | 
533  |  |   { 0x00020402, "Bulgarian (phonetic layout)" }, | 
534  |  |   { 0x00040402, "Bulgarian (phonetic traditional)" }, | 
535  |  |   { 0x00000402, "Bulgarian (Typewriter)" }, | 
536  |  |   { 0x00001009, "Canadian French" }, | 
537  |  |   { 0x00000c0c, "Canadian French (Legacy)" }, | 
538  |  |   { 0x00011009, "Canadian Multilingual Standard" }, | 
539  |  |   { 0x0000085f, "Central Atlas Tamazight" }, | 
540  |  |   { 0x00000429, "Central Kurdish" }, | 
541  |  |   { 0x0000045c, "Cherokee Nation" }, | 
542  |  |   { 0x0001045c, "Cherokee Nation Phonetic" }, | 
543  |  |   { 0x00000804, "Chinese (Simplified) - US Keyboard" }, | 
544  |  |   { 0x00000404, "Chinese (Traditional) - US Keyboard" }, | 
545  |  |   { 0x00000c04, "Chinese (Traditional, Hong Kong S.A.R.)" }, | 
546  |  |   { 0x00001404, "Chinese (Traditional Macao S.A.R.) US Keyboard" }, | 
547  |  |   { 0x00001004, "Chinese (Simplified, Singapore) - US keyboard" }, | 
548  |  |   { 0x0000041a, "Croatian" }, | 
549  |  |   { 0x00000405, "Czech" }, | 
550  |  |   { 0x00010405, "Czech (QWERTY)" }, | 
551  |  |   { 0x00020405, "Czech Programmers" }, | 
552  |  |   { 0x00000406, "Danish" }, | 
553  |  |   { 0x00000439, "Devanagari-INSCRIPT" }, | 
554  |  |   { 0x00000465, "Divehi Phonetic" }, | 
555  |  |   { 0x00010465, "Divehi Typewriter" }, | 
556  |  |   { 0x00000413, "Dutch" }, | 
557  |  |   { 0x00000c51, "Dzongkha" }, | 
558  |  |   { 0x00000425, "Estonian" }, | 
559  |  |   { 0x00000438, "Faeroese" }, | 
560  |  |   { 0x0000040b, "Finnish" }, | 
561  |  |   { 0x0001083b, "Finnish with Sami" }, | 
562  |  |   { 0x0000040c, "French" }, | 
563  |  |   { 0x00120c00, "Futhark" }, | 
564  |  |   { 0x00000437, "Georgian" }, | 
565  |  |   { 0x00020437, "Georgian (Ergonomic)" }, | 
566  |  |   { 0x00010437, "Georgian (QWERTY)" }, | 
567  |  |   { 0x00030437, "Georgian Ministry of Education and Science Schools" }, | 
568  |  |   { 0x00040437, "Georgian (Old Alphabets)" }, | 
569  |  |   { 0x00000407, "German" }, | 
570  |  |   { 0x00010407, "German (IBM)" }, | 
571  |  |   { 0x000c0c00, "Gothic" }, | 
572  |  |   { 0x00000408, "Greek" }, | 
573  |  |   { 0x00010408, "Greek (220)" }, | 
574  |  |   { 0x00030408, "Greek (220) Latin" }, | 
575  |  |   { 0x00020408, "Greek (319)" }, | 
576  |  |   { 0x00040408, "Greek (319) Latin" }, | 
577  |  |   { 0x00050408, "Greek Latin" }, | 
578  |  |   { 0x00060408, "Greek Polytonic" }, | 
579  |  |   { 0x0000046f, "Greenlandic" }, | 
580  |  |   { 0x00000474, "Guarani" }, | 
581  |  |   { 0x00000447, "Gujarati" }, | 
582  |  |   { 0x00000468, "Hausa" }, | 
583  |  |   { 0x0000040d, "Hebrew" }, | 
584  |  |   { 0x00010439, "Hindi Traditional" }, | 
585  |  |   { 0x0000040e, "Hungarian" }, | 
586  |  |   { 0x0001040e, "Hungarian 101-key" }, | 
587  |  |   { 0x0000040f, "Icelandic" }, | 
588  |  |   { 0x00000470, "Igbo" }, | 
589  |  |   { 0x00004009, "India" }, | 
590  |  |   { 0x0000085d, "Inuktitut - Latin" }, | 
591  |  |   { 0x0001045d, "Inuktitut - Naqittaut" }, | 
592  |  |   { 0x00001809, "Irish" }, | 
593  |  |   { 0x00000410, "Italian" }, | 
594  |  |   { 0x00010410, "Italian (142)" }, | 
595  |  |   { 0x00000411, "Japanese" }, | 
596  |  |   { 0x00110c00, "Javanese" }, | 
597  |  |   { 0x0000044b, "Kannada" }, | 
598  |  |   { 0x0000043f, "Kazakh" }, | 
599  |  |   { 0x00000453, "Khmer" }, | 
600  |  |   { 0x00010453, "Khmer (NIDA)" }, | 
601  |  |   { 0x00000412, "Korean" }, | 
602  |  |   { 0x00000440, "Kyrgyz Cyrillic" }, | 
603  |  |   { 0x00000454, "Lao" }, | 
604  |  |   { 0x0000080a, "Latin American" }, | 
605  |  |   { 0x00020426, "Latvian (Standard)" }, | 
606  |  |   { 0x00010426, "Latvian (Legacy)" }, | 
607  |  |   { 0x00070c00, "Lisu (Basic)" }, | 
608  |  |   { 0x00080c00, "Lisu (Standard)" }, | 
609  |  |   { 0x00010427, "Lithuanian" }, | 
610  |  |   { 0x00000427, "Lithuanian IBM" }, | 
611  |  |   { 0x00020427, "Lithuanian Standard" }, | 
612  |  |   { 0x0000046e, "Luxembourgish" }, | 
613  |  |   { 0x0000042f, "Macedonia (FYROM)" }, | 
614  |  |   { 0x0001042f, "Macedonia (FYROM) - Standard" }, | 
615  |  |   { 0x0000044c, "Malayalam" }, | 
616  |  |   { 0x0000043a, "Maltese 47-Key" }, | 
617  |  |   { 0x0001043a, "Maltese 48-key" }, | 
618  |  |   { 0x00000481, "Maori" }, | 
619  |  |   { 0x0000044e, "Marathi" }, | 
620  |  |   { 0x00000850, "Mongolian (Mongolian Script - Legacy)" }, | 
621  |  |   { 0x00020850, "Mongolian (Mongolian Script - Standard)" }, | 
622  |  |   { 0x00000450, "Mongolian Cyrillic" }, | 
623  |  |   { 0x00010c00, "Myanmar" }, | 
624  |  |   { 0x00090c00, "N'ko" }, | 
625  |  |   { 0x00000461, "Nepali" }, | 
626  |  |   { 0x00020c00, "New Tai Lue" }, | 
627  |  |   { 0x00000414, "Norwegian" }, | 
628  |  |   { 0x0000043b, "Norwegian with Sami" }, | 
629  |  |   { 0x00000448, "Odia" }, | 
630  |  |   { 0x000d0c00, "Ol Chiki" }, | 
631  |  |   { 0x000f0c00, "Old Italic" }, | 
632  |  |   { 0x000e0c00, "Osmanya" }, | 
633  |  |   { 0x00000463, "Pashto (Afghanistan)" }, | 
634  |  |   { 0x00000429, "Persian" }, | 
635  |  |   { 0x00050429, "Persian (Standard)" }, | 
636  |  |   { 0x000a0c00, "Phags-pa" }, | 
637  |  |   { 0x00010415, "Polish (214)" }, | 
638  |  |   { 0x00000415, "Polish (Programmers)" }, | 
639  |  |   { 0x00000816, "Portuguese" }, | 
640  |  |   { 0x00000416, "Portuguese (Brazilian ABNT)" }, | 
641  |  |   { 0x00010416, "Portuguese (Brazilian ABNT2)" }, | 
642  |  |   { 0x00000446, "Punjabi" }, | 
643  |  |   { 0x00000418, "Romanian (Legacy)" }, | 
644  |  |   { 0x00020418, "Romanian (Programmers)" }, | 
645  |  |   { 0x00010418, "Romanian (Standard)" }, | 
646  |  |   { 0x00000419, "Russian" }, | 
647  |  |   { 0x00020419, "Russian - Mnemonic" }, | 
648  |  |   { 0x00010419, "Russian (Typewriter)" }, | 
649  |  |   { 0x00000485, "Sakha" }, | 
650  |  |   { 0x0002083b, "Sami Extended Finland-Sweden" }, | 
651  |  |   { 0x0001043b, "Sami Extended Norway" }, | 
652  |  |   { 0x00011809, "Scottish Gaelic" }, | 
653  |  |   { 0x00000c1a, "Serbian (Cyrillic)" }, | 
654  |  |   { 0x0000081a, "Serbian (Latin)" }, | 
655  |  |   { 0x0000046c, "Sesotho sa Leboa" }, | 
656  |  |   { 0x00000432, "Setswana" }, | 
657  |  |   { 0x0000045b, "Sinhala" }, | 
658  |  |   { 0x0001045b, "Sinhala - wij 9" }, | 
659  |  |   { 0x0000041b, "Slovak" }, | 
660  |  |   { 0x0001041b, "Slovak (QWERTY)" }, | 
661  |  |   { 0x00000424, "Slovenian" }, | 
662  |  |   { 0x00100c00, "Sora" }, | 
663  |  |   { 0x0001042e, "Sorbian Extended" }, | 
664  |  |   { 0x0002042e, "Sorbian Standard" }, | 
665  |  |   { 0x0000042e, "Sorbian Standard (Legacy)" }, | 
666  |  |   { 0x0000040a, "Spanish" }, | 
667  |  |   { 0x0001040a, "Spanish Variation" }, | 
668  |  |   { 0x0000041d, "Swedish" }, | 
669  |  |   { 0x0000083b, "Swedish with Sami" }, | 
670  |  |   { 0x0000100c, "Swiss French" }, | 
671  |  |   { 0x00000807, "Swiss German" }, | 
672  |  |   { 0x0000045a, "Syriac" }, | 
673  |  |   { 0x0001045a, "Syriac Phonetic" }, | 
674  |  |   { 0x00030c00, "Tai Le" }, | 
675  |  |   { 0x00000428, "Tajik" }, | 
676  |  |   { 0x00000449, "Tamil" }, | 
677  |  |   { 0x00010444, "Tatar" }, | 
678  |  |   { 0x00000444, "Tatar (Legacy)" }, | 
679  |  |   { 0x0000044a, "Telugu" }, | 
680  |  |   { 0x0000041e, "Thai Kedmanee" }, | 
681  |  |   { 0x0002041e, "Thai Kedmanee (non-ShiftLock)" }, | 
682  |  |   { 0x0001041e, "Thai Pattachote" }, | 
683  |  |   { 0x0003041e, "Thai Pattachote (non-ShiftLock)" }, | 
684  |  |   { 0x00010451, "Tibetan (PRC - Standard)" }, | 
685  |  |   { 0x00000451, "Tibetan (PRC - Legacy)" }, | 
686  |  |   { 0x00050c00, "Tifinagh (Basic)" }, | 
687  |  |   { 0x00060c00, "Tifinagh (Full)" }, | 
688  |  |   { 0x0001041f, "Turkish F" }, | 
689  |  |   { 0x0000041f, "Turkish Q" }, | 
690  |  |   { 0x00000442, "Turkmen" }, | 
691  |  |   { 0x00010408, "Uyghur" }, | 
692  |  |   { 0x00000480, "Uyghur (Legacy)" }, | 
693  |  |   { 0x00000422, "Ukrainian" }, | 
694  |  |   { 0x00020422, "Ukrainian (Enhanced)" }, | 
695  |  |   { 0x00000809, "United Kingdom" }, | 
696  |  |   { 0x00000452, "United Kingdom Extended" }, | 
697  |  |   { 0x00010409, "United States - Dvorak" }, | 
698  |  |   { 0x00020409, "United States - International" }, | 
699  |  |   { 0x00030409, "United States-Dvorak for left hand" }, | 
700  |  |   { 0x00040409, "United States-Dvorak for right hand" }, | 
701  |  |   { 0x00000409, "United States - English" }, | 
702  |  |   { 0x00000420, "Urdu" }, | 
703  |  |   { 0x00010480, "Uyghur" }, | 
704  |  |   { 0x00000843, "Uzbek Cyrillic" }, | 
705  |  |   { 0x0000042a, "Vietnamese" }, | 
706  |  |   { 0x00000488, "Wolof" }, | 
707  |  |   { 0x00000485, "Yakut" }, | 
708  |  |   { 0x0000046a, "Yoruba" }, | 
709  |  | };  | 
710  |  |  | 
711  |  | typedef struct  | 
712  |  | { | 
713  |  |   DWORD code;       /* Keyboard layout code */  | 
714  |  |   DWORD id;         /* Keyboard variant ID */  | 
715  |  |   const char* name; /* Keyboard layout variant name */  | 
716  |  | } RDP_KEYBOARD_LAYOUT_VARIANT;  | 
717  |  |  | 
718  |  | static const RDP_KEYBOARD_LAYOUT_VARIANT RDP_KEYBOARD_LAYOUT_VARIANT_TABLE[] = { | 
719  |  |   { KBD_ARABIC_102, 0x0028, "Arabic (102)" }, | 
720  |  |   { KBD_BULGARIAN_LATIN, 0x0004, "Bulgarian (Latin)" }, | 
721  |  |   { KBD_CZECH_QWERTY, 0x0005, "Czech (QWERTY)" }, | 
722  |  |   { KBD_GERMAN_IBM, 0x0012, "German (IBM)" }, | 
723  |  |   { KBD_GREEK_220, 0x0016, "Greek (220)" }, | 
724  |  |   { KBD_UNITED_STATES_DVORAK, 0x0002, "United States-Dvorak" }, | 
725  |  |   { KBD_SPANISH_VARIATION, 0x0086, "Spanish Variation" }, | 
726  |  |   { KBD_HUNGARIAN_101_KEY, 0x0006, "Hungarian 101-key" }, | 
727  |  |   { KBD_ITALIAN_142, 0x0003, "Italian (142)" }, | 
728  |  |   { KBD_POLISH_214, 0x0007, "Polish (214)" }, | 
729  |  |   { KBD_PORTUGUESE_BRAZILIAN_ABNT2, 0x001D, "Portuguese (Brazilian ABNT2)" }, | 
730  |  |   { KBD_RUSSIAN_TYPEWRITER, 0x0008, "Russian (Typewriter)" }, | 
731  |  |   { KBD_SLOVAK_QWERTY, 0x0013, "Slovak (QWERTY)" }, | 
732  |  |   { KBD_THAI_PATTACHOTE, 0x0021, "Thai Pattachote" }, | 
733  |  |   { KBD_TURKISH_F, 0x0014, "Turkish F" }, | 
734  |  |   { KBD_LATVIAN_QWERTY, 0x0015, "Latvian (QWERTY)" }, | 
735  |  |   { KBD_LITHUANIAN, 0x0027, "Lithuanian" }, | 
736  |  |   { KBD_ARMENIAN_WESTERN, 0x0025, "Armenian Western" }, | 
737  |  |   { KBD_HINDI_TRADITIONAL, 0x000C, "Hindi Traditional" }, | 
738  |  |   { KBD_MALTESE_48_KEY, 0x002B, "Maltese 48-key" }, | 
739  |  |   { KBD_SAMI_EXTENDED_NORWAY, 0x002C, "Sami Extended Norway" }, | 
740  |  |   { KBD_BENGALI_INSCRIPT, 0x002A, "Bengali (Inscript)" }, | 
741  |  |   { KBD_SYRIAC_PHONETIC, 0x000E, "Syriac Phonetic" }, | 
742  |  |   { KBD_DIVEHI_TYPEWRITER, 0x000D, "Divehi Typewriter" }, | 
743  |  |   { KBD_BELGIAN_COMMA, 0x001E, "Belgian (Comma)" }, | 
744  |  |   { KBD_FINNISH_WITH_SAMI, 0x002D, "Finnish with Sami" }, | 
745  |  |   { KBD_CANADIAN_MULTILINGUAL_STANDARD, 0x0020, "Canadian Multilingual Standard" }, | 
746  |  |   { KBD_GAELIC, 0x0026, "Gaelic" }, | 
747  |  |   { KBD_ARABIC_102_AZERTY, 0x0029, "Arabic (102) AZERTY" }, | 
748  |  |   { KBD_CZECH_PROGRAMMERS, 0x000A, "Czech Programmers" }, | 
749  |  |   { KBD_GREEK_319, 0x0018, "Greek (319)" }, | 
750  |  |   { KBD_UNITED_STATES_INTERNATIONAL, 0x0001, "United States-International" }, | 
751  |  |   { KBD_THAI_KEDMANEE_NON_SHIFTLOCK, 0x0022, "Thai Kedmanee (non-ShiftLock)" }, | 
752  |  |   { KBD_SAMI_EXTENDED_FINLAND_SWEDEN, 0x002E, "Sami Extended Finland-Sweden" }, | 
753  |  |   { KBD_GREEK_220_LATIN, 0x0017, "Greek (220) Latin" }, | 
754  |  |   { KBD_UNITED_STATES_DVORAK_FOR_LEFT_HAND, 0x001A, "United States-Dvorak for left hand" }, | 
755  |  |   { KBD_THAI_PATTACHOTE_NON_SHIFTLOCK, 0x0023, "Thai Pattachote (non-ShiftLock)" }, | 
756  |  |   { KBD_GREEK_319_LATIN, 0x0011, "Greek (319) Latin" }, | 
757  |  |   { KBD_UNITED_STATES_DVORAK_FOR_RIGHT_HAND, 0x001B, "United States-Dvorak for right hand" }, | 
758  |  |   { KBD_UNITED_STATES_DVORAK_PROGRAMMER, 0x001C, "United States-Programmer Dvorak" }, | 
759  |  |   { KBD_GREEK_LATIN, 0x0019, "Greek Latin" }, | 
760  |  |   { KBD_US_ENGLISH_TABLE_FOR_IBM_ARABIC_238_L, 0x000B, "US English Table for IBM Arabic 238_L" }, | 
761  |  |   { KBD_GREEK_POLYTONIC, 0x001F, "Greek Polytonic" }, | 
762  |  |   { KBD_FRENCH_BEPO, 0x00C0, "French Bépo" }, | 
763  |  |   { KBD_GERMAN_NEO, 0x00C0, "German Neo" } | 
764  |  | };  | 
765  |  |  | 
766  |  | /* Input Method Editor (IME) */  | 
767  |  |  | 
768  |  | typedef struct  | 
769  |  | { | 
770  |  |   DWORD code;       /* Keyboard layout code */  | 
771  |  |   const char* file; /* IME file */  | 
772  |  |   const char* name; /* Keyboard layout name */  | 
773  |  | } RDP_KEYBOARD_IME;  | 
774  |  |  | 
775  |  | /* Global Input Method Editors (IME) */  | 
776  |  |  | 
777  |  | static const RDP_KEYBOARD_IME RDP_KEYBOARD_IME_TABLE[] = { | 
778  |  |   { KBD_CHINESE_TRADITIONAL_PHONETIC, "phon.ime", "Chinese (Traditional) - Phonetic" }, | 
779  |  |   { KBD_JAPANESE_INPUT_SYSTEM_MS_IME2002, "imjp81.ime", "Japanese Input System (MS-IME2002)" }, | 
780  |  |   { KBD_KOREAN_INPUT_SYSTEM_IME_2000, "imekr61.ime", "Korean Input System (IME 2000)" }, | 
781  |  |   { KBD_CHINESE_SIMPLIFIED_QUANPIN, "winpy.ime", "Chinese (Simplified) - QuanPin" }, | 
782  |  |   { KBD_CHINESE_TRADITIONAL_CHANGJIE, "chajei.ime", "Chinese (Traditional) - ChangJie" }, | 
783  |  |   { KBD_CHINESE_SIMPLIFIED_SHUANGPIN, "winsp.ime", "Chinese (Simplified) - ShuangPin" }, | 
784  |  |   { KBD_CHINESE_TRADITIONAL_QUICK, "quick.ime", "Chinese (Traditional) - Quick" }, | 
785  |  |   { KBD_CHINESE_SIMPLIFIED_ZHENGMA, "winzm.ime", "Chinese (Simplified) - ZhengMa" }, | 
786  |  |   { KBD_CHINESE_TRADITIONAL_BIG5_CODE, "winime.ime", "Chinese (Traditional) - Big5 Code" }, | 
787  |  |   { KBD_CHINESE_TRADITIONAL_ARRAY, "winar30.ime", "Chinese (Traditional) - Array" }, | 
788  |  |   { KBD_CHINESE_SIMPLIFIED_NEIMA, "wingb.ime", "Chinese (Simplified) - NeiMa" }, | 
789  |  |   { KBD_CHINESE_TRADITIONAL_DAYI, "dayi.ime", "Chinese (Traditional) - DaYi" }, | 
790  |  |   { KBD_CHINESE_TRADITIONAL_UNICODE, "unicdime.ime", "Chinese (Traditional) - Unicode" }, | 
791  |  |   { KBD_CHINESE_TRADITIONAL_NEW_PHONETIC, "TINTLGNT.IME", | 
792  |  |     "Chinese (Traditional) - New Phonetic" },  | 
793  |  |   { KBD_CHINESE_TRADITIONAL_NEW_CHANGJIE, "CINTLGNT.IME", | 
794  |  |     "Chinese (Traditional) - New ChangJie" },  | 
795  |  |   { KBD_CHINESE_TRADITIONAL_MICROSOFT_PINYIN_IME_3, "pintlgnt.ime", | 
796  |  |     "Chinese (Traditional) - Microsoft Pinyin IME 3.0" },  | 
797  |  |   { KBD_CHINESE_TRADITIONAL_ALPHANUMERIC, "romanime.ime", "Chinese (Traditional) - Alphanumeric" } | 
798  |  | };  | 
799  |  |  | 
800  |  | void freerdp_keyboard_layouts_free(RDP_KEYBOARD_LAYOUT* layouts, size_t count)  | 
801  | 0  | { | 
802  | 0  |   if (!layouts)  | 
803  | 0  |     return;  | 
804  |  |  | 
805  | 0  |   for (size_t x = 0; x < count; x++)  | 
806  | 0  |   { | 
807  | 0  |     RDP_KEYBOARD_LAYOUT* current = &layouts[x];  | 
808  | 0  |     free(current->name);  | 
809  | 0  |     current++;  | 
810  | 0  |   }  | 
811  |  | 
  | 
812  | 0  |   free(layouts);  | 
813  | 0  | }  | 
814  |  |  | 
815  |  | RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(DWORD types, size_t* count)  | 
816  | 0  | { | 
817  | 0  |   size_t num = 0;  | 
818  | 0  |   RDP_KEYBOARD_LAYOUT* layouts = NULL;  | 
819  |  | 
  | 
820  | 0  |   num = 0;  | 
821  |  | 
  | 
822  | 0  |   WINPR_ASSERT(count);  | 
823  | 0  |   *count = 0;  | 
824  |  | 
  | 
825  | 0  |   if ((types & RDP_KEYBOARD_LAYOUT_TYPE_STANDARD) != 0)  | 
826  | 0  |   { | 
827  | 0  |     const size_t length = ARRAYSIZE(RDP_KEYBOARD_LAYOUT_TABLE);  | 
828  | 0  |     RDP_KEYBOARD_LAYOUT* new = (RDP_KEYBOARD_LAYOUT*)realloc(  | 
829  | 0  |         layouts, (num + length + 1) * sizeof(RDP_KEYBOARD_LAYOUT));  | 
830  |  | 
  | 
831  | 0  |     if (!new)  | 
832  | 0  |       goto fail;  | 
833  |  |  | 
834  | 0  |     layouts = new;  | 
835  |  | 
  | 
836  | 0  |     for (size_t i = 0; i < length; i++, num++)  | 
837  | 0  |     { | 
838  | 0  |       layouts[num].code = RDP_KEYBOARD_LAYOUT_TABLE[i].code;  | 
839  | 0  |       layouts[num].name = _strdup(RDP_KEYBOARD_LAYOUT_TABLE[i].name);  | 
840  |  | 
  | 
841  | 0  |       if (!layouts[num].name)  | 
842  | 0  |         goto fail;  | 
843  | 0  |     }  | 
844  | 0  |   }  | 
845  |  |  | 
846  | 0  |   if ((types & RDP_KEYBOARD_LAYOUT_TYPE_VARIANT) != 0)  | 
847  | 0  |   { | 
848  | 0  |     const size_t length = ARRAYSIZE(RDP_KEYBOARD_LAYOUT_VARIANT_TABLE);  | 
849  | 0  |     RDP_KEYBOARD_LAYOUT* new = (RDP_KEYBOARD_LAYOUT*)realloc(  | 
850  | 0  |         layouts, (num + length + 1) * sizeof(RDP_KEYBOARD_LAYOUT));  | 
851  |  | 
  | 
852  | 0  |     if (!new)  | 
853  | 0  |       goto fail;  | 
854  |  |  | 
855  | 0  |     layouts = new;  | 
856  |  | 
  | 
857  | 0  |     for (size_t i = 0; i < length; i++, num++)  | 
858  | 0  |     { | 
859  | 0  |       layouts[num].code = RDP_KEYBOARD_LAYOUT_VARIANT_TABLE[i].code;  | 
860  | 0  |       layouts[num].name = _strdup(RDP_KEYBOARD_LAYOUT_VARIANT_TABLE[i].name);  | 
861  |  | 
  | 
862  | 0  |       if (!layouts[num].name)  | 
863  | 0  |         goto fail;  | 
864  | 0  |     }  | 
865  | 0  |   }  | 
866  |  |  | 
867  | 0  |   if ((types & RDP_KEYBOARD_LAYOUT_TYPE_IME) != 0)  | 
868  | 0  |   { | 
869  | 0  |     const size_t length = ARRAYSIZE(RDP_KEYBOARD_IME_TABLE);  | 
870  | 0  |     RDP_KEYBOARD_LAYOUT* new = (RDP_KEYBOARD_LAYOUT*)realloc(  | 
871  | 0  |         layouts, (num + length + 1) * sizeof(RDP_KEYBOARD_LAYOUT));  | 
872  |  | 
  | 
873  | 0  |     if (!new)  | 
874  | 0  |       goto fail;  | 
875  |  |  | 
876  | 0  |     layouts = new;  | 
877  |  | 
  | 
878  | 0  |     for (size_t i = 0; i < length; i++, num++)  | 
879  | 0  |     { | 
880  | 0  |       layouts[num].code = RDP_KEYBOARD_IME_TABLE[i].code;  | 
881  | 0  |       layouts[num].name = _strdup(RDP_KEYBOARD_IME_TABLE[i].name);  | 
882  |  | 
  | 
883  | 0  |       if (!layouts[num].name)  | 
884  | 0  |         goto fail;  | 
885  | 0  |     }  | 
886  | 0  |   }  | 
887  |  |  | 
888  | 0  |   *count = num;  | 
889  | 0  |   return layouts;  | 
890  | 0  | fail:  | 
891  | 0  |   freerdp_keyboard_layouts_free(layouts, num);  | 
892  | 0  |   return NULL;  | 
893  | 0  | }  | 
894  |  |  | 
895  |  | const char* freerdp_keyboard_get_layout_name_from_id(DWORD keyboardLayoutID)  | 
896  | 0  | { | 
897  | 0  |   for (size_t i = 0; i < ARRAYSIZE(RDP_KEYBOARD_LAYOUT_TABLE); i++)  | 
898  | 0  |   { | 
899  | 0  |     if (RDP_KEYBOARD_LAYOUT_TABLE[i].code == keyboardLayoutID)  | 
900  | 0  |       return RDP_KEYBOARD_LAYOUT_TABLE[i].name;  | 
901  | 0  |   }  | 
902  |  |  | 
903  | 0  |   for (size_t i = 0; i < ARRAYSIZE(RDP_KEYBOARD_LAYOUT_VARIANT_TABLE); i++)  | 
904  | 0  |   { | 
905  | 0  |     if (RDP_KEYBOARD_LAYOUT_VARIANT_TABLE[i].code == keyboardLayoutID)  | 
906  | 0  |       return RDP_KEYBOARD_LAYOUT_VARIANT_TABLE[i].name;  | 
907  | 0  |   }  | 
908  |  |  | 
909  | 0  |   for (size_t i = 0; i < ARRAYSIZE(RDP_KEYBOARD_IME_TABLE); i++)  | 
910  | 0  |   { | 
911  | 0  |     if (RDP_KEYBOARD_IME_TABLE[i].code == keyboardLayoutID)  | 
912  | 0  |       return RDP_KEYBOARD_IME_TABLE[i].name;  | 
913  | 0  |   }  | 
914  |  |  | 
915  | 0  |   return "unknown";  | 
916  | 0  | }  | 
917  |  |  | 
918  |  | DWORD freerdp_keyboard_get_layout_id_from_name(const char* name)  | 
919  | 0  | { | 
920  | 0  |   for (size_t i = 0; i < ARRAYSIZE(RDP_KEYBOARD_LAYOUT_TABLE); i++)  | 
921  | 0  |   { | 
922  | 0  |     if (strcmp(RDP_KEYBOARD_LAYOUT_TABLE[i].name, name) == 0)  | 
923  | 0  |       return RDP_KEYBOARD_LAYOUT_TABLE[i].code;  | 
924  | 0  |   }  | 
925  |  |  | 
926  | 0  |   for (size_t i = 0; i < ARRAYSIZE(RDP_KEYBOARD_LAYOUT_VARIANT_TABLE); i++)  | 
927  | 0  |   { | 
928  | 0  |     if (strcmp(RDP_KEYBOARD_LAYOUT_VARIANT_TABLE[i].name, name) == 0)  | 
929  | 0  |       return RDP_KEYBOARD_LAYOUT_VARIANT_TABLE[i].code;  | 
930  | 0  |   }  | 
931  |  |  | 
932  | 0  |   for (size_t i = 0; i < ARRAYSIZE(RDP_KEYBOARD_IME_TABLE); i++)  | 
933  | 0  |   { | 
934  | 0  |     if (strcmp(RDP_KEYBOARD_IME_TABLE[i].name, name) == 0)  | 
935  | 0  |       return RDP_KEYBOARD_IME_TABLE[i].code;  | 
936  | 0  |   }  | 
937  |  |  | 
938  | 0  |   return 0;  | 
939  | 0  | }  | 
940  |  |  | 
941  |  | static void copy(const struct LanguageIdentifier* id, RDP_CODEPAGE* cp)  | 
942  | 0  | { | 
943  | 0  |   cp->id = id->LanguageIdentifier;  | 
944  | 0  |   cp->subId = id->SublangaugeIdentifier;  | 
945  | 0  |   cp->primaryId = id->PrimaryLanguageIdentifier;  | 
946  | 0  |   if (id->locale)  | 
947  | 0  |     strncpy(cp->locale, id->locale, ARRAYSIZE(cp->locale) - 1);  | 
948  | 0  |   if (id->PrimaryLanguage)  | 
949  | 0  |     strncpy(cp->primaryLanguage, id->PrimaryLanguage, ARRAYSIZE(cp->primaryLanguage) - 1);  | 
950  | 0  |   if (id->PrimaryLanguageSymbol)  | 
951  | 0  |     strncpy(cp->primaryLanguageSymbol, id->PrimaryLanguageSymbol,  | 
952  | 0  |             ARRAYSIZE(cp->primaryLanguageSymbol) - 1);  | 
953  | 0  |   if (id->Sublanguage)  | 
954  | 0  |     strncpy(cp->subLanguage, id->Sublanguage, ARRAYSIZE(cp->subLanguage) - 1);  | 
955  | 0  |   if (id->SublanguageSymbol)  | 
956  | 0  |     strncpy(cp->subLanguageSymbol, id->SublanguageSymbol, ARRAYSIZE(cp->subLanguageSymbol) - 1);  | 
957  | 0  | }  | 
958  |  |  | 
959  |  | static BOOL copyOnMatch(DWORD column, const char* filter, const struct LanguageIdentifier* cur,  | 
960  |  |                         RDP_CODEPAGE* dst)  | 
961  | 0  | { | 
962  | 0  |   const char* what = NULL;  | 
963  | 0  |   switch (column)  | 
964  | 0  |   { | 
965  | 0  |     case 0:  | 
966  | 0  |       what = cur->locale;  | 
967  | 0  |       break;  | 
968  | 0  |     case 1:  | 
969  | 0  |       what = cur->PrimaryLanguage;  | 
970  | 0  |       break;  | 
971  | 0  |     case 2:  | 
972  | 0  |       what = cur->PrimaryLanguageSymbol;  | 
973  | 0  |       break;  | 
974  | 0  |     case 3:  | 
975  | 0  |       what = cur->Sublanguage;  | 
976  | 0  |       break;  | 
977  | 0  |     case 4:  | 
978  | 0  |       what = cur->SublanguageSymbol;  | 
979  | 0  |       break;  | 
980  | 0  |     default:  | 
981  | 0  |       return FALSE;  | 
982  | 0  |   }  | 
983  |  |  | 
984  | 0  |   if (filter)  | 
985  | 0  |   { | 
986  | 0  |     if (!strstr(what, filter))  | 
987  | 0  |       return FALSE;  | 
988  | 0  |   }  | 
989  | 0  |   copy(cur, dst);  | 
990  | 0  |   return TRUE;  | 
991  | 0  | }  | 
992  |  |  | 
993  |  | RDP_CODEPAGE* freerdp_keyboard_get_matching_codepages(DWORD column, const char* filter,  | 
994  |  |                                                       size_t* count)  | 
995  | 0  | { | 
996  | 0  |   size_t cnt = 0;  | 
997  | 0  |   const size_t c = ARRAYSIZE(language_identifiers);  | 
998  | 0  |   RDP_CODEPAGE* pages = calloc(ARRAYSIZE(language_identifiers), sizeof(RDP_CODEPAGE));  | 
999  |  | 
  | 
1000  | 0  |   if (!pages)  | 
1001  | 0  |     return NULL;  | 
1002  |  |  | 
1003  | 0  |   if (count)  | 
1004  | 0  |     *count = 0;  | 
1005  |  | 
  | 
1006  | 0  |   if (column > 4)  | 
1007  | 0  |     goto fail;  | 
1008  |  |  | 
1009  | 0  |   for (size_t x = 0; x < c; x++)  | 
1010  | 0  |   { | 
1011  | 0  |     const struct LanguageIdentifier* cur = &language_identifiers[x];  | 
1012  | 0  |     if (copyOnMatch(column, filter, cur, &pages[cnt]))  | 
1013  | 0  |       cnt++;  | 
1014  | 0  |   }  | 
1015  |  | 
  | 
1016  | 0  |   if (cnt == 0)  | 
1017  | 0  |     goto fail;  | 
1018  |  |  | 
1019  | 0  |   if (count)  | 
1020  | 0  |     *count = cnt;  | 
1021  |  | 
  | 
1022  | 0  |   return pages;  | 
1023  | 0  | fail:  | 
1024  | 0  |   freerdp_codepages_free(pages);  | 
1025  | 0  |   return NULL;  | 
1026  | 0  | }  | 
1027  |  |  | 
1028  |  | void freerdp_codepages_free(RDP_CODEPAGE* pages)  | 
1029  | 0  | { | 
1030  | 0  |   free(pages);  | 
1031  | 0  | }  |