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.

420 lines
8.8 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996
  5. //
  6. // File: oledsapi.h
  7. //
  8. // Contents: Active Directory C API header
  9. //
  10. //----------------------------------------------------------------------------
  11. #ifndef __ADS_API__
  12. #define __ADS_API__
  13. //////////
  14. //
  15. // Defines
  16. //
  17. //////////
  18. #define DS_NOTHING NULL // ???
  19. #define DS_EVERYTHING 0xFFFFFFFF // ???
  20. // missing a whole bunch...
  21. //////////
  22. //
  23. // typedefs
  24. //
  25. //////////
  26. // (syntax definitions need to be created in another file)
  27. typedef DWORD OID; // To Be Determined (should not be DWORD)
  28. typedef struct _ds_string_list {
  29. DWORD dwItems;
  30. LPWSTR Item[];
  31. } DS_STRING_LIST, *PDS_STRING_LIST;
  32. //
  33. // Note: The struct below is returned when getting the last
  34. // accessed/modified/etc times for some DS or Schema entity.
  35. // The members of this structure are pointers in case the particular
  36. // time information is not available or is not supported by the DS.
  37. //
  38. // Note2: A pointer to this struct is typically present in DS_*_INFO
  39. // structures, in case no such info needs to be specified.
  40. // A user should pass in NULL for PDS_ACCESS_TIMES if it is
  41. // a member of some DS_*_INFO which is used as an IN parameter.
  42. //
  43. typedef struct _ds_access_times {
  44. PSYSTEMTIME pCreated;
  45. PSYSTEMTIME pLastAccess;
  46. PSYSTEMTIME pLastModified;
  47. } DS_ACCESS_TIMES, *PDS_ACCESS_TIMES;
  48. typedef struct _ds_object_info {
  49. OID Oid;
  50. LPWSTR lpszPath;
  51. LPWSTR lpszParent;
  52. LPWSTR lpszName;
  53. LPWSTR lpszClass;
  54. LPWSTR lpszSchema;
  55. PDS_ATTRIBUTE_ENTRY pAttributes; // Usually NULL, but can be used on enum
  56. PDS_ACCESS_TIMES pAccessTimes;
  57. } DS_OBJECT_INFO, *PDS_OBJECT_INFO;
  58. typedef struct _ds_class_info {
  59. OID Oid;
  60. LPWSTR lpszName;
  61. PDS_STRING_LIST DerivedFrom;
  62. PDS_STRING_LIST CanContain;
  63. PDS_STRING_LIST NamingAttributes; // What's the deal with this?
  64. PDS_STRING_LIST RequiredAttributes;
  65. PDS_STRING_LIST OptionalAttributes;
  66. BOOL fAbstract;
  67. PDS_ACCESS_TIMES pAccessTimes;
  68. } DS_CLASS_INFO, *PDS_CLASS_INFO;
  69. typedef struct _ds_attr_info {
  70. OID Oid;
  71. LPWSTR lpszName;
  72. DWORD dwSyntaxId;
  73. BOOL fMultivalued;
  74. //
  75. // Bug: Min/Max? What else?
  76. //
  77. PDS_ACCESS_TIMES pAccessTimes;
  78. } PDS_ATTR_INFO, *PDS_ATTR_INFO;
  79. typedef struct _ds_attribute_value {
  80. DWORD cbData;
  81. LPBYTE lpData;
  82. } DS_ATTRIBUTE_VALUE, *PDS_ATTRIBUTE_VALUE;
  83. //
  84. // NOTE: The dwOperation field is used only when writing attributes.
  85. // It describes how to write or if clearing the attribute is desired.
  86. // If clearing is specified, dwSyntaxId, lpValue, and dwNumValues are
  87. // ignored.
  88. //
  89. typedef struct _ds_attribute_entry {
  90. LPWSTR lpszName;
  91. DWORD dwSyntaxId;
  92. DWORD dwNumValues;
  93. DWORD dwOperation; // ADD, MODIFY, CLEAR ???
  94. PDS_ATTRIBUTE_VALUE lpValue; // Array of values
  95. PDS_ACCESS_TIMES pAccessTimes;
  96. } DS_ATTRIBUTE_ENTRY, *PDS_ATTRIBUTE_ENTRY;
  97. //////////
  98. //
  99. // functions
  100. //
  101. //////////
  102. //
  103. // Memory functions
  104. //
  105. DWORD
  106. WINAPI
  107. DsBufferAlloc(
  108. OUT LPVOID *ppBuffer
  109. );
  110. DWORD
  111. WINAPI
  112. DsBufferFree(
  113. IN LPVOID pBuffer
  114. );
  115. //
  116. // The function below could go out and get kerberos tickets or whatever.
  117. //
  118. // dwType is just a hint in case the user prefers that the underlying
  119. // DS use a particular type of authentication...
  120. //
  121. DWORD
  122. WINAPI
  123. DsCredentialsOpen(
  124. IN LPWSTR lpszUsername,
  125. IN LPWSTR lpszPassword,
  126. IN DWORD dwType, // Like DS_CREDENTIALS_DEFAULT
  127. // DS_CREDENTIALS_KRBV5, etc.???
  128. IN DWORD dwFlags, // What is this???
  129. OUT PHANDLE hCredentials
  130. );
  131. DWORD
  132. WINAPI
  133. DsCredentialsClose(
  134. IN HANDLE hCredentials
  135. );
  136. //
  137. // Good old open
  138. //
  139. // Note: if hRoot is NULL, lpszPath is full object path
  140. // otherwise, lpszPath is relative name from object w/hRoot handle
  141. DWORD
  142. WINAPI
  143. DsObjectOpen(
  144. IN HANDLE hRoot,
  145. IN LPWSTR lpszPath,
  146. IN HANDLE hCredentials, // NULL for process credentials
  147. IN DWORD dwAccess,
  148. IN DWORD dwFlags,
  149. OUT PHANDLE phDs
  150. );
  151. //
  152. // Note: Should we use single close (Object/Enum/Schema)???
  153. //
  154. DWORD
  155. WINAPI
  156. DsObjectClose(
  157. IN HANDLE hDs
  158. );
  159. //
  160. // We need some stuff to operate on handles to get back binding info
  161. // (this stuff comes in only when you do an open or when you refresh)
  162. //
  163. DWORD
  164. WINAPI
  165. DsObjectInfo(
  166. IN HANDLE hDs,
  167. OUT PDS_OBJECT_INFO *ppObjectInfo
  168. );
  169. //
  170. // Read/Write Attributes
  171. //
  172. DWORD
  173. WINAPI
  174. DsObjectRead(
  175. IN HANDLE hDs,
  176. IN DWORD dwFlags, // ???
  177. IN PDS_STRING_LIST pAttributeNames,
  178. OUT PDS_ATTRIBUTE_ENTRY *ppAttributeEntries,
  179. OUT LPDWORD lpdwNumAttributesReturned
  180. );
  181. DWORD
  182. WINAPI
  183. DsObjectWrite(
  184. IN HANDLE hDs,
  185. IN DWORD dwNumAttributesToWrite,
  186. IN PDS_ATTRIBUTE_ENTRY pAttributeEntries,
  187. OUT LPDWORD lpdwNumAttributesWritten
  188. );
  189. //
  190. // Create/Delete Objects
  191. //
  192. DWORD
  193. WINAPI
  194. DsObjectCreate(
  195. IN HANDLE hDs, // Container
  196. IN LPWSTR lpszRelativeName,
  197. IN LPWSTR lpszClass,
  198. IN DWORD dwNumAttributes,
  199. IN PDS_ATTRIBUTE_ENTRY pAttributeEntries
  200. );
  201. DWORD
  202. WINAPI
  203. DsObjectDelete(
  204. IN HANDLE hDs,
  205. IN LPWSTR lpszRelativeName,
  206. IN LPWSTR lpszClass // Could be NULL if name unique??
  207. );
  208. //
  209. // Enumeration
  210. //
  211. DWORD
  212. WINAPI
  213. DsObjectEnumOpen(
  214. IN HANDLE hDs,
  215. IN DWORD dwFlags, // What is this?
  216. IN PDS_STRING_LIST pFilters, // Classes wanted
  217. IN PDS_STRING_LIST pDesiredAttrs, // Attrs wanted or NULL just for info
  218. OUT PHANDLE phEnum
  219. );
  220. DWORD
  221. WINAPI
  222. DsObjectEnumNext(
  223. IN HANDLE hEnum,
  224. IN DWORD dwRequested, // 0xFFFFFFFF for just counting
  225. OUT PDS_OBJECT_INFO *ppObjInfo, // NULL for no info (just counting)
  226. OUT LPDWORD lpdwReturned // Actual number returned/counted
  227. );
  228. DWORD
  229. WINAPI
  230. DsObjectEnumClose(
  231. IN HANDLE hEnum
  232. );
  233. //
  234. // Schema stuff
  235. //
  236. //
  237. // Note: The word "schema" below refers to the schema db and not to
  238. // a class definition.
  239. //
  240. DWORD
  241. WINAPI
  242. DsSchemaOpen(
  243. IN HANDLE hSchema, // NULL if opening schema db,
  244. // must be schema db handle otherwise
  245. IN LPWSTR lpszPath, // One of: path to schema,
  246. // class name,
  247. // attribute name
  248. IN HANDLE hCredentials,
  249. IN DWORD dwAccess,
  250. IN DWORD dwFlags, // DS_OPEN_SCHEMA = 0, DS_OPEN_CLASS, DS_OPEN_ATTR
  251. OUT PHANDLE ph // handle to schema/class/attr depending on dwFlags
  252. );
  253. DWORD
  254. WINAPI
  255. DsSchemaClose(
  256. IN HANDLE hSchema
  257. );
  258. //
  259. // Can also create/delete schema databases (if DS allows it)???
  260. //
  261. DWORD
  262. WINAPI
  263. DsSchemaCreate(
  264. IN LPWSTR lpszPath,
  265. IN DWORD dwFlags //???
  266. );
  267. DWORD
  268. WINAPI
  269. DsSchemaDelete(
  270. IN LPWSTR lpszPath,
  271. IN DWORD dwFlags //???
  272. );
  273. //
  274. // Schema Enumeration
  275. //
  276. //
  277. // enum class/attribute names
  278. //
  279. DWORD
  280. WINAPI
  281. DsSchemaEnumOpen(
  282. IN HANDLE hSchema,
  283. IN DWORD dwFlags, // DS_SCHEMA_ENUM_CLASS xor DS_SCHEMA_ENUM_ATTR
  284. OUT PHANDLE phEnum
  285. );
  286. DWORD
  287. WINAPI
  288. DsSchemaEnumNext(
  289. IN HANDLE hEnum,
  290. IN DWORD dwRequested, // Pass in 0xFFFFFFFF for just counting
  291. IN LPWSTR *ppObjInfo, // Pass in NULL for just counting
  292. OUT LPDWORD lpdwReturned // This would return the count
  293. );
  294. DWORD
  295. WINAPI
  296. DsSchemaEnumClose(
  297. IN HANDLE hEnum
  298. );
  299. //
  300. // Class/Attribute Stuff
  301. //
  302. DWORD
  303. WINAPI
  304. DsSchemaClassCreate(
  305. IN HANDLE hSchema,
  306. IN PDS_CLASS_INFO pClassInfo // What do we do about naming attributes?
  307. );
  308. DWORD
  309. WINAPI
  310. DsSchemaAttrCreate(
  311. IN HANDLE hSchema,
  312. IN PDS_ATTR_INFO pAttrInfo
  313. );
  314. DWORD
  315. WINAPI
  316. DsSchemaClassDelete(
  317. IN HANDLE hSchema,
  318. IN LPWSTR lpszPath,
  319. IN DWORD dwFlags //???
  320. );
  321. DWORD
  322. WINAPI
  323. DsSchemaAttrDelete(
  324. IN HANDLE hSchema,
  325. IN LPWSTR lpszPath,
  326. IN DWORD dwFlags //???
  327. );
  328. DWORD
  329. WINAPI
  330. DsSchemaClassInfo(
  331. IN HANDLE hClass,
  332. OUT PDS_CLASS_INFO *ppClassInfo
  333. );
  334. DWORD
  335. WINAPI
  336. DsSchemaAttrInfo(
  337. IN HANDLE hAttr,
  338. OUT PDS_ATTR_INFO *ppAttrInfo
  339. );
  340. DWORD
  341. WINAPI
  342. DsSchemaClassModify(
  343. IN HANDLE hSchema,
  344. IN PDS_CLASS_INFO pClassInfo // What do we do about naming attributes?
  345. );
  346. DWORD
  347. WINAPI
  348. DsSchemaAttrModify(
  349. IN HANDLE hSchema,
  350. IN PDS_ATTR_INFO pAttrInfo
  351. );
  352. #endif // __ADS_API__