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.5 KiB

  1. /*++
  2. Copyright (c) 2001, Microsoft Corporation
  3. Module Name:
  4. globals.cpp
  5. Abstract:
  6. This file implements the global data.
  7. Author:
  8. Revision History:
  9. Notes:
  10. --*/
  11. #include "private.h"
  12. #include "globals.h"
  13. #include "tls.h"
  14. #include "ime.h"
  15. HINSTANCE g_hInst;
  16. const WCHAR s_szUIClassName[16] = L"MSCTFIME UI";
  17. const WCHAR s_szCompClassName[] = L"MSCTFIME Composition";
  18. DWORD TLS::dwTLSIndex = TLS_OUT_OF_INDEXES;
  19. /* a94c5fd2-c471-4031-9546-709c17300cb9 */
  20. extern const GUID GUID_COMPARTMENT_CTFIME_DIMFLAGS = {
  21. 0xa94c5fd2,
  22. 0xc471,
  23. 0x4031,
  24. {0x95, 0x46, 0x70, 0x9c, 0x17, 0x30, 0x0c, 0xb9}
  25. };
  26. // {85A688F7-6DC8-4f17-A83A-B11C09CDD7BF}
  27. extern const GUID GUID_COMPARTMENT_CTFIME_CICINPUTCONTEXT = {
  28. 0x85a688f7,
  29. 0x6dc8,
  30. 0x4f17,
  31. { 0xa8, 0x3a, 0xb1, 0x1c, 0x9, 0xcd, 0xd7, 0xbf }
  32. };
  33. CCicCriticalSectionStatic g_cs;
  34. DECLARE_OSVER()
  35. /////////////////////////////////////////////////////////////////////////////
  36. // WM_MSIME_xxxx
  37. UINT WM_MSIME_SERVICE;
  38. UINT WM_MSIME_UIREADY;
  39. UINT WM_MSIME_RECONVERTREQUEST;
  40. UINT WM_MSIME_RECONVERT;
  41. UINT WM_MSIME_DOCUMENTFEED;
  42. UINT WM_MSIME_QUERYPOSITION;
  43. UINT WM_MSIME_MODEBIAS;
  44. UINT WM_MSIME_SHOWIMEPAD;
  45. UINT WM_MSIME_MOUSE;
  46. UINT WM_MSIME_KEYMAP;
  47. /* friend */
  48. BOOL IsMsImeMessage(UINT uMsg)
  49. {
  50. if (uMsg == WM_MSIME_SERVICE ||
  51. uMsg == WM_MSIME_UIREADY ||
  52. uMsg == WM_MSIME_RECONVERTREQUEST ||
  53. uMsg == WM_MSIME_RECONVERT ||
  54. uMsg == WM_MSIME_DOCUMENTFEED ||
  55. uMsg == WM_MSIME_QUERYPOSITION ||
  56. uMsg == WM_MSIME_MODEBIAS ||
  57. uMsg == WM_MSIME_SHOWIMEPAD ||
  58. uMsg == WM_MSIME_MOUSE ||
  59. uMsg == WM_MSIME_KEYMAP)
  60. return TRUE;
  61. else
  62. return FALSE;
  63. }
  64. /////////////////////////////////////////////////////////////////////////////
  65. DWORD g_dwThreadDllMain = 0;
  66. /////////////////////////////////////////////////////////////////////////////
  67. DWORD g_bWinLogon = FALSE;
  68. /////////////////////////////////////////////////////////////////////////////
  69. HIMC GetActiveContext()
  70. {
  71. HWND hWnd = GetFocus();
  72. if (hWnd == NULL)
  73. hWnd = GetActiveWindow();
  74. return ImmGetContext(hWnd);
  75. }
  76. BOOL IsVKDBEKey(UINT uVKey)
  77. {
  78. switch (uVKey)
  79. {
  80. case VK_DBE_ALPHANUMERIC:
  81. case VK_DBE_KATAKANA:
  82. case VK_DBE_HIRAGANA:
  83. case VK_DBE_SBCSCHAR:
  84. case VK_DBE_DBCSCHAR:
  85. case VK_DBE_ROMAN:
  86. case VK_DBE_NOROMAN:
  87. case VK_DBE_CODEINPUT:
  88. case VK_DBE_NOCODEINPUT:
  89. case VK_DBE_ENTERWORDREGISTERMODE:
  90. case VK_DBE_ENTERIMECONFIGMODE:
  91. case VK_DBE_ENTERDLGCONVERSIONMODE:
  92. case VK_DBE_DETERMINESTRING:
  93. case VK_DBE_FLUSHSTRING:
  94. case VK_CONVERT:
  95. case VK_KANJI:
  96. return TRUE;
  97. }
  98. return FALSE;
  99. }
  100. /////////////////////////////////////////////////////////////////////////////
  101. typedef BYTE (*PFNRTLDLLSHUTDOWNINPROGRESS)(void);
  102. BOOL DllShutDownInProgress()
  103. {
  104. BOOL fRet = FALSE;
  105. static PFNRTLDLLSHUTDOWNINPROGRESS pfn = NULL;
  106. if (!pfn)
  107. {
  108. HINSTANCE hInst;
  109. hInst = GetSystemModuleHandle("ntdll.dll");
  110. if (hInst)
  111. {
  112. pfn = (PFNRTLDLLSHUTDOWNINPROGRESS)GetProcAddress(hInst,
  113. "RtlDllShutdownInProgress");
  114. }
  115. }
  116. if (pfn)
  117. fRet = pfn() ? TRUE : FALSE;
  118. return fRet;
  119. }