29#define BOGUS_LOCALE_ID 0xFFFF0000
54 if (LocaleData->Type !=
REG_SZ)
60 if (LocaleData->DataLength <
sizeof(
WCHAR))
110 WCHAR ValueBuffer[20], LocaleIdBuffer[20];
145 Status = ZwOpenKey(&NlsLocaleKey,
150 DPRINT1(
"Failed to open %wZ (Status 0x%lx)\n", NlsLocaleKeyPath,
Status);
155 Status = ZwOpenKey(&AltSortKey,
160 DPRINT1(
"Failed to open %wZ (Status 0x%lx)\n", AltSortKeyPath,
Status);
165 Status = ZwOpenKey(&LangGroupKey,
170 DPRINT1(
"Failed to open %wZ (Status 0x%lx)\n", LangGroupPath,
Status);
176 Status = ZwQueryValueKey(NlsLocaleKey,
185 Status = ZwQueryValueKey(AltSortKey,
193 DPRINT1(
"Failed to query value from Alternate Sorts key (Status 0x%lx)\n",
Status);
202 DPRINT1(
"The queried locale is of bad value type or length (Type %lu, DataLength %lu)\n",
210 Status = ZwQueryValueKey(LangGroupKey,
218 DPRINT1(
"Failed to query value from Language Groups key (Status 0x%lx)\n",
Status);
229 DPRINT1(
"The locale data is not valid!\n");
234 if (LangGroupKey !=
NULL)
239 if (AltSortKey !=
NULL)
244 if (NlsLocaleKey !=
NULL)
257 UCHAR ValueBuffer[256];
333 WCHAR ValueBuffer[8];
446 WCHAR ValueBuffer[20];
449 UCHAR KeyValueBuffer[256];
474 L"\\Registry\\Machine\\System\\CurrentControlSet"
475 L"\\Control\\Nls\\Language");
487 if (!DefaultLocaleId)
502 sizeof(KeyValueBuffer),
514 DefaultLocaleId = *((
ULONG*)KeyValueInformation->
Data);
548 (
ULONG)DefaultLocaleId);
555 (
ULONG)DefaultLocaleId & 0xFFFF);
593 MmSetSessionLocaleId(DefaultLocaleId);
667 *LanguageId = SafeLanguageId;
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
static const WCHAR Cleanup[]
LONG NTAPI ExSystemExceptionFilter(VOID)
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
#define InitializeObjectAttributes(p, n, a, r, s)
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
#define KeGetPreviousMode()
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI NTSTATUS NTAPI RtlOpenCurrentUser(_In_ ACCESS_MASK DesiredAccess, _Out_ PHANDLE KeyHandle)
@ KeyValuePartialInformation
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
struct _KEY_VALUE_PARTIAL_INFORMATION * PKEY_VALUE_PARTIAL_INFORMATION
#define MAKELCID(lgid, srtid)
static NTSTATUS ExpValidateNlsLocaleId(_In_ LCID LocaleId)
Validates a NLS locale. Whether a locale is valid or not depends on the following conditions:
static __inline BOOLEAN ExpValidateNlsLocaleData(_In_ PKEY_VALUE_PARTIAL_INFORMATION LocaleData)
Validates the registry data of a NLS locale.
NTSTATUS NTAPI NtQueryInstallUILanguage(OUT LANGID *LanguageId)
LANGID PsDefaultUILanguageId
LANGID PsInstallUILanguageId
NTSTATUS NTAPI NtQueryDefaultLocale(IN BOOLEAN UserProfile, OUT PLCID DefaultLocaleId)
LCID PsDefaultSystemLocaleId
NTSTATUS NTAPI ExpSetCurrentUserUILanguage(IN PCWSTR MuiName, IN LANGID LanguageId)
NTSTATUS NTAPI NtSetDefaultUILanguage(IN LANGID LanguageId)
NTSTATUS NTAPI NtQueryDefaultUILanguage(OUT LANGID *LanguageId)
LCID PsDefaultThreadLocaleId
NTSTATUS NTAPI ExpGetCurrentUserUILanguage(IN PCWSTR MuiName, OUT LANGID *LanguageId)
NTSTATUS NTAPI NtSetDefaultLocale(IN BOOLEAN UserProfile, IN LCID DefaultLocaleId)
ULONG NTAPI MmGetSessionLocaleId(VOID)
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_YIELD(__stmt)
#define LANGIDFROMLCID(l)
#define ProbeForWriteLangId(Ptr)
Data(int index, int value)
#define RTL_CONSTANT_STRING(s)
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_OBJECT_NAME_NOT_FOUND
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_ PCUNICODE_STRING _In_ PCUNICODE_STRING _In_ LCID LocaleId
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value