| 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 |
*/ |
| 7 |
#include <windows.h> |
| 8 |
#include <stdio.h> |
| 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 |
|
| 21 |
LCID lcid = LocaleNameToLCID(pStr, nullptr); |
| 22 |
if (lcid == 0) { |
| 23 |
wprintf(L"Error %d getting LCID\n", GetLastError()); |
| 24 |
return (TRUE); |
| 25 |
} |
| 26 |
|
| 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[]) { |
| 36 |
EnumSystemLocalesEx(MyFuncLocaleEx, LOCALE_ALL, nullptr, nullptr); |
| 37 |
} |