Source code of Windows XP (NT5)
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.

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