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.

99 lines
2.1 KiB

  1. //+--------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // Author: AdamEd
  7. // Date: October 1998
  8. //
  9. // Implementation of language support
  10. // in the Class Store interface module
  11. //
  12. //
  13. //---------------------------------------------------------------------
  14. #include "cstore.hxx"
  15. LANGID gSystemLangId;
  16. //+--------------------------------------------------------------------
  17. //
  18. // InitializeLanguageSupport
  19. //
  20. // Routine Description:
  21. //
  22. // Called at dll init to initialize globals necessary for
  23. // language support
  24. //
  25. // Arguments:
  26. //
  27. // None.
  28. //
  29. // Return Value:
  30. //
  31. // none
  32. //---------------------------------------------------------------------
  33. void InitializeLanguageSupport()
  34. {
  35. gSystemLangId = GetSystemDefaultLangID();
  36. }
  37. DWORD GetLanguagePriority(LANGID PackageLangId, DWORD dwActFlags)
  38. {
  39. //
  40. // If the activation flags indicate that we should always
  41. // match regardless of language, this package gets the highest
  42. // precedence
  43. //
  44. if (dwActFlags & ACTFLG_IgnoreLanguage) {
  45. return PRI_LANG_ALWAYSMATCH;
  46. }
  47. //
  48. // The ignore language flag was not specified by the admin,
  49. // so now we must examine the language id of the package to
  50. // determine its desirability.
  51. //
  52. //
  53. // First, match against the system locale's language --
  54. // exact matches get highest priority
  55. //
  56. if (gSystemLangId == PackageLangId)
  57. {
  58. return PRI_LANG_SYSTEMLOCALE;
  59. }
  60. //
  61. // Try English -- English should function on all systems
  62. //
  63. if (LANG_ENGLISH == PRIMARYLANGID(PackageLangId))
  64. {
  65. return PRI_LANG_ENGLISH;
  66. }
  67. //
  68. // If we couldn't get better matches, accept language neutral
  69. // packages as a last resort
  70. //
  71. if (LANG_NEUTRAL == PackageLangId) {
  72. return PRI_LANG_NEUTRAL;
  73. }
  74. //
  75. // We couldn't find a match -- return the smallest priority
  76. //
  77. return 0;
  78. }
  79.