1#include "windows.h"
2#include "stdio.h"
3
4#define BUFFER_SIZE 512
5BOOL CALLBACK MyFuncLocaleEx(LPWSTR pStr, DWORD dwFlags, LPARAM lparam) {
6    WCHAR wcBuffer[BUFFER_SIZE];
7    int bufferSize;
8
9    bufferSize = GetLocaleInfoEx(pStr, LOCALE_SENGLANGUAGE, wcBuffer, BUFFER_SIZE);
10    if (bufferSize == 0) {
11        wprintf(L"Locale %s had error %d\n", pStr, GetLastError());
12        return (TRUE);
13    }
14
15    LCID lcid = LocaleNameToLCID(pStr, NULL);
16    if (lcid == 0) {
17        wprintf(L"Error %d getting LCID\n", GetLastError());
18        return (TRUE);
19    }
20
21    if (lcid > 0x8000) {
22        wprintf(L"//");
23    }
24    wprintf(L"    { 0x%.4x, \"%s\" }, //%s\n", lcid, pStr, wcBuffer);
25
26    return (TRUE);
27}
28
29int main(int argc, wchar_t* argv[]) {
30    EnumSystemLocalesEx(MyFuncLocaleEx, LOCALE_ALL, NULL, NULL);
31}
32