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.

90 lines
2.5 KiB

  1. //
  2. // globals.h
  3. //
  4. // Global variable declarations.
  5. //
  6. #ifndef GLOBALS_H
  7. #define GLOBALS_H
  8. #include <windows.h>
  9. #include <ole2.h>
  10. #include <olectl.h>
  11. #include <assert.h>
  12. #include "msctf.h"
  13. LONG DllAddRef();
  14. LONG DllRelease();
  15. BOOL AdviseSink(IUnknown *pSource, IUnknown *pSink, REFIID riid, DWORD *pdwCookie);
  16. void UnadviseSink(IUnknown *pSource, DWORD *pdwCookie);
  17. BOOL AdviseSingleSink(TfClientId tfClientId, IUnknown *pSource, IUnknown *pSink, REFIID riid);
  18. void UnadviseSingleSink(TfClientId tfClientId, IUnknown *pSource, REFIID riid);
  19. BOOL IsRangeCovered(TfEditCookie ec, ITfRange *pRangeTest, ITfRange *pRangeCover);
  20. BOOL IsEqualUnknown(IUnknown *interface1, IUnknown *interface2);
  21. #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
  22. #define MARK_LANGID MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)
  23. #define MARK_DESC L"Mark Text Service"
  24. #define MARK_DESC_A "Mark Text Service"
  25. #define MARK_MODEL TEXT("Apartment")
  26. #define LANGBAR_ITEM_DESC L"Mark Menu" // max 32 chars!
  27. #define MARK_ICON_INDEX 0
  28. #define SafeRelease(punk) \
  29. { \
  30. if ((punk) != NULL) \
  31. { \
  32. (punk)->Release(); \
  33. } \
  34. }
  35. #define SafeReleaseClear(punk) \
  36. { \
  37. if ((punk) != NULL) \
  38. { \
  39. (punk)->Release(); \
  40. (punk) = NULL; \
  41. } \
  42. }
  43. //+---------------------------------------------------------------------------
  44. //
  45. // SafeStringCopy
  46. //
  47. // Copies a string from one buffer to another. wcsncpy does not always
  48. // null-terminate the destination buffer; this function does.
  49. //----------------------------------------------------------------------------
  50. inline void SafeStringCopy(WCHAR *pchDst, ULONG cchMax, const WCHAR *pchSrc)
  51. {
  52. if (cchMax > 0)
  53. {
  54. wcsncpy(pchDst, pchSrc, cchMax);
  55. pchDst[cchMax-1] = '\0';
  56. }
  57. }
  58. extern HINSTANCE g_hInst;
  59. extern LONG g_cRefDll;
  60. extern CRITICAL_SECTION g_cs;
  61. extern const CLSID c_clsidMarkTextService;
  62. extern const GUID c_guidMarkProfile;
  63. extern const GUID c_guidLangBarItemButton;
  64. extern const GUID c_guidMarkDisplayAttribute;
  65. extern const GUID c_guidMarkContextCompartment;
  66. extern const GUID c_guidMarkGlobalCompartment;
  67. extern const GUID c_guidCaseProperty;
  68. extern const GUID c_guidCustomProperty;
  69. #endif // GLOBALS_H