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.

166 lines
5.2 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 2000 **/
  4. /**********************************************************************/
  5. /*
  6. global.h
  7. Global defines for the IPSecMon snapin
  8. FILE HISTORY:
  9. */
  10. const TCHAR PA_SERVICE_NAME[] = _T("PolicyAgent");
  11. // Defines for help from the help menu and F1 help for scope pane items
  12. #define IPSMSNAP_HELP_BASE 0xA0000000
  13. #define IPSMSNAP_HELP_SNAPIN IPSMSNAP_HELP_BASE + 1
  14. #define IPSMSNAP_HELP_ROOT IPSMSNAP_HELP_BASE + 2
  15. #define IPSMSNAP_HELP_SERVER IPSMSNAP_HELP_BASE + 3
  16. #define IPSMSNAP_HELP_PROVIDER IPSMSNAP_HELP_BASE + 4
  17. #define IPSMSNAP_HELP_DEVICE IPSMSNAP_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 IPSecMon 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 IPSMSNAP_VERSION 0x00010000
  32. extern DWORD gdwIpsmSnapVersion;
  33. #define IPSMSNAP_FILE_VERSION 0x00000001
  34. // constants for time conversion
  35. #define MILLISEC_PER_SECOND 1000
  36. #define MILLISEC_PER_MINUTE (60 * MILLISEC_PER_SECOND)
  37. #define MILLISEC_PER_HOUR (60 * MILLISEC_PER_MINUTE)
  38. #define IPSECMON_REFRESH_INTERVAL_DEFAULT (45 * MILLISEC_PER_SECOND) // 45 seconds
  39. // macros for memory exception handling
  40. #define CATCH_MEM_EXCEPTION \
  41. TRY
  42. #define END_MEM_EXCEPTION(err) \
  43. CATCH_ALL(e) { \
  44. err = ERROR_NOT_ENOUGH_MEMORY ; \
  45. } END_CATCH_ALL
  46. // some global defines we need
  47. #define STRING_LENGTH_MAX 256
  48. // Note - These are offsets into my image list
  49. typedef enum _ICON_INDICIES
  50. {
  51. ICON_IDX_SERVER,
  52. ICON_IDX_SERVER_BUSY,
  53. ICON_IDX_SERVER_CONNECTED,
  54. ICON_IDX_SERVER_LOST_CONNECTION,
  55. ICON_IDX_MACHINE,
  56. ICON_IDX_FOLDER_OPEN,
  57. ICON_IDX_FOLDER_CLOSED,
  58. ICON_IDX_PRODUCT,
  59. ICON_IDX_FILTER,
  60. ICON_IDX_POLICY,
  61. ICON_IDX_MAX
  62. } ICON_INDICIES, * LPICON_INDICIES;
  63. // Sample folder types
  64. enum NODETYPES
  65. {
  66. // scope pane items
  67. IPSMSNAP_ROOT,
  68. IPSMSNAP_SERVER,
  69. IPSECMON_QM_SA,
  70. IPSECMON_FILTER,
  71. IPSECMON_SPECIFIC_FILTER,
  72. IPSECMON_QUICK_MODE,
  73. IPSECMON_MAIN_MODE,
  74. IPSECMON_MM_POLICY,
  75. IPSECMON_QM_POLICY,
  76. IPSECMON_MM_FILTER,
  77. IPSECMON_MM_SP_FILTER,
  78. IPSECMON_MM_SA,
  79. // result pane items
  80. IPSECMON_QM_SA_ITEM,
  81. IPSECMON_FILTER_ITEM,
  82. IPSECMON_SPECIFIC_FILTER_ITEM,
  83. IPSECMON_MM_POLICY_ITEM,
  84. IPSECMON_QM_POLICY_ITEM,
  85. IPSECMON_MM_FILTER_ITEM,
  86. IPSECMON_MM_SP_FILTER_ITEM,
  87. IPSECMON_MM_SA_ITEM,
  88. IPSECMON_NODETYPE_MAX,
  89. };
  90. // GUIDs are defined in guids.cpp
  91. extern const CLSID CLSID_IpsmSnapin; // In-Proc server GUID
  92. extern const CLSID CLSID_IpsmSnapinExtension; // In-Proc server GUID
  93. extern const CLSID CLSID_IpsmSnapinAbout; // In-Proc server GUID
  94. extern const GUID GUID_IpsmRootNodeType; // Root NodeType GUID
  95. extern const GUID GUID_IpsmServerNodeType; // Server NodeType GUID
  96. extern const GUID GUID_IpsmFilterNodeType; // Filters NodeType GUID
  97. extern const GUID GUID_IpsmSpecificFilterNodeType; // Specific Filters NodeType GUID
  98. extern const GUID GUID_QmNodeType; // Quick Mode NodeType GUID
  99. extern const GUID GUID_MmNodeType; // Main Mode NodeType GUID
  100. extern const GUID GUID_IpsmMmPolicyNodeType; // Main Mode Policy GUID
  101. extern const GUID GUID_IpsmQmPolicyNodeType; // Quick Mode Policy GUID
  102. extern const GUID GUID_IpsmMmFilterNodeType; // Main Mode Filter GUID
  103. extern const GUID GUID_IpsmMmSANodeType; // Main Mode SA GUID
  104. extern const GUID GUID_IpsmMmSpFilterNodeType; // Main Mode Specific Filter GUID
  105. extern const GUID IID_ISpdInfo;
  106. extern const GUID GUID_IpsmQmSANodeType;
  107. const int MAX_COLUMNS = 14;
  108. const int NUM_SCOPE_ITEMS = 3;
  109. const int NUM_CONSOLE_VERBS = 8;
  110. // arrays used to hold all of the result pane column information
  111. extern UINT aColumns[IPSECMON_NODETYPE_MAX][MAX_COLUMNS];
  112. extern int aColumnWidths[IPSECMON_NODETYPE_MAX][MAX_COLUMNS];
  113. // arrays for console verbs
  114. extern MMC_CONSOLE_VERB g_ConsoleVerbs[NUM_CONSOLE_VERBS];
  115. extern MMC_BUTTON_STATE g_ConsoleVerbStates[IPSECMON_NODETYPE_MAX][NUM_CONSOLE_VERBS];
  116. extern MMC_BUTTON_STATE g_ConsoleVerbStatesMultiSel[IPSECMON_NODETYPE_MAX][NUM_CONSOLE_VERBS];
  117. // array for help
  118. extern DWORD g_dwMMCHelp[IPSECMON_NODETYPE_MAX];
  119. // Clipboard format that has the Type and Cookie
  120. extern const wchar_t* SNAPIN_INTERNAL;
  121. // CIpsmSnapinApp definition
  122. class CIpsmSnapinApp : public CWinApp
  123. {
  124. public:
  125. virtual BOOL InitInstance();
  126. virtual int ExitInstance();
  127. DECLARE_MESSAGE_MAP()
  128. public:
  129. BOOL m_bWinsockInited;
  130. };
  131. extern CIpsmSnapinApp theApp;
  132. #define IPSECMON_UPDATE_STATUS ( 0x10000000 )