ReactOS 0.4.16-dev-1537-g4e425b5
GetUserDefaultLocaleName.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Win32 Base API
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Implementation of GetUserDefaultLocaleName
5 * COPYRIGHT: Copyright 2025 Timo Kreuzer <timo.kreuzer@reactos.org>
6 */
7
8#include "k32_vista.h"
9#include <ndk/rtlfuncs.h>
10
11INT
14 LPWSTR lpLocaleName,
16{
17 UNICODE_STRING LocaleNameString;
19
20 if (lpLocaleName == NULL)
21 {
23 return 0;
24 }
25
26 if (cchLocaleName <= 0)
27 {
29 return 0;
30 }
31
33 LocaleNameString.Buffer = lpLocaleName;
34 LocaleNameString.Length = 0;
35 LocaleNameString.MaximumLength = (USHORT)(cchLocaleName * sizeof(WCHAR));
36
37 Status = RtlLcidToLocaleName(LOCALE_USER_DEFAULT, &LocaleNameString, 0, FALSE);
38 if (!NT_SUCCESS(Status))
39 {
41 return 0;
42 }
43
44 return LocaleNameString.Length / sizeof(WCHAR);
45}
INT WINAPI GetUserDefaultLocaleName(LPWSTR lpLocaleName, INT cchLocaleName)
LONG NTSTATUS
Definition: precomp.h:26
_In_ int cchLocaleName
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
Status
Definition: gdiplustypes.h:25
NTSYSAPI NTSTATUS WINAPI RtlLcidToLocaleName(LCID, UNICODE_STRING *, ULONG, BOOLEAN)
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define min(a, b)
Definition: monoChain.cc:55
#define LOCALE_NAME_MAX_LENGTH
#define LOCALE_USER_DEFAULT
unsigned short USHORT
Definition: pedump.c:61
USHORT MaximumLength
Definition: env_spec_w32.h:370
int32_t INT
Definition: typedefs.h:58
#define WINAPI
Definition: msvc.h:6
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184