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.

612 lines
43 KiB

  1. #define DEFINE_CONTAINED_IADs_Implementation(cls) \
  2. STDMETHODIMP \
  3. cls::get_Name(THIS_ BSTR FAR* retval) \
  4. { \
  5. RRETURN(_pADs->get_Name(retval)); \
  6. } \
  7. \
  8. STDMETHODIMP \
  9. cls::get_ADsPath(THIS_ BSTR FAR* retval) \
  10. { \
  11. \
  12. RRETURN(_pADs->get_ADsPath(retval)); \
  13. } \
  14. \
  15. STDMETHODIMP \
  16. cls::get_Class(THIS_ BSTR FAR* retval) \
  17. { \
  18. \
  19. RRETURN(_pADs->get_Class(retval)); \
  20. } \
  21. \
  22. \
  23. STDMETHODIMP \
  24. cls::get_Parent(THIS_ BSTR FAR* retval) \
  25. { \
  26. RRETURN(_pADs->get_Parent(retval)); \
  27. } \
  28. \
  29. STDMETHODIMP \
  30. cls::get_Schema(THIS_ BSTR FAR* retval) \
  31. { \
  32. RRETURN(_pADs->get_Schema(retval)); \
  33. } \
  34. \
  35. STDMETHODIMP \
  36. cls::get_GUID(THIS_ BSTR FAR* retval) \
  37. { \
  38. RRETURN(_pADs->get_GUID(retval)); \
  39. } \
  40. \
  41. STDMETHODIMP \
  42. cls::GetInfo(THIS_) \
  43. { \
  44. RRETURN(_pADs->GetInfo()); \
  45. } \
  46. \
  47. STDMETHODIMP \
  48. cls::SetInfo(THIS_ ) \
  49. { \
  50. RRETURN(_pADs->SetInfo()); \
  51. } \
  52. STDMETHODIMP \
  53. cls::GetInfoEx(THIS_ VARIANT vProperties, long lnReserved) \
  54. { \
  55. RRETURN(_pADs->GetInfoEx(vProperties, lnReserved)); \
  56. }
  57. #define DEFINE_CONTAINED_IADsPutGet_Implementation(cls, ClassPropMapping) \
  58. STDMETHODIMP \
  59. cls::Get(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  60. { \
  61. LPTSTR pszPropName = bstrName; \
  62. \
  63. for ( DWORD i = 0; i < ARRAY_SIZE(ClassPropMapping); i++ ) \
  64. { \
  65. if ( _tcsicmp(bstrName, ClassPropMapping[i].pszADsProp ) == 0 ) \
  66. { \
  67. pszPropName = ClassPropMapping[i].pszNDSProp; \
  68. break; \
  69. } \
  70. } \
  71. \
  72. RRETURN(_pADs->Get( pszPropName, pvProp)); \
  73. } \
  74. \
  75. STDMETHODIMP \
  76. cls::Put(THIS_ BSTR bstrName, VARIANT vProp) \
  77. { \
  78. LPTSTR pszPropName = bstrName; \
  79. \
  80. for ( DWORD i = 0; i < ARRAY_SIZE(ClassPropMapping); i++ ) \
  81. { \
  82. if ( _tcsicmp(bstrName, ClassPropMapping[i].pszADsProp) == 0 ) \
  83. { \
  84. pszPropName = ClassPropMapping[i].pszNDSProp; \
  85. break; \
  86. } \
  87. } \
  88. \
  89. RRETURN(_pADs->Put( pszPropName, vProp)); \
  90. } \
  91. \
  92. STDMETHODIMP \
  93. cls::GetEx(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  94. { \
  95. LPTSTR pszPropName = bstrName; \
  96. \
  97. for ( DWORD i = 0; i < ARRAY_SIZE(ClassPropMapping); i++ ) \
  98. { \
  99. if ( _tcsicmp(bstrName, ClassPropMapping[i].pszADsProp ) == 0 ) \
  100. { \
  101. pszPropName = ClassPropMapping[i].pszNDSProp; \
  102. break; \
  103. } \
  104. } \
  105. \
  106. RRETURN(_pADs->GetEx( pszPropName, pvProp)); \
  107. } \
  108. STDMETHODIMP \
  109. cls::PutEx(THIS_ long lnControlCode, BSTR bstrName, VARIANT vProp) \
  110. { \
  111. LPTSTR pszPropName = bstrName; \
  112. \
  113. for ( DWORD i = 0; i < ARRAY_SIZE(ClassPropMapping); i++ ) \
  114. { \
  115. if ( _tcsicmp(bstrName, ClassPropMapping[i].pszADsProp) == 0 ) \
  116. { \
  117. pszPropName = ClassPropMapping[i].pszNDSProp; \
  118. break; \
  119. } \
  120. } \
  121. \
  122. RRETURN(_pADs->PutEx( lnControlCode, pszPropName, vProp)); \
  123. }
  124. #define DEFINE_CONTAINED_IDirectoryObject_Implementation(cls) \
  125. STDMETHODIMP \
  126. cls::SetObjectAttributes( \
  127. PADS_ATTR_INFO pAttributeEntries, \
  128. DWORD dwNumAttributes, \
  129. DWORD *pdwNumAttributesModified \
  130. ) \
  131. { \
  132. HRESULT hr = S_OK; \
  133. \
  134. hr = _pDSObject->SetObjectAttributes( \
  135. pAttributeEntries, \
  136. dwNumAttributes, \
  137. pdwNumAttributesModified \
  138. ); \
  139. RRETURN(hr); \
  140. } \
  141. \
  142. STDMETHODIMP \
  143. cls::GetObjectAttributes( \
  144. LPWSTR * pAttributeNames, \
  145. DWORD dwNumberAttributes, \
  146. PADS_ATTR_INFO *ppAttributeEntries, \
  147. DWORD * pdwNumAttributesReturned \
  148. ) \
  149. { \
  150. HRESULT hr = S_OK; \
  151. \
  152. hr = _pDSObject->GetObjectAttributes( \
  153. pAttributeNames, \
  154. dwNumberAttributes, \
  155. ppAttributeEntries, \
  156. pdwNumAttributesReturned \
  157. ); \
  158. RRETURN(hr); \
  159. } \
  160. \
  161. \
  162. STDMETHODIMP \
  163. cls::CreateDSObject( \
  164. LPWSTR pszRDNName, \
  165. PADS_ATTR_INFO pAttributeEntries, \
  166. DWORD dwNumAttributes, \
  167. IDispatch * FAR* ppObject \
  168. ) \
  169. { \
  170. HRESULT hr = S_OK; \
  171. \
  172. hr = _pDSObject->CreateDSObject( \
  173. pszRDNName, \
  174. pAttributeEntries, \
  175. dwNumAttributes, \
  176. ppObject \
  177. ); \
  178. RRETURN(hr); \
  179. } \
  180. \
  181. STDMETHODIMP \
  182. cls::DeleteDSObject( \
  183. LPWSTR pszRDNName \
  184. ) \
  185. \
  186. { \
  187. HRESULT hr = S_OK; \
  188. \
  189. hr = _pDSObject->DeleteDSObject( \
  190. pszRDNName \
  191. ); \
  192. RRETURN(hr); \
  193. } \
  194. \
  195. STDMETHODIMP \
  196. cls::GetObjectInformation( \
  197. THIS_ PADS_OBJECT_INFO * ppObjInfo \
  198. ) \
  199. { \
  200. HRESULT hr = S_OK; \
  201. \
  202. hr = _pDSObject->GetObjectInformation( \
  203. ppObjInfo \
  204. ); \
  205. RRETURN(hr); \
  206. }
  207. #define DEFINE_CONTAINED_IDirectorySearch_Implementation(cls) \
  208. STDMETHODIMP \
  209. cls::SetSearchPreference( \
  210. PADS_SEARCHPREF_INFO pSearchPrefs, \
  211. DWORD dwNumPrefs \
  212. \
  213. ) \
  214. { \
  215. HRESULT hr = S_OK; \
  216. \
  217. hr = _pDSSearch->SetSearchPreference( \
  218. pSearchPrefs, \
  219. dwNumPrefs \
  220. ); \
  221. RRETURN(hr); \
  222. } \
  223. \
  224. STDMETHODIMP \
  225. cls::ExecuteSearch( \
  226. LPWSTR pszSearchFilter, \
  227. LPWSTR * pAttributeNames, \
  228. DWORD dwNumberAttributes, \
  229. PADS_SEARCH_HANDLE phSearchResult \
  230. \
  231. ) \
  232. { \
  233. HRESULT hr = S_OK; \
  234. \
  235. hr = _pDSSearch->ExecuteSearch( \
  236. pszSearchFilter, \
  237. pAttributeNames, \
  238. dwNumberAttributes, \
  239. phSearchResult \
  240. ); \
  241. RRETURN(hr); \
  242. } \
  243. STDMETHODIMP \
  244. cls::AbandonSearch( \
  245. ADS_SEARCH_HANDLE hSearchResult \
  246. \
  247. ) \
  248. { \
  249. HRESULT hr = S_OK; \
  250. \
  251. hr = _pDSSearch->AbandonSearch( \
  252. hSearchResult \
  253. ); \
  254. RRETURN(hr); \
  255. } \
  256. \
  257. STDMETHODIMP \
  258. cls::GetFirstRow( \
  259. ADS_SEARCH_HANDLE hSearchResult \
  260. \
  261. ) \
  262. { \
  263. HRESULT hr = S_OK; \
  264. \
  265. hr = _pDSSearch->GetFirstRow( \
  266. hSearchResult \
  267. ); \
  268. RRETURN(hr); \
  269. } \
  270. \
  271. \
  272. STDMETHODIMP \
  273. cls::GetNextRow( \
  274. ADS_SEARCH_HANDLE hSearchResult \
  275. \
  276. ) \
  277. { \
  278. HRESULT hr = S_OK; \
  279. \
  280. hr = _pDSSearch->GetNextRow( \
  281. hSearchResult \
  282. ); \
  283. RRETURN(hr); \
  284. } \
  285. \
  286. STDMETHODIMP \
  287. cls::GetPreviousRow( \
  288. ADS_SEARCH_HANDLE hSearchResult \
  289. \
  290. ) \
  291. { \
  292. HRESULT hr = S_OK; \
  293. \
  294. hr = _pDSSearch->GetPreviousRow( \
  295. hSearchResult \
  296. ); \
  297. RRETURN(hr); \
  298. } \
  299. \
  300. STDMETHODIMP \
  301. cls::GetNextColumnName( \
  302. ADS_SEARCH_HANDLE hSearchResult, \
  303. LPWSTR * ppszColumnName \
  304. ) \
  305. { \
  306. HRESULT hr = S_OK; \
  307. \
  308. hr = _pDSSearch->GetNextColumnName( \
  309. hSearchResult, \
  310. ppszColumnName \
  311. ); \
  312. RRETURN(hr); \
  313. } \
  314. \
  315. STDMETHODIMP \
  316. cls::GetColumn( \
  317. ADS_SEARCH_HANDLE hSearchResult, \
  318. LPWSTR szColumnName, \
  319. PADS_SEARCH_COLUMN pSearchColumn \
  320. ) \
  321. { \
  322. HRESULT hr = S_OK; \
  323. \
  324. hr = _pDSSearch->GetColumn( \
  325. hSearchResult, \
  326. szColumnName, \
  327. pSearchColumn \
  328. ); \
  329. RRETURN(hr); \
  330. } \
  331. \
  332. \
  333. STDMETHODIMP \
  334. cls::FreeColumn( \
  335. PADS_SEARCH_COLUMN pSearchColumn \
  336. ) \
  337. { \
  338. HRESULT hr = S_OK; \
  339. \
  340. hr = _pDSSearch->FreeColumn( \
  341. pSearchColumn \
  342. ); \
  343. RRETURN(hr); \
  344. } \
  345. \
  346. \
  347. STDMETHODIMP \
  348. cls::CloseSearchHandle( \
  349. ADS_SEARCH_HANDLE hSearchResult \
  350. ) \
  351. { \
  352. HRESULT hr = S_OK; \
  353. \
  354. hr = _pDSSearch->CloseSearchHandle( \
  355. hSearchResult \
  356. ); \
  357. RRETURN(hr); \
  358. }
  359. #define DEFINE_CONTAINED_IADsPropertyList_Implementation(cls) \
  360. STDMETHODIMP \
  361. cls::get_PropertyCount(THIS_ long FAR * plCount) \
  362. { \
  363. HRESULT hr = S_OK; \
  364. \
  365. hr = _pADsPropList->get_PropertyCount( \
  366. plCount \
  367. ); \
  368. \
  369. RRETURN(hr); \
  370. \
  371. } \
  372. \
  373. \
  374. STDMETHODIMP \
  375. cls::Next(THIS_ VARIANT FAR *pVariant) \
  376. { \
  377. HRESULT hr = S_OK; \
  378. \
  379. hr = _pADsPropList->Next( \
  380. pVariant \
  381. ); \
  382. \
  383. RRETURN(hr); \
  384. } \
  385. \
  386. \
  387. STDMETHODIMP \
  388. cls::Skip(THIS_ long cElements) \
  389. { \
  390. HRESULT hr = S_OK; \
  391. \
  392. hr = _pADsPropList->Skip( \
  393. cElements \
  394. ); \
  395. \
  396. RRETURN(hr); \
  397. \
  398. } \
  399. \
  400. \
  401. STDMETHODIMP \
  402. cls::Reset() \
  403. { \
  404. HRESULT hr = S_OK; \
  405. \
  406. hr = _pADsPropList->Reset( \
  407. ); \
  408. \
  409. RRETURN(hr); \
  410. \
  411. } \
  412. \
  413. STDMETHODIMP \
  414. cls::ResetPropertyItem(THIS_ VARIANT varEntry) \
  415. { \
  416. HRESULT hr = S_OK; \
  417. \
  418. hr = _pADsPropList->ResetPropertyItem( \
  419. varEntry \
  420. ); \
  421. \
  422. RRETURN(hr); \
  423. \
  424. } \
  425. STDMETHODIMP \
  426. cls::GetPropertyItem(THIS_ BSTR bstrName, LONG lnADsType, VARIANT * pVariant) \
  427. { \
  428. HRESULT hr = S_OK; \
  429. \
  430. hr = _pADsPropList->GetPropertyItem( \
  431. bstrName, \
  432. lnADsType, \
  433. pVariant \
  434. ); \
  435. \
  436. RRETURN(hr); \
  437. \
  438. } \
  439. STDMETHODIMP \
  440. cls::PutPropertyItem(THIS_ VARIANT varData) \
  441. { \
  442. HRESULT hr = S_OK; \
  443. \
  444. hr = _pADsPropList->PutPropertyItem( \
  445. varData \
  446. ); \
  447. \
  448. RRETURN(hr); \
  449. \
  450. } \
  451. STDMETHODIMP \
  452. cls::PurgePropertyList(THIS_) \
  453. { \
  454. HRESULT hr = S_OK; \
  455. \
  456. hr = _pADsPropList->PurgePropertyList(); \
  457. \
  458. RRETURN(hr); \
  459. } \
  460. STDMETHODIMP \
  461. cls::Item(THIS_ VARIANT varIndex, VARIANT * pVariant) \
  462. { \
  463. HRESULT hr = S_OK; \
  464. \
  465. hr = _pADsPropList->Item( \
  466. varIndex, \
  467. pVariant \
  468. ); \
  469. \
  470. RRETURN(hr); \
  471. }
  472. #define DEFINE_CONTAINED_IDirectorySchemaMgmt_Implementation(cls) \
  473. STDMETHODIMP \
  474. cls::EnumAttributes( \
  475. LPWSTR * ppszAttrNames, \
  476. DWORD dwNumAttributes, \
  477. PADS_ATTR_DEF * ppAttrDefinition, \
  478. DWORD * pdwNumAttributes \
  479. ) \
  480. { \
  481. HRESULT hr = S_OK; \
  482. \
  483. hr = _pDSAttrMgmt->EnumAttributes( \
  484. ppszAttrNames, \
  485. dwNumAttributes, \
  486. ppAttrDefinition, \
  487. pdwNumAttributes \
  488. ); \
  489. \
  490. RRETURN(hr); \
  491. } \
  492. \
  493. \
  494. STDMETHODIMP \
  495. cls::CreateAttributeDefinition( \
  496. LPWSTR pszAttributeName, \
  497. PADS_ATTR_DEF pAttributeDefinition \
  498. ) \
  499. { \
  500. HRESULT hr = S_OK; \
  501. \
  502. hr = _pDSAttrMgmt->CreateAttributeDefinition( \
  503. pszAttributeName, \
  504. pAttributeDefinition \
  505. ); \
  506. \
  507. RRETURN(hr); \
  508. } \
  509. \
  510. STDMETHODIMP \
  511. cls::WriteAttributeDefinition( \
  512. LPWSTR pszAttributeName, \
  513. PADS_ATTR_DEF pAttributeDefinition \
  514. ) \
  515. { \
  516. HRESULT hr = S_OK; \
  517. \
  518. hr = _pDSAttrMgmt->WriteAttributeDefinition( \
  519. pszAttributeName, \
  520. pAttributeDefinition \
  521. ); \
  522. \
  523. RRETURN(hr); \
  524. } \
  525. \
  526. STDMETHODIMP \
  527. cls::DeleteAttributeDefinition( \
  528. LPWSTR pszAttributeName \
  529. ) \
  530. { \
  531. HRESULT hr = S_OK; \
  532. \
  533. hr = _pDSAttrMgmt->DeleteAttributeDefinition( \
  534. pszAttributeName \
  535. ); \
  536. \
  537. RRETURN(hr); \
  538. } \
  539. \
  540. STDMETHODIMP \
  541. cls::EnumClasses( \
  542. LPWSTR * ppszClassNames, \
  543. DWORD dwNumClasses, \
  544. PADS_CLASS_DEF * ppClassDefinition, \
  545. DWORD * pdwNumClasses \
  546. ) \
  547. { \
  548. HRESULT hr = S_OK; \
  549. \
  550. hr = _pDSAttrMgmt->EnumClasses( \
  551. ppszClassNames, \
  552. dwNumClasses, \
  553. ppClassDefinition, \
  554. pdwNumClasses \
  555. ); \
  556. \
  557. RRETURN(hr); \
  558. } \
  559. \
  560. STDMETHODIMP \
  561. cls::CreateClassDefinition( \
  562. LPWSTR pszClassName, \
  563. PADS_CLASS_DEF pClassDefinition \
  564. ) \
  565. { \
  566. HRESULT hr = S_OK; \
  567. \
  568. hr = _pDSAttrMgmt->CreateClassDefinition( \
  569. pszClassName, \
  570. pClassDefinition \
  571. ); \
  572. \
  573. RRETURN(hr); \
  574. } \
  575. \
  576. STDMETHODIMP \
  577. cls::WriteClassDefinition( \
  578. LPWSTR pszClassName, \
  579. PADS_CLASS_DEF pClassDefinition \
  580. ) \
  581. { \
  582. HRESULT hr = S_OK; \
  583. \
  584. hr = _pDSAttrMgmt->WriteClassDefinition( \
  585. pszClassName, \
  586. pClassDefinition \
  587. ); \
  588. \
  589. RRETURN(hr); \
  590. } \
  591. \
  592. STDMETHODIMP \
  593. cls::DeleteClassDefinition( \
  594. LPWSTR pszClassName \
  595. ) \
  596. { \
  597. HRESULT hr = S_OK; \
  598. \
  599. hr = _pDSAttrMgmt->DeleteClassDefinition( \
  600. pszClassName \
  601. ); \
  602. \
  603. RRETURN(hr); \
  604. }