Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1322 lines
69 KiB

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