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.

302 lines
11 KiB

  1. /***********************************************************************
  2. *
  3. * _IAB.H
  4. *
  5. * Header file for code in IADRBOOK.C: Address Book object
  6. *
  7. * Copyright 1992 - 1996 Microsoft Corporation. All Rights Reserved.
  8. *
  9. ***********************************************************************/
  10. //
  11. // structure used to contain information about the open hierarchy tables
  12. //
  13. typedef struct {
  14. ULONG ulConnection;
  15. LPMAPITABLE lpTable;
  16. LPMAPITABLE lpmtRestricted;
  17. LPIAB lpIAB;
  18. LPMAPIADVISESINK lpABAdviseSink;
  19. LPMAPICONTAINER lpContainer;
  20. } TABLEINFO, *LPTABLEINFO;
  21. #define SafeRelease(x) \
  22. if (x) \
  23. { \
  24. ULONG uRef = (x)->lpVtbl->Release((x)); \
  25. DebugTrace(TEXT("**** SafeRelease: %s: Release refCount: %d\n"), TEXT(#x), uRef); \
  26. if(uRef==0) (x) = NULL; \
  27. }
  28. // This following struct contains info about extensible actions in the UI
  29. // Declared here because these actions are read from the registry and cached
  30. // on the IAddrBook object once per session
  31. //
  32. typedef struct _WABACTIONITEM
  33. {
  34. GUID guidContextMenu; // GUID identifying the menu extension
  35. LPCONTEXTMENU lpContextMenu; // ICOntextMenu object provided by the extension
  36. LPWABEXTINIT lpWABExtInit; // IWABExtInit object provided by the extension
  37. int nCmdIdFirst; // First Menu Command ID for this extension
  38. int nCmdIdLast; // Last Menu Command ID for this extension
  39. struct _WABACTIONITEM * lpNext;
  40. } WABACTIONITEM, FAR * LPWABACTIONITEM;
  41. // Folders within the WAB are just special mailuser entries
  42. // We cache information about all the WAB fodlers on the IAB Object
  43. // so that we have handy access to the folders from the lpAdrBook object
  44. //
  45. // There are 2 types of folders:
  46. // User Folders
  47. // Regular folders
  48. //
  49. // User folders correspond to the various identities... Each identity gets
  50. // one user folder which is non-shareable and appears at the top level of the
  51. // treeview in the WAB Main view. This folder is distinguished in that it has a
  52. // corresponding GUID identifying the identity it corresponds to.
  53. // User folders are not shareable.
  54. // Regular folders don't correspond to a particular Identity and are shareable.
  55. //
  56. // Folowing structure holds information about a particular folder
  57. //
  58. typedef struct _WABFOLDER
  59. {
  60. LPTSTR lpFolderName; // String containing folder name
  61. LPTSTR lpProfileID; // <GUID> profile ID for the Identity that created the folder (if it's a User folder)
  62. BOOL bShared; // Whether the folder is shared or not
  63. BOOL bOwned; // Set to true if this folder "belongs" to an existing user folder
  64. SBinary sbEID; // Entryif of this item
  65. LPTSTR lpFolderOwner; // String identifying the "owner" of this folder - used for reverting a folder to it's original creator if it is shared or unshared
  66. int nMenuCmdID; // when we load a list of folders, we will assign a menu id to them to make it easier to manipulate them in the Share Folders menu
  67. struct _WABFOLDERLIST * lpFolderList;
  68. struct _WABFOLDER * lpNext;
  69. } WABFOLDER, FAR * LPWABFOLDER;
  70. typedef struct _WABFOLDERLIST
  71. {
  72. LPWABFOLDER lpFolder;
  73. struct _WABFOLDERLIST * lpNext;
  74. } WABFOLDERLIST, FAR * LPWABFOLDERLIST;
  75. #define WABUSERFOLDER WABFOLDER
  76. #define LPWABUSERFOLDER LPWABFOLDER
  77. // This structure is used for doing prop sheet extensions
  78. // Information about property sheet extensions is loaded up the first time
  79. // user wants to see properties on a WAB contact. The info is then cached on the
  80. // IAB object
  81. //
  82. typedef struct _ExtDisplayDLLInfo
  83. {
  84. GUID guidPropExt; // GUID identifying the Property Sheet extension
  85. BOOL bMailUser; // Whether this is property sheet extension for a MailUser or a DistList
  86. LPSHELLPROPSHEETEXT lpPropSheetExt; // IShellPropSheetExt object returned by extension
  87. LPWABEXTINIT lpWABExtInit; // IWABExtInit object returned by extension
  88. struct _ExtDisplayDLLInfo * lpNext;
  89. } EXTDLLINFO, * LPEXTDLLINFO;
  90. /* IDentityChangeNotification
  91. - Identity Change Notification object for the Identity manager
  92. - This is cached on the IAB Object so that the IAB always has the
  93. - knowledge of the latest current identity*/
  94. typedef struct _WAB_IDENTITYCHANGENOTIFY * LPWABIDENTITYCHANGENOTIFY;
  95. //
  96. // IAB Object
  97. //
  98. typedef struct _IAB {
  99. MAPIX_BASE_MEMBERS(IAB)
  100. LPPROPDATA lpPropData;
  101. LONG lRowID; // Status Row #
  102. LPIWOINT lpWABObject; // Our parent WABObject
  103. //
  104. // Stores a handle to the open property store
  105. //
  106. LPPROPERTY_STORE lpPropertyStore;
  107. // Default directory info
  108. LPENTRYID lpEntryIDDD;
  109. ULONG cbEntryIDDD;
  110. // PAB directory info
  111. LPENTRYID lpEntryIDPAB;
  112. ULONG cbEntryIDPAB;
  113. BOOL fReloadSearchPath;
  114. // Cached Search Path containers
  115. LPSPropValue lpspvSearchPathCache;
  116. // Merged hierarchy table
  117. LPTABLEDATA lpTableData;
  118. LPMAPITABLE lpmtHierarchy;
  119. // Merged One Off Table
  120. LPTABLEDATA lpOOData;
  121. LPMAPITABLE lpmtOOT;
  122. // List of open hierarchy tables
  123. ULONG ulcTableInfo;
  124. LPTABLEINFO pargTableInfo;
  125. // List of open oneoff tables
  126. ULONG ulcOOTableInfo;
  127. LPTABLEINFO pargOOTableInfo;
  128. // List of IAB handled Advise "ulConnections"
  129. LPADVISELIST padviselistIAB;
  130. // WAB Version of notifications for this pointer
  131. LPADVISE_LIST pWABAdviseList;
  132. // Set TRUE if creation of IAB loaded LDAP client
  133. BOOL fLoadedLDAP;
  134. HWND hWndNotify; // hidden window that runs a notification spooler
  135. UINT_PTR ulNotifyTimer; // notification spooler timer
  136. LPWSTR lpwszWABFilePath;// FCN file path
  137. HANDLE hThreadNotify;
  138. HANDLE hEventKillNotifyThread;
  139. FILETIME ftLast;
  140. // Stuff used with Context Extensions
  141. // This is a list of extensions cached on the IAB object
  142. LPWABACTIONITEM lpActionList; // All the registered rt-click actions for this wab
  143. LPMAILUSER lpCntxtMailUser;
  144. // Browse window .. assuming there's only one per IAddrBook object ..
  145. HWND hWndBrowse;
  146. // Identity manager information cached on the IAB object
  147. LPWABIDENTITYCHANGENOTIFY lpWABIDCN;
  148. DWORD dwWABIDCN;
  149. IUserIdentityManager * lpUserIdentityManager;
  150. BOOL fCoInitUserIdentityManager;
  151. ULONG cIdentInit;
  152. // Information about the current identity
  153. TCHAR szProfileName[CCH_IDENTITY_NAME_MAX_LENGTH];// Current identities name
  154. TCHAR szProfileID[CCH_IDENTITY_NAME_MAX_LENGTH]; // Current identities GUID in string form
  155. LPWABUSERFOLDER lpWABUserFolders; // Linked list of all user folders
  156. LPWABUSERFOLDER lpWABCurrentUserFolder; // The current Identities user folder
  157. LPWABFOLDER lpWABFolders; // Linked list of ALL WAB folders
  158. GUID guidCurrentUser; // GUID for the current Identity
  159. HKEY hKeyCurrentUser; // Special HKEY for the identity
  160. // Stuff for caching prop sheet extensions
  161. LPEXTDLLINFO lpPropExtDllList;
  162. int nPropExtDLLs; //# of extension DLLs
  163. // Caling processes can pass in a GUID through WABOpen WAB_PARAM structure
  164. // that identifies the calling process. This GUID can later be used for
  165. // several app-specific things - e.g.
  166. // We use this guid to identify which property sheet and context menu
  167. // extensions belong to the calling app and then decide to only show those
  168. // extensions in that case. Could also use this guid to load the apps
  169. // specific printer extension.
  170. GUID guidPSExt;
  171. // Outlook folder information
  172. struct _OlkContInfo *rgwabci;
  173. ULONG cwabci;
  174. // Flags that tell us the state of the WAB
  175. BOOL bProfilesEnabled; // means the caller didn't pass in WAB_ENABLE_PROFILES
  176. // in WABOpen so we should treat the API as olde flavor
  177. // but the UI should show folders etc
  178. BOOL bProfilesIdent; // means the caller passed in WAB_ENABLE_PROFILES
  179. // both UI and API should be identity aware,
  180. // but probably Identities are disabled
  181. BOOL bProfilesAPIEnabled; // means the caller passed in WAB_ENABLE_PROFILES
  182. // so both UI and API should be identity aware
  183. BOOL bUseOEForSendMail; // set to true when client passes WAB_USE_OE_SENDMAIL
  184. // into WABOpen - when this flag is passed in we try to
  185. // exclusively use OE for send-mail
  186. BOOL bSetOLKAllocators; // Boolean set if this object created inside and Outlook session, i.e.,
  187. // the WAB is set to use the Outlook MAPI allocators.
  188. HANDLE hMutexOlk; // used for keeping track of outlook notifications
  189. DWORD dwOlkRefreshCount;
  190. DWORD dwOlkFolderRefreshCount;
  191. } IAB, *LPIAB;
  192. //
  193. // Private Prototypes
  194. //
  195. //
  196. // Entry point to create a new IAB object
  197. //
  198. HRESULT HrNewIAB(LPPROPERTY_STORE lpPropertyStore,
  199. LPWABOBJECT lpWABObject,
  200. LPVOID * lppIAB);
  201. HRESULT MergeOOTables(LPIAB lpIAB,
  202. ULONG ulFlags);
  203. HRESULT HrMergeTableRows(LPTABLEDATA lptadDst,
  204. LPMAPITABLE lpmtSrc,
  205. ULONG ulProviderNum);
  206. #define MIN_CCH_LAST_ERROR 256
  207. #define MAX_CCH_LAST_ERROR 2048
  208. // The Number of MAPI internal ONE-OFF entries in the AB OOTable.
  209. #define IAB_INTERNAL_OOCNT 1
  210. // Max Hierarchy Entries per Provider
  211. #define IAB_PROVIDER_HIERARCHY_MAX 0x0000ffff
  212. // used with ptagaABSearchPath declared in abint.c
  213. enum {
  214. iPATH = 0,
  215. iUPDATE
  216. };
  217. enum ivtANRCols {
  218. ivtACPR_ENTRYID = 0,
  219. ivtACPR_DISPLAY_NAME_A,
  220. ivtACPR_ADDRTYPE_A,
  221. ivtACPR_OBJECT_TYPE,
  222. ivtACPR_DISPLAY_TYPE,
  223. ivtACPR_EMAIL_ADDRESS_A,
  224. ivtACPR_SEARCH_KEY,
  225. ivtACPR_SEND_RICH_INFO,
  226. ivtACPR_TRANSMITABLE_DISPLAY_NAME_A,
  227. ivtACPR_7BIT_DISPLAY_NAME,
  228. cvtACMax
  229. };
  230. // Loads the WABs internally used name properties
  231. HRESULT HrLoadPrivateWABProps(LPIAB lpIAB);
  232. // Reads the custom column props from the registry
  233. void ReadWABCustomColumnProps(LPIAB lpIAB);
  234. // Functions defined in Notify.c
  235. HRESULT HrAdvise(LPIAB lpIAB,
  236. ULONG cbEntryID,
  237. LPENTRYID lpEntryID,
  238. ULONG ulEventMask,
  239. LPMAPIADVISESINK lpAdvise,
  240. ULONG FAR * lpulConnection);
  241. HRESULT HrUnadvise(LPIAB lpIAB, ULONG ulConnection);
  242. // fires the nontifications
  243. HRESULT HrWABNotify(LPIAB lpIAB);