Commit eeb8eddf authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Move GeoID functions to kernelbase.

parent 098e71ad
...@@ -419,7 +419,7 @@ ...@@ -419,7 +419,7 @@
@ stdcall EnumSystemCodePagesA(ptr long) @ stdcall EnumSystemCodePagesA(ptr long)
@ stdcall -import EnumSystemCodePagesW(ptr long) @ stdcall -import EnumSystemCodePagesW(ptr long)
@ stdcall -import EnumSystemFirmwareTables(long ptr long) @ stdcall -import EnumSystemFirmwareTables(long ptr long)
@ stdcall EnumSystemGeoID(long long ptr) @ stdcall -import EnumSystemGeoID(long long ptr)
@ stdcall EnumSystemLanguageGroupsA(ptr long ptr) @ stdcall EnumSystemLanguageGroupsA(ptr long ptr)
@ stdcall -import EnumSystemLanguageGroupsW(ptr long ptr) @ stdcall -import EnumSystemLanguageGroupsW(ptr long ptr)
@ stdcall -import EnumSystemLocalesA(ptr long) @ stdcall -import EnumSystemLocalesA(ptr long)
...@@ -693,7 +693,7 @@ ...@@ -693,7 +693,7 @@
# @ stub GetFullPathNameTransactedW # @ stub GetFullPathNameTransactedW
@ stdcall -import GetFullPathNameW(wstr long ptr ptr) @ stdcall -import GetFullPathNameW(wstr long ptr ptr)
@ stdcall GetGeoInfoA(long long ptr long long) @ stdcall GetGeoInfoA(long long ptr long long)
@ stdcall GetGeoInfoW(long long ptr long long) @ stdcall -import GetGeoInfoW(long long ptr long long)
@ stdcall GetHandleContext(long) @ stdcall GetHandleContext(long)
@ stdcall -import GetHandleInformation(long ptr) @ stdcall -import GetHandleInformation(long ptr)
@ stub -i386 GetLSCallbackTarget @ stub -i386 GetLSCallbackTarget
...@@ -875,7 +875,7 @@ ...@@ -875,7 +875,7 @@
@ stdcall -import GetUserDefaultLangID() @ stdcall -import GetUserDefaultLangID()
@ stdcall -import GetUserDefaultLocaleName(ptr long) @ stdcall -import GetUserDefaultLocaleName(ptr long)
@ stdcall -import GetUserDefaultUILanguage() @ stdcall -import GetUserDefaultUILanguage()
@ stdcall GetUserGeoID(long) @ stdcall -import GetUserGeoID(long)
@ stub GetVDMCurrentDirectories @ stub GetVDMCurrentDirectories
@ stdcall -import GetVersion() @ stdcall -import GetVersion()
@ stdcall -import GetVersionExA(ptr) @ stdcall -import GetVersionExA(ptr)
...@@ -1471,7 +1471,7 @@ ...@@ -1471,7 +1471,7 @@
@ stub SetTimerQueueTimer @ stub SetTimerQueueTimer
@ stdcall -arch=x86_64 SetUmsThreadInformation(ptr long ptr long) @ stdcall -arch=x86_64 SetUmsThreadInformation(ptr long ptr long)
@ stdcall -import SetUnhandledExceptionFilter(ptr) @ stdcall -import SetUnhandledExceptionFilter(ptr)
@ stdcall SetUserGeoID(long) @ stdcall -import SetUserGeoID(long)
@ stub SetVDMCurrentDirectories @ stub SetVDMCurrentDirectories
@ stdcall SetVolumeLabelA(str str) @ stdcall SetVolumeLabelA(str str)
@ stdcall SetVolumeLabelW(wstr wstr) @ stdcall SetVolumeLabelW(wstr wstr)
......
...@@ -84,41 +84,6 @@ static inline UINT get_lcid_codepage( LCID lcid ) ...@@ -84,41 +84,6 @@ static inline UINT get_lcid_codepage( LCID lcid )
} }
/***********************************************************************
* create_registry_key
*
* Create the Control Panel\\International registry key.
*/
static inline HANDLE create_registry_key(void)
{
static const WCHAR cplW[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l',0};
static const WCHAR intlW[] = {'I','n','t','e','r','n','a','t','i','o','n','a','l',0};
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
HANDLE cpl_key, hkey = 0;
if (RtlOpenCurrentUser( KEY_ALL_ACCESS, &hkey ) != STATUS_SUCCESS) return 0;
attr.Length = sizeof(attr);
attr.RootDirectory = hkey;
attr.ObjectName = &nameW;
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &nameW, cplW );
if (!NtCreateKey( &cpl_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
{
NtClose( attr.RootDirectory );
attr.RootDirectory = cpl_key;
RtlInitUnicodeString( &nameW, intlW );
if (NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) hkey = 0;
}
NtClose( attr.RootDirectory );
return hkey;
}
static BOOL get_dummy_preferred_ui_language( DWORD flags, ULONG *count, WCHAR *buffer, ULONG *size ) static BOOL get_dummy_preferred_ui_language( DWORD flags, ULONG *count, WCHAR *buffer, ULONG *size )
{ {
LCTYPE type; LCTYPE type;
...@@ -445,21 +410,6 @@ FoldStringA_exit: ...@@ -445,21 +410,6 @@ FoldStringA_exit:
return ret; return ret;
} }
static HANDLE NLS_RegOpenKey(HANDLE hRootKey, LPCWSTR szKeyName)
{
UNICODE_STRING keyName;
OBJECT_ATTRIBUTES attr;
HANDLE hkey;
RtlInitUnicodeString( &keyName, szKeyName );
InitializeObjectAttributes(&attr, &keyName, 0, hRootKey, NULL);
if (NtOpenKey( &hkey, KEY_READ, &attr ) != STATUS_SUCCESS)
hkey = 0;
return hkey;
}
/****************************************************************************** /******************************************************************************
* EnumSystemLanguageGroupsA (KERNEL32.@) * EnumSystemLanguageGroupsA (KERNEL32.@)
*/ */
...@@ -559,551 +509,6 @@ BOOL WINAPI EnumUILanguagesA( UILANGUAGE_ENUMPROCA proc, DWORD flags, LONG_PTR p ...@@ -559,551 +509,6 @@ BOOL WINAPI EnumUILanguagesA( UILANGUAGE_ENUMPROCA proc, DWORD flags, LONG_PTR p
} }
enum locationkind {
LOCATION_NATION = 0,
LOCATION_REGION,
LOCATION_BOTH
};
struct geoinfo_t {
GEOID id;
WCHAR iso2W[3];
WCHAR iso3W[4];
GEOID parent;
INT uncode;
enum locationkind kind;
};
static const struct geoinfo_t geoinfodata[] = {
{ 2, {'A','G',0}, {'A','T','G',0}, 10039880, 28 }, /* Antigua and Barbuda */
{ 3, {'A','F',0}, {'A','F','G',0}, 47614, 4 }, /* Afghanistan */
{ 4, {'D','Z',0}, {'D','Z','A',0}, 42487, 12 }, /* Algeria */
{ 5, {'A','Z',0}, {'A','Z','E',0}, 47611, 31 }, /* Azerbaijan */
{ 6, {'A','L',0}, {'A','L','B',0}, 47610, 8 }, /* Albania */
{ 7, {'A','M',0}, {'A','R','M',0}, 47611, 51 }, /* Armenia */
{ 8, {'A','D',0}, {'A','N','D',0}, 47610, 20 }, /* Andorra */
{ 9, {'A','O',0}, {'A','G','O',0}, 42484, 24 }, /* Angola */
{ 10, {'A','S',0}, {'A','S','M',0}, 26286, 16 }, /* American Samoa */
{ 11, {'A','R',0}, {'A','R','G',0}, 31396, 32 }, /* Argentina */
{ 12, {'A','U',0}, {'A','U','S',0}, 10210825, 36 }, /* Australia */
{ 14, {'A','T',0}, {'A','U','T',0}, 10210824, 40 }, /* Austria */
{ 17, {'B','H',0}, {'B','H','R',0}, 47611, 48 }, /* Bahrain */
{ 18, {'B','B',0}, {'B','R','B',0}, 10039880, 52 }, /* Barbados */
{ 19, {'B','W',0}, {'B','W','A',0}, 10039883, 72 }, /* Botswana */
{ 20, {'B','M',0}, {'B','M','U',0}, 23581, 60 }, /* Bermuda */
{ 21, {'B','E',0}, {'B','E','L',0}, 10210824, 56 }, /* Belgium */
{ 22, {'B','S',0}, {'B','H','S',0}, 10039880, 44 }, /* Bahamas, The */
{ 23, {'B','D',0}, {'B','G','D',0}, 47614, 50 }, /* Bangladesh */
{ 24, {'B','Z',0}, {'B','L','Z',0}, 27082, 84 }, /* Belize */
{ 25, {'B','A',0}, {'B','I','H',0}, 47610, 70 }, /* Bosnia and Herzegovina */
{ 26, {'B','O',0}, {'B','O','L',0}, 31396, 68 }, /* Bolivia */
{ 27, {'M','M',0}, {'M','M','R',0}, 47599, 104 }, /* Myanmar */
{ 28, {'B','J',0}, {'B','E','N',0}, 42483, 204 }, /* Benin */
{ 29, {'B','Y',0}, {'B','L','R',0}, 47609, 112 }, /* Belarus */
{ 30, {'S','B',0}, {'S','L','B',0}, 20900, 90 }, /* Solomon Islands */
{ 32, {'B','R',0}, {'B','R','A',0}, 31396, 76 }, /* Brazil */
{ 34, {'B','T',0}, {'B','T','N',0}, 47614, 64 }, /* Bhutan */
{ 35, {'B','G',0}, {'B','G','R',0}, 47609, 100 }, /* Bulgaria */
{ 37, {'B','N',0}, {'B','R','N',0}, 47599, 96 }, /* Brunei */
{ 38, {'B','I',0}, {'B','D','I',0}, 47603, 108 }, /* Burundi */
{ 39, {'C','A',0}, {'C','A','N',0}, 23581, 124 }, /* Canada */
{ 40, {'K','H',0}, {'K','H','M',0}, 47599, 116 }, /* Cambodia */
{ 41, {'T','D',0}, {'T','C','D',0}, 42484, 148 }, /* Chad */
{ 42, {'L','K',0}, {'L','K','A',0}, 47614, 144 }, /* Sri Lanka */
{ 43, {'C','G',0}, {'C','O','G',0}, 42484, 178 }, /* Congo */
{ 44, {'C','D',0}, {'C','O','D',0}, 42484, 180 }, /* Congo (DRC) */
{ 45, {'C','N',0}, {'C','H','N',0}, 47600, 156 }, /* China */
{ 46, {'C','L',0}, {'C','H','L',0}, 31396, 152 }, /* Chile */
{ 49, {'C','M',0}, {'C','M','R',0}, 42484, 120 }, /* Cameroon */
{ 50, {'K','M',0}, {'C','O','M',0}, 47603, 174 }, /* Comoros */
{ 51, {'C','O',0}, {'C','O','L',0}, 31396, 170 }, /* Colombia */
{ 54, {'C','R',0}, {'C','R','I',0}, 27082, 188 }, /* Costa Rica */
{ 55, {'C','F',0}, {'C','A','F',0}, 42484, 140 }, /* Central African Republic */
{ 56, {'C','U',0}, {'C','U','B',0}, 10039880, 192 }, /* Cuba */
{ 57, {'C','V',0}, {'C','P','V',0}, 42483, 132 }, /* Cape Verde */
{ 59, {'C','Y',0}, {'C','Y','P',0}, 47611, 196 }, /* Cyprus */
{ 61, {'D','K',0}, {'D','N','K',0}, 10039882, 208 }, /* Denmark */
{ 62, {'D','J',0}, {'D','J','I',0}, 47603, 262 }, /* Djibouti */
{ 63, {'D','M',0}, {'D','M','A',0}, 10039880, 212 }, /* Dominica */
{ 65, {'D','O',0}, {'D','O','M',0}, 10039880, 214 }, /* Dominican Republic */
{ 66, {'E','C',0}, {'E','C','U',0}, 31396, 218 }, /* Ecuador */
{ 67, {'E','G',0}, {'E','G','Y',0}, 42487, 818 }, /* Egypt */
{ 68, {'I','E',0}, {'I','R','L',0}, 10039882, 372 }, /* Ireland */
{ 69, {'G','Q',0}, {'G','N','Q',0}, 42484, 226 }, /* Equatorial Guinea */
{ 70, {'E','E',0}, {'E','S','T',0}, 10039882, 233 }, /* Estonia */
{ 71, {'E','R',0}, {'E','R','I',0}, 47603, 232 }, /* Eritrea */
{ 72, {'S','V',0}, {'S','L','V',0}, 27082, 222 }, /* El Salvador */
{ 73, {'E','T',0}, {'E','T','H',0}, 47603, 231 }, /* Ethiopia */
{ 75, {'C','Z',0}, {'C','Z','E',0}, 47609, 203 }, /* Czech Republic */
{ 77, {'F','I',0}, {'F','I','N',0}, 10039882, 246 }, /* Finland */
{ 78, {'F','J',0}, {'F','J','I',0}, 20900, 242 }, /* Fiji Islands */
{ 80, {'F','M',0}, {'F','S','M',0}, 21206, 583 }, /* Micronesia */
{ 81, {'F','O',0}, {'F','R','O',0}, 10039882, 234 }, /* Faroe Islands */
{ 84, {'F','R',0}, {'F','R','A',0}, 10210824, 250 }, /* France */
{ 86, {'G','M',0}, {'G','M','B',0}, 42483, 270 }, /* Gambia, The */
{ 87, {'G','A',0}, {'G','A','B',0}, 42484, 266 }, /* Gabon */
{ 88, {'G','E',0}, {'G','E','O',0}, 47611, 268 }, /* Georgia */
{ 89, {'G','H',0}, {'G','H','A',0}, 42483, 288 }, /* Ghana */
{ 90, {'G','I',0}, {'G','I','B',0}, 47610, 292 }, /* Gibraltar */
{ 91, {'G','D',0}, {'G','R','D',0}, 10039880, 308 }, /* Grenada */
{ 93, {'G','L',0}, {'G','R','L',0}, 23581, 304 }, /* Greenland */
{ 94, {'D','E',0}, {'D','E','U',0}, 10210824, 276 }, /* Germany */
{ 98, {'G','R',0}, {'G','R','C',0}, 47610, 300 }, /* Greece */
{ 99, {'G','T',0}, {'G','T','M',0}, 27082, 320 }, /* Guatemala */
{ 100, {'G','N',0}, {'G','I','N',0}, 42483, 324 }, /* Guinea */
{ 101, {'G','Y',0}, {'G','U','Y',0}, 31396, 328 }, /* Guyana */
{ 103, {'H','T',0}, {'H','T','I',0}, 10039880, 332 }, /* Haiti */
{ 104, {'H','K',0}, {'H','K','G',0}, 47600, 344 }, /* Hong Kong S.A.R. */
{ 106, {'H','N',0}, {'H','N','D',0}, 27082, 340 }, /* Honduras */
{ 108, {'H','R',0}, {'H','R','V',0}, 47610, 191 }, /* Croatia */
{ 109, {'H','U',0}, {'H','U','N',0}, 47609, 348 }, /* Hungary */
{ 110, {'I','S',0}, {'I','S','L',0}, 10039882, 352 }, /* Iceland */
{ 111, {'I','D',0}, {'I','D','N',0}, 47599, 360 }, /* Indonesia */
{ 113, {'I','N',0}, {'I','N','D',0}, 47614, 356 }, /* India */
{ 114, {'I','O',0}, {'I','O','T',0}, 39070, 86 }, /* British Indian Ocean Territory */
{ 116, {'I','R',0}, {'I','R','N',0}, 47614, 364 }, /* Iran */
{ 117, {'I','L',0}, {'I','S','R',0}, 47611, 376 }, /* Israel */
{ 118, {'I','T',0}, {'I','T','A',0}, 47610, 380 }, /* Italy */
{ 119, {'C','I',0}, {'C','I','V',0}, 42483, 384 }, /* Côte d'Ivoire */
{ 121, {'I','Q',0}, {'I','R','Q',0}, 47611, 368 }, /* Iraq */
{ 122, {'J','P',0}, {'J','P','N',0}, 47600, 392 }, /* Japan */
{ 124, {'J','M',0}, {'J','A','M',0}, 10039880, 388 }, /* Jamaica */
{ 125, {'S','J',0}, {'S','J','M',0}, 10039882, 744 }, /* Jan Mayen */
{ 126, {'J','O',0}, {'J','O','R',0}, 47611, 400 }, /* Jordan */
{ 127, {'X','X',0}, {'X','X',0}, 161832256 }, /* Johnston Atoll */
{ 129, {'K','E',0}, {'K','E','N',0}, 47603, 404 }, /* Kenya */
{ 130, {'K','G',0}, {'K','G','Z',0}, 47590, 417 }, /* Kyrgyzstan */
{ 131, {'K','P',0}, {'P','R','K',0}, 47600, 408 }, /* North Korea */
{ 133, {'K','I',0}, {'K','I','R',0}, 21206, 296 }, /* Kiribati */
{ 134, {'K','R',0}, {'K','O','R',0}, 47600, 410 }, /* Korea */
{ 136, {'K','W',0}, {'K','W','T',0}, 47611, 414 }, /* Kuwait */
{ 137, {'K','Z',0}, {'K','A','Z',0}, 47590, 398 }, /* Kazakhstan */
{ 138, {'L','A',0}, {'L','A','O',0}, 47599, 418 }, /* Laos */
{ 139, {'L','B',0}, {'L','B','N',0}, 47611, 422 }, /* Lebanon */
{ 140, {'L','V',0}, {'L','V','A',0}, 10039882, 428 }, /* Latvia */
{ 141, {'L','T',0}, {'L','T','U',0}, 10039882, 440 }, /* Lithuania */
{ 142, {'L','R',0}, {'L','B','R',0}, 42483, 430 }, /* Liberia */
{ 143, {'S','K',0}, {'S','V','K',0}, 47609, 703 }, /* Slovakia */
{ 145, {'L','I',0}, {'L','I','E',0}, 10210824, 438 }, /* Liechtenstein */
{ 146, {'L','S',0}, {'L','S','O',0}, 10039883, 426 }, /* Lesotho */
{ 147, {'L','U',0}, {'L','U','X',0}, 10210824, 442 }, /* Luxembourg */
{ 148, {'L','Y',0}, {'L','B','Y',0}, 42487, 434 }, /* Libya */
{ 149, {'M','G',0}, {'M','D','G',0}, 47603, 450 }, /* Madagascar */
{ 151, {'M','O',0}, {'M','A','C',0}, 47600, 446 }, /* Macao S.A.R. */
{ 152, {'M','D',0}, {'M','D','A',0}, 47609, 498 }, /* Moldova */
{ 154, {'M','N',0}, {'M','N','G',0}, 47600, 496 }, /* Mongolia */
{ 156, {'M','W',0}, {'M','W','I',0}, 47603, 454 }, /* Malawi */
{ 157, {'M','L',0}, {'M','L','I',0}, 42483, 466 }, /* Mali */
{ 158, {'M','C',0}, {'M','C','O',0}, 10210824, 492 }, /* Monaco */
{ 159, {'M','A',0}, {'M','A','R',0}, 42487, 504 }, /* Morocco */
{ 160, {'M','U',0}, {'M','U','S',0}, 47603, 480 }, /* Mauritius */
{ 162, {'M','R',0}, {'M','R','T',0}, 42483, 478 }, /* Mauritania */
{ 163, {'M','T',0}, {'M','L','T',0}, 47610, 470 }, /* Malta */
{ 164, {'O','M',0}, {'O','M','N',0}, 47611, 512 }, /* Oman */
{ 165, {'M','V',0}, {'M','D','V',0}, 47614, 462 }, /* Maldives */
{ 166, {'M','X',0}, {'M','E','X',0}, 27082, 484 }, /* Mexico */
{ 167, {'M','Y',0}, {'M','Y','S',0}, 47599, 458 }, /* Malaysia */
{ 168, {'M','Z',0}, {'M','O','Z',0}, 47603, 508 }, /* Mozambique */
{ 173, {'N','E',0}, {'N','E','R',0}, 42483, 562 }, /* Niger */
{ 174, {'V','U',0}, {'V','U','T',0}, 20900, 548 }, /* Vanuatu */
{ 175, {'N','G',0}, {'N','G','A',0}, 42483, 566 }, /* Nigeria */
{ 176, {'N','L',0}, {'N','L','D',0}, 10210824, 528 }, /* Netherlands */
{ 177, {'N','O',0}, {'N','O','R',0}, 10039882, 578 }, /* Norway */
{ 178, {'N','P',0}, {'N','P','L',0}, 47614, 524 }, /* Nepal */
{ 180, {'N','R',0}, {'N','R','U',0}, 21206, 520 }, /* Nauru */
{ 181, {'S','R',0}, {'S','U','R',0}, 31396, 740 }, /* Suriname */
{ 182, {'N','I',0}, {'N','I','C',0}, 27082, 558 }, /* Nicaragua */
{ 183, {'N','Z',0}, {'N','Z','L',0}, 10210825, 554 }, /* New Zealand */
{ 184, {'P','S',0}, {'P','S','E',0}, 47611, 275 }, /* Palestinian Authority */
{ 185, {'P','Y',0}, {'P','R','Y',0}, 31396, 600 }, /* Paraguay */
{ 187, {'P','E',0}, {'P','E','R',0}, 31396, 604 }, /* Peru */
{ 190, {'P','K',0}, {'P','A','K',0}, 47614, 586 }, /* Pakistan */
{ 191, {'P','L',0}, {'P','O','L',0}, 47609, 616 }, /* Poland */
{ 192, {'P','A',0}, {'P','A','N',0}, 27082, 591 }, /* Panama */
{ 193, {'P','T',0}, {'P','R','T',0}, 47610, 620 }, /* Portugal */
{ 194, {'P','G',0}, {'P','N','G',0}, 20900, 598 }, /* Papua New Guinea */
{ 195, {'P','W',0}, {'P','L','W',0}, 21206, 585 }, /* Palau */
{ 196, {'G','W',0}, {'G','N','B',0}, 42483, 624 }, /* Guinea-Bissau */
{ 197, {'Q','A',0}, {'Q','A','T',0}, 47611, 634 }, /* Qatar */
{ 198, {'R','E',0}, {'R','E','U',0}, 47603, 638 }, /* Reunion */
{ 199, {'M','H',0}, {'M','H','L',0}, 21206, 584 }, /* Marshall Islands */
{ 200, {'R','O',0}, {'R','O','U',0}, 47609, 642 }, /* Romania */
{ 201, {'P','H',0}, {'P','H','L',0}, 47599, 608 }, /* Philippines */
{ 202, {'P','R',0}, {'P','R','I',0}, 10039880, 630 }, /* Puerto Rico */
{ 203, {'R','U',0}, {'R','U','S',0}, 47609, 643 }, /* Russia */
{ 204, {'R','W',0}, {'R','W','A',0}, 47603, 646 }, /* Rwanda */
{ 205, {'S','A',0}, {'S','A','U',0}, 47611, 682 }, /* Saudi Arabia */
{ 206, {'P','M',0}, {'S','P','M',0}, 23581, 666 }, /* St. Pierre and Miquelon */
{ 207, {'K','N',0}, {'K','N','A',0}, 10039880, 659 }, /* St. Kitts and Nevis */
{ 208, {'S','C',0}, {'S','Y','C',0}, 47603, 690 }, /* Seychelles */
{ 209, {'Z','A',0}, {'Z','A','F',0}, 10039883, 710 }, /* South Africa */
{ 210, {'S','N',0}, {'S','E','N',0}, 42483, 686 }, /* Senegal */
{ 212, {'S','I',0}, {'S','V','N',0}, 47610, 705 }, /* Slovenia */
{ 213, {'S','L',0}, {'S','L','E',0}, 42483, 694 }, /* Sierra Leone */
{ 214, {'S','M',0}, {'S','M','R',0}, 47610, 674 }, /* San Marino */
{ 215, {'S','G',0}, {'S','G','P',0}, 47599, 702 }, /* Singapore */
{ 216, {'S','O',0}, {'S','O','M',0}, 47603, 706 }, /* Somalia */
{ 217, {'E','S',0}, {'E','S','P',0}, 47610, 724 }, /* Spain */
{ 218, {'L','C',0}, {'L','C','A',0}, 10039880, 662 }, /* St. Lucia */
{ 219, {'S','D',0}, {'S','D','N',0}, 42487, 736 }, /* Sudan */
{ 220, {'S','J',0}, {'S','J','M',0}, 10039882, 744 }, /* Svalbard */
{ 221, {'S','E',0}, {'S','W','E',0}, 10039882, 752 }, /* Sweden */
{ 222, {'S','Y',0}, {'S','Y','R',0}, 47611, 760 }, /* Syria */
{ 223, {'C','H',0}, {'C','H','E',0}, 10210824, 756 }, /* Switzerland */
{ 224, {'A','E',0}, {'A','R','E',0}, 47611, 784 }, /* United Arab Emirates */
{ 225, {'T','T',0}, {'T','T','O',0}, 10039880, 780 }, /* Trinidad and Tobago */
{ 227, {'T','H',0}, {'T','H','A',0}, 47599, 764 }, /* Thailand */
{ 228, {'T','J',0}, {'T','J','K',0}, 47590, 762 }, /* Tajikistan */
{ 231, {'T','O',0}, {'T','O','N',0}, 26286, 776 }, /* Tonga */
{ 232, {'T','G',0}, {'T','G','O',0}, 42483, 768 }, /* Togo */
{ 233, {'S','T',0}, {'S','T','P',0}, 42484, 678 }, /* São Tomé and Príncipe */
{ 234, {'T','N',0}, {'T','U','N',0}, 42487, 788 }, /* Tunisia */
{ 235, {'T','R',0}, {'T','U','R',0}, 47611, 792 }, /* Turkey */
{ 236, {'T','V',0}, {'T','U','V',0}, 26286, 798 }, /* Tuvalu */
{ 237, {'T','W',0}, {'T','W','N',0}, 47600, 158 }, /* Taiwan */
{ 238, {'T','M',0}, {'T','K','M',0}, 47590, 795 }, /* Turkmenistan */
{ 239, {'T','Z',0}, {'T','Z','A',0}, 47603, 834 }, /* Tanzania */
{ 240, {'U','G',0}, {'U','G','A',0}, 47603, 800 }, /* Uganda */
{ 241, {'U','A',0}, {'U','K','R',0}, 47609, 804 }, /* Ukraine */
{ 242, {'G','B',0}, {'G','B','R',0}, 10039882, 826 }, /* United Kingdom */
{ 244, {'U','S',0}, {'U','S','A',0}, 23581, 840 }, /* United States */
{ 245, {'B','F',0}, {'B','F','A',0}, 42483, 854 }, /* Burkina Faso */
{ 246, {'U','Y',0}, {'U','R','Y',0}, 31396, 858 }, /* Uruguay */
{ 247, {'U','Z',0}, {'U','Z','B',0}, 47590, 860 }, /* Uzbekistan */
{ 248, {'V','C',0}, {'V','C','T',0}, 10039880, 670 }, /* St. Vincent and the Grenadines */
{ 249, {'V','E',0}, {'V','E','N',0}, 31396, 862 }, /* Bolivarian Republic of Venezuela */
{ 251, {'V','N',0}, {'V','N','M',0}, 47599, 704 }, /* Vietnam */
{ 252, {'V','I',0}, {'V','I','R',0}, 10039880, 850 }, /* Virgin Islands */
{ 253, {'V','A',0}, {'V','A','T',0}, 47610, 336 }, /* Vatican City */
{ 254, {'N','A',0}, {'N','A','M',0}, 10039883, 516 }, /* Namibia */
{ 257, {'E','H',0}, {'E','S','H',0}, 42487, 732 }, /* Western Sahara (disputed) */
{ 258, {'X','X',0}, {'X','X',0}, 161832256 }, /* Wake Island */
{ 259, {'W','S',0}, {'W','S','M',0}, 26286, 882 }, /* Samoa */
{ 260, {'S','Z',0}, {'S','W','Z',0}, 10039883, 748 }, /* Swaziland */
{ 261, {'Y','E',0}, {'Y','E','M',0}, 47611, 887 }, /* Yemen */
{ 263, {'Z','M',0}, {'Z','M','B',0}, 47603, 894 }, /* Zambia */
{ 264, {'Z','W',0}, {'Z','W','E',0}, 47603, 716 }, /* Zimbabwe */
{ 269, {'C','S',0}, {'S','C','G',0}, 47610, 891 }, /* Serbia and Montenegro (Former) */
{ 270, {'M','E',0}, {'M','N','E',0}, 47610, 499 }, /* Montenegro */
{ 271, {'R','S',0}, {'S','R','B',0}, 47610, 688 }, /* Serbia */
{ 273, {'C','W',0}, {'C','U','W',0}, 10039880, 531 }, /* Curaçao */
{ 276, {'S','S',0}, {'S','S','D',0}, 42487, 728 }, /* South Sudan */
{ 300, {'A','I',0}, {'A','I','A',0}, 10039880, 660 }, /* Anguilla */
{ 301, {'A','Q',0}, {'A','T','A',0}, 39070, 10 }, /* Antarctica */
{ 302, {'A','W',0}, {'A','B','W',0}, 10039880, 533 }, /* Aruba */
{ 303, {'X','X',0}, {'X','X',0}, 343 }, /* Ascension Island */
{ 304, {'X','X',0}, {'X','X',0}, 10210825 }, /* Ashmore and Cartier Islands */
{ 305, {'X','X',0}, {'X','X',0}, 161832256 }, /* Baker Island */
{ 306, {'B','V',0}, {'B','V','T',0}, 39070, 74 }, /* Bouvet Island */
{ 307, {'K','Y',0}, {'C','Y','M',0}, 10039880, 136 }, /* Cayman Islands */
{ 308, {'X','X',0}, {'X','X',0}, 10210824, 830, LOCATION_BOTH }, /* Channel Islands */
{ 309, {'C','X',0}, {'C','X','R',0}, 12, 162 }, /* Christmas Island */
{ 310, {'X','X',0}, {'X','X',0}, 27114 }, /* Clipperton Island */
{ 311, {'C','C',0}, {'C','C','K',0}, 10210825, 166 }, /* Cocos (Keeling) Islands */
{ 312, {'C','K',0}, {'C','O','K',0}, 26286, 184 }, /* Cook Islands */
{ 313, {'X','X',0}, {'X','X',0}, 10210825 }, /* Coral Sea Islands */
{ 314, {'X','X',0}, {'X','X',0}, 114 }, /* Diego Garcia */
{ 315, {'F','K',0}, {'F','L','K',0}, 31396, 238 }, /* Falkland Islands (Islas Malvinas) */
{ 317, {'G','F',0}, {'G','U','F',0}, 31396, 254 }, /* French Guiana */
{ 318, {'P','F',0}, {'P','Y','F',0}, 26286, 258 }, /* French Polynesia */
{ 319, {'T','F',0}, {'A','T','F',0}, 39070, 260 }, /* French Southern and Antarctic Lands */
{ 321, {'G','P',0}, {'G','L','P',0}, 10039880, 312 }, /* Guadeloupe */
{ 322, {'G','U',0}, {'G','U','M',0}, 21206, 316 }, /* Guam */
{ 323, {'X','X',0}, {'X','X',0}, 39070 }, /* Guantanamo Bay */
{ 324, {'G','G',0}, {'G','G','Y',0}, 308, 831 }, /* Guernsey */
{ 325, {'H','M',0}, {'H','M','D',0}, 39070, 334 }, /* Heard Island and McDonald Islands */
{ 326, {'X','X',0}, {'X','X',0}, 161832256 }, /* Howland Island */
{ 327, {'X','X',0}, {'X','X',0}, 161832256 }, /* Jarvis Island */
{ 328, {'J','E',0}, {'J','E','Y',0}, 308, 832 }, /* Jersey */
{ 329, {'X','X',0}, {'X','X',0}, 161832256 }, /* Kingman Reef */
{ 330, {'M','Q',0}, {'M','T','Q',0}, 10039880, 474 }, /* Martinique */
{ 331, {'Y','T',0}, {'M','Y','T',0}, 47603, 175 }, /* Mayotte */
{ 332, {'M','S',0}, {'M','S','R',0}, 10039880, 500 }, /* Montserrat */
{ 333, {'A','N',0}, {'A','N','T',0}, 10039880, 530, LOCATION_BOTH }, /* Netherlands Antilles (Former) */
{ 334, {'N','C',0}, {'N','C','L',0}, 20900, 540 }, /* New Caledonia */
{ 335, {'N','U',0}, {'N','I','U',0}, 26286, 570 }, /* Niue */
{ 336, {'N','F',0}, {'N','F','K',0}, 10210825, 574 }, /* Norfolk Island */
{ 337, {'M','P',0}, {'M','N','P',0}, 21206, 580 }, /* Northern Mariana Islands */
{ 338, {'X','X',0}, {'X','X',0}, 161832256 }, /* Palmyra Atoll */
{ 339, {'P','N',0}, {'P','C','N',0}, 26286, 612 }, /* Pitcairn Islands */
{ 340, {'X','X',0}, {'X','X',0}, 337 }, /* Rota Island */
{ 341, {'X','X',0}, {'X','X',0}, 337 }, /* Saipan */
{ 342, {'G','S',0}, {'S','G','S',0}, 39070, 239 }, /* South Georgia and the South Sandwich Islands */
{ 343, {'S','H',0}, {'S','H','N',0}, 42483, 654 }, /* St. Helena */
{ 346, {'X','X',0}, {'X','X',0}, 337 }, /* Tinian Island */
{ 347, {'T','K',0}, {'T','K','L',0}, 26286, 772 }, /* Tokelau */
{ 348, {'X','X',0}, {'X','X',0}, 343 }, /* Tristan da Cunha */
{ 349, {'T','C',0}, {'T','C','A',0}, 10039880, 796 }, /* Turks and Caicos Islands */
{ 351, {'V','G',0}, {'V','G','B',0}, 10039880, 92 }, /* Virgin Islands, British */
{ 352, {'W','F',0}, {'W','L','F',0}, 26286, 876 }, /* Wallis and Futuna */
{ 742, {'X','X',0}, {'X','X',0}, 39070, 2, LOCATION_REGION }, /* Africa */
{ 2129, {'X','X',0}, {'X','X',0}, 39070, 142, LOCATION_REGION }, /* Asia */
{ 10541, {'X','X',0}, {'X','X',0}, 39070, 150, LOCATION_REGION }, /* Europe */
{ 15126, {'I','M',0}, {'I','M','N',0}, 10039882, 833 }, /* Man, Isle of */
{ 19618, {'M','K',0}, {'M','K','D',0}, 47610, 807 }, /* Macedonia, Former Yugoslav Republic of */
{ 20900, {'X','X',0}, {'X','X',0}, 27114, 54, LOCATION_REGION }, /* Melanesia */
{ 21206, {'X','X',0}, {'X','X',0}, 27114, 57, LOCATION_REGION }, /* Micronesia */
{ 21242, {'X','X',0}, {'X','X',0}, 161832256 }, /* Midway Islands */
{ 23581, {'X','X',0}, {'X','X',0}, 10026358, 21, LOCATION_REGION }, /* Northern America */
{ 26286, {'X','X',0}, {'X','X',0}, 27114, 61, LOCATION_REGION }, /* Polynesia */
{ 27082, {'X','X',0}, {'X','X',0}, 161832257, 13, LOCATION_REGION }, /* Central America */
{ 27114, {'X','X',0}, {'X','X',0}, 39070, 9, LOCATION_REGION }, /* Oceania */
{ 30967, {'S','X',0}, {'S','X','M',0}, 10039880, 534 }, /* Sint Maarten (Dutch part) */
{ 31396, {'X','X',0}, {'X','X',0}, 161832257, 5, LOCATION_REGION }, /* South America */
{ 31706, {'M','F',0}, {'M','A','F',0}, 10039880, 663 }, /* Saint Martin (French part) */
{ 39070, {'X','X',0}, {'X','X',0}, 39070, 1, LOCATION_REGION }, /* World */
{ 42483, {'X','X',0}, {'X','X',0}, 742, 11, LOCATION_REGION }, /* Western Africa */
{ 42484, {'X','X',0}, {'X','X',0}, 742, 17, LOCATION_REGION }, /* Middle Africa */
{ 42487, {'X','X',0}, {'X','X',0}, 742, 15, LOCATION_REGION }, /* Northern Africa */
{ 47590, {'X','X',0}, {'X','X',0}, 2129, 143, LOCATION_REGION }, /* Central Asia */
{ 47599, {'X','X',0}, {'X','X',0}, 2129, 35, LOCATION_REGION }, /* South-Eastern Asia */
{ 47600, {'X','X',0}, {'X','X',0}, 2129, 30, LOCATION_REGION }, /* Eastern Asia */
{ 47603, {'X','X',0}, {'X','X',0}, 742, 14, LOCATION_REGION }, /* Eastern Africa */
{ 47609, {'X','X',0}, {'X','X',0}, 10541, 151, LOCATION_REGION }, /* Eastern Europe */
{ 47610, {'X','X',0}, {'X','X',0}, 10541, 39, LOCATION_REGION }, /* Southern Europe */
{ 47611, {'X','X',0}, {'X','X',0}, 2129, 145, LOCATION_REGION }, /* Middle East */
{ 47614, {'X','X',0}, {'X','X',0}, 2129, 34, LOCATION_REGION }, /* Southern Asia */
{ 7299303, {'T','L',0}, {'T','L','S',0}, 47599, 626 }, /* Democratic Republic of Timor-Leste */
{ 9914689, {'X','K',0}, {'X','K','S',0}, 47610, 906 }, /* Kosovo */
{ 10026358, {'X','X',0}, {'X','X',0}, 39070, 19, LOCATION_REGION }, /* Americas */
{ 10028789, {'A','X',0}, {'A','L','A',0}, 10039882, 248 }, /* Åland Islands */
{ 10039880, {'X','X',0}, {'X','X',0}, 161832257, 29, LOCATION_REGION }, /* Caribbean */
{ 10039882, {'X','X',0}, {'X','X',0}, 10541, 154, LOCATION_REGION }, /* Northern Europe */
{ 10039883, {'X','X',0}, {'X','X',0}, 742, 18, LOCATION_REGION }, /* Southern Africa */
{ 10210824, {'X','X',0}, {'X','X',0}, 10541, 155, LOCATION_REGION }, /* Western Europe */
{ 10210825, {'X','X',0}, {'X','X',0}, 27114, 53, LOCATION_REGION }, /* Australia and New Zealand */
{ 161832015, {'B','L',0}, {'B','L','M',0}, 10039880, 652 }, /* Saint Barthélemy */
{ 161832256, {'U','M',0}, {'U','M','I',0}, 27114, 581 }, /* U.S. Minor Outlying Islands */
{ 161832257, {'X','X',0}, {'X','X',0}, 10026358, 419, LOCATION_REGION }, /* Latin America and the Caribbean */
};
static const struct geoinfo_t *get_geoinfo_dataptr(GEOID geoid)
{
int min, max;
min = 0;
max = ARRAY_SIZE(geoinfodata)-1;
while (min <= max) {
const struct geoinfo_t *ptr;
int n = (min+max)/2;
ptr = &geoinfodata[n];
if (geoid == ptr->id)
/* we don't need empty entries */
return *ptr->iso2W ? ptr : NULL;
if (ptr->id > geoid)
max = n-1;
else
min = n+1;
}
return NULL;
}
/******************************************************************************
* GetUserGeoID (KERNEL32.@)
*
* Retrieves the ID of the user's geographic nation or region.
*
* PARAMS
* geoclass [I] One of GEOCLASS_NATION or GEOCLASS_REGION (SYSGEOCLASS enum from "winnls.h").
*
* RETURNS
* SUCCESS: The ID of the specified geographic class.
* FAILURE: GEOID_NOT_AVAILABLE.
*/
GEOID WINAPI GetUserGeoID(GEOCLASS geoclass)
{
GEOID ret = 39070;
static const WCHAR geoW[] = {'G','e','o',0};
static const WCHAR nationW[] = {'N','a','t','i','o','n',0};
static const WCHAR regionW[] = {'R','e','g','i','o','n',0};
WCHAR bufferW[40], *end;
HANDLE hkey, hsubkey = 0;
UNICODE_STRING keyW;
const KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)bufferW;
DWORD count = sizeof(bufferW);
RtlInitUnicodeString(&keyW, nationW);
switch (geoclass)
{
case GEOCLASS_NATION:
RtlInitUnicodeString(&keyW, nationW);
break;
case GEOCLASS_REGION:
RtlInitUnicodeString(&keyW, regionW);
break;
default:
WARN("Unknown geoclass %d\n", geoclass);
return GEOID_NOT_AVAILABLE;
}
if (!(hkey = create_registry_key())) return ret;
if ((hsubkey = NLS_RegOpenKey(hkey, geoW)))
{
if((NtQueryValueKey(hsubkey, &keyW, KeyValuePartialInformation,
bufferW, count, &count) == STATUS_SUCCESS ) && info->DataLength)
ret = strtolW((const WCHAR*)info->Data, &end, 10);
}
NtClose(hkey);
if (hsubkey) NtClose(hsubkey);
return ret;
}
/******************************************************************************
* SetUserGeoID (KERNEL32.@)
*
* Sets the ID of the user's geographic location.
*
* PARAMS
* geoid [I] The geographic ID to be set.
*
* RETURNS
* SUCCESS: TRUE.
* FAILURE: FALSE. GetLastError() will return ERROR_INVALID_PARAMETER if the ID was invalid.
*/
BOOL WINAPI SetUserGeoID(GEOID geoid)
{
const struct geoinfo_t *geoinfo = get_geoinfo_dataptr(geoid);
static const WCHAR geoW[] = {'G','e','o',0};
static const WCHAR nationW[] = {'N','a','t','i','o','n',0};
static const WCHAR regionW[] = {'R','e','g','i','o','n',0};
static const WCHAR formatW[] = {'%','i',0};
UNICODE_STRING nameW, keyW;
WCHAR bufferW[10];
OBJECT_ATTRIBUTES attr;
HANDLE hkey;
if (!geoinfo)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!(hkey = create_registry_key())) return FALSE;
attr.Length = sizeof(attr);
attr.RootDirectory = hkey;
attr.ObjectName = &nameW;
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString(&nameW, geoW);
if (geoinfo->kind == LOCATION_NATION)
RtlInitUnicodeString(&keyW, nationW);
else
RtlInitUnicodeString(&keyW, regionW);
if (NtCreateKey(&hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL) != STATUS_SUCCESS)
{
NtClose(attr.RootDirectory);
return FALSE;
}
sprintfW(bufferW, formatW, geoinfo->id);
NtSetValueKey(hkey, &keyW, 0, REG_SZ, bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR));
NtClose(attr.RootDirectory);
NtClose(hkey);
return TRUE;
}
/******************************************************************************
* GetGeoInfoW (KERNEL32.@)
*
* Retrieves information about a geographic location by its GeoID.
*
* PARAMS
* geoid [I] The GeoID of the location of interest.
* geotype [I] The type of information to be retrieved (SYSGEOTYPE enum from "winnls.h").
* data [O] The output buffer to store the information.
* data_len [I] The length of the buffer, measured in WCHARs and including the null terminator.
* lang [I] Language identifier. Must be 0 unless geotype is GEO_RFC1766 or GEO_LCID.
*
* RETURNS
* Success: The number of WCHARs (including null) written to the buffer -or-
* if no buffer was provided, the minimum length required to hold the full data.
* Failure: Zero. Call GetLastError() to determine the cause.
*
* NOTES
* On failure, GetLastError() will return one of the following values:
* - ERROR_INVALID_PARAMETER: the GeoID provided was invalid.
* - ERROR_INVALID_FLAGS: the specified geotype was invalid.
* - ERROR_INSUFFICIENT_BUFFER: the provided buffer was too small to hold the full data.
* - ERROR_CALL_NOT_IMPLEMENTED: (Wine implementation) we don't handle that geotype yet.
*
* The list of available GeoIDs can be retrieved with EnumSystemGeoID(),
* or call GetUserGeoID() to retrieve the user's current location.
*
* TODO
* Currently, we only handle the following geotypes: GEO_ID, GEO_ISO2, GEO_ISO3,
* GEO_ISO_UN_NUMBER, GEO_PARENT and GEO_NATION.
*/
INT WINAPI GetGeoInfoW(GEOID geoid, GEOTYPE geotype, LPWSTR data, int data_len, LANGID lang)
{
const struct geoinfo_t *ptr;
WCHAR buffW[12];
const WCHAR *str = buffW;
int len;
static const WCHAR fmtW[] = {'%','d',0};
TRACE("%d %d %p %d %d\n", geoid, geotype, data, data_len, lang);
if (!(ptr = get_geoinfo_dataptr(geoid))) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
switch (geotype) {
case GEO_NATION:
if (ptr->kind != LOCATION_NATION) return 0;
/* fall through */
case GEO_ID:
sprintfW(buffW, fmtW, ptr->id);
break;
case GEO_ISO_UN_NUMBER:
sprintfW(buffW, fmtW, ptr->uncode);
break;
case GEO_PARENT:
sprintfW(buffW, fmtW, ptr->parent);
break;
case GEO_ISO2:
str = ptr->iso2W;
break;
case GEO_ISO3:
str = ptr->iso3W;
break;
case GEO_RFC1766:
case GEO_LCID:
case GEO_FRIENDLYNAME:
case GEO_OFFICIALNAME:
case GEO_TIMEZONES:
case GEO_OFFICIALLANGUAGES:
case GEO_LATITUDE:
case GEO_LONGITUDE:
FIXME("type %d is not supported\n", geotype);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
default:
WARN("unrecognized type %d\n", geotype);
SetLastError(ERROR_INVALID_FLAGS);
return 0;
}
len = strlenW(str) + 1;
if (!data || !data_len)
return len;
memcpy(data, str, min(len, data_len)*sizeof(WCHAR));
if (data_len < len)
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return data_len < len ? 0 : len;
}
/****************************************************************************** /******************************************************************************
* GetGeoInfoA (KERNEL32.@) * GetGeoInfoA (KERNEL32.@)
*/ */
...@@ -1137,68 +542,6 @@ INT WINAPI GetGeoInfoA(GEOID geoid, GEOTYPE geotype, LPSTR data, int data_len, L ...@@ -1137,68 +542,6 @@ INT WINAPI GetGeoInfoA(GEOID geoid, GEOTYPE geotype, LPSTR data, int data_len, L
return data_len < len ? 0 : len; return data_len < len ? 0 : len;
} }
/******************************************************************************
* EnumSystemGeoID (KERNEL32.@)
*
* Calls a user's function for every location available on the system.
*
* PARAMS
* geoclass [I] Type of location desired (SYSGEOTYPE enum from "winnls.h")
* parent [I] GeoID for the parent
* enumproc [I] Callback function to call for each location (prototype in "winnls.h")
*
* RETURNS
* Success: TRUE.
* Failure: FALSE. Use GetLastError() to determine the cause.
*
* NOTES
* The enumproc function returns TRUE to continue enumerating
* or FALSE to interrupt the enumeration.
*
* On failure, GetLastError() returns one of the following values:
* - ERROR_INVALID_PARAMETER: no callback function was provided.
* - ERROR_INVALID_FLAGS: the location type was invalid.
*
* TODO
* On Windows 10, this function filters out those locations which
* simultaneously lack ISO and UN codes (e.g. Johnson Atoll).
*/
BOOL WINAPI EnumSystemGeoID(GEOCLASS geoclass, GEOID parent, GEO_ENUMPROC enumproc)
{
INT i;
TRACE("(%d, %d, %p)\n", geoclass, parent, enumproc);
if (!enumproc) {
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (geoclass != GEOCLASS_NATION && geoclass != GEOCLASS_REGION && geoclass != GEOCLASS_ALL) {
SetLastError(ERROR_INVALID_FLAGS);
return FALSE;
}
for (i = 0; i < ARRAY_SIZE(geoinfodata); i++) {
const struct geoinfo_t *ptr = &geoinfodata[i];
if (geoclass == GEOCLASS_NATION && (ptr->kind != LOCATION_NATION))
continue;
/* LOCATION_BOTH counts as region. */
if (geoclass == GEOCLASS_REGION && (ptr->kind == LOCATION_NATION))
continue;
if (parent && ptr->parent != parent)
continue;
if (!enumproc(ptr->id))
return TRUE;
}
return TRUE;
}
enum { enum {
BASE = 36, BASE = 36,
......
...@@ -313,7 +313,7 @@ ...@@ -313,7 +313,7 @@
@ stdcall EnumResourceTypesExW(long ptr long long long) @ stdcall EnumResourceTypesExW(long ptr long long long)
@ stdcall EnumSystemCodePagesW(ptr long) @ stdcall EnumSystemCodePagesW(ptr long)
@ stdcall EnumSystemFirmwareTables(long ptr long) @ stdcall EnumSystemFirmwareTables(long ptr long)
@ stdcall EnumSystemGeoID(long long ptr) kernel32.EnumSystemGeoID @ stdcall EnumSystemGeoID(long long ptr)
@ stdcall EnumSystemLanguageGroupsW(ptr long ptr) @ stdcall EnumSystemLanguageGroupsW(ptr long ptr)
@ stdcall EnumSystemLocalesA(ptr long) @ stdcall EnumSystemLocalesA(ptr long)
@ stdcall EnumSystemLocalesEx(ptr long long ptr) @ stdcall EnumSystemLocalesEx(ptr long long ptr)
...@@ -530,7 +530,7 @@ ...@@ -530,7 +530,7 @@
@ stdcall GetFullPathNameW(wstr long ptr ptr) @ stdcall GetFullPathNameW(wstr long ptr ptr)
# @ stub GetGPOListInternalA # @ stub GetGPOListInternalA
# @ stub GetGPOListInternalW # @ stub GetGPOListInternalW
@ stdcall GetGeoInfoW(long long ptr long long) kernel32.GetGeoInfoW @ stdcall GetGeoInfoW(long long ptr long long)
@ stdcall GetHandleInformation(long ptr) @ stdcall GetHandleInformation(long ptr)
# @ stub GetHivePath # @ stub GetHivePath
# @ stub GetIntegratedDisplaySize # @ stub GetIntegratedDisplaySize
...@@ -743,7 +743,7 @@ ...@@ -743,7 +743,7 @@
@ stdcall GetUserDefaultLangID() @ stdcall GetUserDefaultLangID()
@ stdcall GetUserDefaultLocaleName(ptr long) @ stdcall GetUserDefaultLocaleName(ptr long)
@ stdcall GetUserDefaultUILanguage() @ stdcall GetUserDefaultUILanguage()
@ stdcall GetUserGeoID(long) kernel32.GetUserGeoID @ stdcall GetUserGeoID(long)
@ stub GetUserInfo @ stub GetUserInfo
@ stub GetUserInfoWord @ stub GetUserInfoWord
# @ stub GetUserOverrideString # @ stub GetUserOverrideString
...@@ -1502,7 +1502,7 @@ ...@@ -1502,7 +1502,7 @@
@ stdcall SetTimeZoneInformation(ptr) kernel32.SetTimeZoneInformation @ stdcall SetTimeZoneInformation(ptr) kernel32.SetTimeZoneInformation
@ stdcall SetTokenInformation(long long ptr long) @ stdcall SetTokenInformation(long long ptr long)
@ stdcall SetUnhandledExceptionFilter(ptr) @ stdcall SetUnhandledExceptionFilter(ptr)
@ stdcall SetUserGeoID(long) kernel32.SetUserGeoID @ stdcall SetUserGeoID(long)
@ stdcall SetWaitableTimer(long ptr long ptr ptr long) @ stdcall SetWaitableTimer(long ptr long ptr ptr long)
@ stdcall SetWaitableTimerEx(long ptr long ptr ptr ptr long) @ stdcall SetWaitableTimerEx(long ptr long ptr ptr ptr long)
# @ stub SetXStateFeaturesMask # @ stub SetXStateFeaturesMask
......
...@@ -222,6 +222,322 @@ static const WCHAR ligatures[][5] = ...@@ -222,6 +222,322 @@ static const WCHAR ligatures[][5] =
{ 0xfb06, 's','t',0 }, { 0xfb06, 's','t',0 },
}; };
enum locationkind { LOCATION_NATION = 0, LOCATION_REGION, LOCATION_BOTH };
struct geoinfo
{
GEOID id;
WCHAR iso2W[3];
WCHAR iso3W[4];
GEOID parent;
int uncode;
enum locationkind kind;
};
static const struct geoinfo geoinfodata[] =
{
{ 2, L"AG", L"ATG", 10039880, 28 }, /* Antigua and Barbuda */
{ 3, L"AF", L"AFG", 47614, 4 }, /* Afghanistan */
{ 4, L"DZ", L"DZA", 42487, 12 }, /* Algeria */
{ 5, L"AZ", L"AZE", 47611, 31 }, /* Azerbaijan */
{ 6, L"AL", L"ALB", 47610, 8 }, /* Albania */
{ 7, L"AM", L"ARM", 47611, 51 }, /* Armenia */
{ 8, L"AD", L"AND", 47610, 20 }, /* Andorra */
{ 9, L"AO", L"AGO", 42484, 24 }, /* Angola */
{ 10, L"AS", L"ASM", 26286, 16 }, /* American Samoa */
{ 11, L"AR", L"ARG", 31396, 32 }, /* Argentina */
{ 12, L"AU", L"AUS", 10210825, 36 }, /* Australia */
{ 14, L"AT", L"AUT", 10210824, 40 }, /* Austria */
{ 17, L"BH", L"BHR", 47611, 48 }, /* Bahrain */
{ 18, L"BB", L"BRB", 10039880, 52 }, /* Barbados */
{ 19, L"BW", L"BWA", 10039883, 72 }, /* Botswana */
{ 20, L"BM", L"BMU", 23581, 60 }, /* Bermuda */
{ 21, L"BE", L"BEL", 10210824, 56 }, /* Belgium */
{ 22, L"BS", L"BHS", 10039880, 44 }, /* Bahamas, The */
{ 23, L"BD", L"BGD", 47614, 50 }, /* Bangladesh */
{ 24, L"BZ", L"BLZ", 27082, 84 }, /* Belize */
{ 25, L"BA", L"BIH", 47610, 70 }, /* Bosnia and Herzegovina */
{ 26, L"BO", L"BOL", 31396, 68 }, /* Bolivia */
{ 27, L"MM", L"MMR", 47599, 104 }, /* Myanmar */
{ 28, L"BJ", L"BEN", 42483, 204 }, /* Benin */
{ 29, L"BY", L"BLR", 47609, 112 }, /* Belarus */
{ 30, L"SB", L"SLB", 20900, 90 }, /* Solomon Islands */
{ 32, L"BR", L"BRA", 31396, 76 }, /* Brazil */
{ 34, L"BT", L"BTN", 47614, 64 }, /* Bhutan */
{ 35, L"BG", L"BGR", 47609, 100 }, /* Bulgaria */
{ 37, L"BN", L"BRN", 47599, 96 }, /* Brunei */
{ 38, L"BI", L"BDI", 47603, 108 }, /* Burundi */
{ 39, L"CA", L"CAN", 23581, 124 }, /* Canada */
{ 40, L"KH", L"KHM", 47599, 116 }, /* Cambodia */
{ 41, L"TD", L"TCD", 42484, 148 }, /* Chad */
{ 42, L"LK", L"LKA", 47614, 144 }, /* Sri Lanka */
{ 43, L"CG", L"COG", 42484, 178 }, /* Congo */
{ 44, L"CD", L"COD", 42484, 180 }, /* Congo (DRC) */
{ 45, L"CN", L"CHN", 47600, 156 }, /* China */
{ 46, L"CL", L"CHL", 31396, 152 }, /* Chile */
{ 49, L"CM", L"CMR", 42484, 120 }, /* Cameroon */
{ 50, L"KM", L"COM", 47603, 174 }, /* Comoros */
{ 51, L"CO", L"COL", 31396, 170 }, /* Colombia */
{ 54, L"CR", L"CRI", 27082, 188 }, /* Costa Rica */
{ 55, L"CF", L"CAF", 42484, 140 }, /* Central African Republic */
{ 56, L"CU", L"CUB", 10039880, 192 }, /* Cuba */
{ 57, L"CV", L"CPV", 42483, 132 }, /* Cape Verde */
{ 59, L"CY", L"CYP", 47611, 196 }, /* Cyprus */
{ 61, L"DK", L"DNK", 10039882, 208 }, /* Denmark */
{ 62, L"DJ", L"DJI", 47603, 262 }, /* Djibouti */
{ 63, L"DM", L"DMA", 10039880, 212 }, /* Dominica */
{ 65, L"DO", L"DOM", 10039880, 214 }, /* Dominican Republic */
{ 66, L"EC", L"ECU", 31396, 218 }, /* Ecuador */
{ 67, L"EG", L"EGY", 42487, 818 }, /* Egypt */
{ 68, L"IE", L"IRL", 10039882, 372 }, /* Ireland */
{ 69, L"GQ", L"GNQ", 42484, 226 }, /* Equatorial Guinea */
{ 70, L"EE", L"EST", 10039882, 233 }, /* Estonia */
{ 71, L"ER", L"ERI", 47603, 232 }, /* Eritrea */
{ 72, L"SV", L"SLV", 27082, 222 }, /* El Salvador */
{ 73, L"ET", L"ETH", 47603, 231 }, /* Ethiopia */
{ 75, L"CZ", L"CZE", 47609, 203 }, /* Czech Republic */
{ 77, L"FI", L"FIN", 10039882, 246 }, /* Finland */
{ 78, L"FJ", L"FJI", 20900, 242 }, /* Fiji Islands */
{ 80, L"FM", L"FSM", 21206, 583 }, /* Micronesia */
{ 81, L"FO", L"FRO", 10039882, 234 }, /* Faroe Islands */
{ 84, L"FR", L"FRA", 10210824, 250 }, /* France */
{ 86, L"GM", L"GMB", 42483, 270 }, /* Gambia, The */
{ 87, L"GA", L"GAB", 42484, 266 }, /* Gabon */
{ 88, L"GE", L"GEO", 47611, 268 }, /* Georgia */
{ 89, L"GH", L"GHA", 42483, 288 }, /* Ghana */
{ 90, L"GI", L"GIB", 47610, 292 }, /* Gibraltar */
{ 91, L"GD", L"GRD", 10039880, 308 }, /* Grenada */
{ 93, L"GL", L"GRL", 23581, 304 }, /* Greenland */
{ 94, L"DE", L"DEU", 10210824, 276 }, /* Germany */
{ 98, L"GR", L"GRC", 47610, 300 }, /* Greece */
{ 99, L"GT", L"GTM", 27082, 320 }, /* Guatemala */
{ 100, L"GN", L"GIN", 42483, 324 }, /* Guinea */
{ 101, L"GY", L"GUY", 31396, 328 }, /* Guyana */
{ 103, L"HT", L"HTI", 10039880, 332 }, /* Haiti */
{ 104, L"HK", L"HKG", 47600, 344 }, /* Hong Kong S.A.R. */
{ 106, L"HN", L"HND", 27082, 340 }, /* Honduras */
{ 108, L"HR", L"HRV", 47610, 191 }, /* Croatia */
{ 109, L"HU", L"HUN", 47609, 348 }, /* Hungary */
{ 110, L"IS", L"ISL", 10039882, 352 }, /* Iceland */
{ 111, L"ID", L"IDN", 47599, 360 }, /* Indonesia */
{ 113, L"IN", L"IND", 47614, 356 }, /* India */
{ 114, L"IO", L"IOT", 39070, 86 }, /* British Indian Ocean Territory */
{ 116, L"IR", L"IRN", 47614, 364 }, /* Iran */
{ 117, L"IL", L"ISR", 47611, 376 }, /* Israel */
{ 118, L"IT", L"ITA", 47610, 380 }, /* Italy */
{ 119, L"CI", L"CIV", 42483, 384 }, /* Côte d'Ivoire */
{ 121, L"IQ", L"IRQ", 47611, 368 }, /* Iraq */
{ 122, L"JP", L"JPN", 47600, 392 }, /* Japan */
{ 124, L"JM", L"JAM", 10039880, 388 }, /* Jamaica */
{ 125, L"SJ", L"SJM", 10039882, 744 }, /* Jan Mayen */
{ 126, L"JO", L"JOR", 47611, 400 }, /* Jordan */
{ 127, L"XX", L"XX", 161832256 }, /* Johnston Atoll */
{ 129, L"KE", L"KEN", 47603, 404 }, /* Kenya */
{ 130, L"KG", L"KGZ", 47590, 417 }, /* Kyrgyzstan */
{ 131, L"KP", L"PRK", 47600, 408 }, /* North Korea */
{ 133, L"KI", L"KIR", 21206, 296 }, /* Kiribati */
{ 134, L"KR", L"KOR", 47600, 410 }, /* Korea */
{ 136, L"KW", L"KWT", 47611, 414 }, /* Kuwait */
{ 137, L"KZ", L"KAZ", 47590, 398 }, /* Kazakhstan */
{ 138, L"LA", L"LAO", 47599, 418 }, /* Laos */
{ 139, L"LB", L"LBN", 47611, 422 }, /* Lebanon */
{ 140, L"LV", L"LVA", 10039882, 428 }, /* Latvia */
{ 141, L"LT", L"LTU", 10039882, 440 }, /* Lithuania */
{ 142, L"LR", L"LBR", 42483, 430 }, /* Liberia */
{ 143, L"SK", L"SVK", 47609, 703 }, /* Slovakia */
{ 145, L"LI", L"LIE", 10210824, 438 }, /* Liechtenstein */
{ 146, L"LS", L"LSO", 10039883, 426 }, /* Lesotho */
{ 147, L"LU", L"LUX", 10210824, 442 }, /* Luxembourg */
{ 148, L"LY", L"LBY", 42487, 434 }, /* Libya */
{ 149, L"MG", L"MDG", 47603, 450 }, /* Madagascar */
{ 151, L"MO", L"MAC", 47600, 446 }, /* Macao S.A.R. */
{ 152, L"MD", L"MDA", 47609, 498 }, /* Moldova */
{ 154, L"MN", L"MNG", 47600, 496 }, /* Mongolia */
{ 156, L"MW", L"MWI", 47603, 454 }, /* Malawi */
{ 157, L"ML", L"MLI", 42483, 466 }, /* Mali */
{ 158, L"MC", L"MCO", 10210824, 492 }, /* Monaco */
{ 159, L"MA", L"MAR", 42487, 504 }, /* Morocco */
{ 160, L"MU", L"MUS", 47603, 480 }, /* Mauritius */
{ 162, L"MR", L"MRT", 42483, 478 }, /* Mauritania */
{ 163, L"MT", L"MLT", 47610, 470 }, /* Malta */
{ 164, L"OM", L"OMN", 47611, 512 }, /* Oman */
{ 165, L"MV", L"MDV", 47614, 462 }, /* Maldives */
{ 166, L"MX", L"MEX", 27082, 484 }, /* Mexico */
{ 167, L"MY", L"MYS", 47599, 458 }, /* Malaysia */
{ 168, L"MZ", L"MOZ", 47603, 508 }, /* Mozambique */
{ 173, L"NE", L"NER", 42483, 562 }, /* Niger */
{ 174, L"VU", L"VUT", 20900, 548 }, /* Vanuatu */
{ 175, L"NG", L"NGA", 42483, 566 }, /* Nigeria */
{ 176, L"NL", L"NLD", 10210824, 528 }, /* Netherlands */
{ 177, L"NO", L"NOR", 10039882, 578 }, /* Norway */
{ 178, L"NP", L"NPL", 47614, 524 }, /* Nepal */
{ 180, L"NR", L"NRU", 21206, 520 }, /* Nauru */
{ 181, L"SR", L"SUR", 31396, 740 }, /* Suriname */
{ 182, L"NI", L"NIC", 27082, 558 }, /* Nicaragua */
{ 183, L"NZ", L"NZL", 10210825, 554 }, /* New Zealand */
{ 184, L"PS", L"PSE", 47611, 275 }, /* Palestinian Authority */
{ 185, L"PY", L"PRY", 31396, 600 }, /* Paraguay */
{ 187, L"PE", L"PER", 31396, 604 }, /* Peru */
{ 190, L"PK", L"PAK", 47614, 586 }, /* Pakistan */
{ 191, L"PL", L"POL", 47609, 616 }, /* Poland */
{ 192, L"PA", L"PAN", 27082, 591 }, /* Panama */
{ 193, L"PT", L"PRT", 47610, 620 }, /* Portugal */
{ 194, L"PG", L"PNG", 20900, 598 }, /* Papua New Guinea */
{ 195, L"PW", L"PLW", 21206, 585 }, /* Palau */
{ 196, L"GW", L"GNB", 42483, 624 }, /* Guinea-Bissau */
{ 197, L"QA", L"QAT", 47611, 634 }, /* Qatar */
{ 198, L"RE", L"REU", 47603, 638 }, /* Reunion */
{ 199, L"MH", L"MHL", 21206, 584 }, /* Marshall Islands */
{ 200, L"RO", L"ROU", 47609, 642 }, /* Romania */
{ 201, L"PH", L"PHL", 47599, 608 }, /* Philippines */
{ 202, L"PR", L"PRI", 10039880, 630 }, /* Puerto Rico */
{ 203, L"RU", L"RUS", 47609, 643 }, /* Russia */
{ 204, L"RW", L"RWA", 47603, 646 }, /* Rwanda */
{ 205, L"SA", L"SAU", 47611, 682 }, /* Saudi Arabia */
{ 206, L"PM", L"SPM", 23581, 666 }, /* St. Pierre and Miquelon */
{ 207, L"KN", L"KNA", 10039880, 659 }, /* St. Kitts and Nevis */
{ 208, L"SC", L"SYC", 47603, 690 }, /* Seychelles */
{ 209, L"ZA", L"ZAF", 10039883, 710 }, /* South Africa */
{ 210, L"SN", L"SEN", 42483, 686 }, /* Senegal */
{ 212, L"SI", L"SVN", 47610, 705 }, /* Slovenia */
{ 213, L"SL", L"SLE", 42483, 694 }, /* Sierra Leone */
{ 214, L"SM", L"SMR", 47610, 674 }, /* San Marino */
{ 215, L"SG", L"SGP", 47599, 702 }, /* Singapore */
{ 216, L"SO", L"SOM", 47603, 706 }, /* Somalia */
{ 217, L"ES", L"ESP", 47610, 724 }, /* Spain */
{ 218, L"LC", L"LCA", 10039880, 662 }, /* St. Lucia */
{ 219, L"SD", L"SDN", 42487, 736 }, /* Sudan */
{ 220, L"SJ", L"SJM", 10039882, 744 }, /* Svalbard */
{ 221, L"SE", L"SWE", 10039882, 752 }, /* Sweden */
{ 222, L"SY", L"SYR", 47611, 760 }, /* Syria */
{ 223, L"CH", L"CHE", 10210824, 756 }, /* Switzerland */
{ 224, L"AE", L"ARE", 47611, 784 }, /* United Arab Emirates */
{ 225, L"TT", L"TTO", 10039880, 780 }, /* Trinidad and Tobago */
{ 227, L"TH", L"THA", 47599, 764 }, /* Thailand */
{ 228, L"TJ", L"TJK", 47590, 762 }, /* Tajikistan */
{ 231, L"TO", L"TON", 26286, 776 }, /* Tonga */
{ 232, L"TG", L"TGO", 42483, 768 }, /* Togo */
{ 233, L"ST", L"STP", 42484, 678 }, /* São Tomé and Príncipe */
{ 234, L"TN", L"TUN", 42487, 788 }, /* Tunisia */
{ 235, L"TR", L"TUR", 47611, 792 }, /* Turkey */
{ 236, L"TV", L"TUV", 26286, 798 }, /* Tuvalu */
{ 237, L"TW", L"TWN", 47600, 158 }, /* Taiwan */
{ 238, L"TM", L"TKM", 47590, 795 }, /* Turkmenistan */
{ 239, L"TZ", L"TZA", 47603, 834 }, /* Tanzania */
{ 240, L"UG", L"UGA", 47603, 800 }, /* Uganda */
{ 241, L"UA", L"UKR", 47609, 804 }, /* Ukraine */
{ 242, L"GB", L"GBR", 10039882, 826 }, /* United Kingdom */
{ 244, L"US", L"USA", 23581, 840 }, /* United States */
{ 245, L"BF", L"BFA", 42483, 854 }, /* Burkina Faso */
{ 246, L"UY", L"URY", 31396, 858 }, /* Uruguay */
{ 247, L"UZ", L"UZB", 47590, 860 }, /* Uzbekistan */
{ 248, L"VC", L"VCT", 10039880, 670 }, /* St. Vincent and the Grenadines */
{ 249, L"VE", L"VEN", 31396, 862 }, /* Bolivarian Republic of Venezuela */
{ 251, L"VN", L"VNM", 47599, 704 }, /* Vietnam */
{ 252, L"VI", L"VIR", 10039880, 850 }, /* Virgin Islands */
{ 253, L"VA", L"VAT", 47610, 336 }, /* Vatican City */
{ 254, L"NA", L"NAM", 10039883, 516 }, /* Namibia */
{ 257, L"EH", L"ESH", 42487, 732 }, /* Western Sahara (disputed) */
{ 258, L"XX", L"XX", 161832256 }, /* Wake Island */
{ 259, L"WS", L"WSM", 26286, 882 }, /* Samoa */
{ 260, L"SZ", L"SWZ", 10039883, 748 }, /* Swaziland */
{ 261, L"YE", L"YEM", 47611, 887 }, /* Yemen */
{ 263, L"ZM", L"ZMB", 47603, 894 }, /* Zambia */
{ 264, L"ZW", L"ZWE", 47603, 716 }, /* Zimbabwe */
{ 269, L"CS", L"SCG", 47610, 891 }, /* Serbia and Montenegro (Former) */
{ 270, L"ME", L"MNE", 47610, 499 }, /* Montenegro */
{ 271, L"RS", L"SRB", 47610, 688 }, /* Serbia */
{ 273, L"CW", L"CUW", 10039880, 531 }, /* Curaçao */
{ 276, L"SS", L"SSD", 42487, 728 }, /* South Sudan */
{ 300, L"AI", L"AIA", 10039880, 660 }, /* Anguilla */
{ 301, L"AQ", L"ATA", 39070, 10 }, /* Antarctica */
{ 302, L"AW", L"ABW", 10039880, 533 }, /* Aruba */
{ 303, L"XX", L"XX", 343 }, /* Ascension Island */
{ 304, L"XX", L"XX", 10210825 }, /* Ashmore and Cartier Islands */
{ 305, L"XX", L"XX", 161832256 }, /* Baker Island */
{ 306, L"BV", L"BVT", 39070, 74 }, /* Bouvet Island */
{ 307, L"KY", L"CYM", 10039880, 136 }, /* Cayman Islands */
{ 308, L"XX", L"XX", 10210824, 830, LOCATION_BOTH }, /* Channel Islands */
{ 309, L"CX", L"CXR", 12, 162 }, /* Christmas Island */
{ 310, L"XX", L"XX", 27114 }, /* Clipperton Island */
{ 311, L"CC", L"CCK", 10210825, 166 }, /* Cocos (Keeling) Islands */
{ 312, L"CK", L"COK", 26286, 184 }, /* Cook Islands */
{ 313, L"XX", L"XX", 10210825 }, /* Coral Sea Islands */
{ 314, L"XX", L"XX", 114 }, /* Diego Garcia */
{ 315, L"FK", L"FLK", 31396, 238 }, /* Falkland Islands (Islas Malvinas) */
{ 317, L"GF", L"GUF", 31396, 254 }, /* French Guiana */
{ 318, L"PF", L"PYF", 26286, 258 }, /* French Polynesia */
{ 319, L"TF", L"ATF", 39070, 260 }, /* French Southern and Antarctic Lands */
{ 321, L"GP", L"GLP", 10039880, 312 }, /* Guadeloupe */
{ 322, L"GU", L"GUM", 21206, 316 }, /* Guam */
{ 323, L"XX", L"XX", 39070 }, /* Guantanamo Bay */
{ 324, L"GG", L"GGY", 308, 831 }, /* Guernsey */
{ 325, L"HM", L"HMD", 39070, 334 }, /* Heard Island and McDonald Islands */
{ 326, L"XX", L"XX", 161832256 }, /* Howland Island */
{ 327, L"XX", L"XX", 161832256 }, /* Jarvis Island */
{ 328, L"JE", L"JEY", 308, 832 }, /* Jersey */
{ 329, L"XX", L"XX", 161832256 }, /* Kingman Reef */
{ 330, L"MQ", L"MTQ", 10039880, 474 }, /* Martinique */
{ 331, L"YT", L"MYT", 47603, 175 }, /* Mayotte */
{ 332, L"MS", L"MSR", 10039880, 500 }, /* Montserrat */
{ 333, L"AN", L"ANT", 10039880, 530, LOCATION_BOTH }, /* Netherlands Antilles (Former) */
{ 334, L"NC", L"NCL", 20900, 540 }, /* New Caledonia */
{ 335, L"NU", L"NIU", 26286, 570 }, /* Niue */
{ 336, L"NF", L"NFK", 10210825, 574 }, /* Norfolk Island */
{ 337, L"MP", L"MNP", 21206, 580 }, /* Northern Mariana Islands */
{ 338, L"XX", L"XX", 161832256 }, /* Palmyra Atoll */
{ 339, L"PN", L"PCN", 26286, 612 }, /* Pitcairn Islands */
{ 340, L"XX", L"XX", 337 }, /* Rota Island */
{ 341, L"XX", L"XX", 337 }, /* Saipan */
{ 342, L"GS", L"SGS", 39070, 239 }, /* South Georgia and the South Sandwich Islands */
{ 343, L"SH", L"SHN", 42483, 654 }, /* St. Helena */
{ 346, L"XX", L"XX", 337 }, /* Tinian Island */
{ 347, L"TK", L"TKL", 26286, 772 }, /* Tokelau */
{ 348, L"XX", L"XX", 343 }, /* Tristan da Cunha */
{ 349, L"TC", L"TCA", 10039880, 796 }, /* Turks and Caicos Islands */
{ 351, L"VG", L"VGB", 10039880, 92 }, /* Virgin Islands, British */
{ 352, L"WF", L"WLF", 26286, 876 }, /* Wallis and Futuna */
{ 742, L"XX", L"XX", 39070, 2, LOCATION_REGION }, /* Africa */
{ 2129, L"XX", L"XX", 39070, 142, LOCATION_REGION }, /* Asia */
{ 10541, L"XX", L"XX", 39070, 150, LOCATION_REGION }, /* Europe */
{ 15126, L"IM", L"IMN", 10039882, 833 }, /* Man, Isle of */
{ 19618, L"MK", L"MKD", 47610, 807 }, /* Macedonia, Former Yugoslav Republic of */
{ 20900, L"XX", L"XX", 27114, 54, LOCATION_REGION }, /* Melanesia */
{ 21206, L"XX", L"XX", 27114, 57, LOCATION_REGION }, /* Micronesia */
{ 21242, L"XX", L"XX", 161832256 }, /* Midway Islands */
{ 23581, L"XX", L"XX", 10026358, 21, LOCATION_REGION }, /* Northern America */
{ 26286, L"XX", L"XX", 27114, 61, LOCATION_REGION }, /* Polynesia */
{ 27082, L"XX", L"XX", 161832257, 13, LOCATION_REGION }, /* Central America */
{ 27114, L"XX", L"XX", 39070, 9, LOCATION_REGION }, /* Oceania */
{ 30967, L"SX", L"SXM", 10039880, 534 }, /* Sint Maarten (Dutch part) */
{ 31396, L"XX", L"XX", 161832257, 5, LOCATION_REGION }, /* South America */
{ 31706, L"MF", L"MAF", 10039880, 663 }, /* Saint Martin (French part) */
{ 39070, L"XX", L"XX", 39070, 1, LOCATION_REGION }, /* World */
{ 42483, L"XX", L"XX", 742, 11, LOCATION_REGION }, /* Western Africa */
{ 42484, L"XX", L"XX", 742, 17, LOCATION_REGION }, /* Middle Africa */
{ 42487, L"XX", L"XX", 742, 15, LOCATION_REGION }, /* Northern Africa */
{ 47590, L"XX", L"XX", 2129, 143, LOCATION_REGION }, /* Central Asia */
{ 47599, L"XX", L"XX", 2129, 35, LOCATION_REGION }, /* South-Eastern Asia */
{ 47600, L"XX", L"XX", 2129, 30, LOCATION_REGION }, /* Eastern Asia */
{ 47603, L"XX", L"XX", 742, 14, LOCATION_REGION }, /* Eastern Africa */
{ 47609, L"XX", L"XX", 10541, 151, LOCATION_REGION }, /* Eastern Europe */
{ 47610, L"XX", L"XX", 10541, 39, LOCATION_REGION }, /* Southern Europe */
{ 47611, L"XX", L"XX", 2129, 145, LOCATION_REGION }, /* Middle East */
{ 47614, L"XX", L"XX", 2129, 34, LOCATION_REGION }, /* Southern Asia */
{ 7299303, L"TL", L"TLS", 47599, 626 }, /* Democratic Republic of Timor-Leste */
{ 9914689, L"XK", L"XKS", 47610, 906 }, /* Kosovo */
{ 10026358, L"XX", L"XX", 39070, 19, LOCATION_REGION }, /* Americas */
{ 10028789, L"AX", L"ALA", 10039882, 248 }, /* Åland Islands */
{ 10039880, L"XX", L"XX", 161832257, 29, LOCATION_REGION }, /* Caribbean */
{ 10039882, L"XX", L"XX", 10541, 154, LOCATION_REGION }, /* Northern Europe */
{ 10039883, L"XX", L"XX", 742, 18, LOCATION_REGION }, /* Southern Africa */
{ 10210824, L"XX", L"XX", 10541, 155, LOCATION_REGION }, /* Western Europe */
{ 10210825, L"XX", L"XX", 27114, 53, LOCATION_REGION }, /* Australia and New Zealand */
{ 161832015, L"BL", L"BLM", 10039880, 652 }, /* Saint Barthélemy */
{ 161832256, L"UM", L"UMI", 27114, 581 }, /* U.S. Minor Outlying Islands */
{ 161832257, L"XX", L"XX", 10026358, 419, LOCATION_REGION }, /* Latin America and the Caribbean */
};
static NLSTABLEINFO nls_info; static NLSTABLEINFO nls_info;
static UINT mac_cp = 10000; static UINT mac_cp = 10000;
static HKEY intl_key; static HKEY intl_key;
...@@ -1924,6 +2240,23 @@ static int compare_weights(int flags, const WCHAR *str1, int len1, ...@@ -1924,6 +2240,23 @@ static int compare_weights(int flags, const WCHAR *str1, int len1,
} }
static const struct geoinfo *get_geoinfo_ptr( GEOID geoid )
{
int min = 0, max = ARRAY_SIZE( geoinfodata )-1;
while (min <= max)
{
int n = (min + max)/2;
const struct geoinfo *ptr = &geoinfodata[n];
if (geoid == ptr->id) /* we don't need empty entries */
return *ptr->iso2W ? ptr : NULL;
if (ptr->id > geoid) max = n-1;
else min = n+1;
}
return NULL;
}
/* Note: the Internal_ functions are not documented. The number of parameters /* Note: the Internal_ functions are not documented. The number of parameters
* should be correct, but their exact meaning may not. * should be correct, but their exact meaning may not.
*/ */
...@@ -2548,6 +2881,40 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumSystemCodePagesW( CODEPAGE_ENUMPROCW proc, DWO ...@@ -2548,6 +2881,40 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnumSystemCodePagesW( CODEPAGE_ENUMPROCW proc, DWO
/****************************************************************************** /******************************************************************************
* EnumSystemGeoID (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH EnumSystemGeoID( GEOCLASS class, GEOID parent, GEO_ENUMPROC proc )
{
INT i;
TRACE( "(%d, %d, %p)\n", class, parent, proc );
if (!proc)
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
if (class != GEOCLASS_NATION && class != GEOCLASS_REGION && class != GEOCLASS_ALL)
{
SetLastError( ERROR_INVALID_FLAGS );
return FALSE;
}
for (i = 0; i < ARRAY_SIZE(geoinfodata); i++)
{
const struct geoinfo *ptr = &geoinfodata[i];
if (class == GEOCLASS_NATION && (ptr->kind != LOCATION_NATION)) continue;
/* LOCATION_BOTH counts as region */
if (class == GEOCLASS_REGION && (ptr->kind == LOCATION_NATION)) continue;
if (parent && ptr->parent != parent) continue;
if (!proc( ptr->id )) break;
}
return TRUE;
}
/******************************************************************************
* EnumSystemLanguageGroupsW (kernelbase.@) * EnumSystemLanguageGroupsW (kernelbase.@)
*/ */
BOOL WINAPI DECLSPEC_HOTPATCH EnumSystemLanguageGroupsW( LANGUAGEGROUP_ENUMPROCW proc, BOOL WINAPI DECLSPEC_HOTPATCH EnumSystemLanguageGroupsW( LANGUAGEGROUP_ENUMPROCW proc,
...@@ -3143,6 +3510,73 @@ INT WINAPI DECLSPEC_HOTPATCH GetCalendarInfoEx( const WCHAR *locale, CALID calen ...@@ -3143,6 +3510,73 @@ INT WINAPI DECLSPEC_HOTPATCH GetCalendarInfoEx( const WCHAR *locale, CALID calen
/****************************************************************************** /******************************************************************************
* GetGeoInfoW (kernelbase.@)
*/
INT WINAPI DECLSPEC_HOTPATCH GetGeoInfoW( GEOID id, GEOTYPE type, WCHAR *data, int count, LANGID lang )
{
const struct geoinfo *ptr = get_geoinfo_ptr( id );
WCHAR bufferW[12];
const WCHAR *str = bufferW;
int len;
TRACE( "%d %d %p %d %d\n", id, type, data, count, lang );
if (!ptr)
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
switch (type)
{
case GEO_NATION:
if (ptr->kind != LOCATION_NATION) return 0;
/* fall through */
case GEO_ID:
swprintf( bufferW, ARRAY_SIZE(bufferW), L"%u", ptr->id );
break;
case GEO_ISO_UN_NUMBER:
swprintf( bufferW, ARRAY_SIZE(bufferW), L"%03u", ptr->uncode );
break;
case GEO_PARENT:
swprintf( bufferW, ARRAY_SIZE(bufferW), L"%u", ptr->parent );
break;
case GEO_ISO2:
str = ptr->iso2W;
break;
case GEO_ISO3:
str = ptr->iso3W;
break;
case GEO_RFC1766:
case GEO_LCID:
case GEO_FRIENDLYNAME:
case GEO_OFFICIALNAME:
case GEO_TIMEZONES:
case GEO_OFFICIALLANGUAGES:
case GEO_LATITUDE:
case GEO_LONGITUDE:
case GEO_DIALINGCODE:
case GEO_CURRENCYCODE:
case GEO_CURRENCYSYMBOL:
case GEO_NAME:
FIXME( "type %d is not supported\n", type );
SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
return 0;
default:
WARN( "unrecognized type %d\n", type );
SetLastError( ERROR_INVALID_FLAGS );
return 0;
}
len = lstrlenW(str) + 1;
if (!data || !count) return len;
memcpy( data, str, min(len, count) * sizeof(WCHAR) );
if (count < len) SetLastError( ERROR_INSUFFICIENT_BUFFER );
return count < len ? 0 : len;
}
/******************************************************************************
* GetLocaleInfoA (kernelbase.@) * GetLocaleInfoA (kernelbase.@)
*/ */
INT WINAPI DECLSPEC_HOTPATCH GetLocaleInfoA( LCID lcid, LCTYPE lctype, char *buffer, INT len ) INT WINAPI DECLSPEC_HOTPATCH GetLocaleInfoA( LCID lcid, LCTYPE lctype, char *buffer, INT len )
...@@ -3549,6 +3983,39 @@ LANGID WINAPI DECLSPEC_HOTPATCH GetUserDefaultUILanguage(void) ...@@ -3549,6 +3983,39 @@ LANGID WINAPI DECLSPEC_HOTPATCH GetUserDefaultUILanguage(void)
/****************************************************************************** /******************************************************************************
* GetUserGeoID (kernelbase.@)
*/
GEOID WINAPI DECLSPEC_HOTPATCH GetUserGeoID( GEOCLASS geoclass )
{
GEOID ret = 39070;
const WCHAR *name;
WCHAR bufferW[40];
HKEY hkey;
switch (geoclass)
{
case GEOCLASS_NATION:
name = L"Nation";
break;
case GEOCLASS_REGION:
name = L"Region";
break;
default:
WARN("Unknown geoclass %d\n", geoclass);
return GEOID_NOT_AVAILABLE;
}
if (!RegOpenKeyExW( intl_key, L"Geo", 0, KEY_ALL_ACCESS, &hkey ))
{
DWORD count = sizeof(bufferW);
if (!RegQueryValueExW( hkey, name, NULL, NULL, (BYTE *)bufferW, &count ))
ret = wcstol( bufferW, NULL, 10 );
RegCloseKey( hkey );
}
return ret;
}
/******************************************************************************
* IsCharAlphaA (kernelbase.@) * IsCharAlphaA (kernelbase.@)
*/ */
BOOL WINAPI DECLSPEC_HOTPATCH IsCharAlphaA( CHAR c ) BOOL WINAPI DECLSPEC_HOTPATCH IsCharAlphaA( CHAR c )
...@@ -4234,6 +4701,31 @@ INT WINAPI /* DECLSPEC_HOTPATCH */ SetCalendarInfoW( LCID lcid, CALID calendar, ...@@ -4234,6 +4701,31 @@ INT WINAPI /* DECLSPEC_HOTPATCH */ SetCalendarInfoW( LCID lcid, CALID calendar,
} }
/******************************************************************************
* SetUserGeoID (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH SetUserGeoID( GEOID id )
{
const struct geoinfo *geoinfo = get_geoinfo_ptr( id );
WCHAR bufferW[10];
HKEY hkey;
if (!geoinfo)
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
if (!RegCreateKeyExW( intl_key, L"Geo", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
{
const WCHAR *name = geoinfo->kind == LOCATION_NATION ? L"Nation" : L"Region";
swprintf( bufferW, ARRAY_SIZE(bufferW), L"%u", geoinfo->id );
RegSetValueExW( hkey, name, 0, REG_SZ, (BYTE *)bufferW, (lstrlenW(bufferW) + 1) * sizeof(WCHAR) );
RegCloseKey( hkey );
}
return TRUE;
}
/*********************************************************************** /***********************************************************************
* VerLanguageNameA (kernelbase.@) * VerLanguageNameA (kernelbase.@)
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment