summaryrefslogtreecommitdiffstats
path: root/src/detection/locale/locale_windows.c
blob: b247365069b69a76cdbb548a4f74b375327833f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "detection/locale/locale.h"
#include "common/windows/unicode.h"

#include <windows.h>

const char* ffDetectLocale(FFstrbuf* result) {
    wchar_t name[LOCALE_NAME_MAX_LENGTH];
    int size = GetUserDefaultLocaleName(name, LOCALE_NAME_MAX_LENGTH);
    if (size <= 1) { // including '\0'
        return "GetUserDefaultLocaleName() failed";
    }

    ffStrbufSetNWS(result, (uint32_t) size - 1, name);

    return NULL;
}