From e080b835d034a642ae17318a73753d32c817e9e8 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Wed, 10 Mar 2004 20:26:40 +0000 Subject: [PATCH] - Fixed querying of thread locale. svn path=/trunk/; revision=8628 --- reactos/ntoskrnl/ps/locale.c | 38 ++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/ps/locale.c b/reactos/ntoskrnl/ps/locale.c index 85d291bc3d8..2e356d0db66 100644 --- a/reactos/ntoskrnl/ps/locale.c +++ b/reactos/ntoskrnl/ps/locale.c @@ -1,4 +1,4 @@ -/* $Id: locale.c,v 1.7 2004/02/12 15:55:57 navaraf Exp $ +/* $Id: locale.c,v 1.8 2004/03/10 20:26:40 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -26,7 +26,7 @@ */ LCID PsDefaultThreadLocaleId = 0; LCID PsDefaultSystemLocaleId = 0; - +BOOL PsDefaultThreadLocaleInitialized = FALSE; #define VALUE_BUFFER_SIZE 256 @@ -96,6 +96,33 @@ PiInitDefaultLocale(VOID) } NtClose(KeyHandle); } +} + + +VOID STDCALL +PiInitThreadLocale(VOID) +/* + * FUNCTION: + * Initializes the default thread locale. + * Reads default locale from registry, if available + * ARGUMENTS: + * None. + * Returns: + * None. + */ +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING KeyName; + UNICODE_STRING ValueName; + HANDLE KeyHandle; + ULONG ValueLength; + UCHAR ValueBuffer[VALUE_BUFFER_SIZE]; + PKEY_VALUE_PARTIAL_INFORMATION ValueInfo; + UNICODE_STRING ValueString; + ULONG LocaleValue; + NTSTATUS Status; + + ValueInfo = (PKEY_VALUE_PARTIAL_INFORMATION)ValueBuffer; /* read default thread locale */ RtlRosInitUnicodeStringFromLiteral(&KeyName, @@ -136,6 +163,8 @@ PiInitDefaultLocale(VOID) } NtClose(KeyHandle); } + + PsDefaultThreadLocaleInitialized = TRUE; } @@ -158,6 +187,10 @@ NtQueryDefaultLocale(IN BOOLEAN ThreadOrSystem, if (ThreadOrSystem == TRUE) { + if (PsDefaultThreadLocaleInitialized == FALSE) + { + PiInitThreadLocale(); + } /* set thread locale */ *DefaultLocaleId = PsDefaultThreadLocaleId; } @@ -259,6 +292,7 @@ NtSetDefaultLocale(IN BOOLEAN ThreadOrSystem, /* set thread locale */ DPRINT("Thread locale: %08lu\n", DefaultLocaleId); PsDefaultThreadLocaleId = DefaultLocaleId; + PsDefaultThreadLocaleInitialized = TRUE; } else {