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.

387 lines
9.4 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996
  5. //
  6. // File: oledscom.h
  7. //
  8. // Contents: Active Directory COM Interfaces
  9. // - IDsOpen
  10. // - IDsObject
  11. // - IDsContainer
  12. // - IDsEnum
  13. // - IDsSchema
  14. // - IDsClass
  15. // - IDsAttribute
  16. // - (IDsSecurity needs to be defined)
  17. //
  18. // Note: Objects are:
  19. // DsObject: IDsOpen, IDsSecurity, IDsObject,
  20. // and IDsContainer if object is a container (even if empty)
  21. // DsSchema: IDsOpen, IDsSecurity, IDsSchema
  22. // DsClass: IDsOpen, IDsSecurity, IDsClass
  23. // DsAttribute: IDsOpen, IDsSecurity, IDsAttribute
  24. // DsEnum: IDsOpen
  25. //
  26. // So, every object supports IDsEnum and all but DsEnum supports IDsSecurity
  27. //
  28. // Note2: I thought about having DsObject support IDsClass for easy class
  29. // access, but I trashed that because of complexity.*
  30. // Similarlry, I thought about IDsSchema support for DsClass and
  31. // DsAttribute. Same problem here.*
  32. // *SubNote: The object model would become a bit weird. However,
  33. // adding a function to the main interface to get the
  34. // Class/Schema object might be useful.
  35. //
  36. //----------------------------------------------------------------------------
  37. #ifndef __ADS_COM__
  38. #define __ADS_COM__
  39. #include <oledsapi.h>
  40. /* Definition of interface: IDsOpen */
  41. /*
  42. This interface should be used when you need to open some object or
  43. schema path.
  44. You can QI for it on any DS COM object
  45. */
  46. #undef INTERFACE
  47. #define INTERFACE IDsOpen
  48. DECLARE_INTERFACE_(IDsOpen, IUnknown)
  49. {
  50. BEGIN_INTERFACE
  51. #ifndef NO_BASEINTERFACE_FUNCS
  52. /* IUnknown methods */
  53. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  54. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  55. STDMETHOD_(ULONG, Release)(THIS) PURE;
  56. #endif
  57. /* IDsOpen */
  58. STDMETHOD(OpenObject)(
  59. THIS_
  60. IN LPWSTR lpszObjectPath,
  61. IN LPWSTR lpszUsername,
  62. IN LPWSTR lpszPassword,
  63. IN DWORD dwAccess,
  64. IN DWORD dwFlags,
  65. IN REFIID riid,
  66. OUT void **ppADsObj
  67. ) PURE;
  68. STDMETHOD(OpenSchemaDatabase)(
  69. THIS_
  70. IN LPWSTR lpszSchemaPath,
  71. IN LPWSTR lpszUsername,
  72. IN LPWSTR lpszPassword,
  73. IN DWORD dwAccess,
  74. IN DWORD dwFlags,
  75. OUT IDsSchema **ppDsSchema
  76. ) PURE;
  77. };
  78. /* Definition of interface: IDsObject */
  79. /*
  80. This interface is only supported by actual DS object. It should not be
  81. supported by schema entities.
  82. NOTE: The names for the methods below should be shortened some for
  83. ease of use.
  84. */
  85. #undef INTERFACE
  86. #define INTERFACE IDsObject
  87. DECLARE_INTERFACE_(IDsObject, IUnknown)
  88. {
  89. BEGIN_INTERFACE
  90. #ifndef NO_BASEINTERFACE_FUNCS
  91. /* IUnknown methods */
  92. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  93. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  94. STDMETHOD_(ULONG, Release)(THIS) PURE;
  95. #endif
  96. /* IDsObject*/
  97. STDMETHOD(GetObjectInformation)(
  98. THIS_
  99. OUT PDS_OBJECT_INFO pObjInfo
  100. ) PURE;
  101. STDMETHOD(GetObjectAttributes)(
  102. THIS_
  103. IN PDS_STRING_LIST pAttributeNames,
  104. OUT PDS_ATTRIBUTE_ENTRY *ppAttributeEntries,
  105. OUT PDWORD pdwNumAttributesReturned
  106. ) PURE;
  107. STDMETHOD(SetObjectAttributes)(
  108. THIS_
  109. IN DWORD dwFlags,
  110. IN PDS_ATTRIBUTE_ENTRY pAttributeEntries,
  111. IN DWORD dwNumAttributes,
  112. OUT PDWORD pdwNumAttributesModified
  113. ) PURE;
  114. STDMETHOD(OpenSchemaDefinition)(
  115. THIS_
  116. OUT IDsSchema **ppDsSchema
  117. ) PURE;
  118. };
  119. /* Definition of interface: IDsContainer */
  120. /*
  121. This interface should be supported by any container object. Therefore,
  122. all objects should support this interface except for objects whose class
  123. definitions prohibit them from containing anything.
  124. NOTE: Open, Create, and Delete accept any relative name, not just
  125. objects immediately under the container (i.e. from object
  126. "foo://bar", I can open "baz/foobar", which is really
  127. "foo://bar/baz/foobar").
  128. This funtionality allows me to open "@ADs!" and do all
  129. sorts of operations without having to browse!
  130. ("All the power comes to me." -- a guy in some movie,
  131. unfortunately, I don't know which guy or what movie.)
  132. */
  133. #undef INTERFACE
  134. #define INTERFACE IDsContainer
  135. DECLARE_INTERFACE_(IDsContainer, IUnknown)
  136. {
  137. BEGIN_INTERFACE
  138. #ifndef NO_BASEINTERFACE_FUNCS
  139. /* IUnknown methods */
  140. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  141. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  142. STDMETHOD_(ULONG, Release)(THIS) PURE;
  143. #endif
  144. /* IDsContainer*/
  145. STDMETHOD(OpenEnum)(
  146. THIS_
  147. IN DWORD dwFlags,
  148. IN PDS_STRING_LIST pFilters,
  149. IN PDS_STRING_LIST pDesiredAttrs,
  150. OUT IDsEnum **ppDsEnum
  151. ) PURE;
  152. STDMETHOD(OpenObject)(
  153. THIS_
  154. IN LPWSTR lpszRelativeName,
  155. IN IN LPWSTR lpszUsername,
  156. IN LPWSTR lpszPassword,
  157. IN DWORD dwAccess,
  158. IN DWORD dwFlags,
  159. IN REFIID riid,
  160. OUT void **ppADsObj
  161. ) PURE;
  162. STDMETHOD(Create)(
  163. THIS_
  164. IN LPWSTR lpszRelativeName,
  165. IN LPWSTR lpszClass,
  166. IN DWORD dwNumAttributes,
  167. IN PDS_ATTRIBUTE_ENTRY pAttributeEntries
  168. ) PURE;
  169. STDMETHOD(Delete)(
  170. THIS_
  171. IN LPWSTR lpszRDName,
  172. IN LPWSTR lpszClassName
  173. ) PURE;
  174. };
  175. /* Definition of interface: IDsEnum */
  176. /*
  177. $$$$ The notes below are very important!!! $$$$
  178. Note: *ppEnumInfo should be cast to PDS_OBJECT_INFO or LPWSTR depending
  179. on whether the enum was on objects or class/attributes
  180. (If this enum interface is used for other stuff, can use other
  181. castings as appropriate.)
  182. Note2: IDsEnum is only supported by enumeration objects that are created
  183. when an enumeration takes place. These enumeration objects only
  184. support IUnknown, IDsOpen, and IDsEnum. They cannot support any
  185. other IDs* interfaces.
  186. */
  187. #undef INTERFACE
  188. #define INTERFACE IDsEnum
  189. DECLARE_INTERFACE_(IDsEnum, IUnknown)
  190. {
  191. BEGIN_INTERFACE
  192. #ifndef NO_BASEINTERFACE_FUNCS
  193. /* IUnknown methods */
  194. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  195. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  196. STDMETHOD_(ULONG, Release)(THIS) PURE;
  197. #endif
  198. /* IDsEnum */
  199. STDMETHOD(Next)(
  200. THIS_
  201. IN DWORD dwRequested, // 0xFFFFFFFF for just counting
  202. OUT PVOID *ppEnumInfo, // NULL for no info (just counting)
  203. OUT LPDWORD lpdwReturned // This would return the count
  204. ) PURE;
  205. };
  206. /* Definition of interface: IDsSchema */
  207. #undef INTERFACE
  208. #define INTERFACE IDsSchema
  209. DECLARE_INTERFACE_(IDsSchema, IUnknown)
  210. {
  211. BEGIN_INTERFACE
  212. #ifndef NO_BASEINTERFACE_FUNCS
  213. /* IUnknown methods */
  214. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  215. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  216. STDMETHOD_(ULONG, Release)(THIS) PURE;
  217. #endif
  218. /* IDsSchema */
  219. STDMETHOD(OpenClass)(
  220. THIS_
  221. IN LPWSTR lpszClass,
  222. IN LPWSTR lpszUsername,
  223. IN LPWSTR lpszPassword,
  224. IN DWORD dwAccess,
  225. IN DWORD dwFlags,
  226. OUT IDsClass **ppDsClass
  227. ) PURE;
  228. STDMETHOD(OpenAttribute)(
  229. THIS_
  230. IN LPWSTR lpszAttribute,
  231. IN LPWSTR lpszUsername,
  232. IN LPWSTR lpszPassword,
  233. IN DWORD dwAccess,
  234. IN DWORD dwFlags,
  235. OUT IDsAttribute **ppDsAttribute
  236. ) PURE;
  237. STDMETHOD(OpenClassEnum)(
  238. THIS_
  239. OUT IDsEnum **ppDsEnum
  240. ) PURE;
  241. STDMETHOD(OpenAttributeEnum)(
  242. THIS_
  243. OUT IDsEnum **ppDsEnum
  244. ) PURE;
  245. STDMETHOD(CreateClass)(
  246. THIS_
  247. IN PDS_CLASS_INFO pClassInfo
  248. ) PURE;
  249. STDMETHOD(CreateAttribute)(
  250. THIS_
  251. IN PDS_ATTR_INFO pAttrInfo
  252. ) PURE;
  253. STDMETHOD(DeleteClass)(
  254. THIS_
  255. IN LPWSTR lpszName,
  256. IN DWORD dwFlags
  257. ) PURE;
  258. STDMETHOD(DeleteAttribute)(
  259. THIS_
  260. IN LPWSTR lpszName,
  261. IN DWORD dwFlags
  262. ) PURE;
  263. };
  264. /* Definition of interface: IDsClass */
  265. #undef INTERFACE
  266. #define INTERFACE IDsClass
  267. DECLARE_INTERFACE_(IDsClass, IUnknown)
  268. {
  269. BEGIN_INTERFACE
  270. #ifndef NO_BASEINTERFACE_FUNCS
  271. /* IUnknown methods */
  272. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  273. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  274. STDMETHOD_(ULONG, Release)(THIS) PURE;
  275. #endif
  276. /* IDsClass */
  277. STDMETHOD(GetClassInfo)(
  278. THIS_
  279. OUT PDS_CLASS_INFO *ppClassInfo
  280. );
  281. STDMETHOD(ModifyClassInfo)(
  282. THIS_
  283. IN PDS_CLASS_INFO pClassInfo
  284. ) PURE;
  285. };
  286. /* Definition of interface: IDsAttribute */
  287. #undef INTERFACE
  288. #define INTERFACE IDsAttribute
  289. DECLARE_INTERFACE_(IDsAttribute, IUnknown)
  290. {
  291. BEGIN_INTERFACE
  292. #ifndef NO_BASEINTERFACE_FUNCS
  293. /* IUnknown methods */
  294. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  295. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  296. STDMETHOD_(ULONG, Release)(THIS) PURE;
  297. #endif
  298. /* IDsAttribute */
  299. STDMETHOD(GetAttributeInfo)(
  300. THIS_
  301. OUT PDS_ATTR_INFO *ppAttrInfo
  302. );
  303. STDMETHOD(ModifyAttributeInfo)(
  304. THIS_
  305. IN PDS_ATTR_INFO pAttrInfo
  306. ) PURE;
  307. };
  308. #endif // __ADS_COM__