Commit in reactos/ntoskrnl/ps on MAIN
locale.c+36-21.7 -> 1.8
- Fixed querying of thread locale.

reactos/ntoskrnl/ps
locale.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- locale.c	12 Feb 2004 15:55:57 -0000	1.7
+++ locale.c	10 Mar 2004 20:26:40 -0000	1.8
@@ -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 @@
 	  }
 	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 @@
 	  }
 	NtClose(KeyHandle);
      }
+
+   PsDefaultThreadLocaleInitialized = TRUE;
 }
 
 
@@ -158,6 +187,10 @@
 
    if (ThreadOrSystem == TRUE)
      {
+        if (PsDefaultThreadLocaleInitialized == FALSE)
+          {
+             PiInitThreadLocale();
+          }
 	/* set thread locale */
 	*DefaultLocaleId = PsDefaultThreadLocaleId;
      }
@@ -259,6 +292,7 @@
 	/* set thread locale */
 	DPRINT("Thread locale: %08lu\n", DefaultLocaleId);
 	PsDefaultThreadLocaleId = DefaultLocaleId;
+	PsDefaultThreadLocaleInitialized = TRUE;
      }
    else
      {
CVSspam 0.2.8