ReactOS 0.4.16-dev-1946-g52006dd
LCIDToLocaleName.c File Reference
#include "k32_vista.h"
#include <ndk/rtlfuncs.h>
Include dependency graph for LCIDToLocaleName.c:

Go to the source code of this file.

Functions

int WINAPI LCIDToLocaleName (_In_ LCID Locale, _Out_writes_opt_(cchName) LPWSTR lpName, _In_ int cchName, _In_ DWORD dwFlags)
 

Function Documentation

◆ LCIDToLocaleName()

int WINAPI LCIDToLocaleName ( _In_ LCID  Locale,
_Out_writes_opt_(cchName) LPWSTR  lpName,
_In_ int  cchName,
_In_ DWORD  dwFlags 
)

Definition at line 13 of file LCIDToLocaleName.c.

18{
20 UNICODE_STRING LocaleNameString;
21 DWORD RtlFlags = 0;
23
24 if (cchName < 0)
25 {
27 return 0;
28 }
29
31 {
32 RtlFlags |= RTL_LOCALE_ALLOW_NEUTRAL_NAMES;
33 }
34
35 if (lpName != NULL)
36 {
38 LocaleNameString.Buffer = lpName;
39 LocaleNameString.Length = 0;
40 LocaleNameString.MaximumLength = (USHORT)(cchName * sizeof(WCHAR));
41 }
42 else
43 {
44 LocaleNameString.Buffer = Buffer;
45 LocaleNameString.Length = 0;
46 LocaleNameString.MaximumLength = sizeof(Buffer);
47 }
48
49 /* Call the RTL function */
50 Status = RtlLcidToLocaleName(Locale, &LocaleNameString, RtlFlags, FALSE);
51 if (!NT_SUCCESS(Status))
52 {
54 return 0;
55 }
56
57 /* Return the length including the terminating null */
58 return (LocaleNameString.Length / sizeof(WCHAR)) + 1;
59}
LONG NTSTATUS
Definition: precomp.h:26
Definition: bufpool.h:45
#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
unsigned long DWORD
Definition: ntddk_ex.h:95
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
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
#define LOCALE_NAME_MAX_LENGTH
unsigned short USHORT
Definition: pedump.c:61
USHORT MaximumLength
Definition: env_spec_w32.h:370
_In_ LPCSTR lpName
Definition: winbase.h:2543
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2521
#define LOCALE_ALLOW_NEUTRAL_NAMES
Definition: winnls.h:25
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by get_language_string(), GetNLSVersion(), GetSystemDefaultLocaleName(), GetUserDefaultLocaleName(), and InitFunctionPointers().