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.

80 lines
2.0 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. void DllAddRef();
  14. void DllRelease();
  15. void ToggleCase(TfEditCookie ec, ITfRange *range, BOOL fIgnoreRangeEnd);
  16. void InsertTextAtSelection(TfEditCookie ec, ITfContext *pContext, const WCHAR *pchText, ULONG cchText);
  17. #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
  18. #define CASE_LANGID MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)
  19. #define CASE_DESC L"Case Text Service"
  20. #define CASE_DESC_A "Case Text Service"
  21. #define CASE_MODEL TEXT("Apartment")
  22. #define LANGBAR_ITEM_DESC L"Case Menu" // max 32 chars!
  23. #define CASE_ICON_INDEX 0
  24. #define SafeRelease(punk) \
  25. { \
  26. if ((punk) != NULL) \
  27. { \
  28. (punk)->Release(); \
  29. } \
  30. }
  31. #define SafeReleaseClear(punk) \
  32. { \
  33. if ((punk) != NULL) \
  34. { \
  35. (punk)->Release(); \
  36. (punk) = NULL; \
  37. } \
  38. }
  39. //+---------------------------------------------------------------------------
  40. //
  41. // SafeStringCopy
  42. //
  43. // Copies a string from one buffer to another. wcsncpy does not always
  44. // null-terminate the destination buffer; this function does.
  45. //----------------------------------------------------------------------------
  46. inline void SafeStringCopy(WCHAR *pchDst, ULONG cchMax, const WCHAR *pchSrc)
  47. {
  48. if (cchMax > 0)
  49. {
  50. wcsncpy(pchDst, pchSrc, cchMax);
  51. pchDst[cchMax-1] = '\0';
  52. }
  53. }
  54. extern HINSTANCE g_hInst;
  55. extern LONG g_cRefDll;
  56. extern CRITICAL_SECTION g_cs;
  57. extern const CLSID c_clsidCaseTextService;
  58. extern const GUID c_guidCaseProfile;
  59. extern const GUID c_guidLangBarItemButton;
  60. #endif // GLOBALS_H