WINDSGBL.H
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:11k
源码类别:

Windows编程

开发平台:

Visual C++

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  File Name 
  4. //      WINDSGBL.H
  5. //
  6. //  Description
  7. //      Global declarations for providers communicating with the WINDS Sample
  8. //      Server Messaging Host.
  9. //
  10. //  Author
  11. //      Irving De la Cruz
  12. //
  13. //  Revision: 1.7
  14. //
  15. // Written for Microsoft Windows Developer Support
  16. // Copyright (c) 1995-1996 Microsoft Corporation. All rights reserved.
  17. //
  18. #ifndef _WINDSGBL_H
  19. #define _WINDSGBL_H
  20. ///////////////////////////////////////////////////////////////////////////////
  21. // General constants
  22. #ifdef UNICODE
  23. #define WINDS_RPC_STRING        unsigned short *
  24. #else
  25. #define WINDS_RPC_STRING        unsigned char *
  26. #endif
  27. // WinDS string for the RPC manual binding functions
  28. // The WinDS service uses RPC over the NAMED PIPES protocols and the
  29. // especific end-points for the protocol are listed below: One for the remote
  30. // administrator and one for the MAPI providers
  31. #define WINDS_RPC_PROTOCOL              TEXT("ncacn_np")
  32. #define WINDS_ADMIN_RPC_ENDPOINT        TEXT("\pipe\WINDS-ADMIN")
  33. #define WINDS_PROVIDERS_RPC_ENDPOINT    TEXT("\pipe\WINDS")
  34. // WinDS registry key for store permanent information
  35. #define WINDS_ADMIN_REGISTRY_KEY        TEXT("Software\Microsoft\PSS MAPI Samples\WinDS Remote Administrator")
  36. #define WINDS_SERVICE_REGISTRY_KEY      TEXT("System\CurrentControlSet\Services\WindsMessagingHost")
  37. // WinDS administrator subkeys
  38. #define SERVER_SUB_KEY                  TEXT("Default Server")
  39. // WinDS service subkeys
  40. #define DATA_FILE_SUB_KEY               TEXT("Data File")
  41. // Name of the address type of the user in the system and for the transports to register for.
  42. #define WINDS_ADDRESS_TYPE                      TEXT("WINDS")
  43. // Name of the Mailslot we use to send notifications to in the client machine
  44. #define AB_WINDS_NOTIFICATION_MAILSLOT          TEXT("WINDS_AB_NOTIFICATIONS")
  45. #define XP_WINDS_NOTIFICATION_MAILSLOT          TEXT("WINDS_XP_NOTIFICATIONS")
  46. #define MS_WINDS_NOTIFICATION_MAILSLOT          TEXT("WINDS_MS_NOTIFICATIONS")
  47. #define ADMIN_WINDS_NOTIFICATION_MAILSLOT       TEXT("WINDS_ADMIN_NOTIFICATIONS")
  48. #define CLIENT_MAILSLOT_SINK_NAME_FORMAT        TEXT("\\.\mailslot\%s\%x")
  49. #define SERVER_MAILSLOT_SINK_NAME_FORMAT        TEXT("\\%s\mailslot\%s\%x")
  50. // Bulk download/upload pipe name
  51. #define PIPE_NAME_FORMAT                        TEXT("%s\pipe\%d")
  52. // Handy buffer size
  53. #define IO_BUFFERSIZE                   1024
  54. #define WINDS_UNICODE                   0x80000000
  55. #define WINDS_ADMINISTRATOR             0x40000000
  56. #define HIDE_IN_DIR                     0x0001
  57. #define OBJECT_DISABLED                 0x0002
  58. #define ADMIN_RIGHTS                    0x0010
  59. #define DL_OWNED                        0x0010
  60. // Field sizes in the object properties structures
  61. #define MAX_ALIAS_SIZE      16
  62. #define MAX_STRING_SIZE     32
  63. #define MAX_PHONE_SIZE      12
  64. #define MAX_COMMENT_SIZE    79
  65. #define MAX_PASSWORD_SIZE   MAX_ALIAS_SIZE
  66. // Constants for the transports
  67. #define TRANSPORT_MESSAGE_EID_SIZE              MAX_ALIAS_SIZE
  68. #define ENTRYID_DATA_FIELD_SIZE                 MAX_ALIAS_SIZE
  69. enum
  70. {
  71.     ROOT_CONTAINER_ID       = 0xFFFFFFFF,
  72.     GATEWAY_CONTAINERS_ID   = 0xFFFFFFFE,
  73.     FAX_CONTAINER_ID        = 0xFFFFFFFD,   // Don't change the order of this (see STORAGE.CPP (ReadABContainerInfo) in the WINDS project)
  74.     SMTP_CONTAINER_ID       = 0xFFFFFFFC,
  75.     EXCHANGE_CONTAINER_ID   = 0xFFFFFFFB,
  76.     GAL_CONTAINER_ID        = 0xFFFFFFFA
  77. };
  78. typedef enum _WINDS_AB_OBJTYPE
  79. {
  80.     UNDEFINED_OBJECT_TYPE       = 0,
  81.     SERVER_USER_MAILBOX         = 1,    // Don't change the order or the values
  82.     SERVER_DISTRIBUTION_LIST    = 2,
  83.     GATEWAY_RECIPIENT           = 3,
  84.     PUBLIC_FOLDER               = 4
  85. } WINDS_AB_OBJTYPE;
  86. typedef struct _PUBLIC_FOLDER_INFO_A
  87. {
  88.     char        szFolderName[MAX_STRING_SIZE+4];
  89.     char        szComments[MAX_COMMENT_SIZE+4];
  90.     DWORD       dwObjID;
  91.     FILETIME    ftCreationTime;
  92.     FILETIME    ftLastModTime;
  93.     DWORD       dwMessageStorageSize;
  94.     DWORD       dwMessageCount;
  95.     DWORD       pdwMessagesIDs;
  96. } PUBLIC_FOLDER_INFO_A, *PPUBLIC_FOLDER_INFO_A;
  97. typedef struct _PUBLIC_FOLDER_INFO_W
  98. {
  99.     WCHAR       szFolderName[MAX_STRING_SIZE+4];
  100.     WCHAR       szComments[MAX_COMMENT_SIZE+4];
  101.     DWORD       dwObjID;
  102.     FILETIME    ftCreationTime;
  103.     FILETIME    ftLastModTime;
  104.     DWORD       dwMessageStorageSize;
  105.     DWORD       dwMessageCount;
  106.     DWORD       pdwMessagesIDs;
  107. } PUBLIC_FOLDER_INFO_W, *PPUBLIC_FOLDER_INFO_W;
  108. typedef struct _PF_MESSAGE_PROPERTIES_A
  109. {
  110.     char    szAuthor[MAX_ALIAS_SIZE+4];
  111.     DWORD   dwObjID;
  112. } PF_MESSAGE_PROPERTIES_A, *PPF_MESSAGE_PROPERTIES_A;
  113. typedef struct _PF_MESSAGE_PROPERTIES_W
  114. {
  115.     WCHAR   szAuthor[MAX_ALIAS_SIZE+4];
  116.     DWORD   dwObjID;
  117. } PF_MESSAGE_PROPERTIES_W, *PPF_MESSAGE_PROPERTIES_W;
  118. typedef struct _MAILBOX_INFO_A
  119. {
  120.     char    szMailboxName[MAX_ALIAS_SIZE+1];
  121.     char    szFullName[MAX_STRING_SIZE+1];
  122.     char    szJobTitle[MAX_STRING_SIZE+1];
  123.     char    szOffice[MAX_STRING_SIZE+1];
  124.     char    szPhone[MAX_PHONE_SIZE+1];
  125.     char    szAltPhone[MAX_PHONE_SIZE+1];
  126.     char    szFax[MAX_PHONE_SIZE+1];
  127.     char    szPassword[MAX_ALIAS_SIZE+1];
  128.     char    szCompany[MAX_STRING_SIZE+1];
  129.     char    szDepartment[MAX_STRING_SIZE+1];
  130.     char    szComments[MAX_COMMENT_SIZE+1];
  131.     char    szManagerName[MAX_STRING_SIZE+1];
  132.     char    szManagerAlias[MAX_STRING_SIZE+1];
  133.     DWORD   dwManagerID;
  134.     DWORD   dwObjID;
  135.     DWORD   dwFlags;
  136. } MAILBOX_INFO_A, *PMAILBOX_INFO_A;
  137. typedef struct _MAILBOX_INFO_W
  138. {
  139.     WCHAR   szMailboxName[MAX_ALIAS_SIZE+1];
  140.     WCHAR   szFullName[MAX_STRING_SIZE+1];
  141.     WCHAR   szJobTitle[MAX_STRING_SIZE+1];
  142.     WCHAR   szOffice[MAX_STRING_SIZE+1];
  143.     WCHAR   szPhone[MAX_PHONE_SIZE+1];
  144.     WCHAR   szAltPhone[MAX_PHONE_SIZE+1];
  145.     WCHAR   szFax[MAX_PHONE_SIZE+1];
  146.     WCHAR   szPassword[MAX_ALIAS_SIZE+1];
  147.     WCHAR   szCompany[MAX_STRING_SIZE+1];
  148.     WCHAR   szDepartment[MAX_STRING_SIZE+1];
  149.     WCHAR   szComments[MAX_COMMENT_SIZE+1];
  150.     WCHAR   szManagerName[MAX_STRING_SIZE+1];
  151.     WCHAR   szManagerAlias[MAX_STRING_SIZE+1];
  152.     DWORD   dwManagerID;
  153.     DWORD   dwObjID;
  154.     DWORD   dwFlags;
  155. } MAILBOX_INFO_W, *PMAILBOX_INFO_W;
  156. typedef struct _DIST_LIST_INFO_A
  157. {
  158.     char                szDLAlias[MAX_ALIAS_SIZE+1];
  159.     char                szDLFullName[MAX_STRING_SIZE+1];
  160.     DWORD               dwObjID;
  161.     DWORD               dwFlags;
  162.     char                szOwnerAlias[MAX_ALIAS_SIZE+1];
  163.     char                szOwnerName[MAX_STRING_SIZE+1];
  164.     DWORD               dwOwnerID;
  165.     char                szComments[MAX_COMMENT_SIZE+1];
  166.     DWORD               dwMemberCount;
  167.     LPVOID              pMembers;
  168. } DIST_LIST_INFO_A, *PDIST_LIST_INFO_A;
  169. typedef struct _DIST_LIST_INFO_W
  170. {
  171.     WCHAR               szDLAlias[MAX_ALIAS_SIZE+1];
  172.     WCHAR               szDLFullName[MAX_STRING_SIZE+1];
  173.     DWORD               dwObjID;
  174.     DWORD               dwFlags;
  175.     WCHAR               szOwnerAlias[MAX_ALIAS_SIZE+1];
  176.     WCHAR               szOwnerName[MAX_STRING_SIZE+1];
  177.     DWORD               dwOwnerID;
  178.     WCHAR               szComments[MAX_COMMENT_SIZE+1];
  179.     DWORD               dwMemberCount;
  180.     LPVOID              pMembers;
  181. } DIST_LIST_INFO_W, *PDIST_LIST_INFO_W;
  182. // UNICODE/ANSI macro for the structures
  183. #ifdef UNICODE
  184. #error WINDS: UNICODE has not been implemented yet. IrvingD 9/11/95
  185. #define MAILBOX_INFO                MAILBOX_INFO_W
  186. #define PMAILBOX_INFO               PMAILBOX_INFO_W
  187. #define DIST_LIST_INFO              DIST_LIST_INFO_W
  188. #define PDIST_LIST_INFO             PDIST_LIST_INFO_W
  189. #define PUBLIC_FOLDER_INFO          PUBLIC_FOLDER_INFO_W
  190. #define PPUBLIC_FOLDER_INFO         PPUBLIC_FOLDER_INFO_W
  191. #define PF_MESSAGE_PROPERTIES       PF_MESSAGE_PROPERTIES_W
  192. #define PPF_MESSAGE_PROPERTIES      PPF_MESSAGE_PROPERTIES_W
  193. #else
  194. #define MAILBOX_INFO                MAILBOX_INFO_A
  195. #define PMAILBOX_INFO               PMAILBOX_INFO_A
  196. #define DIST_LIST_INFO              DIST_LIST_INFO_A
  197. #define PDIST_LIST_INFO             PDIST_LIST_INFO_A
  198. #define PUBLIC_FOLDER_INFO          PUBLIC_FOLDER_INFO_A
  199. #define PPUBLIC_FOLDER_INFO         PPUBLIC_FOLDER_INFO_A
  200. #define PF_MESSAGE_PROPERTIES       PF_MESSAGE_PROPERTIES_A
  201. #define PPF_MESSAGE_PROPERTIES      PPF_MESSAGE_PROPERTIES_A
  202. #endif
  203. typedef union _WINDS_OBJS_INFO
  204. {
  205.     DWORD               dwFlags;
  206.     MAILBOX_INFO        MB;
  207.     DIST_LIST_INFO      DL;
  208.     PUBLIC_FOLDER_INFO  PF;
  209. } WINDS_OBJS_INFO;
  210. typedef struct _AB_ENTRY_INFO
  211. {
  212.     WINDS_OBJS_INFO     Info;
  213.     WINDS_AB_OBJTYPE    Type;
  214. } AB_ENTRY_INFO, *PAB_ENTRY_INFO;
  215. ///////////////////////////////////////////////////////////////////////////////
  216. // Message Transport Support
  217. // Command numbers for telling the remote server what to do (from a transport)
  218. typedef enum tagMID
  219. {
  220.     MSG_DOWNLOAD, 
  221.     MSG_DELETE,
  222.     MSG_MOVE,
  223.     OP_STARTED,
  224.     OP_COMPLETE,
  225.     OP_FAILED,
  226.     GOODBYE,
  227.     UNMARKED
  228. } MID;
  229. // Command message header
  230. typedef union _MSG_HDR_INFO
  231. {
  232.     BYTE    EID[TRANSPORT_MESSAGE_EID_SIZE];
  233.     ULONG   ulMsgLen;
  234. } MSG_HDR_INFO;
  235. typedef struct _MSG_HDR
  236. {
  237.     MID             ulMID;
  238.     MSG_HDR_INFO    Info;
  239. } MSG_HDR;
  240. ///////////////////////////////////////////////////////////////////////////////
  241. // Client/Server notification support 
  242. enum
  243. {
  244.     WINDS_NOTIF_ON_USER         = 0x0001,
  245.     WINDS_NOTIF_ON_XP           = 0x0002,
  246.     WINDS_NOTIF_ON_AB           = 0x0004,
  247.     WINDS_NOTIF_ON_MS           = 0x0008
  248. };
  249. typedef enum _WINDS_NOTIF_EVENT
  250. {
  251.     GENERAL_NOTIF_MIN           = 0x0000,
  252.     LOGGED_USER_PROPS_CHANGED   = 0x0000,
  253.     SERVER_IS_SHUTTING_DOWN     = 0x0001,
  254.     SERVER_HAS_RESTARTED        = 0x0002,
  255.     RESET_LINKS_WITH_SERVER     = 0x0003,
  256.     GENERAL_NOTIF_MAX           = 0x000F,
  257.     XP_NOTIF_MIN                = 0x0010,
  258.     XP_NEW_MAIL_ARRIVED         = 0x0010,
  259.     XP_NOTIF_MAX                = 0x00F0,
  260.     AB_NOTIF_MIN                = 0x0100,
  261.     AB_USER_ADDED               = 0x0100,
  262.     AB_USER_MODIFIED            = 0x0200,
  263.     AB_USER_DELETED             = 0x0300,
  264.     AB_DL_ADDED                 = 0x0400,
  265.     AB_DL_MODIFIED              = 0x0500,
  266.     AB_DL_DELETED               = 0x0600,
  267.     AB_GET_LOCAL_ABDATA_NOW     = 0x0700,
  268.     AB_NOTIF_MAX                = 0x0F00,
  269.     MS_NOTIF_MIN                = 0x1000,
  270.     MS_MESSAGE_ADDED            = 0x1000,
  271.     MS_MESSAGE_MODIFIED         = 0x2000,
  272.     MS_MESSAGE_DELETED          = 0x3000,
  273.     MS_FOLDER_ADDED             = 0x4000,
  274.     MS_FOLDER_MODIFIED          = 0x5000,
  275.     MS_FOLDER_DELETED           = 0x6000,
  276.     MS_NOTIF_MAX                = 0xF000
  277. } WINDS_NOTIF_EVENT;
  278. typedef struct _WINDS_NOTIFICATION
  279. {
  280.     WINDS_NOTIF_EVENT   Event;
  281.     FILETIME            ftEventTime;
  282.     WINDS_OBJS_INFO     Info;
  283. } WINDS_NOTIFICATION, *PWINDS_NOTIFICATION;
  284. ///////////////////////////////////////////////////////////////////////////////
  285. // Generic exception class for C++'s throw and catch
  286. class CException
  287. {
  288. public:
  289.     CException()
  290.     {
  291.         m_hResult = E_FAIL;
  292.     }
  293.     CException (HRESULT hResult)
  294.     {
  295.         if (0 == hResult)
  296.         {
  297.             hResult = E_FAIL;
  298.         }
  299.         m_hResult = hResult;
  300.     }
  301.     inline HRESULT WINAPI GetError()
  302.     {
  303.         return m_hResult;
  304.     }
  305. private:
  306.     HRESULT m_hResult;
  307. };
  308. #endif // _WINDSGBL_H
  309. // End of file for WINDSGBL.H