Source code of Windows XP (NT5)
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.

141 lines
4.5 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. global.h
  7. Global defines for the Tapi snapin
  8. FILE HISTORY:
  9. */
  10. #define TAPI_SERVICE_NAME _T("tapisrv")
  11. // Defines for help from the help menu and F1 help for scope pane items
  12. #define TAPISNAP_HELP_BASE 0xA0000000
  13. #define TAPISNAP_HELP_SNAPIN TAPISNAP_HELP_BASE + 1
  14. #define TAPISNAP_HELP_ROOT TAPISNAP_HELP_BASE + 2
  15. #define TAPISNAP_HELP_SERVER TAPISNAP_HELP_BASE + 3
  16. #define TAPISNAP_HELP_PROVIDER TAPISNAP_HELP_BASE + 4
  17. #define TAPISNAP_HELP_DEVICE TAPISNAP_HELP_BASE + 5
  18. // wait cursor stuff around functions. If you need a wait cursor for
  19. // and entire fucntion, just use CWaitCursor. To wrap a wait cursor
  20. // around an rpc call, use these macros.
  21. #define BEGIN_WAIT_CURSOR { CWaitCursor waitCursor;
  22. #define RESTORE_WAIT_CURSOR waitCursor.Restore();
  23. #define END_WAIT_CURSOR }
  24. #define ARRAYLEN(x) (sizeof(x) / sizeof((x)[0]))
  25. // macro to get the handler for a node. This is a Tapi snapin specific
  26. // implementation
  27. #define GETHANDLER(classname, node) (reinterpret_cast<classname *>(node->GetData(TFS_DATA_USER)))
  28. // HRESULT Mapping
  29. #define WIN32_FROM_HRESULT(hr) (0x0000FFFF & (hr))
  30. // Version Suff
  31. #define TAPISNAP_VERSION 0x00010000
  32. #define TAPISNAP_MAJOR_VERSION HIWORD(TAPISNAP_VERSION)
  33. #define TAPISNAP_MINOR_VERSION LOWORD(TAPISNAP_VERSION)
  34. extern DWORD gdwTapiSnapVersion;
  35. #define TAPISNAP_FILE_VERSION_1 0x00000001
  36. #define TAPISNAP_FILE_VERSION 0x00000002
  37. // constants for time conversion
  38. #define MILLISEC_PER_SECOND 1000
  39. #define MILLISEC_PER_MINUTE (60 * MILLISEC_PER_SECOND)
  40. #define MILLISEC_PER_HOUR (60 * MILLISEC_PER_MINUTE)
  41. #define TAPISNAP_REFRESH_INTERVAL_DEFAULT (10 * MILLISEC_PER_MINUTE) // 10 minutes in milliseconds
  42. // macros for memory exception handling
  43. #define CATCH_MEM_EXCEPTION \
  44. TRY
  45. #define END_MEM_EXCEPTION(err) \
  46. CATCH_ALL(e) { \
  47. err = ERROR_NOT_ENOUGH_MEMORY ; \
  48. } END_CATCH_ALL
  49. // some global defines we need
  50. #define STRING_LENGTH_MAX 256
  51. // Note - These are offsets into my image list
  52. typedef enum _ICON_INDICIES
  53. {
  54. ICON_IDX_SERVER,
  55. ICON_IDX_SERVER_BUSY,
  56. ICON_IDX_SERVER_CONNECTED,
  57. ICON_IDX_SERVER_LOST_CONNECTION,
  58. ICON_IDX_MACHINE,
  59. ICON_IDX_FOLDER_OPEN,
  60. ICON_IDX_FOLDER_CLOSED,
  61. ICON_IDX_PRODUCT,
  62. ICON_IDX_MAX
  63. } ICON_INDICIES, * LPICON_INDICIES;
  64. // Sample folder types
  65. enum NODETYPES
  66. {
  67. // scope pane items
  68. TAPISNAP_ROOT,
  69. TAPISNAP_SERVER,
  70. TAPISNAP_PROVIDER,
  71. // result pane items
  72. TAPISNAP_DEVICE,
  73. TAPISNAP_NODETYPE_MAX,
  74. };
  75. // GUIDs are defined in guids.cpp
  76. extern const CLSID CLSID_TapiSnapin; // In-Proc server GUID
  77. extern const CLSID CLSID_TapiSnapinExtension; // In-Proc server GUID
  78. extern const CLSID CLSID_TapiSnapinAbout; // In-Proc server GUID
  79. extern const GUID GUID_TapiRootNodeType; // Root NodeType GUID
  80. extern const GUID GUID_TapiServerNodeType; // Server NodeType GUID
  81. extern const GUID GUID_TapiProviderNodeType; // Lines NodeType GUID
  82. extern const GUID GUID_TapiLineNodeType; // Line (result pane) NodeType GUID
  83. extern const GUID GUID_TapiUserNodeType; // User (result pane) NodeType GUID
  84. extern const GUID GUID_TapiPhoneNumNodeType; // User (result pane) NodeType GUID
  85. extern const GUID IID_ITapiInfo;
  86. const int MAX_COLUMNS = 5;
  87. const int NUM_SCOPE_ITEMS = 3;
  88. const int NUM_CONSOLE_VERBS = 8;
  89. // arrays used to hold all of the result pane column information
  90. extern UINT aColumns[TAPISNAP_NODETYPE_MAX][MAX_COLUMNS];
  91. extern int aColumnWidths[TAPISNAP_NODETYPE_MAX][MAX_COLUMNS];
  92. // arrays for console verbs
  93. extern MMC_CONSOLE_VERB g_ConsoleVerbs[NUM_CONSOLE_VERBS];
  94. extern MMC_BUTTON_STATE g_ConsoleVerbStates[TAPISNAP_NODETYPE_MAX][NUM_CONSOLE_VERBS];
  95. extern MMC_BUTTON_STATE g_ConsoleVerbStatesMultiSel[TAPISNAP_NODETYPE_MAX][NUM_CONSOLE_VERBS];
  96. // array for help
  97. extern DWORD g_dwMMCHelp[TAPISNAP_NODETYPE_MAX];
  98. // Clipboard format that has the Type and Cookie
  99. extern const wchar_t* SNAPIN_INTERNAL;
  100. // CTapiSnapinApp definition
  101. class CTapiSnapinApp : public CWinApp
  102. {
  103. public:
  104. virtual BOOL InitInstance();
  105. virtual int ExitInstance();
  106. DECLARE_MESSAGE_MAP()
  107. public:
  108. BOOL m_bWinsockInited;
  109. };
  110. extern CTapiSnapinApp theApp;