Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1997-1999, Microsoft Corporation All rights reserved.
  3. Module Name :
  4. lpk_nls.c
  5. Abstract:
  6. This module picks up any changes to the NLS data which happen to the
  7. registry. A thread is dispatched from the LPK and waits for an event
  8. of a registry-change notification. This is a HELL-OF overhead, since it
  9. envolves a thread overhead/process as long as the LPK is attached
  10. to each process.
  11. Current NLS information being set :
  12. - Numeric Style (Native + Substitution). Currently for Beta-1 timeframe,
  13. we'll just set the registry entry at setup time, and if user wants to change it,
  14. he should go CURRENT_USER\Control Panel\International and change the value of
  15. sNativeDigits and iDigitSubstitution.
  16. Author:
  17. Samer Arafeh (SamerA) 27-Feb-1997 @ 5:04 pm
  18. Revision History:
  19. [samera] Apr 3rd, 1997, Dispatch NLS thread to wait on Control Panel\Internationl Reg Notification Change
  20. [DBrown] Dec 4th, 1997, Update for NT5 LPK and Uniscribe
  21. --*/
  22. #include "precomp.hxx"
  23. /************************************************************
  24. BOOL ReadNLSScriptSettings
  25. Reads script related registry settings from
  26. HKEY_CURRENT_USER\Control Panel\International
  27. History :
  28. Samera Created Feb 18, 1997
  29. ************************************************************/
  30. ///// ReadNLSScriptSettings
  31. BOOL ReadNLSScriptSettings(
  32. void) {
  33. #define MAXWCBUF 80
  34. WCHAR wcBuf[MAXWCBUF]; // Registry read buffer
  35. int cBuf;
  36. SCRIPT_ITEM item[2];
  37. int cItems;
  38. HRESULT hr;
  39. // User locale information
  40. g_UserLocale = GetUserDefaultLCID();
  41. g_UserPrimaryLanguage = PRIMARYLANGID(LANGIDFROMLCID(g_UserLocale));
  42. cBuf = GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_FONTSIGNATURE, wcBuf, MAXWCBUF);
  43. g_UserBidiLocale = (cBuf && wcBuf[7] & 0x0800) ? TRUE : FALSE;
  44. // Establish users digit substitution settings
  45. hr = ScriptRecordDigitSubstitution(LOCALE_USER_DEFAULT, &g_DigitSubstitute);
  46. if (FAILED(hr)) {
  47. return FALSE;
  48. }
  49. return TRUE ;
  50. }
  51. /************************************************************
  52. BOOL InitNLS()
  53. Initializes all NLS related info in LPK Globals and fetches
  54. out the registry Control Panel\International for Numeric settings.
  55. History :
  56. Dbrown Created
  57. Samera Feb 18, 1997 Read NLS at init
  58. ************************************************************/
  59. ///// InitNLS
  60. BOOL InitNLS() {
  61. // Initialize Thread-NLS-Pickup
  62. g_hCPIntlInfoRegKey = NULL;
  63. g_hNLSWaitThread = NULL;
  64. // Always update our NLS cache at initialization.
  65. g_ulNlsUpdateCacheCount = -1;
  66. return TRUE;
  67. }