halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
Ben Wagner | 8bd6e8f | 2019-05-15 09:28:52 -0400 | [diff] [blame] | 7 | #include <windows.h> |
| 8 | #include <stdio.h> |
bungeman@google.com | 07a69f8 | 2013-04-02 14:12:38 +0000 | [diff] [blame] | 9 | |
| 10 | #define BUFFER_SIZE 512 |
| 11 | BOOL CALLBACK MyFuncLocaleEx(LPWSTR pStr, DWORD dwFlags, LPARAM lparam) { |
| 12 | WCHAR wcBuffer[BUFFER_SIZE]; |
| 13 | int bufferSize; |
| 14 | |
| 15 | bufferSize = GetLocaleInfoEx(pStr, LOCALE_SENGLANGUAGE, wcBuffer, BUFFER_SIZE); |
| 16 | if (bufferSize == 0) { |
| 17 | wprintf(L"Locale %s had error %d\n", pStr, GetLastError()); |
| 18 | return (TRUE); |
| 19 | } |
| 20 | |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 21 | LCID lcid = LocaleNameToLCID(pStr, nullptr); |
bungeman@google.com | 07a69f8 | 2013-04-02 14:12:38 +0000 | [diff] [blame] | 22 | if (lcid == 0) { |
| 23 | wprintf(L"Error %d getting LCID\n", GetLastError()); |
| 24 | return (TRUE); |
| 25 | } |
skia.committer@gmail.com | 041e2db | 2013-04-03 07:01:14 +0000 | [diff] [blame] | 26 | |
bungeman@google.com | 07a69f8 | 2013-04-02 14:12:38 +0000 | [diff] [blame] | 27 | if (lcid > 0x8000) { |
| 28 | wprintf(L"//"); |
| 29 | } |
| 30 | wprintf(L" { 0x%.4x, \"%s\" }, //%s\n", lcid, pStr, wcBuffer); |
| 31 | |
| 32 | return (TRUE); |
| 33 | } |
| 34 | |
| 35 | int main(int argc, wchar_t* argv[]) { |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 36 | EnumSystemLocalesEx(MyFuncLocaleEx, LOCALE_ALL, nullptr, nullptr); |
bungeman@google.com | 07a69f8 | 2013-04-02 14:12:38 +0000 | [diff] [blame] | 37 | } |