home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / mapi / flatfile.ab / abp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-11  |  20.9 KB  |  705 lines

  1. /***********************************************************************
  2.  *
  3.  *  ABP.H
  4.  *
  5.  *  Definitions for Sample Address Book Provider
  6.  *
  7.  *  Copyright 1992-1995 Microsoft Corporation.  All Rights Reserved.
  8.  *
  9.  ***********************************************************************/
  10.  
  11.  
  12. #ifdef _WIN32
  13. #define INC_OLE2                /* Get the OLE2 stuff */
  14. #define INC_RPC                 /* harmless on Windows NT; Windows 95 needs it */
  15. #endif
  16. #include <windows.h>
  17. #include <windowsx.h>
  18. #include <limits.h>
  19. #include <mapiwin.h>
  20. #include <mapidbg.h>
  21.  
  22. #include <mapidefs.h>
  23. #include <mapicode.h>
  24. #include <mapitags.h>
  25. #include <mapiguid.h>
  26. #include <mapispi.h>
  27. #include <mapiutil.h>
  28. #include <mapival.h>
  29.  
  30. #include <memory.h>
  31. #include <commdlg.h>
  32.  
  33. /*
  34.  *  IUnknown base members
  35.  */
  36. #define SAB_IUnknown                    \
  37.     LONG                lcInit;         \
  38.     HRESULT             hResult;        \
  39.     UINT                idsLastError;   \
  40.     HINSTANCE           hLibrary;       \
  41.     LPALLOCATEBUFFER    lpAllocBuff;    \
  42.     LPALLOCATEMORE      lpAllocMore;    \
  43.     LPFREEBUFFER        lpFreeBuff;     \
  44.     LPMALLOC            lpMalloc;       \
  45.     CRITICAL_SECTION    cs
  46.  
  47. #define SAB_IUnkWithLogon               \
  48.     SAB_IUnknown;                       \
  49.     LPABLOGON           lpABLogon
  50.  
  51. #define SAB_Wrapped                     \
  52.     SAB_IUnkWithLogon;                  \
  53.     LPMAPIPROP          lpPropData
  54.  
  55. /*
  56.  *  Definition of all the objects referred to in the various source modules
  57.  *  of this provider.
  58.  */
  59.  
  60. /*
  61.  *  Declaration of IABProvider object implementation
  62.  *  Code for this is in ABP.C
  63.  */
  64. #undef  INTERFACE
  65. #define INTERFACE struct _ABP
  66.  
  67. #undef  MAPIMETHOD_
  68. #define MAPIMETHOD_(type, method)   MAPIMETHOD_DECLARE(type, method, ABP_)
  69.         MAPI_IUNKNOWN_METHODS(IMPL)
  70.         MAPI_IABPROVIDER_METHODS(IMPL)
  71. #undef  MAPIMETHOD_
  72. #define MAPIMETHOD_(type, method)   MAPIMETHOD_TYPEDEF(type, method, ABP_)
  73.         MAPI_IUNKNOWN_METHODS(IMPL)
  74.         MAPI_IABPROVIDER_METHODS(IMPL)
  75. #undef  MAPIMETHOD_
  76. #define MAPIMETHOD_(type, method)   STDMETHOD_(type, method)
  77.  
  78. DECLARE_MAPI_INTERFACE(ABP_)
  79. {
  80.     MAPI_IUNKNOWN_METHODS(IMPL)
  81.     MAPI_IABPROVIDER_METHODS(IMPL)
  82. };
  83.  
  84.  
  85. /*
  86.  *  Declaration of IABLogon object implementation
  87.  *  Code for this is in ABP.C
  88.  */
  89. #undef  INTERFACE
  90. #define INTERFACE struct _ABPLOGON
  91.  
  92. #undef  MAPIMETHOD_
  93. #define MAPIMETHOD_(type, method)   MAPIMETHOD_DECLARE(type, method, ABPLOGON_)
  94.         MAPI_IUNKNOWN_METHODS(IMPL)
  95.         MAPI_IABLOGON_METHODS(IMPL)
  96. #undef  MAPIMETHOD_
  97. #define MAPIMETHOD_(type, method)   MAPIMETHOD_TYPEDEF(type, method, ABPLOGON_)
  98.         MAPI_IUNKNOWN_METHODS(IMPL)
  99.         MAPI_IABLOGON_METHODS(IMPL)
  100. #undef  MAPIMETHOD_
  101. #define MAPIMETHOD_(type, method)   STDMETHOD_(type, method)
  102.  
  103. DECLARE_MAPI_INTERFACE(ABPLOGON_)
  104. {
  105.     MAPI_IUNKNOWN_METHODS(IMPL)
  106.     MAPI_IABLOGON_METHODS(IMPL)
  107. };
  108.  
  109.  
  110. /*
  111.  *  Declaration of IABContainer object implementation
  112.  *  Code for this is in ROOT.C
  113.  */
  114. #undef  INTERFACE
  115. #define INTERFACE   struct _ROOT
  116.  
  117. #undef  MAPIMETHOD_
  118. #define MAPIMETHOD_(type, method)   MAPIMETHOD_DECLARE(type, method, ROOT_)
  119.         MAPI_IUNKNOWN_METHODS(IMPL)
  120.         MAPI_IMAPIPROP_METHODS(IMPL)
  121.         MAPI_IMAPICONTAINER_METHODS(IMPL)
  122.         MAPI_IABCONTAINER_METHODS(IMPL)
  123. #undef  MAPIMETHOD_
  124. #define MAPIMETHOD_(type, method)   MAPIMETHOD_TYPEDEF(type, method, ROOT_)
  125.         MAPI_IUNKNOWN_METHODS(IMPL)
  126.         MAPI_IMAPIPROP_METHODS(IMPL)
  127.         MAPI_IMAPICONTAINER_METHODS(IMPL)
  128.         MAPI_IABCONTAINER_METHODS(IMPL)
  129. #undef  MAPIMETHOD_
  130. #define MAPIMETHOD_(type, method)   STDMETHOD_(type, method)
  131.  
  132. DECLARE_MAPI_INTERFACE(ROOT_)
  133. {
  134.     MAPI_IUNKNOWN_METHODS(IMPL)
  135.     MAPI_IMAPIPROP_METHODS(IMPL)
  136.     MAPI_IMAPICONTAINER_METHODS(IMPL)
  137.     MAPI_IABCONTAINER_METHODS(IMPL)
  138. };
  139.  
  140. #define ROOT_ValidateObject(Method, pThis)          \
  141. {                                                   \
  142.     HRESULT hResult;                                \
  143.     if (IsBadReadPtr(pThis, sizeof(ROOT)))          \
  144.     {                                               \
  145.         hResult = ResultFromScode(E_INVALIDARG);    \
  146.         DebugTraceResult(ROOT##_##Method, hResult); \
  147.         return hResult;                             \
  148.     }                                               \
  149.                                                     \
  150.     if (pThis->lpVtbl != &vtblROOT)                 \
  151.     {                                               \
  152.         hResult = ResultFromScode(E_INVALIDARG);    \
  153.         DebugTraceResult(ROOT##_##Method, hResult); \
  154.         return hResult;                             \
  155.     }                                               \
  156. }
  157.  
  158.  
  159.  
  160. /*
  161.  *  Declaration of IABContainer object implementation
  162.  *  Code for this is in ABCONT.C
  163.  */
  164. #undef  INTERFACE
  165. #define INTERFACE   struct _ABCNT
  166.  
  167. #undef  MAPIMETHOD_
  168. #define MAPIMETHOD_(type, method)   MAPIMETHOD_DECLARE(type, method, ABC_)
  169.         MAPI_IUNKNOWN_METHODS(IMPL)
  170.         MAPI_IMAPIPROP_METHODS(IMPL)
  171.         MAPI_IMAPICONTAINER_METHODS(IMPL)
  172.         MAPI_IABCONTAINER_METHODS(IMPL)
  173. #undef  MAPIMETHOD_
  174. #define MAPIMETHOD_(type, method)   MAPIMETHOD_TYPEDEF(type, method, ABC_)
  175.         MAPI_IUNKNOWN_METHODS(IMPL)
  176.         MAPI_IMAPIPROP_METHODS(IMPL)
  177.         MAPI_IMAPICONTAINER_METHODS(IMPL)
  178.         MAPI_IABCONTAINER_METHODS(IMPL)
  179. #undef  MAPIMETHOD_
  180. #define MAPIMETHOD_(type, method)   STDMETHOD_(type, method)
  181.  
  182. DECLARE_MAPI_INTERFACE(ABC_)
  183. {
  184.     MAPI_IUNKNOWN_METHODS(IMPL)
  185.     MAPI_IMAPIPROP_METHODS(IMPL)
  186.     MAPI_IMAPICONTAINER_METHODS(IMPL)
  187.     MAPI_IABCONTAINER_METHODS(IMPL)
  188. };
  189.  
  190. #define ABC_ValidateObject(Method, pThis)           \
  191. {                                                   \
  192.     HRESULT hResult;                                \
  193.     if (IsBadReadPtr(pThis, sizeof(ABC)))           \
  194.     {                                               \
  195.         hResult = ResultFromScode(E_INVALIDARG);    \
  196.         DebugTraceResult(ABC##_##Method, hResult);  \
  197.         return hResult;                             \
  198.     }                                               \
  199.                                                     \
  200.     if (pThis->lpVtbl != &vtblABC)                  \
  201.     {                                               \
  202.         hResult = ResultFromScode(E_INVALIDARG);    \
  203.         DebugTraceResult(ABC##_##Method, hResult);  \
  204.         return hResult;                             \
  205.     }                                               \
  206. }
  207.  
  208.  
  209. /*
  210.  *  Declaration of IMAPIContainer object implementation
  211.  *  Code for this is in ABSEARCH.C
  212.  */
  213. #undef  INTERFACE
  214. #define INTERFACE   struct _ABSRCH
  215.  
  216. #undef  MAPIMETHOD_
  217. #define MAPIMETHOD_(type, method)   MAPIMETHOD_DECLARE(type, method, ABSRCH_)
  218.         MAPI_IUNKNOWN_METHODS(IMPL)
  219.         MAPI_IMAPIPROP_METHODS(IMPL)
  220.         MAPI_IMAPICONTAINER_METHODS(IMPL)
  221.         MAPI_IABCONTAINER_METHODS(IMPL)
  222. #undef  MAPIMETHOD_
  223. #define MAPIMETHOD_(type, method)   MAPIMETHOD_TYPEDEF(type, method, ABSRCH_)
  224.         MAPI_IUNKNOWN_METHODS(IMPL)
  225.         MAPI_IMAPIPROP_METHODS(IMPL)
  226.         MAPI_IMAPICONTAINER_METHODS(IMPL)
  227.         MAPI_IABCONTAINER_METHODS(IMPL)
  228. #undef  MAPIMETHOD_
  229. #define MAPIMETHOD_(type, method)   STDMETHOD_(type, method)
  230.  
  231. DECLARE_MAPI_INTERFACE(ABSRCH_)
  232. {
  233.     MAPI_IUNKNOWN_METHODS(IMPL)
  234.     MAPI_IMAPIPROP_METHODS(IMPL)
  235.     MAPI_IMAPICONTAINER_METHODS(IMPL)
  236. };
  237.  
  238. #define ABSRCH_ValidateObject(Method, pThis)        \
  239. {                                                   \
  240.     HRESULT hResult;                                \
  241.     if (IsBadReadPtr(pThis, sizeof(ABSRCH)))        \
  242.     {                                               \
  243.         hResult = ResultFromScode(E_INVALIDARG);    \
  244.         DebugTraceResult(ABSRCH##_##Method, hResult);   \
  245.         return hResult;                             \
  246.     }                                               \
  247.                                                     \
  248.     if (pThis->lpVtbl != &vtblABSRCH)                   \
  249.     {                                               \
  250.         hResult = ResultFromScode(E_INVALIDARG);    \
  251.         DebugTraceResult(ABSRCH##_##Method, hResult);   \
  252.         return hResult;                             \
  253.     }                                               \
  254. }
  255.  
  256.  
  257.  
  258. /*
  259.  *  Declaration of IMailUser object implementation
  260.  *  Code for this is in ABUSER.C
  261.  */
  262. #undef  INTERFACE
  263. #define INTERFACE   struct _ABUSER
  264.  
  265. #undef  MAPIMETHOD_
  266. #define MAPIMETHOD_(type, method)   MAPIMETHOD_DECLARE(type, method, ABU_)
  267.         MAPI_IUNKNOWN_METHODS(IMPL)
  268.         MAPI_IMAPIPROP_METHODS(IMPL)
  269.         MAPI_IMAILUSER_METHODS(IMPL)
  270. #undef  MAPIMETHOD_
  271. #define MAPIMETHOD_(type, method)   MAPIMETHOD_TYPEDEF(type, method, ABU_)
  272.         MAPI_IUNKNOWN_METHODS(IMPL)
  273.         MAPI_IMAPIPROP_METHODS(IMPL)
  274.         MAPI_IMAILUSER_METHODS(IMPL)
  275. #undef  MAPIMETHOD_
  276. #define MAPIMETHOD_(type, method)   STDMETHOD_(type, method)
  277.  
  278. DECLARE_MAPI_INTERFACE(ABU_)
  279. {
  280.     MAPI_IUNKNOWN_METHODS(IMPL)
  281.     MAPI_IMAPIPROP_METHODS(IMPL)
  282.     MAPI_IMAILUSER_METHODS(IMPL)
  283. };
  284.  
  285. #define ABU_ValidateObject(Method, pThis)       \
  286. {                                                   \
  287.     HRESULT hResult;                                \
  288.     if (IsBadReadPtr(pThis, sizeof(ABUSER)))        \
  289.     {                                               \
  290.         hResult = ResultFromScode(E_INVALIDARG);    \
  291.         DebugTraceResult(ABU##_##Method, hResult);  \
  292.         return hResult;                             \
  293.     }                                               \
  294.                                                     \
  295.     if (pThis->lpVtbl != &vtblABU)                  \
  296.     {                                               \
  297.         hResult = ResultFromScode(E_INVALIDARG);    \
  298.         DebugTraceResult(ABU##_##Method, hResult);  \
  299.         return hResult;                             \
  300.     }                                               \
  301. }
  302.  
  303. /*
  304.  *  Declaration of IMAPIProp object implementation
  305.  *  Code for this is in WRAP.C
  306.  */
  307. #undef  INTERFACE
  308. #define INTERFACE   struct _WRAP
  309.  
  310. #undef  MAPIMETHOD_
  311. #define MAPIMETHOD_(type, method)   MAPIMETHOD_DECLARE(type, method, WRAP_)
  312.         MAPI_IUNKNOWN_METHODS(IMPL)
  313.         MAPI_IMAPIPROP_METHODS(IMPL)
  314. #undef  MAPIMETHOD_
  315. #define MAPIMETHOD_(type, method)   MAPIMETHOD_TYPEDEF(type, method, WRAP_)
  316.         MAPI_IUNKNOWN_METHODS(IMPL)
  317.         MAPI_IMAPIPROP_METHODS(IMPL)
  318. #undef  MAPIMETHOD_
  319. #define MAPIMETHOD_(type, method)   STDMETHOD_(type, method)
  320.  
  321. DECLARE_MAPI_INTERFACE(WRAP_)
  322. {
  323.     MAPI_IUNKNOWN_METHODS(IMPL)
  324.     MAPI_IMAPIPROP_METHODS(IMPL)
  325. };
  326.  
  327.  
  328.  
  329. #undef  INTERFACE
  330. #define INTERFACE   struct _IVTABC
  331.  
  332. #undef  MAPIMETHOD_
  333. #define MAPIMETHOD_(type, method)   MAPIMETHOD_DECLARE(type, method, IVTABC_)
  334.         MAPI_IUNKNOWN_METHODS(IMPL)
  335.         MAPI_IMAPITABLE_METHODS(IMPL)
  336. #undef  MAPIMETHOD_
  337. #define MAPIMETHOD_(type, method)   MAPIMETHOD_TYPEDEF(type, method, IVTABC_)
  338.         MAPI_IUNKNOWN_METHODS(IMPL)
  339.         MAPI_IMAPITABLE_METHODS(IMPL)
  340. #undef  MAPIMETHOD_
  341. #define MAPIMETHOD_(type, method)   STDMETHOD_(type, method)
  342.  
  343. DECLARE_MAPI_INTERFACE(IVTABC_)
  344. {
  345.     MAPI_IUNKNOWN_METHODS(IMPL)
  346.     MAPI_IMAPITABLE_METHODS(IMPL)
  347. };
  348.  
  349.  
  350. /*
  351.  *  Internal utility functions that allow access to data stored in the Init object
  352.  */
  353. void
  354. RemoveLogonObject(LPABPROVIDER lpABProvider, LPVOID lpvABLogon, LPFREEBUFFER lpFreeBuff);
  355.  
  356. void
  357. FindLogonObject(LPABPROVIDER lpABProvider, LPMAPIUID lpMuidToFind, LPABLOGON * lppABLogon);
  358.  
  359. /*
  360.  *  Internal utility functions that allow access to data stored in the logon object
  361.  */
  362.  
  363. LPMAPIUID
  364. LpMuidFromLogon(LPABLOGON lpABLogon);
  365.  
  366. HRESULT
  367. HrLpszGetCurrentFileName(LPABLOGON lpABLogon, LPSTR * lppszFileName);
  368.  
  369. HRESULT
  370. HrReplaceCurrentFileName(LPABLOGON lpABLogon, LPSTR lpstrT);
  371.  
  372. void
  373. GenerateContainerDN(LPABLOGON lpABLogon, LPSTR lpszName);
  374.  
  375. BOOL
  376. FEqualSABFiles( LPABLOGON lpABLogon,
  377.                 LPSTR lpszFileName);
  378.  
  379. /*
  380.  *
  381.  *  Functions that return new objects
  382.  *
  383.  */
  384.  
  385. /*
  386.  *  Creates a new ABPLogon object  (see ABLOGON.C)
  387.  */
  388. HRESULT
  389. HrNewABLogon(   LPABLOGON *         lppABLogon,
  390.                 LPABPROVIDER        lpABP,
  391.                 LPMAPISUP           lpMAPISup,
  392.                 LPSTR               lpszSABFile,
  393.                 LPMAPIUID           lpmuid,
  394.                 HINSTANCE           hLibrary,
  395.                 LPALLOCATEBUFFER    lpAllocBuff,
  396.                 LPALLOCATEMORE      lpAllocMore,
  397.                 LPFREEBUFFER        lpFreeBuff,
  398.                 LPMALLOC            lpMalloc );
  399.  
  400. /*
  401.  *  Creates a new ROOT container object  (see ROOT.C)
  402.  */
  403. HRESULT
  404. HrNewROOT(LPABCONT *        lppROOT,
  405.           ULONG *           lpulObjType,
  406.           LPABLOGON         lpABPLogon,
  407.           LPCIID            lpInterface,
  408.           HINSTANCE         hLibrary,
  409.           LPALLOCATEBUFFER  lpAllocBuff,
  410.           LPALLOCATEMORE    lpAllocMore,
  411.           LPFREEBUFFER      lpFreeBuff,
  412.           LPMALLOC          lpMalloc );
  413.  
  414. /*
  415.  *  Creates a new directory container object (see ABCONT.C)
  416.  */
  417. HRESULT 
  418. HrNewSampDirectory( LPABCONT *          lppABC,
  419.                     ULONG *             lpulObjType,
  420.                     LPABLOGON           lpABPLogon,
  421.                     LPCIID              lpInterface,
  422.                     HINSTANCE           hLibrary,
  423.                     LPALLOCATEBUFFER    lpAllocBuff,
  424.                     LPALLOCATEMORE      lpAllocMore,
  425.                     LPFREEBUFFER        lpFreeBuff,
  426.                     LPMALLOC            lpMalloc );
  427.  
  428. /*
  429.  *  Creates the search object associated with the SampDirectory (see ABSEARCH.C)
  430.  */
  431. HRESULT
  432. HrNewSearch(LPMAPICONTAINER *   lppABSearch,
  433.             LPABLOGON           lpABLogon,
  434.             LPCIID              lpInterface,
  435.             HINSTANCE           hLibrary,
  436.             LPALLOCATEBUFFER    lpAllocBuff,
  437.             LPALLOCATEMORE      lpAllocMore,
  438.             LPFREEBUFFER        lpFreeBuff,
  439.             LPMALLOC            lpMalloc );
  440.  
  441. /*
  442.  *  Creates a new Mail User object  (see ABUSER.C)
  443.  */
  444. HRESULT
  445. HrNewSampUser(  LPMAILUSER *        lppMAPIPropEntry,
  446.                 ULONG *             lpulObjectType,
  447.                 ULONG               cbEntryID,
  448.                 LPENTRYID           lpEntryID,
  449.                 LPABLOGON           lpABPLogon,
  450.                 LPCIID              lpInterface,
  451.                 HINSTANCE           hLibrary,
  452.                 LPALLOCATEBUFFER    lpAllocBuff,
  453.                 LPALLOCATEMORE      lpAllocMore,
  454.                 LPFREEBUFFER        lpFreeBuff,
  455.                 LPMALLOC            lpMalloc );
  456.  
  457. /*
  458.  *  Creates a new one-off templateID object (see TID.C)
  459.  */
  460. HRESULT 
  461. HrNewOOTID( LPMAPIPROP *        lppMAPIPropNew,
  462.             ULONG               cbTemplateId,
  463.             LPENTRYID           lpTemplateId,
  464.             ULONG               ulTemplateFlags,
  465.             LPMAPIPROP          lpMAPIPropData,
  466.             LPABLOGON           lpABPLogon,
  467.             LPCIID              lpInterface,
  468.             HINSTANCE           hLibrary,
  469.             LPALLOCATEBUFFER    lpAllocBuff,
  470.             LPALLOCATEMORE      lpAllocMore,
  471.             LPFREEBUFFER        lpFreeBuff,
  472.             LPMALLOC            lpMalloc );
  473.  
  474. /*
  475.  *  Creates a new one-off mail user object (see OOUSER.C)
  476.  */
  477. HRESULT
  478. HrNewSampOOUser(LPMAILUSER *        lppMAPIPropEntry,
  479.                 ULONG *             lpulObjectType,
  480.                 ULONG               cbEntryID,
  481.                 LPENTRYID           lpEntryID,
  482.                 LPABLOGON           lpABPLogon,
  483.                 LPCIID              lpInterface,
  484.                 HINSTANCE           hLibrary,
  485.                 LPALLOCATEBUFFER    lpAllocBuff,
  486.                 LPALLOCATEMORE      lpAllocMore,
  487.                 LPFREEBUFFER        lpFreeBuff,
  488.                 LPMALLOC            lpMalloc );
  489.  
  490. /*
  491.  *  Creates a new status object for this provider (see STATUS.C)
  492.  */
  493. HRESULT 
  494. HrNewStatusObject(LPMAPISTATUS *    lppABS,
  495.                 ULONG *             lpulObjType,
  496.                 ULONG               ulFlags,
  497.                 LPABLOGON           lpABPLogon,
  498.                 LPCIID              lpInterface,
  499.                 HINSTANCE           hLibrary,
  500.                 LPALLOCATEBUFFER    lpAllocBuff,
  501.                 LPALLOCATEMORE      lpAllocMore,
  502.                 LPFREEBUFFER        lpFreeBuff,
  503.                 LPMALLOC            lpMalloc );
  504.  
  505. /*
  506.  * Creates a new templateID object that's associated with
  507.  * a SAB mailuser object.
  508.  */
  509. HRESULT
  510. HrNewTID (  LPMAPIPROP *        lppMAPIPropNew,
  511.             ULONG               cbTemplateId,
  512.             LPENTRYID           lpTemplateId,
  513.             ULONG               ulTemplateFlags,
  514.             LPMAPIPROP          lpMAPIPropData,
  515.             LPABLOGON           lpABPLogon,
  516.             LPCIID              lpInterface,
  517.             HINSTANCE           hLibrary,
  518.             LPALLOCATEBUFFER    lpAllocBuff,
  519.             LPALLOCATEMORE      lpAllocMore,
  520.             LPFREEBUFFER        lpFreeBuff,
  521.             LPMALLOC            lpMalloc );
  522.  
  523.  
  524. /*
  525.  *  Creates a new contents table object
  526.  */
  527. HRESULT
  528. HrNewIVTAbc (LPMAPITABLE *      lppIVTAbc,
  529.              LPABLOGON          lpABLogon,
  530.              LPABCONT           lpABC,
  531.              HINSTANCE          hLibrary,
  532.              LPALLOCATEBUFFER   lpAllocBuff,
  533.              LPALLOCATEMORE     lpAllocMore,
  534.              LPFREEBUFFER       lpFreeBuff,
  535.              LPMALLOC           lpMalloc );
  536.  
  537. /*
  538.  *  Creates/Updates the SAB's root hierarchy
  539.  */
  540. HRESULT
  541. HrBuildRootHier(LPABLOGON lpABLogon, LPMAPITABLE * lppMAPITable);
  542.  
  543.  
  544. /*
  545.  *  Sets an error string associated with a particular hResult on an object.
  546.  *  It's used in conjunction with the method GetLastError.
  547.  */
  548. VOID SetErrorIDS (LPVOID lpObject, HRESULT hResult, UINT ids);
  549.  
  550.  
  551. /*
  552.  *  Loads a string from a resource.  Optionally allocates room for the string
  553.  *  if lpAllocBuff is not NULL.  See ABP.C.
  554.  */
  555. SCODE ScLoadString( UINT                ids,
  556.                     ULONG               ulcch,
  557.                     LPALLOCATEBUFFER    lpAllocBuff,
  558.                     HINSTANCE           hLibrary,
  559.                     LPSTR *             lppsz);
  560.  
  561. /*
  562.  *  The sample ABPs MAPIUID
  563.  *
  564.  *  This MAPIUID must be unique (see the Service Provider Writer's Guide on
  565.  *  Constructing Entry IDs)
  566.  */
  567. #define MUIDABSAMPLE {0x81,0x2b,0x1f,0x40,0xbe,0xa3,0x10,0x19,0x9d,0x6e,0x00,0xdd,0x01,0x0f,0x54,0x02}
  568.  
  569. #define SZEMAILTYPE                         "MSPEER"
  570. #define MAX_DISPLAY_NAME                    45
  571.  
  572. /*
  573.  *  Browse record
  574.  *
  575.  *  The .SAB files are made up of the following records.
  576.  */
  577.  
  578. #define MAX_NAME_SIZE   30
  579. #define MAX_EMA_SIZE    50
  580.  
  581. #pragma pack(4)
  582. typedef struct _ABCREC
  583. {
  584.  
  585.     char rgchDisplayName[MAX_NAME_SIZE + 1];
  586.     char rgchEmailAddress[MAX_EMA_SIZE + 1];
  587.  
  588. } ABCREC, *LPABCREC;
  589. #pragma pack()
  590.  
  591. /*
  592.  *  Defines of various entryid types
  593.  */
  594. #define SAMP_DIRECTORY  0x00000000
  595. #define SAMP_USER       0x00000001
  596. #define SAMP_UNKNOWN    0x00000002
  597. #define SAMP_OOUSER     0x00000003
  598.  
  599. /*
  600.  *  The version of this ABPs entryids
  601.  */
  602. #define SAMP_VERSION    0x000000002
  603.  
  604. /*
  605.  *  Directory entry id structure
  606.  *
  607.  *  This entryid is permanent.
  608.  */
  609. typedef struct _dir_entryid
  610. {
  611.  
  612.     BYTE abFlags[4];
  613.     MAPIUID muid;
  614.     ULONG ulVersion;
  615.     ULONG ulType;
  616.     MAPIUID muidID;
  617.  
  618. } DIR_ENTRYID, *LPDIR_ENTRYID;
  619.  
  620. /*
  621.  *  Mail user entry id structure
  622.  *
  623.  *  This entryid is permanent.
  624.  */
  625. #pragma pack(4)
  626. typedef struct _usr_entryid
  627. {
  628.  
  629.     BYTE abFlags[4];
  630.     MAPIUID muid;
  631.     ULONG ulVersion;
  632.     ULONG ulType;
  633.     ABCREC abcrec;
  634.  
  635. } USR_ENTRYID, *LPUSR_ENTRYID;
  636. #pragma pack()
  637.  
  638. /*
  639.  *  One off user entry id structure
  640.  *
  641.  *  This entryid is permanent.
  642.  */
  643. typedef struct _oousr_entryid
  644. {
  645.     BYTE abFlags[4];
  646.     MAPIUID muid;
  647.     ULONG ulVersion;
  648.     ULONG ulType;
  649.  
  650. } OOUSR_ENTRYID, *LPOOUSR_ENTRYID;
  651.  
  652.  
  653. /*
  654.  *  Externs used throughout various modules within this provider.
  655.  *  They actually get defined in abp.c
  656.  */
  657.  
  658. extern LCID lcidUser;
  659.  
  660. extern MAPIUID muidABSample;
  661.  
  662. extern MAPIUID muidSABProviderID;
  663.  
  664. extern DTBLLABEL dtbllabel;
  665.  
  666. extern DTBLPAGE dtblpage;
  667.  
  668. extern DTBLGROUPBOX dtblgroupbox;
  669.  
  670. extern CHAR szNoFilter[];
  671.  
  672. extern LPSTR lpszEMT;
  673.  
  674. extern CHAR szAddrTypeFilter[];
  675.  
  676. extern CHAR szFileNameFilter[];
  677.  
  678. #define PR_LISTBOX_TABLE                PROP_TAG(PT_OBJECT,0x6605)
  679. #define PR_COMBOBOX_TABLE               PROP_TAG(PT_OBJECT,0x6607)
  680. #define PR_DDLISTBOX_TABLE              PROP_TAG(PT_OBJECT,0x6609)
  681.  
  682.  
  683. /*
  684.  *  Properties defined for our one-off entry
  685.  */
  686. #define     PR_SERVER_NAME              PROP_TAG(PT_TSTRING,0x660b)
  687. #define     PR_SHARE_NAME               PROP_TAG(PT_TSTRING,0x660c)
  688. #define     PR_PATH_NAME                PROP_TAG(PT_TSTRING,0x660d)
  689.  
  690. #define MAX_SERVER_NAME                 15
  691. #define MAX_SHARE_NAME                  12
  692.  
  693. /*
  694.  *  MACROs for Win16
  695.  */
  696.  
  697. #ifdef WIN16
  698.  
  699.  
  700. #define lstrcatA        lstrcat
  701. #define wsprintfA       wsprintf
  702. #define CharUpperBuffA  CharUpperBuff
  703.  
  704. #endif /*WIN16*/
  705.