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.

100 lines
3.2 KiB

  1. //
  2. // Globals.h : Global variable declarations.
  3. //
  4. // History:
  5. // 15-NOV-1999 CSLim Created
  6. #if !defined (__GLOBALS_H__INCLUDED_)
  7. #define __GLOBALS_H__INCLUDED_
  8. #include "ciccs.h"
  9. ///////////////////////////////////////////////////////////////////////////////
  10. // Global variables
  11. extern HINSTANCE g_hInst;
  12. extern LONG g_cRefDll;
  13. extern const GUID GUID_ATTR_KORIMX_INPUT;
  14. extern const GUID GUID_IC_PRIVATE;
  15. extern const GUID GUID_COMPARTMENT_KORIMX_CONVMODE;
  16. extern const GUID GUID_COMPARTMENT_KOR_SOFTKBD_OPENCLOSE;
  17. extern const GUID GUID_KOREAN_HANGULSIMULATE;
  18. extern const GUID GUID_KOREAN_HANJASIMULATE;
  19. // SoftKbd
  20. extern const GUID GUID_COMPARTMENT_KOR_SOFTKBD_OPENCLOSE;
  21. extern const GUID GUID_COMPARTMENT_SOFTKBD_KBDLAYOUT;
  22. extern const GUID GUID_COMPARTMENT_SOFTKBD_WNDPOSITION;
  23. extern DWORD g_dwThreadDllMain;
  24. extern CCicCriticalSectionStatic g_cs;
  25. extern CCicCriticalSectionStatic g_csInDllMain;
  26. #ifndef DEBUG
  27. #define CicEnterCriticalSection(lpCriticalSection) EnterCriticalSection(lpCriticalSection)
  28. #else // DEBUG
  29. extern const TCHAR *g_szMutexEnterFile;
  30. extern int g_iMutexEnterLine;
  31. //
  32. // In debug, you can see the file/line number where g_cs was last entered
  33. // by checking g_szMutexEnterFile and g_iMutexEnterLine.
  34. //
  35. #define CicEnterCriticalSection(lpCriticalSection) \
  36. { \
  37. Assert(g_dwThreadDllMain != GetCurrentThreadId()); \
  38. \
  39. EnterCriticalSection(lpCriticalSection); \
  40. \
  41. if (lpCriticalSection == (CRITICAL_SECTION *)g_cs) \
  42. { \
  43. g_szMutexEnterFile = __FILE__; \
  44. g_iMutexEnterLine = __LINE__; \
  45. /* need the InterlockedXXX to keep retail from optimizing away the assignment */ \
  46. InterlockedIncrement((long *)&g_szMutexEnterFile); \
  47. InterlockedDecrement((long *)&g_szMutexEnterFile); \
  48. InterlockedIncrement((long *)&g_iMutexEnterLine); \
  49. InterlockedDecrement((long *)&g_iMutexEnterLine); \
  50. } \
  51. }
  52. #endif // DEBUG
  53. inline void CicLeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
  54. {
  55. Assert(g_dwThreadDllMain != GetCurrentThreadId());
  56. LeaveCriticalSection(lpCriticalSection);
  57. }
  58. ///////////////////////////////////////////////////////////////////////////////
  59. // Window class names
  60. const TCHAR c_szOwnerWndClass[] = TEXT("KorIMX OwnerWndClass");
  61. ///////////////////////////////////////////////////////////////////////////////
  62. // Inline functions
  63. // Shift and Ctrl key check helper functions
  64. inline
  65. BOOL IsShiftKeyPushed(const BYTE lpbKeyState[256])
  66. {
  67. return ((lpbKeyState[VK_SHIFT] & 0x80) != 0);
  68. }
  69. inline
  70. BOOL IsControlKeyPushed(const BYTE lpbKeyState[256])
  71. {
  72. return ((lpbKeyState[VK_CONTROL] & 0x80) != 0);
  73. }
  74. inline
  75. BOOL IsAltKeyPushed(const BYTE lpbKeyState[256])
  76. {
  77. return ((lpbKeyState[VK_MENU] & 0x80) != 0);
  78. }
  79. #endif // __GLOBALS_H__INCLUDED_