home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / dapi.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  69.4 KB  |  1,333 lines

  1. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  2.  
  3. /*******************************************************************
  4.  *
  5.  * Copyright (c) Microsoft Corp. 1986-1996. All Rights Reserved.
  6.  *
  7.  *
  8.  *    DESCRIPTION:   This header file defines the functions, structures,
  9.  *                   and macros used to access the Microsoft Exchange
  10.  *                   APIs for modifying entries in the Exchange 4.0 DIT.
  11.  *                   These APIs permit a calling process to create, 
  12.  *                   modify, or delete DIT objects by specifying the
  13.  *                   name of a CSV text file containing attributes 
  14.  *                   for objects to import into ( or to modify) 
  15.  *                   the DIT.  See the Directory Access Functions
  16.  *                   section of the Exchange Developer's Kit for 
  17.  *                   more detailed description of this interface.
  18.  *                   
  19.  *                   Calling programs must link with DAPI.LIB.
  20.  *                   
  21.  *                   Error and warning codes are defined in DAPIMSG.H
  22.  *
  23.  *
  24.  *******************************************************************/
  25.  
  26. /** include files **/
  27. #ifndef _WINDOWS_
  28. #include <windows.h>
  29. #endif
  30.  
  31. /** local definitions **/
  32.  
  33. #ifndef  _DAPI_INCLUDED_
  34. #define  _DAPI_INCLUDED_
  35.  
  36. #ifdef __cplusplus
  37. extern "C"
  38. {
  39. #endif
  40.  
  41. // Import / Export APIs check for the presence of this signature in 
  42. // the dwDAPISignature field in the import parameter blocks.
  43. // This signature will be incremented each time one of the parameter
  44. // blocks is changed so that header synchronization problems can be 
  45. // detected.
  46. #define  DAPI_SIGNATURE                   0x46414400
  47.  
  48.  
  49. // Combinable flags used to control the API functions.
  50.  
  51.    // The following flags control filtering of DAPI events
  52.    // The default action is DAPI_EVENT_ALL
  53. #define DAPI_EVENT_MASK                   0x00000007  /* bit-field containing event-filtering requested 
  54.                                                          if none of these bits are set, DAPI_EVENT_ALL is assumed */
  55. #define DAPI_EVENT_MIN                    0x00000001  /* No warning or error logging.
  56.                                                          Log start and stop messages */
  57. #define DAPI_EVENT_SOME                   0x00000002  /* Start, Stop, and Error messages will be logged. */
  58. #define DAPI_EVENT_ALL                    0x00000004  /* Start, Stop, Error, and Warning messages
  59.                                                          will be logged. */
  60.                                                          
  61.    // The following flags control schema read and use of the schema
  62. #define DAPI_FORCE_SCHEMA_LOAD            0x00000010  /* Unload previously loaded schema
  63.                                                          and read schema again.
  64.                                                          Default action is to re-use
  65.                                                          previously loaded schema if read
  66.                                                          from the same messaging domain */
  67. #define DAPI_RAW_MODE                     0x00000020  /* Import / Export in "Raw" mode.  Import
  68.                                                          lines are taken literally.  No
  69.                                                          attributes will be inherited, 
  70.                                                          constructed, etc.  Aliases for 
  71.                                                          attribute and class names will
  72.                                                          not be recognized. */
  73.                                                          
  74. #define DAPI_OVERRIDE_CONTAINER           0x00000040  /* Container specified in the parameter block
  75.                                                          overrides the contents of the container column.
  76.                                                          Default behaviour is for the value specified
  77.                                                          in the Obj-Container column to override
  78.                                                          that specified in the parameter block */
  79.                                                  
  80. #define DAPI_IMPORT_NO_ERR_FILE           0x00000080  /* Do not create Error File -- BatchImport only */
  81. #define DAPI_IMPORT_WRITE_THROUGH         0x00400000  /* Commit write operations immediately */
  82.  
  83. // Flags defined for "Batch" operations only -- ignored by DAPIRead, DAPIWrite
  84. #define DAPI_YES_TO_ALL                   0x00000100  /* Force "yes" response on any
  85.                                                          user-prompt UI 
  86.                                                          (i.e., continue w/o proxy addresses, etc.) */
  87.  
  88. #define DAPI_SUPPRESS_PROGRESS            0x00000200  /* Suppress progress thermometer on batch operations.
  89.                                                          Default is to display progress */
  90. #define DAPI_SUPPRESS_COMPLETION          0x00000400  /* Suppress completion notification message box on batch operations */
  91.                                                          
  92. #define DAPI_SUPPRESS_ARCHIVES            0x00000800  /* Suppress creation of "archive" copies
  93.                                                          of output files -- BatchImport and BatchExport only*/
  94.                                                          
  95.  
  96.  
  97. // Flags defined for BatchExport
  98. #define DAPI_EXPORT_MAILBOX               0x00001000  /* Export Mailbox recipients */
  99. #define DAPI_EXPORT_CUSTOM                0x00002000  /* Export remote address recipients */
  100. #define DAPI_EXPORT_DIST_LIST             0x00004000  /* Export Distribution Lists */
  101. #define DAPI_EXPORT_RECIPIENTS       (DAPI_EXPORT_MAILBOX | DAPI_EXPORT_CUSTOM | DAPI_EXPORT_DIST_LIST)
  102.                                                       /* Export all recipient objects */
  103.  
  104. #define DAPI_EXPORT_ALL_CLASSES           0x00008000  /* If this flag is set, all objects meeting other restrictions
  105.                                                          (i.e., USN level, container scope, etc.) will be exported,
  106.                                                          regardless of class */
  107.  
  108. #define DAPI_EXPORT_HIDDEN                0x00010000  /* Include Hidden objects in export.
  109.                                                                       Default is no export if Hide-From-Address-Book */
  110. #define DAPI_EXPORT_SUBTREE               0x00020000  /* Traverse the Directory Information Tree hierarchy,
  111.                                                          exporting objects that meet the export restrictions */
  112. #define DAPI_EXPORT_BASEPOINT_ONLY        0x00040000  /* Export only the requested attributes from
  113.                                                          the named BasePoint object.  All other 
  114.                                                          export restrictions are ignored (class flags, 
  115.                                                          rgpszClasses, pszServerName). 
  116.                                                          This flag implies DAPI_SUPPRESS_PROGRESS
  117.                                                          and DAPI_SUPPRESS_COMPLETION */
  118.  
  119. // Flags defined only for BatchImport
  120. #define DAPI_OVERRIDE_SYNCH_STATE         0x00080000  /* Override server's synchronization status,
  121.                                                          normally checked on BatchImport.
  122.                                                          NOTE:  This flag should normally NOT be set.
  123.                                                                 The normal behaviour is to prevent BatchImport
  124.                                                                 operations from possible conflict with directory
  125.                                                                 synchronization */
  126.  
  127.  
  128. // Flags defined only for DAPIRead                                                         
  129. #define  DAPI_READ_DEFINED_ATTRIBUTES     0x00100000  /* return all attributes that are set
  130.                                                          for the current object. 
  131.                                                          This flag is ignored if pAttributes is specified. */
  132.  
  133. #define  DAPI_READ_ALL_ATTRIBUTES         0x00200000  /* return all attributes that are defined
  134.                                                          for the class of the current object. 
  135.                                                          This flag is ignored if pAttributes is specified. */
  136.  
  137.  
  138.  // The following flags control NT Security management
  139. #define DAPI_RESTRICT_ACCESS              0x01000000  /* Apply NT Security Descriptor to 
  140.                                                          created objects */
  141. #define DAPI_CREATE_NT_ACCOUNT            0x02000000  /* Create NT accounts 
  142.                                                          (valid only in Create/Modify mode) */
  143. #define DAPI_CREATE_RANDOM_PASSWORD       0x04000000  /* Generate random passwords for
  144.                                                          created NT accounts.  Ignored if DAPI_CREATE_NT_ACCOUNT
  145.                                                          is not set */
  146.                                                          
  147. #define DAPI_DELETE_NT_ACCOUNT            0x08000000  /* Delete ASSOC-NT-ACCOUNT when
  148.                                                          deleting mailbox */
  149. // Flags defined only for DAPIWrite
  150. #define DAPI_MODIFY_REPLACE_PROPERTIES    0x00800000  /* Append values to multi-value attributes when modifying */
  151.  
  152. #define  DAPI_WRITE_UPDATE                0x10000000  /* Modify if object exists, create if it doesn't.
  153.                                                          NOTE:  This is the default mode */
  154. #define  DAPI_WRITE_CREATE                0x20000000  /* Create object -- fail if object exists */
  155. #define  DAPI_WRITE_MODIFY                0x30000000  /* Modify object -- fail if object does not exist */
  156. #define  DAPI_WRITE_DELETE                0x40000000  /* Delete object */
  157. #define  DAPI_WRITE_MODE_MASK             0x70000000
  158.  
  159.  
  160.  
  161. // Callback flags
  162. #define  DAPI_CALLBACK_CHAIN              0x00000001  /* If set in dwFlags field of the ERROR_CALLBACK
  163.                                                          and the CALLBACKPROGRESS structures, the default
  164.                                                          handler will be invoked after calling out to the 
  165.                                                          caller-supplied handler function, unless the user
  166.                                                          function returns FALSE, indicating cancel.
  167.                                                          NOTE:  This flag is not defined for the EXPORT_CALLBACK
  168.                                                                 structure.
  169.                                                          NOTE:  This flag should not be set in the dwFlags
  170.                                                                 field of the main parameter block */
  171.  
  172.  
  173. // default delimiter values used when parsing the import file
  174.  
  175. #define DAPI_DEFAULT_DELIMA   ','
  176. #define DAPI_DEFAULT_QUOTEA   '"'
  177. #define DAPI_DEFAULT_MV_SEPA  '%'
  178. #define DAPI_DEFAULT_DELIMW   L','
  179. #define DAPI_DEFAULT_QUOTEW   L'"'
  180. #define DAPI_DEFAULT_MV_SEPW  L'%'
  181.  
  182.  
  183. #define DAPI_CTRL_FILE_PTRA   '='
  184. #define DAPI_CTRL_FILE_PTRW   L'='
  185. #define DAPI_CTRL_ANR_PREFIXA '='
  186. #define DAPI_CTRL_ANR_PREFIXW L'='
  187. #define DAPI_CTRL_META_CHARA  '~'
  188. #define DAPI_CTRL_META_CHARW  L'~'
  189. #define pszSubstServerA       "~SERVER"
  190. #define pszSubstServerW       L"~SERVER"
  191. #define cchSubstServer        ((sizeof (pszSubstServerA) / sizeof(CHAR)) - 1)
  192. #define pszDeleteKeyA         "~DEL"
  193. #define pszDeleteKeyW         L"~DEL"
  194. #define cchDeleteKey          ((sizeof (pszDeleteKeyA) / sizeof(CHAR)) - 1)
  195.  
  196. #define DAPI_UNICODE_FILE     ((UINT)-1)
  197.  
  198. #ifdef UNICODE
  199.  
  200. #define DAPI_DEFAULT_DELIM    DAPI_DEFAULT_DELIMW
  201. #define DAPI_DEFAULT_QUOTE    DAPI_DEFAULT_QUOTEW
  202. #define DAPI_DEFAULT_MV_SEP   DAPI_DEFAULT_MV_SEPW
  203. #define DAPI_CTRL_FILE_PTR    DAPI_CTRL_FILE_PTRW
  204. #define DAPI_CTRL_ANR_PREFIX  DAPI_CTRL_ANR_PREFIXW
  205. #define DAPI_CTRL_META_CHAR   DAPI_CTRL_META_CHARW
  206. #define pszSubstServer        pszSubstServerW
  207. #define pszDeleteKey          pszDeleteKeyW
  208.  
  209. #else
  210.  
  211. #define DAPI_DEFAULT_DELIM    DAPI_DEFAULT_DELIMA
  212. #define DAPI_DEFAULT_QUOTE    DAPI_DEFAULT_QUOTEA
  213. #define DAPI_DEFAULT_MV_SEP   DAPI_DEFAULT_MV_SEPA
  214. #define DAPI_CTRL_FILE_PTR    DAPI_CTRL_FILE_PTRA
  215. #define DAPI_CTRL_ANR_PREFIX  DAPI_CTRL_ANR_PREFIXA
  216. #define DAPI_CTRL_META_CHAR   DAPI_CTRL_META_CHARA
  217. #define pszSubstServer        pszSubstServerA
  218. #define pszDeleteKey          pszDeleteKeyA
  219.  
  220. #endif
  221.  
  222.  
  223. /*******************************************************************************
  224. * Batch Operation Progress Callback Function Definitions
  225. * Pointers to functions of these types are provided by the caller via the 
  226. * CALLBACKPROGRESS structure in the Batch function parameter block
  227. *               
  228. ********************************************************************************
  229. *               
  230. *  procedure :  PDAPI_FInitProgress
  231. *               
  232. *    purpose :  Initialize progress handler (possibly progress display dialog)
  233. *               
  234. * parameters :  lpvAppDefined value provided in the progress callback structure
  235. *               nMac          Maximum Anticipated Calls.  If non-zero, this indicates
  236. *                             the number of progress events anticipated.
  237. *                             If zero, the number of items to process is unknown,
  238. *                             so the number of calls to UpdateProgress is indeterminate.
  239. *               
  240. *    returns :  TRUE    Indicates that all is well
  241. *               FALSE   Could not initialize progress handler, cancel session.
  242. *               
  243. ********************************************************************************
  244. *               
  245. *  procedure :  PDAPI_FResetProgress
  246. *               
  247. *    purpose :  Re-initialize progress handler (possibly reset progress bar)
  248. *               
  249. * parameters :  lpvAppDefined value provided in the progress callback structure
  250. *               nMac          Maximum Anticipated Calls.  If non-zero, this indicates
  251. *                             the number of progress events anticipated.
  252. *                             If zero, the number of items to process is unknown,
  253. *                             so the number of calls to UpdateProgress is indeterminate.
  254. *               
  255. *    returns :  TRUE    Indicates that all is well
  256. *               FALSE   Could not re-initialize progress handler, cancel session.
  257. *               
  258. ********************************************************************************
  259. *               
  260. *  procedure :  PDAPI_FEndProgress
  261. *               
  262. *    purpose :  Terminate progress handler (possibly progress display dialog)
  263. *               
  264. * parameters :  lpvAppDefined value provided in the progress callback structure
  265. *               
  266. *    returns :  TRUE    Indicates that all is well
  267. *               FALSE   Could not terminate progress handler, cancel session.
  268. *               
  269. ********************************************************************************
  270. *               
  271. *  procedure :  PDAPI_FUpdateProgress
  272. *               
  273. *    purpose :  Completed processing item.  Called to indicate time to increment
  274. *               progress display.
  275. *               
  276. * parameters :  lpvAppDefined value provided in the progress callback structure
  277. *               
  278. *    returns :  TRUE    Indicates that all is well
  279. *               FALSE   Cancel session (i.e., cancel button pressed).
  280. *               
  281. ********************************************************************************
  282. *               
  283. *  procedure :  PDAPI_FUpdateProgressText
  284. *               
  285. *    purpose :  Replace progress text area with provided text string
  286. *               
  287. * parameters :  lpvAppDefined value provided in the progress callback structure
  288. *               
  289. *    returns :  TRUE    Indicates that all is well
  290. *               FALSE   Cancel session (i.e., cancel button pressed).
  291. *               
  292. ********************************************************************************/
  293. typedef BOOL (PASCAL * PDAPI_FInitProgress)
  294.                           (LPVOID lpvAppDefined, INT nMac);
  295. typedef BOOL (PASCAL * PDAPI_FUpdateProgress)
  296.                           (LPVOID lpvAppDefined);
  297. typedef BOOL (PASCAL * PDAPI_FEndProgress)
  298.                           (LPVOID lpvAppDefined);
  299. typedef BOOL (PASCAL * PDAPI_FResetProgress)
  300.                           (LPVOID lpvAppDefined, INT nMac);
  301. typedef BOOL (PASCAL * PDAPI_FUpdateProgressText)
  302.                           (LPVOID lpvAppDefined, LPTSTR pszText);
  303.             
  304. typedef struct CallBackProgressEntryPoints
  305. {
  306.    DWORD                      dwFlags;
  307.    LPVOID                     lpvAppDefined;
  308.    PDAPI_FInitProgress        pfnInitProgress;
  309.    PDAPI_FUpdateProgress      pfnUpdateProgress;
  310.    PDAPI_FEndProgress         pfnEndProgress;
  311.    PDAPI_FResetProgress       pfnResetProgress;
  312.    PDAPI_FUpdateProgressText  pfnUpdateProgressText;
  313. } CALLBACKPROGRESS, *PCALLBACKPROGRESS;
  314.  
  315.  
  316.  
  317. // Values specified in the ulEvalTag field of the 
  318. //    DAPI_ENTRY and EXPORT_CALLBACK structures
  319. //    
  320. typedef enum _DAPI_EVAL
  321. {
  322.    VALUE_ARRAY = 0,           // Each attribute has an entry in the array
  323.                               //    Text strings and object names exported as text
  324.                               //    Numerical values exported as numbers
  325.                               //    Binary data exported as binary string
  326.    TEXT_VALUE_ARRAY,          // Each attribute has an entry in the array
  327.                               //    All values converted to text representation
  328.    TEXT_LINE                  // first item in the rgEntryValues array
  329.                               //    is a delimited text line
  330. } DAPI_EVAL, *PDAPI_EVAL;
  331.  
  332. typedef enum _EXP_TYPE_TAG
  333. {
  334.    EXPORT_HEADER = 0,         // export item contains column headers
  335.    EXPORT_ENTRY               // export item contains attribute values
  336. } EXP_TYPE, * PEXP_TYPE;
  337.  
  338.  
  339. typedef enum enumDAPI_DATA_TYPE
  340. {
  341.    DAPI_NO_VALUE = 0,
  342.    DAPI_STRING8,
  343.    DAPI_UNICODE,
  344.    DAPI_BINARY,
  345.    DAPI_INT,
  346.    DAPI_BOOL,
  347. } DAPI_DATA_TYPE, * PDAPI_DATA_TYPE;
  348.  
  349. #ifdef UNICODE
  350. #define DAPI_TEXT DAPI_UNICODE
  351. #else
  352. #define DAPI_TEXT DAPI_STRING8
  353. #endif
  354.  
  355. typedef union _DAPI_VALUE
  356. {
  357.    LPSTR    pszA;
  358.    LPWSTR   pszW;
  359. #ifdef UNICODE
  360.    LPWSTR   pszValue;
  361. #else
  362.    LPSTR    pszValue;
  363. #endif
  364.    LPBYTE   lpBinary;
  365.    INT      iValue;
  366. #ifdef __BORLANDC__
  367.    BOOL     _bool;
  368. #else
  369.    BOOL     bool;
  370. #endif
  371. } DAPI_VALUE, * PDAPI_VALUE;
  372.  
  373.  
  374.  
  375. // The ATT_VALUE structure contains a text representation of an attribute value
  376. // A linked list of these structures is used for a multi-valued attribute
  377. typedef struct _ATT_VALUE
  378. {
  379.    DAPI_DATA_TYPE       DapiType;         // How to evaluate DAPI_VALUE union
  380.    DAPI_VALUE           Value;
  381.    UINT                 size;             // size of the value -- 
  382.                                           //    # chars if string type
  383.                                           //    else, # bytes
  384.    struct _ATT_VALUE *  pNextValue;
  385. } ATT_VALUE, * PATT_VALUE;
  386.  
  387.  
  388. typedef struct _DAPI_ENTRY
  389. {
  390.    UINT           unAttributes;              // Number of attributes exported
  391.    DAPI_EVAL      ulEvalTag;                 // rgEntryValues is interpreted based on this value
  392.    PATT_VALUE     rgEntryValues;             // if (ulEvalTag == TEXT_LINE)
  393.                                              //    There is a single value, w/ delimited line
  394.                                              // else
  395.                                              //    unAttributes, each w/ 1 or more value in list
  396. } DAPI_ENTRY, * PDAPI_ENTRY;
  397.  
  398. // Define type for address of application routine 
  399. // for call-back on each exported entry.
  400. // Return value of FALSE indicates that export operation should be cancelled
  401. typedef BOOL (PASCAL DAPI_FNExportEntry) (
  402.                EXP_TYPE    ExportDataType,   // What type of data is being exported
  403.                LPVOID      lpvAppDefined,    // Application-defined parameter,
  404.                                              // passed in EXPORT_CALLBACK structure
  405.                                              // on initialization
  406.                PDAPI_ENTRY pExportEntry      // pointer to exported entry data
  407.                                              // NOTE: Data in this structure
  408.                                              // will NOT remain valid after return
  409.                                              // from this function
  410.                );
  411. typedef DAPI_FNExportEntry * PDAPI_FNExportEntry;
  412.  
  413. typedef struct _EXPORT_CALLBACK
  414. {
  415.    DWORD       dwFlags;                      // Flags defined to control callback functionality
  416.                                              // See flag definitions below
  417.    DAPI_EVAL   ulEvalTag;                    // Specifies data format on callback
  418.    LPVOID      lpvAppDefined;                // Application-defined field, passed as parm to callback
  419.    PDAPI_FNExportEntry  pfnExportEntry;      // Pointer to function called to process
  420.                                              // each exported entry
  421.  
  422. } EXPORT_CALLBACK, * PEXPORT_CALLBACK;
  423.  
  424.  
  425.  
  426. /*******************************************************************************
  427. *  procedure :  pfnErrorCallback
  428. *               
  429. *    purpose :  The following section defines structures for the error callback
  430. *               mechanism of the Batch Import APIs
  431. *               Events will be filtered based on the ControlfFlags set in the 
  432. *               API parameter block
  433. *               
  434. ********************************************************************************/
  435.  
  436. // Define flags used for export callback
  437.  
  438. // Define the maximum number of substitutions in a single event string
  439. #define DAPI_MAX_SUBST 8
  440.  
  441.  
  442. typedef struct _DAPI_EVENTA
  443. {
  444.    DWORD             dwDAPIError;            // Message ID for event log
  445.    LPSTR             rgpszSubst[DAPI_MAX_SUBST];   // Event message substitution array
  446.    UINT              unSubst;                // number of substitution strings
  447.    LPSTR             pszAttribute;           // Name of attribute specifically affected
  448.                                              //    Note:  may be NULL on some errors
  449.    LPSTR             pszHoldLine;            // point to buffer containing copy
  450.                                              //    of current import line
  451.    HINSTANCE         hinstDAPI;              // Instance of DAPI DLL
  452.    struct _DAPI_EVENTA * pNextEvent;       // Pointer to next event
  453. } DAPI_EVENTA, *PDAPI_EVENTA;
  454.  
  455. typedef struct _DAPI_EVENTW
  456. {
  457.    DWORD             dwDAPIError;            // Message ID for event log
  458.    LPWSTR            rgpszSubst[DAPI_MAX_SUBST];   // Event message substitution array
  459.    UINT              unSubst;                // number of substitution strings
  460.    LPWSTR            pszAttribute;           // Name of attribute specifically affected
  461.                                              //    Note:  may be NULL on some errors
  462.    LPWSTR            pszHoldLine;            // point to buffer containing copy
  463.                                              //    of current import line
  464.    HINSTANCE         hinstDAPI;              // Instance of DAPI DLL
  465.    struct _DAPI_EVENTW * pNextEvent;       // Pointer to next event
  466. } DAPI_EVENTW, *PDAPI_EVENTW;
  467.  
  468. #ifdef UNICODE
  469. typedef DAPI_EVENTW  DAPI_EVENT;
  470. typedef PDAPI_EVENTW PDAPI_EVENT;
  471. #else
  472. typedef DAPI_EVENTA  DAPI_EVENT;
  473. typedef PDAPI_EVENTA PDAPI_EVENT;
  474. #endif
  475.  
  476. // Define type for address of application routine 
  477. // for call-back on each error encountered.
  478. // Return value of FALSE indicates that operation should be cancelled
  479. typedef BOOL (PASCAL DAPI_FNErrorCallback) (
  480.                LPVOID      lpvAppDefined,    // Application-defined parameter,
  481.                                              // passed in EXPORT_CALLBACK structure
  482.                                              // on initialization
  483.                PDAPI_EVENT pDapiEvent        // Event information structure
  484.                                              // NOTE: Data in the event record
  485.                                              // will NOT remain valid after return
  486.                                              // from this function
  487.                );
  488. typedef DAPI_FNErrorCallback * PDAPI_FNErrorCallback;
  489.  
  490.  
  491. typedef struct tagERROR_CALLBACK
  492. {
  493.    DWORD                   dwFlags;          // Flags defined to control callback functionality
  494.                                              // See flag definitions above
  495.    LPVOID                  lpvAppDefined;    // Application-defined field, passed back in callback
  496.    PDAPI_FNErrorCallback   pfnErrorCallback; // Address of function that should be
  497.                                              // called on each error encountered
  498.                                              // If not supplied (NULL), default
  499.                                              // error handler is called, which
  500.                                              // writes the error into the 
  501.                                              // NT Application event log
  502.  
  503. } ERROR_CALLBACK, * PERROR_CALLBACK;
  504.  
  505.  
  506.  
  507.  
  508.  
  509. /*******************************************************************************
  510. *  
  511. *   Batch Directory Import Interface definitions
  512. *               
  513. ********************************************************************************/
  514.  
  515. /*******************************************************************************
  516. *  procedure :  DAPIUninitialize
  517. *               
  518. *    purpose :  Notify DAPI that it is time to terminate background threads
  519. *               and such in preparation for process shutdown
  520. *               
  521. * parameters :  dwFlags        combinable bits which may be set to control function
  522. *               
  523. *    returns :  nothing
  524. *               
  525. *    created :  11/01/95 
  526. *               
  527. *    changes :  
  528. *               
  529. ********************************************************************************/
  530. extern void APIENTRY DAPIUninitialize (
  531.                               DWORD    dwFlags // Flags for call
  532. );
  533.  
  534.  
  535.  
  536. /*******************************************************************************
  537. *  procedure :  SchemaPreload
  538. *               
  539. *    purpose :  Called to perform asyncronous schema load.  This entry point
  540. *               spawns a thread that initializes all the attribute and class
  541. *               tables for normal import/export operation.
  542. *               
  543. * parameters :  pSchemaPreloadParms    pointer to SchemaPreloadParameter block
  544. *               
  545. *    returns :  nothing
  546. *               
  547. *    history :  
  548. *               
  549. ********************************************************************************/
  550. extern void APIENTRY SchemaPreloadA (
  551.                               DWORD    dwFlags, // Flags used to control schema load.
  552.                               LPSTR    pszDSA   // name of DSA from which to read schema
  553. );
  554.  
  555. extern void APIENTRY SchemaPreloadW (
  556.                               DWORD    dwFlags, // Flags used to control schema load.
  557.                               LPWSTR   pszDSA   // name of DSA from which to read schema
  558. );
  559.  
  560. #ifdef UNICODE
  561. #define  SchemaPreload  SchemaPreloadW
  562. #else
  563. #define  SchemaPreload  SchemaPreloadA
  564. #endif
  565.  
  566. typedef struct _BIMPORT_PARMSW
  567. {
  568.    // NOTE:  the order of the first three fields of this structure 
  569.    //       should NOT be changed.
  570.    DWORD    dwDAPISignature;
  571.    DWORD    dwFlags;             // Bitmapped flags that control import action
  572.    HWND     hwndParent;                // Windows handle to use when displaying message boxes
  573.    LPWSTR   pszImportFile;       // Fully qualified pathname to Import Data file
  574.                                  //   On Batch Import, objects are imported into
  575.                                  //   the DIT from this file.
  576.    UINT     uCodePage;           // Code page specification for import file.
  577.                                  // The following values are interpreted:
  578.                                  // DAPI_UNICODE_FILE    Import file is Unicode
  579.                                  //                        Will return error if file is ANSI
  580.                                  // 0                    Auto-detect file type
  581.                                  //                        If ANSI, assume CP_ACP
  582.                                  // other                File contains text in the
  583.                                  //                        specified code page
  584.                                  //                        Will return error if file is Unicode
  585.                                  //                      Will return error if code page is not
  586.                                  //                        supported by the system
  587.    LPWSTR   pszDSAName;          // Computer name of DSA to update
  588.                                  //    Default:  local DSA (if operating)
  589.                                  //              if no local DSA, first DSA found 
  590.                                  //              on network is used
  591.    LPWSTR   pszBasePoint;        // DN of base-point in DIT for bulk operations
  592.                                  //    Default values:
  593.                                  //       if NULL, Messaging Site containing bound server
  594.                                  //       if empty string, enterprise containing bound server
  595.    LPWSTR   pszContainer;        // RDN of default container under which
  596.                                  //    to perform bulk import operations
  597.                                  //    NOTE:  This container is assumed to be
  598.                                  //          at the level below that indicated by
  599.                                  //          the pszBasePoint.  If NULL, 
  600.                                  //          bulk operations will be performed at
  601.                                  //          the level below BaseImportPoint.
  602.                                  //          Container names specified in the 
  603.                                  //          import file will override this value.
  604.    WCHAR    chColSep;            // Column Separator -- 
  605.                                  //    DEFAULT_DELIM is used if this value is zero
  606.    WCHAR    chQuote;             // String enclosing character -- 
  607.                                  //    DEFAULT_QUOTE is used if this value is zero
  608.    WCHAR    chMVSep;             // Multi-value Property Separator --
  609.                                  //    DEFAULT_MV_SEP is used if this value is zero
  610.    WCHAR    creserved;           // alignment
  611.    CALLBACKPROGRESS  ProgressCallBacks;    // Progress call-back entry points
  612.    ERROR_CALLBACK    ErrorCallback;
  613.    
  614.    LPWSTR   pszNTDomain;         // Name of NT Domain in which to lookup / create NT accounts.
  615.                                  //    Defaults to current logon domain if NULL or empty
  616.    LPWSTR   pszCreateTemplate;   // DN of the Default User (NULL if none) from which
  617.                                  //    to draw template values
  618.  
  619. } BIMPORT_PARMSW, *PBIMPORT_PARMSW, *LPBIMPORT_PARMSW;
  620.  
  621. typedef struct _BIMPORT_PARMSA
  622. {
  623.    // NOTE:  the order of the first three fields of this structure 
  624.    //       should NOT be changed.
  625.    DWORD    dwDAPISignature;
  626.    DWORD    dwFlags;             // Bitmapped flags that control import action
  627.    HWND     hwndParent;          // Windows handle to use when displaying message boxes
  628.    LPSTR    pszImportFile;       // Fully qualified pathname to Import Data file
  629.                                  //   On Batch Import, objects are imported into
  630.                                  //   the DIT from this file.
  631.    UINT     uCodePage;           // Code page specification for import file.
  632.                                  // The following values are interpreted:
  633.                                  // DAPI_UNICODE_FILE    Import file is Unicode
  634.                                  //                        Will return error if file is ANSI
  635.                                  // 0                    Auto-detect file type
  636.                                  //                        If ANSI, assume CP_ACP
  637.                                  // other                File contains text in the
  638.                                  //                        specified code page
  639.                                  //                        Will return error if file is Unicode
  640.                                  //                      Will return error if code page is not
  641.                                  //                        supported by the system
  642.    LPSTR    pszDSAName;          // Computer name of DSA to update
  643.                                  //    Default:  local DSA (if operating)
  644.                                  //              if no local DSA, first DSA found 
  645.                                  //              on network is used
  646.    LPSTR    pszBasePoint;        // DN of base-point in DIT for bulk operations
  647.                                  //    Default values:
  648.                                  //       if NULL, Messaging Site containing bound server
  649.                                  //       if empty string, enterprise containing bound server
  650.    LPSTR    pszContainer;        // RDN of default container under which
  651.                                  //    to perform bulk import operations
  652.                                  //    NOTE:  This container is assumed to be
  653.                                  //          at the level below that indicated by
  654.                                  //          the pszBasePoint.  If NULL, 
  655.                                  //          bulk operations will be performed at
  656.                                  //          the level below BaseImportPoint.
  657.                                  //          Container names specified in the 
  658.                                  //          import file will override this value.
  659.    CHAR     chColSep;            // Column Separator -- 
  660.                                  //    DEFAULT_DELIM is used if this value is zero
  661.    CHAR     chQuote;             // String enclosing character -- 
  662.                                  //    DEFAULT_QUOTE is used if this value is zero
  663.    CHAR     chMVSep;             // Multi-value Property Separator --
  664.                                  //    DEFAULT_MV_SEP is used if this value is zero
  665.    CHAR     creserved;           // alignment
  666.    CALLBACKPROGRESS  ProgressCallBacks;    // Progress call-back entry points
  667.    ERROR_CALLBACK    ErrorCallback;
  668.    
  669.    LPSTR    pszNTDomain;         // Name of NT Domain in which to lookup / create NT accounts.
  670.                                  //    Defaults to current logon domain if NULL or empty
  671.    LPSTR    pszCreateTemplate;   // DN of the Default User (NULL if none) from which
  672.                                  //    to draw template values
  673.  
  674. } BIMPORT_PARMSA, *PBIMPORT_PARMSA, *LPBIMPORT_PARMSA;
  675.  
  676. #ifdef UNICODE
  677. typedef  BIMPORT_PARMSW    BIMPORT_PARMS;
  678. typedef  PBIMPORT_PARMSW   PBIMPORT_PARMS;
  679. typedef  LPBIMPORT_PARMSW  LPBIMPORT_PARMS;
  680. #else
  681. typedef  BIMPORT_PARMSA    BIMPORT_PARMS;
  682. typedef  PBIMPORT_PARMSA   PBIMPORT_PARMS;
  683. typedef  LPBIMPORT_PARMSA  LPBIMPORT_PARMS;
  684. #endif
  685.  
  686. // The BatchImport function provides single-call BatchImport from the
  687. //    specified import file.  All import parameters are specified in the
  688. //    BIMPORT_PARMS structure pointed to by lpBimportParms.
  689. //    The return value indicates the number of errors logged in the
  690. //    NT Application log.  Please note that this does not indicate
  691. //    success or failure of the Batch Import.
  692. //    UI and Logging of errors and warnings into the Application log 
  693. //    are controlled through import parameters.
  694. extern DWORD APIENTRY BatchImportW (LPBIMPORT_PARMSW lpBimportParms);
  695. extern DWORD APIENTRY BatchImportA (LPBIMPORT_PARMSA lpBimportParms);
  696.  
  697. #ifdef UNICODE
  698. #define BatchImport        BatchImportW
  699. #else
  700. #define BatchImport        BatchImportA
  701. #endif
  702.  
  703. /*******************************************************************************
  704. *  
  705. *   Batch Directory Export Interface definitions
  706. *               
  707. ********************************************************************************/
  708.  
  709. typedef struct _BEXPORT_PARMSW
  710. {
  711.    DWORD    dwDAPISignature;
  712.    DWORD    dwFlags;             // Bitmapped flags that control export action
  713.    HWND     hwndParent;          // Windows handle to use when displaying message boxes
  714.    LPWSTR   pszExportFile;       // Fully qualified pathname of file to export into
  715.                                  //   Ignored if ExportCallback is specified
  716.    UINT     uCodePage;           // Code page specification for export file.
  717.                                  // The following values are interpreted:
  718.                                  // DAPI_UNICODE_FILE    Export file is Unicode.
  719.                                  //                      Will return error 
  720.                                  //                        if file exists and is ANSI
  721.                                  // 0                    Auto-detect file type
  722.                                  //                        If file does not exist,
  723.                                  //                          export file will contain CP_ACP text.
  724.                                  //                        If file exists and is ANSI
  725.                                  //                          export file will contain CP_ACP text.
  726.                                  //                        If file exists and is Unicode,
  727.                                  //                          export file will contain Unicode
  728.                                  // other                Export text to file in the
  729.                                  //                        specified code page
  730.                                  //                      Will return error 
  731.                                  //                        if file exists and is Unicode
  732.                                  //                      Will return error if code page is not
  733.                                  //                        supported by the system
  734.    LPWSTR   pszDSAName;          // Computer name of DSA from which to export
  735.                                  //    Default:  local DSA (if operating)
  736.                                  //              if no local DSA, first DSA found 
  737.                                  //              on network is used
  738.    LPWSTR   pszBasePoint;        // DN of base-point in DIT for bulk operations
  739.                                  //    Default values:
  740.                                  //       if NULL, Messaging Site containing bound server
  741.                                  //       if empty string, enterprise containing bound server
  742.    LPWSTR   pszContainer;        // RDN of container from which to export objects
  743.                                  //    NOTE:  This container is assumed to be
  744.                                  //          at the level below that indicated by
  745.                                  //          the pszBasePoint.  If NULL, 
  746.                                  //          the contents of all containers below
  747.                                  //          the BaseImportPoint will be exported.
  748.    WCHAR     chColSep;           // Column Separator -- 
  749.                                  //    DEFAULT_DELIM is used if this value is zero
  750.    WCHAR     chQuote;            // String enclosing character -- 
  751.                                  //    DEFAULT_QUOTE is used if this value is zero
  752.    WCHAR     chMVSep;            // Multi-value Property Separator --
  753.                                  //    DEFAULT_MV_SEP is used if this value is zero
  754.    WCHAR     cReserved;          // alignment
  755.  
  756.    CALLBACKPROGRESS  ProgressCallBacks;    // Progress call-back entry points
  757.    ERROR_CALLBACK    ErrorCallback;
  758.    EXPORT_CALLBACK   ExportCallback;   // Structure filled in by calling app to 
  759.                                        // receive callback on each exported item
  760.                                        // NOTE:  Callback functions are optional
  761.                                        // The default export function (write to file)
  762.                                        // will be called if these pointers are NULL
  763.    PDAPI_ENTRY       pAttributes;      // DAPI_ENTRY filled with names of attributes to export
  764.                                        // Optional if pszExportFile specified
  765.                                        // Required if ExportCallback specified
  766.    LPWSTR   pszHomeServer;       // Name of server for server-associated export
  767.    LPWSTR * rgpszClasses;        // array of pointers to zero-terminated object classes to export
  768.                                  // The last entry must be NULL
  769.                                  // NOTE:  The Directory will be queried for objects
  770.                                  //          of the classes in the specified order.
  771.    ULONG       ulUSNBase;        // Base USN to use for export restriction.  
  772.                                  //    If non-zero, only items having USN-Changed >= ulUSNBase will be exported
  773.    LPVOID      pReserved;        // Reserved -- Must be zero
  774.    
  775. } BEXPORT_PARMSW, *PBEXPORT_PARMSW, *LPBEXPORT_PARMSW;
  776.  
  777. typedef struct _BEXPORT_PARMSA
  778. {
  779.    DWORD    dwDAPISignature;
  780.    DWORD    dwFlags;             // Bitmapped flags that control export action
  781.    HWND     hwndParent;          // Windows handle to use when displaying message boxes
  782.    LPSTR    pszExportFile;       // Fully qualified pathname of file to export into
  783.                                  //   Ignored if ExportCallback is specified
  784.    UINT     uCodePage;           // Code page specification for export file.
  785.                                  // The following values are interpreted:
  786.                                  // DAPI_UNICODE_FILE    Export file is Unicode.
  787.                                  //                      Will return error 
  788.                                  //                        if file exists and is ANSI
  789.                                  // 0                    Auto-detect file type
  790.                                  //                        If file does not exist,
  791.                                  //                          export file will contain CP_ACP text.
  792.                                  //                        If file exists and is ANSI
  793.                                  //                          export file will contain CP_ACP text.
  794.                                  //                        If file exists and is Unicode,
  795.                                  //                          export file will contain Unicode
  796.                                  // other                Export text to file in the
  797.                                  //                        specified code page
  798.                                  //                      Will return error 
  799.                                  //                        if file exists and is Unicode
  800.                                  //                      Will return error if code page is not
  801.                                  //                        supported by the system
  802.    LPSTR    pszDSAName;          // Computer name of DSA from which to export
  803.                                  //    Default:  local DSA (if operating)
  804.                                  //              if no local DSA, first DSA found 
  805.                                  //              on network is used
  806.    LPSTR    pszBasePoint;        // DN of base-point in DIT for bulk operations
  807.                                  //    Default values:
  808.                                  //       if NULL, Messaging Site containing bound server
  809.                                  //       if empty string, enterprise containing bound server
  810.    LPSTR    pszContainer;        // RDN of container from which to export objects
  811.                                  //    NOTE:  This container is assumed to be
  812.                                  //          at the level below that indicated by
  813.                                  //          the pszBasePoint.  If NULL, 
  814.                                  //          the contents of all containers below
  815.                                  //          the BaseImportPoint will be exported.
  816.    CHAR     chColSep;            // Column Separator -- 
  817.                                  //    DEFAULT_DELIM is used if this value is zero
  818.    CHAR     chQuote;             // String enclosing character -- 
  819.                                  //    DEFAULT_QUOTE is used if this value is zero
  820.    CHAR     chMVSep;             // Multi-value Property Separator --
  821.                                  //    DEFAULT_MV_SEP is used if this value is zero
  822.    CHAR     cReserved;           // alignment
  823.  
  824.    CALLBACKPROGRESS  ProgressCallBacks;    // Progress call-back entry points
  825.    ERROR_CALLBACK    ErrorCallback;
  826.    EXPORT_CALLBACK   ExportCallback;   // Structure filled in by calling app to 
  827.                                        // receive callback on each exported item
  828.                                        // NOTE:  Callback functions are optional
  829.                                        // The default export function (write to file)
  830.                                        // will be called if these pointers are NULL
  831.    PDAPI_ENTRY       pAttributes; // DAPI_ENTRY filled with names of attributes to export
  832.                                         // Optional if pszExportFile specified
  833.                                         // Required if ExportCallback specified
  834.    LPSTR    pszHomeServer;       // Name of server for server-associated export
  835.    LPSTR  * rgpszClasses;        // array of pointers to zero-terminated object classes to export
  836.                                  // The last entry must be NULL
  837.                                  // NOTE:  The Directory will be queried for objects
  838.                                  //          of the classes in the specified order.
  839.    ULONG       ulUSNBase;        // Base USN to use for export restriction.  
  840.                                  //    If non-zero, only items having USN-Changed >= ulUSNBase will be exported
  841.    LPVOID      pReserved;        // Reserved -- Must be zero
  842.    
  843. } BEXPORT_PARMSA, *PBEXPORT_PARMSA, *LPBEXPORT_PARMSA;
  844.  
  845.  
  846. #ifdef UNICODE
  847. typedef  BEXPORT_PARMSW    BEXPORT_PARMS;
  848. typedef  PBEXPORT_PARMSW   PBEXPORT_PARMS;
  849. typedef  LPBEXPORT_PARMSW  LPBEXPORT_PARMS;
  850. #else
  851. typedef  BEXPORT_PARMSA    BEXPORT_PARMS;
  852. typedef  PBEXPORT_PARMSA   PBEXPORT_PARMS;
  853. typedef  LPBEXPORT_PARMSA  LPBEXPORT_PARMS;
  854. #endif
  855.  
  856.  
  857.  
  858. // Batch Export entry points
  859.  
  860. // The BatchExport function provides single-call BatchExport from the
  861. //    specified import file.  All import parameters are specified in the
  862. //    BEXPORT_PARMS structure pointed to by lpBexportParms.
  863. //    The return value indicates the number of errors logged in the
  864. //    NT Application log.  Please note that this does not indicate
  865. //    success or failure of the Batch Export.
  866. //    UI and Logging of errors and warnings into the Application log 
  867. //    are controlled through import parameters.
  868. extern DWORD   APIENTRY BatchExportW (LPBEXPORT_PARMSW lpBexportParms);
  869. extern DWORD   APIENTRY BatchExportA (LPBEXPORT_PARMSA lpBexportParms);
  870.  
  871. #ifdef UNICODE
  872. #define BatchExport     BatchExportW
  873. #else
  874. #define BatchExport     BatchExportA
  875. #endif
  876.  
  877.  
  878. /*******************************************************************************
  879. *  
  880. *  Single-Object Interface definitions             
  881. *               
  882. ********************************************************************************/
  883.  
  884. typedef struct _DAPI_PARMSW
  885. {
  886.    DWORD        dwDAPISignature;
  887.    DWORD        dwFlags;         // Bitmapped flags that control import action
  888.                                  //    See Import Control flags defined above.
  889.    LPWSTR       pszDSAName;      // Computer name of DSA to update
  890.                                  //    Default:  local DSA (if operating)
  891.                                  //              if no local DSA, first DSA found 
  892.                                  //              on network is used
  893.    LPWSTR       pszBasePoint;    // DN of base-point in DIT for bulk operations
  894.                                  //    Default values:
  895.                                  //       if NULL, Messaging Site containing bound server
  896.                                  //       if empty string, enterprise containing bound server
  897.    LPWSTR       pszContainer;    // RDN of default container under which
  898.                                  //    to perform bulk import operations
  899.                                  //    NOTE:  This container is assumed to be
  900.                                  //          at the level below that indicated by
  901.                                  //          the pszBasePoint.  If NULL, 
  902.                                  //          bulk operations will be performed at
  903.                                  //          the level below BaseImportPoint.
  904.                                  //          Container names specified in the 
  905.                                  //          import file will override this value.
  906.    LPWSTR       pszNTDomain;     // Name of NT Domain in which to lookup accounts
  907.                                  //   and to create NT accounts.
  908.                                  //   Current logon domain is used if NULL or empty string.
  909.    LPWSTR       pszCreateTemplate;// DN of the template object used for default values
  910.    PDAPI_ENTRY  pAttributes;    // DAPI_ENTRY filled with default attribute list
  911. } DAPI_PARMSW, *PDAPI_PARMSW, FAR *LPDAPI_PARMSW;
  912.  
  913. typedef struct _DAPI_PARMSA
  914. {
  915.    DWORD    dwDAPISignature;
  916.    DWORD    dwFlags;             // Bitmapped flags that control import action
  917.                                  //    See Import Control flags defined above.
  918.    LPSTR    pszDSAName;          // Computer name of DSA to update
  919.                                  //    Default:  local DSA (if operating)
  920.                                  //              if no local DSA, first DSA found 
  921.                                  //              on network is used
  922.    LPSTR    pszBasePoint;        // DN of base-point in DIT for bulk operations
  923.                                  //    Default values:
  924.                                  //       if NULL, Messaging Site containing bound server
  925.                                  //       if empty string, enterprise containing bound server
  926.    LPSTR    pszContainer;        // RDN of default container under which
  927.                                  //    to perform bulk import operations
  928.                                  //    NOTE:  This container is assumed to be
  929.                                  //          at the level below that indicated by
  930.                                  //          the pszBasePoint.  If NULL, 
  931.                                  //          bulk operations will be performed at
  932.                                  //          the level below BaseImportPoint.
  933.                                  //          Container names specified in the 
  934.                                  //          import file will override this value.
  935.    LPSTR    pszNTDomain;         // Name of NT Domain in which to lookup accounts
  936.                                  //   and to create NT accounts.
  937.                                  //   Current logon domain is used if NULL or empty string.
  938.    LPSTR    pszCreateTemplate;   // DN of the template object used for default values
  939.    PDAPI_ENTRY   pAttributes;    // DAPI_ENTRY filled with default attribute list
  940. } DAPI_PARMSA, *PDAPI_PARMSA, FAR *LPDAPI_PARMSA;
  941.  
  942.  
  943. #ifdef UNICODE
  944. typedef  DAPI_PARMSW    DAPI_PARMS;
  945. typedef  PDAPI_PARMSW   PDAPI_PARMS;
  946. typedef  LPDAPI_PARMSW  LPDAPI_PARMS;
  947. #else
  948. typedef  DAPI_PARMSA    DAPI_PARMS;
  949. typedef  PDAPI_PARMSA   PDAPI_PARMS;
  950. typedef  LPDAPI_PARMSA  LPDAPI_PARMS;
  951. #endif
  952.  
  953.  
  954. typedef  LPVOID   DAPI_HANDLE;
  955. typedef  LPVOID * PDAPI_HANDLE;
  956. typedef  LPVOID FAR * LPDAPI_HANDLE;
  957.  
  958. #define  DAPI_INVALID_HANDLE  ((DAPI_HANDLE) -1)
  959.  
  960.  
  961.  
  962. // DAPIStart initializes a DAPI session.
  963. //    for use by DAPIRead and DAPIWrite.  The return value is 0 if no errors
  964. //    are encountered.  A pointer to a DAPI_EVENT structure is returned if an 
  965. //    error is encountered.  
  966. //    NOTE:  The DAPI_HANDLE must be returned via a call to DAPIEnd.
  967. //           If a non-NULL value is returned, its memory must be freed by
  968. //           a call to DAPIFreeMemory
  969. extern PDAPI_EVENTW APIENTRY DAPIStartW  (LPDAPI_HANDLE    lphDAPISession,
  970.                                           LPDAPI_PARMSW     lpDAPIParms);
  971. extern PDAPI_EVENTA APIENTRY DAPIStartA  (LPDAPI_HANDLE    lphDAPISession,
  972.                                           LPDAPI_PARMSA     lpDAPIParms);
  973.  
  974. #ifdef UNICODE
  975. #define DAPIStart    DAPIStartW
  976. #else
  977. #define DAPIStart    DAPIStartA
  978. #endif
  979.  
  980. // DAPIEnd invalidates the DAPI_HANDLE obtained by the call to DAPIStart.
  981. //    NOTE:  There are no separate Unicode / Ansi entry points defined 
  982. extern   void  APIENTRY DAPIEnd (LPDAPI_HANDLE lphDAPISession);
  983.  
  984.  
  985. // DAPIRead() Reads indicated attributes from the named Directory Object
  986. // Parameters:  
  987. // Returned value:   NULL indicates no difficulties encountered.
  988. //                   Else, pointer to structure containing description of 
  989. //                      error(s) or warning(s) encountered.
  990. //                      Must be freed by call to DAPIFreeMemory.
  991. //    hDAPISession   DAPI Session handle obtained via InitDAPISession
  992. //    dwFlags        control operation
  993. //    pszObjectName  String containing name of object to read.
  994. //                      If specified as RDN, combined w/ session's
  995. //                      pszBasePoint and pszParentContainer.
  996. //                      If specified w/ prefix of "/cn=", the string 
  997. //                      is concatenated to the session pszBasePoint.
  998. //                      If specified w/ prefix of "/o=", the string
  999. //                      is taken to be a fully-qualified DN.
  1000. //    pAttList       Pointer to DAPI_ENTRY structure containing names of
  1001. //                      attributes to read.  The session default list is
  1002. //                      overridden for the present call only.
  1003. //    ppValues       Address of variable receiving pointer to DAPI_ENTRY
  1004. //                      structure containing the values read from the DIT entry.
  1005. //                      The pointer returned must be freed by call to 
  1006. //                      DAPIFreeMemory.
  1007. //    ppAttributes   Address of variable receiving pointer to DAPI_ENTRY
  1008. //                      structure containing the names of attributes read
  1009. //                      from the DIT IFF DAPI_ALL_ATTRIBUTES or DAPI_LEGAL_ATTRIBUTES
  1010. //                      were set in dwFlags.
  1011. //                      The pointer returned must be freed by call to 
  1012. //                      DAPIFreeMemory.
  1013. extern PDAPI_EVENTW APIENTRY DAPIReadW   (DAPI_HANDLE        hDAPISession,
  1014.                                              DWORD          dwFlags,
  1015.                                              LPWSTR         pszObjectName,
  1016.                                              PDAPI_ENTRY    pAttList,
  1017.                                              PDAPI_ENTRY *  ppValues,
  1018.                                              PDAPI_ENTRY *  ppAttributes);
  1019. extern PDAPI_EVENTA APIENTRY DAPIReadA   (DAPI_HANDLE        hDAPISession,
  1020.                                              DWORD          dwFlags,
  1021.                                              LPSTR          pszObjectName,
  1022.                                              PDAPI_ENTRY    pAttList,
  1023.                                              PDAPI_ENTRY *  ppValues,
  1024.                                              PDAPI_ENTRY *  ppAttributes);
  1025.  
  1026. #ifdef UNICODE
  1027. #define DAPIRead     DAPIReadW
  1028. #else
  1029. #define DAPIRead     DAPIReadA
  1030. #endif
  1031.  
  1032.  
  1033. // DAPIWrite() 
  1034. //   Perform the indicated write operation on the named object
  1035. // Returned value:   NULL indicates no difficulties encountered.
  1036. //                   Else, pointer to structure containing description of 
  1037. //                      error(s) or warning(s) encountered.
  1038. //                      Must be freed by call to DAPIFreeMemory.
  1039. // Parameters:  
  1040. //    hDAPISession   DAPI Session handle obtained via InitDAPISession
  1041. //    dwFlags        Operational control
  1042. //    pAttributes   Pointer to DAPI_ENTRY structure containing names of
  1043. //                      attributes to write.  The session default list is
  1044. //                      used if this parameter is NULL
  1045. //    pValues        Pointer to DAPI_ENTRY structure containing the values 
  1046. //                      to set on the DIT entry.
  1047. //    lpulUSN         Optional:  Address of variable receiving USN of updated
  1048. //                      DIT entry.  May be specified as NULL to suppress this
  1049. //                      return value.
  1050. //    lppszCreatedAccount  Address receiving pointer to name of created NT account
  1051. //    lppszPassword  Address receiving pointer to password generated if
  1052. //                      NT Account is created. 
  1053. extern PDAPI_EVENTW APIENTRY DAPIWriteW (DAPI_HANDLE        hDAPISession,
  1054.                                              DWORD          dwFlags,
  1055.                                              PDAPI_ENTRY    pAttributes,
  1056.                                              PDAPI_ENTRY    pValues,
  1057.                                              PULONG         lpulUSN,
  1058.                                              LPWSTR *       lppszCreatedAccount,
  1059.                                              LPWSTR *       lppszPassword);
  1060. extern PDAPI_EVENTA APIENTRY DAPIWriteA (DAPI_HANDLE        hDAPISession,
  1061.                                              DWORD          dwFlags,
  1062.                                              PDAPI_ENTRY    pAttributes,
  1063.                                              PDAPI_ENTRY    pValues,
  1064.                                              PULONG         lpulUSN,
  1065.                                              LPSTR *        lppszCreatedAccount,
  1066.                                              LPSTR *        lppszPassword);
  1067. #ifdef UNICODE
  1068. #define DAPIWrite      DAPIWriteW
  1069. #else
  1070. #define DAPIWrite      DAPIWriteA
  1071. #endif
  1072.  
  1073.  
  1074. /*******************************************************************************
  1075. *  procedure :  DAPIAllocBuffer
  1076. *               
  1077. *    purpose :  Allocate buffer, logically linking it to the pvAllocBase
  1078. *               The first buffer in logically linked set of allocations must be 
  1079. *               freed by call to DAPIFreeMemory
  1080. *               
  1081. * parameters :  cbSize        dword containing size of allocation request (in bytes)
  1082. *               pvAllocBase    base for logical linking of allocated block
  1083. *                             May be NULL
  1084. *                             If non-NULL, must be a block previously allocated
  1085. *                             by DAPIAllocBuffer or returned by DAPI function
  1086. *               
  1087. *    returns :  ptr to allocated block
  1088. *               
  1089. *    history :  
  1090. *               
  1091. ********************************************************************************/
  1092. extern LPVOID APIENTRY DAPIAllocBuffer (DWORD    cbSize, LPVOID    pvAllocBase);
  1093.  
  1094.  
  1095. /*******************************************************************************
  1096. *  procedure :  DAPIFreeMemory
  1097. *               
  1098. *    purpose :  Release memory allocated for structures returned by DAPI calls.
  1099. *               
  1100. * parameters :  lpVoid  pointer to block to free
  1101. *               
  1102. *    returns :  nothing
  1103. *               
  1104. *    history :  
  1105. *               
  1106. ********************************************************************************/
  1107. extern void APIENTRY DAPIFreeMemory (LPVOID   lpVoid);
  1108.  
  1109.  
  1110. /* 
  1111.  * NetUserList interface definitions
  1112.  */
  1113. // When getting callbacks from NTExport / NWExport, these indices
  1114. // can be used to interpret the value array returned in the callback
  1115. // >>>>    NOTE:  These indices are NOT valid for Bexport callback!    <<<<
  1116. #define  NET_CLASS         0
  1117. #define  NET_COMMON_NAME   1
  1118. #define  NET_DISPLAY_NAME  2
  1119. #define  NET_HOME_SERVER   3
  1120. #define  NET_COMMENT       4     /* NTExport only */
  1121.  
  1122. #define  NTEXP_ENTRY_COUNT 5 /* number of parts in NT User export */
  1123. #define  NWEXP_ENTRY_COUNT 4 /* number of parts in NetWare user export */
  1124.  
  1125.  
  1126.  
  1127. /*******************************************************************************
  1128. *  
  1129. * NTIMPORT Interface definitions
  1130. *               
  1131. ********************************************************************************/
  1132.  
  1133. typedef struct _NTEXPORT_PARMSW
  1134. {
  1135.    DWORD             dwDAPISignature;
  1136.    DWORD             dwFlags;          // Bitmapped flags that control the user export
  1137.    HWND              hwndParent;       // Windows handle to use when displaying message boxes
  1138.    LPWSTR            pszExportFile;    // Name of file to create
  1139.                                        //   Ignored if using callbacks
  1140.    CALLBACKPROGRESS  ProgressCallBacks;// Progress call-back entry points
  1141.    ERROR_CALLBACK    ErrorCallback;
  1142.    EXPORT_CALLBACK   ExportCallback;   // Structure filled in by calling app to 
  1143.                                        // receive callback on each exported item
  1144.                                        // NOTE:  Callback functions are optional
  1145.                                        // The default export function (write to file)
  1146.                                        // will be called if these pointers are NULL
  1147.    LPWSTR            pszDCName;        // Name of Domain Controller from which to get users
  1148.                                        // NOTE:  Specification of Domain Controller overrides
  1149.                                        //        the NTDomain
  1150.    LPWSTR            pszNTDomain;      // Name of Domain from which to read users
  1151.                                        // If neither pszNTDomain and pszDCName are specified,
  1152.                                        //   users are extracted from the current login domain
  1153. } NTEXPORT_PARMSW, *PNTEXPORT_PARMSW, FAR *LPNTEXPORT_PARMSW;
  1154.  
  1155. typedef struct _NTEXPORT_PARMSA
  1156. {
  1157.    DWORD             dwDAPISignature;
  1158.    DWORD             dwFlags;          // Bitmapped flags that control the user export
  1159.    HWND              hwndParent;       // Windows handle to use when displaying message boxes
  1160.    LPSTR             pszExportFile;    // Name of file to create
  1161.                                        //   Ignored if using callbacks
  1162.    CALLBACKPROGRESS  ProgressCallBacks;// Progress call-back entry points
  1163.    ERROR_CALLBACK    ErrorCallback;
  1164.    EXPORT_CALLBACK   ExportCallback;   // Structure filled in by calling app to 
  1165.                                        // receive callback on each exported item
  1166.                                        // NOTE:  Callback functions are optional
  1167.                                        // The default export function (write to file)
  1168.                                        // will be called if these pointers are NULL
  1169.    LPSTR             pszDCName;        // NOTE:  Specification of Domain Controller overrides
  1170.                                        //        the NTDomain
  1171.                                        // Name of Domain from which to read users
  1172.    LPSTR             pszNTDomain;      // If neither pszNTDomain and pszDCName are specified,
  1173.                                        //   users are extracted from the current login domain
  1174.                                        
  1175. } NTEXPORT_PARMSA, *PNTEXPORT_PARMSA, FAR *LPNTEXPORT_PARMSA;
  1176.  
  1177. #ifdef UNICODE
  1178. typedef  NTEXPORT_PARMSW      NTEXPORT_PARMS;
  1179. typedef  PNTEXPORT_PARMSW     PNTEXPORT_PARMS;
  1180. typedef  LPNTEXPORT_PARMSW    LPNTEXPORT_PARMS;
  1181. #else
  1182. typedef  NTEXPORT_PARMSA      NTEXPORT_PARMS;
  1183. typedef  PNTEXPORT_PARMSA     PNTEXPORT_PARMS;
  1184. typedef  LPNTEXPORT_PARMSA    LPNTEXPORT_PARMS;
  1185. #endif
  1186.  
  1187. extern   DWORD APIENTRY    NTExportW (LPNTEXPORT_PARMSW pNTExportParms);
  1188. extern   DWORD APIENTRY    NTExportA (LPNTEXPORT_PARMSA pNTExportParms);
  1189.  
  1190. #ifdef UNICODE
  1191. #define NTExport              NTExportW
  1192. #else
  1193. #define NTExport              NTExportA
  1194. #endif
  1195.  
  1196.  
  1197. /*******************************************************************************
  1198. *  
  1199. * NWIMPORT Interface definitions
  1200. *               
  1201. ********************************************************************************/
  1202.  
  1203. typedef struct _NWEXPORT_PARMSW
  1204. {
  1205.    DWORD             dwDAPISignature;
  1206.    DWORD             dwFlags;          // Bitmapped flags that control the user export
  1207.    HWND              hwndParent;       // Windows handle to use when displaying message boxes
  1208.    LPWSTR            pszExportFile;    // Name of file to create
  1209.                                        //   Ignored if using callbacks
  1210.    CALLBACKPROGRESS  ProgressCallBacks;// Progress call-back entry points
  1211.    ERROR_CALLBACK    ErrorCallback;
  1212.    EXPORT_CALLBACK   ExportCallback;   // Structure filled in by calling app to 
  1213.                                        // receive callback on each exported item
  1214.                                        // NOTE:  Callback functions are optional
  1215.                                        // The default export function (write to file)
  1216.                                        // will be called if these pointers are NULL
  1217.    LPWSTR            pszFileServer;    // Name of the file server to connect to
  1218.    LPWSTR            pszUserName;      // User Name -- Must have administrator priviliges
  1219.    LPWSTR            pszPassword;      // Password to connect to the server
  1220. } NWEXPORT_PARMSW, *PNWEXPORT_PARMSW, *LPNWEXPORT_PARMSW;
  1221.  
  1222. typedef struct _NWEXPORT_PARMSA
  1223. {
  1224.    DWORD             dwDAPISignature;
  1225.    DWORD             dwFlags;          // Bitmapped flags that control the user export
  1226.    HWND              hwndParent;       // Windows handle to use when displaying message boxes
  1227.    LPSTR             pszExportFile;    // Name of file to create
  1228.                                        //   Ignored if using callbacks
  1229.    CALLBACKPROGRESS  ProgressCallBacks;// Progress call-back entry points
  1230.    ERROR_CALLBACK    ErrorCallback;
  1231.    EXPORT_CALLBACK   ExportCallback;   // Structure filled in by calling app to 
  1232.                                        // receive callback on each exported item
  1233.                                        // NOTE:  Callback functions are optional
  1234.                                        // The default export function (write to file)
  1235.                                        // will be called if these pointers are NULL
  1236.    LPSTR             pszFileServer;    // Name of the file server to connect to
  1237.    LPSTR             pszUserName;      // User Name -- Must have administrator priviliges
  1238.    LPSTR             pszPassword;      // Password to connect to the server
  1239. } NWEXPORT_PARMSA, *PNWEXPORT_PARMSA, *LPNWEXPORT_PARMSA;
  1240.  
  1241. #ifdef UNICODE
  1242. typedef  NWEXPORT_PARMSW      NWEXPORT_PARMS;
  1243. typedef  PNWEXPORT_PARMSW     PNWEXPORT_PARMS;
  1244. typedef  LPNWEXPORT_PARMSW    LPNWEXPORT_PARMS;
  1245. #else
  1246. typedef  NWEXPORT_PARMSA      NWEXPORT_PARMS;
  1247. typedef  PNWEXPORT_PARMSA     PNWEXPORT_PARMS;
  1248. typedef  LPNWEXPORT_PARMSA    LPNWEXPORT_PARMS;
  1249. #endif
  1250.  
  1251. extern   DWORD APIENTRY    NWExportW (LPNWEXPORT_PARMSW pNWExportParms);
  1252. extern   DWORD APIENTRY    NWExportA (LPNWEXPORT_PARMSA pNWExportParms);
  1253.  
  1254. #ifdef UNICODE
  1255. #define NWExport              NWExportW
  1256. #else
  1257. #define NWExport              NWExportA
  1258. #endif
  1259.  
  1260.  
  1261. // Definitions for the DAPIGetSiteInfo call
  1262.  
  1263. typedef struct _NAME_INFOA
  1264. {
  1265.    LPSTR    pszName;                            // Simple object name
  1266.    LPSTR    pszDNString;                        // DN of object
  1267.    LPSTR    pszDisplayName;                     // Display name of object
  1268. } NAME_INFOA, *PNAME_INFOA;
  1269.  
  1270. typedef struct _NAME_INFOW
  1271. {
  1272.    LPWSTR   pszName;                            // Simple object name
  1273.    LPWSTR   pszDNString;                        // DN of object
  1274.    LPWSTR   pszDisplayName;                     // Display name of object
  1275. } NAME_INFOW, *PNAME_INFOW;
  1276.  
  1277. typedef struct _PSITE_INFOA
  1278. {
  1279.    LPSTR       pszCountry;                      // Country code
  1280.    NAME_INFOA  objServer;                       // Name information for server
  1281.    NAME_INFOA  objSite;                         // Name information for site containing server
  1282.    NAME_INFOA  objEnterprise;                   // Name information for enterprise containing server
  1283. } SITE_INFOA, *PSITE_INFOA;
  1284.  
  1285. typedef struct _PSITE_INFOW
  1286. {
  1287.    LPWSTR      pszCountry;                      // Country code
  1288.    NAME_INFOW  objServer;                       // Name information for server
  1289.    NAME_INFOW  objSite;                         // Name information for site containing server
  1290.    NAME_INFOW  objEnterprise;                   // Name information for enterprise containing server
  1291. } SITE_INFOW, *PSITE_INFOW;
  1292.  
  1293. #ifdef UNICODE
  1294. typedef  NAME_INFOW        NAME_INFO;
  1295. typedef  PNAME_INFOW       PNAME_INFO;
  1296. typedef  SITE_INFOW        SITE_INFO;
  1297. typedef  PSITE_INFOW       PSITE_INFO;
  1298. #else
  1299. typedef  NAME_INFOA        NAME_INFO;
  1300. typedef  PNAME_INFOA       PNAME_INFO;
  1301. typedef  SITE_INFOA        SITE_INFO;
  1302. typedef  PSITE_INFOA       PSITE_INFO;
  1303. #endif
  1304.  
  1305. extern PDAPI_EVENTA APIENTRY DAPIGetSiteInfoA (
  1306.                               DWORD    dwFlags,                // Flags for request
  1307.                               LPSTR    pszDSA,                 // name of DSA from which to get information
  1308.                               PSITE_INFOA *   ppSiteInfo       // Address receiving pointer to pSiteInfo structure
  1309.                                                                // containing return data
  1310. );
  1311.  
  1312. extern PDAPI_EVENTW APIENTRY DAPIGetSiteInfoW (
  1313.                               DWORD    dwFlags,                // Flags for request
  1314.                               LPWSTR   pszDSA,                 // name of DSA from which to get information
  1315.                               PSITE_INFOW *   ppSiteInfo       // Address receiving pointer to pSiteInfo structure
  1316.                                                                // containing return dataname of DSA from which to read schema
  1317. );
  1318.  
  1319. #ifdef UNICODE
  1320. #define  DAPIGetSiteInfo DAPIGetSiteInfoW
  1321. #else
  1322. #define  DAPIGetSiteInfo DAPIGetSiteInfoA
  1323. #endif
  1324.  
  1325.  
  1326.  
  1327. #ifdef __cplusplus
  1328. }
  1329. #endif
  1330.  
  1331. #endif   // _DAPI_INCLUDED
  1332. #pragma option pop /*P_O_Pop*/
  1333.