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.

157 lines
3.1 KiB

  1. /*++
  2. Copyright (c) 2001, Microsoft Corporation
  3. Module Name:
  4. oldaimm.cpp
  5. Abstract:
  6. This file implements the old AIMM Class.
  7. Author:
  8. Revision History:
  9. Notes:
  10. --*/
  11. #include "private.h"
  12. #include "oldaimm.h"
  13. #include "delay.h"
  14. #include "cregkey.h"
  15. #include "globals.h"
  16. #ifdef OLD_AIMM_ENABLED
  17. #include "imtls.h"
  18. DWORD g_dwTLSIndex = -1;
  19. BOOL g_fInLegacyClsid = FALSE;
  20. BOOL g_fTrident55 = FALSE;
  21. BOOL g_fAIMM12Trident = FALSE;
  22. typedef enum
  23. {
  24. CUAS_UNKNOWN = -1,
  25. CUAS_OFF = 0,
  26. CUAS_ON = 1
  27. } CUAS_SWITCH;
  28. CUAS_SWITCH g_fCUAS = CUAS_UNKNOWN;
  29. //+---------------------------------------------------------------------------
  30. //
  31. // IsCTFIMEEnabled
  32. //
  33. //----------------------------------------------------------------------------
  34. BOOL IsCTFIMEEnabled()
  35. {
  36. return imm32prev::CtfImmIsCiceroEnabled();
  37. }
  38. //+---------------------------------------------------------------------------
  39. //
  40. // IsOldAImm
  41. //
  42. //----------------------------------------------------------------------------
  43. BOOL IsOldAImm()
  44. {
  45. if (! GetSystemMetrics( SM_IMMENABLED ))
  46. return TRUE;
  47. if (! IsCTFIMEEnabled())
  48. return TRUE;
  49. return FALSE;
  50. }
  51. //+---------------------------------------------------------------------------
  52. //
  53. // IsCUAS_ON
  54. //
  55. //----------------------------------------------------------------------------
  56. BOOL IsCUAS_ON()
  57. {
  58. //
  59. // REGKEY
  60. //
  61. const TCHAR c_szCTFSharedKey[] = TEXT("SOFTWARE\\Microsoft\\CTF\\SystemShared");
  62. // REG_DWORD : 0 // No
  63. // 1 // Yes
  64. const TCHAR c_szCUAS[] = TEXT("CUAS");
  65. if (g_fCUAS == CUAS_UNKNOWN)
  66. {
  67. CMyRegKey CtfReg;
  68. LONG lRet;
  69. lRet = CtfReg.Open(HKEY_LOCAL_MACHINE, c_szCTFSharedKey, KEY_READ);
  70. if (lRet == ERROR_SUCCESS) {
  71. DWORD dw;
  72. lRet = CtfReg.QueryValue(dw, c_szCUAS);
  73. if (lRet == ERROR_SUCCESS) {
  74. g_fCUAS = (dw == 0 ? CUAS_OFF : CUAS_ON);
  75. }
  76. }
  77. }
  78. return g_fCUAS == CUAS_ON ? TRUE : FALSE;
  79. }
  80. //+---------------------------------------------------------------------------
  81. //
  82. // OldAImm_DllProcessAttach
  83. //
  84. //----------------------------------------------------------------------------
  85. BOOL OldAImm_DllProcessAttach(HINSTANCE hInstance)
  86. {
  87. g_hInst = hInstance;
  88. g_dwTLSIndex = TlsAlloc();
  89. if (!DIMM12_DllProcessAttach())
  90. return FALSE;
  91. if (!WIN32LR_DllProcessAttach())
  92. return FALSE;
  93. return TRUE;
  94. }
  95. BOOL OldAImm_DllThreadAttach()
  96. {
  97. WIN32LR_DllThreadAttach();
  98. return TRUE;
  99. }
  100. VOID OldAImm_DllThreadDetach()
  101. {
  102. WIN32LR_DllThreadDetach();
  103. IMTLS_Free();
  104. }
  105. VOID OldAImm_DllProcessDetach()
  106. {
  107. WIN32LR_DllProcessDetach();
  108. IMTLS_Free();
  109. TlsFree(g_dwTLSIndex);
  110. }
  111. #else // OLD_AIMM_ENABLED
  112. BOOL IsOldAImm() { return FALSE; }
  113. BOOL OldAImm_DllProcessAttach(HINSTANCE hInstance) { return FALSE; }
  114. BOOL OldAImm_DllThreadAttach() { return FALSE; }
  115. VOID OldAImm_DllThreadDetach() { }
  116. VOID OldAImm_DllProcessDetach() { }
  117. #endif // OLD_AIMM_ENABLED