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.

346 lines
7.0 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1997
  5. //
  6. // File: ndsutil.hxx
  7. //
  8. // Contents: Functions that encapsulate NDS API functions for ADSI
  9. //
  10. //
  11. // History:
  12. // Shanksh Created 10/27/97
  13. //----------------------------------------------------------------------------
  14. typedef struct _nds_buffer_data {
  15. pBuf_T pInBuf;
  16. pBuf_T pOutBuf;
  17. nint32 lIterationHandle;
  18. DWORD dwInfoType;
  19. DWORD dwOperation;
  20. DWORD fAllAttrs;
  21. } NDS_BUFFER_DATA, *PNDS_BUFFER_DATA;
  22. typedef HANDLE NDS_BUFFER_HANDLE, PNDS_BUFFER_HANDLE;
  23. typedef struct
  24. {
  25. LPWSTR szObjectName;
  26. LPWSTR szObjectClass;
  27. DWORD dwModificationTime;
  28. DWORD dwSubordinateCount;
  29. DWORD dwObjectFlags;
  30. DWORD dwNumAttributes; // Zero for ADsNdsReadObject results.
  31. LPVOID lpAttribute; // For ADsNdsSearch results, cast this
  32. // to either LPNDS_ATTR_INFO or
  33. // LPNDS_NAME_ONLY, depending on value of
  34. // lpdwAttrInformationType from call to
  35. // NwNdsGetObjectListFromBuffer.
  36. BOOL fNameOnly; // FALSE if lpAttribute is type NDS_ATTR_INFO,
  37. // TRUE if is of type NDS_NAME_ONLY
  38. } ADSNDS_OBJECT_INFO, * PADSNDS_OBJECT_INFO;
  39. HRESULT
  40. ADsNdsOpenContext(
  41. LPWSTR pszNDSTreeName,
  42. CCredentials& Credentials,
  43. PNDS_CONTEXT_HANDLE ppADsContext
  44. );
  45. HRESULT
  46. ADsNdsCloseContext(
  47. NDS_CONTEXT_HANDLE pADsContext
  48. );
  49. HRESULT
  50. ADsNdsReadObject(
  51. NDS_CONTEXT_HANDLE pADsContext,
  52. LPWSTR pszDn,
  53. DWORD dwInfoType,
  54. LPWSTR *ppAttrs,
  55. DWORD nAttrs,
  56. pTimeStamp_T pTimeStamp,
  57. PNDS_ATTR_INFO *ppAttrEntries,
  58. DWORD *pAttrsReturned
  59. );
  60. HRESULT
  61. ADsNdsGetAttrListFromBuffer(
  62. NDS_CONTEXT_HANDLE pADsContext,
  63. pBuf_T pBuf,
  64. BOOL fNamesOnly,
  65. PVOID *ppAttriEntries,
  66. PDWORD pdwAttrReturned
  67. );
  68. HRESULT
  69. ADsNdsAppendAttrListFromBuffer(
  70. NDS_CONTEXT_HANDLE hADsContext,
  71. pBuf_T pBuf,
  72. BOOL fAttrsOnly,
  73. PVOID *ppAttrEntries,
  74. PDWORD pNewAttrsReturned,
  75. DWORD dwCurrentAttrs
  76. );
  77. HRESULT
  78. ADsNdsGetAttrsFromBuffer(
  79. NDS_CONTEXT_HANDLE hADsContext,
  80. pBuf_T pBuf,
  81. DWORD luAttrCount,
  82. BOOL fAttrsOnly,
  83. PVOID *ppAttrsReturned
  84. );
  85. HRESULT
  86. FreeNdsAttrInfo(
  87. PNDS_ATTR_INFO pAttrEntries,
  88. DWORD dwNumEntries
  89. );
  90. HRESULT
  91. FreeNdsAttrNames(
  92. PNDS_NAME_ONLY pAttrNames,
  93. DWORD dwNumEntries
  94. );
  95. HRESULT
  96. ADsNdsListObjects(
  97. NDS_CONTEXT_HANDLE pADsContext,
  98. LPWSTR pszDn,
  99. LPWSTR classFilter,
  100. LPWSTR objectFilter,
  101. pTimeStamp_T pTimeStamp,
  102. BOOL fOnlyContainers,
  103. HANDLE *phOperationData
  104. );
  105. HRESULT
  106. ADsNdsGetObjectListFromBuffer(
  107. NDS_CONTEXT_HANDLE pADsContext,
  108. NDS_BUFFER_HANDLE hBufData,
  109. PDWORD dwObjectsReturned,
  110. PADSNDS_OBJECT_INFO *ppObjects
  111. );
  112. HRESULT
  113. ADsNdsFreeNdsObjInfoList(
  114. PADSNDS_OBJECT_INFO pObjInfo,
  115. DWORD dwNumEntries
  116. );
  117. HRESULT
  118. ADsNdsReadClassDef(
  119. NDS_CONTEXT_HANDLE hADsContext,
  120. DWORD dwInfoType,
  121. LPWSTR *ppszClasses,
  122. DWORD nClasses,
  123. NDS_BUFFER_HANDLE *phBuf
  124. );
  125. HRESULT
  126. ADsNdsGetClassDefListFromBuffer(
  127. NDS_CONTEXT_HANDLE hADsContext,
  128. NDS_BUFFER_HANDLE hBufData,
  129. PDWORD pdwNumEntries,
  130. PDWORD pdwInfoType,
  131. PNDS_CLASS_DEF *ppClassDef
  132. );
  133. HRESULT
  134. GetItemsToList(
  135. NWDSContextHandle context,
  136. pBuf_T pBuf,
  137. DWORD luItemCount,
  138. LPWSTR_LIST *pList
  139. );
  140. HRESULT
  141. ADsNdsFreeClassDef(
  142. PNDS_CLASS_DEF pClassDef
  143. );
  144. HRESULT
  145. ADsNdsFreeClassDefList(
  146. PNDS_CLASS_DEF pClassDef,
  147. DWORD dwNumEntries
  148. );
  149. HRESULT
  150. ADsNdsReadAttrDef(
  151. NDS_CONTEXT_HANDLE hADsContext,
  152. DWORD dwInfoType,
  153. LPWSTR *ppszAttrs,
  154. DWORD nAttrs,
  155. NDS_BUFFER_HANDLE *phBuf
  156. );
  157. HRESULT
  158. ADsNdsGetAttrDefListFromBuffer(
  159. NDS_CONTEXT_HANDLE hADsContext,
  160. NDS_BUFFER_HANDLE hBufData,
  161. PDWORD pdwNumEntries,
  162. PDWORD pdwInfoType,
  163. PNDS_ATTR_DEF *ppAttrDef
  164. );
  165. HRESULT
  166. ADsNdsFreeAttrDef(
  167. PNDS_ATTR_DEF pAttrDef
  168. );
  169. HRESULT
  170. ADsNdsFreeAttrDefList(
  171. PNDS_ATTR_DEF pAttrDef,
  172. DWORD dwNumEntries
  173. );
  174. HRESULT
  175. ADsNdsCreateBuffer(
  176. NDS_CONTEXT_HANDLE hADsContext,
  177. DWORD dwOperation,
  178. NDS_BUFFER_HANDLE *phBufData
  179. );
  180. HRESULT
  181. ADsNdsFreeBuffer(
  182. NDS_BUFFER_HANDLE hBuf
  183. );
  184. HRESULT
  185. FreeItemList(
  186. LPWSTR_LIST pList
  187. );
  188. HRESULT
  189. ADsNdsPutInBuffer(
  190. NDS_CONTEXT_HANDLE hADsContext,
  191. NDS_BUFFER_HANDLE hBufData,
  192. LPWSTR szAttributeName,
  193. DWORD dwSyntaxID,
  194. LPNDSOBJECT lpAttributeValues,
  195. DWORD dwValueCount,
  196. DWORD dwChangeType
  197. );
  198. HRESULT
  199. ADsNdsPutFilter(
  200. NDS_CONTEXT_HANDLE hADsContext,
  201. NDS_BUFFER_HANDLE hBufData,
  202. pFilter_Cursor_T pCur,
  203. void (N_FAR N_CDECL *freeVal)(nuint32 syntax, nptr val)
  204. );
  205. HRESULT
  206. ADsNdsModifyObject(
  207. NDS_CONTEXT_HANDLE hADsContext,
  208. LPWSTR szObjectName,
  209. NDS_BUFFER_HANDLE hBufData
  210. );
  211. HRESULT
  212. ADsNdsAddObject(
  213. NDS_CONTEXT_HANDLE hADsContext,
  214. LPWSTR szObjectName,
  215. NDS_BUFFER_HANDLE hBufData
  216. );
  217. HRESULT
  218. ADsNdsGenObjectKey(
  219. NDS_CONTEXT_HANDLE hADsContext,
  220. LPWSTR szObjectName
  221. );
  222. HRESULT
  223. ADsNdsRenameObject(
  224. NDS_CONTEXT_HANDLE hADsContext,
  225. LPWSTR pszSrcObjectDn,
  226. LPWSTR pszNewRDN
  227. );
  228. HRESULT
  229. ADsNdsRemoveObject(
  230. NDS_CONTEXT_HANDLE hADsContext,
  231. LPWSTR szObjectName
  232. );
  233. HRESULT
  234. ADsNdsGetSyntaxID(
  235. NDS_CONTEXT_HANDLE hADsContext,
  236. LPWSTR szAttributeName,
  237. PDWORD pdwSyntaxId
  238. );
  239. HRESULT
  240. ADsNdsSearch(
  241. NDS_CONTEXT_HANDLE hADsContext,
  242. LPWSTR szObjectName,
  243. DWORD scope,
  244. BOOL fSearchAliases,
  245. NDS_BUFFER_HANDLE hFilterBuf,
  246. pTimeStamp_T pTimeStamp,
  247. DWORD dwInfoType,
  248. LPWSTR *ppszAttrs,
  249. DWORD nAttrs,
  250. DWORD nObjectsTobeSearched,
  251. PDWORD pnObjectsSearched,
  252. NDS_BUFFER_HANDLE *phBuf,
  253. pnint32 plIterationHandle
  254. );
  255. HRESULT
  256. ADsNdsMoveObject(
  257. NDS_CONTEXT_HANDLE hADsContext,
  258. LPWSTR pszSrcObjectDn,
  259. LPWSTR pszDestContainerDn,
  260. LPWSTR pszNewRDN
  261. );
  262. HRESULT
  263. ADsNdsChangeObjectPassword(
  264. NDS_CONTEXT_HANDLE hADsContext,
  265. LPWSTR szObjectName,
  266. NWOBJ_TYPE dwOT_ID,
  267. LPWSTR szOldPassword,
  268. LPWSTR szNewPassword
  269. );
  270. HRESULT
  271. ConvertVariantArrayToStringArray(
  272. PVARIANT pVarArray,
  273. PWSTR **pppszStringArray,
  274. DWORD dwNumStrings
  275. );
  276. HRESULT
  277. NWApiOpenPrinter(
  278. LPWSTR lpszUncPrinterName,
  279. HANDLE *phPrinter,
  280. DWORD dwAccess
  281. );
  282. HRESULT
  283. NWApiClosePrinter(
  284. HANDLE hPrinter
  285. );
  286. HRESULT
  287. NWApiSetPrinter(
  288. HANDLE hPrinter,
  289. DWORD dwLevel,
  290. LPBYTE lpbPrinters,
  291. DWORD dwAccess
  292. );