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.

636 lines
44 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].pszLDAPProp; \
  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].pszLDAPProp; \
  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].pszLDAPProp; \
  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].pszLDAPProp; \
  118. break; \
  119. } \
  120. } \
  121. \
  122. RRETURN(_pADs->PutEx( lnControlCode, pszPropName, vProp)); \
  123. }
  124. #define DEFINE_CONTAINED_IADsContainer_Implementation(cls) \
  125. STDMETHODIMP \
  126. cls::get_Filter(THIS_ VARIANT FAR* pVar ) \
  127. { \
  128. HRESULT hr = E_NOTIMPL; \
  129. if ( _pADsContainer ) { \
  130. hr = _pADsContainer->get_Filter( pVar ); \
  131. } \
  132. RRETURN(hr); \
  133. } \
  134. \
  135. STDMETHODIMP \
  136. cls::put_Filter(THIS_ VARIANT Var ) \
  137. { \
  138. HRESULT hr = E_NOTIMPL; \
  139. if ( _pADsContainer ) { \
  140. hr = _pADsContainer->put_Filter( Var ); \
  141. } \
  142. RRETURN(hr); \
  143. } \
  144. \
  145. STDMETHODIMP \
  146. cls::get_Hints(THIS_ VARIANT FAR* pVar ) \
  147. { \
  148. HRESULT hr = E_NOTIMPL; \
  149. if ( _pADsContainer ) { \
  150. hr = _pADsContainer->get_Hints( pVar ); \
  151. } \
  152. RRETURN(hr); \
  153. } \
  154. \
  155. STDMETHODIMP \
  156. cls::put_Hints(THIS_ VARIANT Var ) \
  157. { \
  158. HRESULT hr = E_NOTIMPL; \
  159. if ( _pADsContainer ) { \
  160. hr = _pADsContainer->put_Hints( Var ); \
  161. } \
  162. RRETURN(hr); \
  163. } \
  164. \
  165. STDMETHODIMP \
  166. cls::get_Count(THIS_ long FAR* retval) \
  167. { \
  168. HRESULT hr = E_NOTIMPL; \
  169. if ( _pADsContainer ) { \
  170. hr = _pADsContainer->get_Count( retval ); \
  171. } \
  172. RRETURN(hr); \
  173. } \
  174. \
  175. STDMETHODIMP \
  176. cls::get__NewEnum(THIS_ IUnknown * FAR * retval ) \
  177. { \
  178. HRESULT hr = E_NOTIMPL; \
  179. if ( _pADsContainer ) { \
  180. hr = _pADsContainer->get__NewEnum( retval ); \
  181. } \
  182. RRETURN(hr); \
  183. } \
  184. \
  185. STDMETHODIMP \
  186. cls::GetObject(THIS_ BSTR ClassName, BSTR RelativeName, \
  187. IDispatch * FAR * ppObject ) \
  188. { \
  189. HRESULT hr = E_NOTIMPL; \
  190. if ( _pADsContainer ) { \
  191. hr = _pADsContainer->GetObject( ClassName, RelativeName, ppObject ); \
  192. } \
  193. RRETURN(hr); \
  194. } \
  195. \
  196. STDMETHODIMP \
  197. cls::Create(THIS_ BSTR ClassName, BSTR RelativeName, \
  198. IDispatch * FAR * ppObject ) \
  199. { \
  200. HRESULT hr = E_NOTIMPL; \
  201. if ( _pADsContainer ) { \
  202. hr =_pADsContainer->Create( ClassName, RelativeName, ppObject ); \
  203. } \
  204. RRETURN(hr); \
  205. } \
  206. \
  207. STDMETHODIMP \
  208. cls::Delete(THIS_ BSTR ClassName, BSTR SourceName ) \
  209. { \
  210. HRESULT hr = E_NOTIMPL; \
  211. if ( _pADsContainer ) { \
  212. hr = _pADsContainer->Delete( ClassName, SourceName ); \
  213. } \
  214. RRETURN(hr); \
  215. } \
  216. \
  217. STDMETHODIMP \
  218. cls::CopyHere(THIS_ BSTR SourceName, BSTR NewName, \
  219. IDispatch * FAR * ppObject ) \
  220. { \
  221. HRESULT hr = E_NOTIMPL; \
  222. if ( _pADsContainer ) { \
  223. hr = _pADsContainer->CopyHere( SourceName, NewName, ppObject ); \
  224. } \
  225. RRETURN(hr); \
  226. } \
  227. \
  228. STDMETHODIMP \
  229. cls::MoveHere(THIS_ BSTR SourceName, BSTR NewName, \
  230. IDispatch * FAR * ppObject ) \
  231. { \
  232. HRESULT hr = E_NOTIMPL; \
  233. if ( _pADsContainer ) { \
  234. hr = _pADsContainer->MoveHere( SourceName, NewName, ppObject ); \
  235. } \
  236. RRETURN(hr); \
  237. }
  238. #define DEFINE_CONTAINED_IDirectoryObject_Implementation(cls) \
  239. STDMETHODIMP \
  240. cls::SetObjectAttributes( \
  241. PADS_ATTR_INFO pAttributeEntries, \
  242. DWORD dwNumAttributes, \
  243. DWORD *pdwNumAttributesModified \
  244. ) \
  245. { \
  246. HRESULT hr = S_OK; \
  247. \
  248. hr = _pDSObject->SetObjectAttributes( \
  249. pAttributeEntries, \
  250. dwNumAttributes, \
  251. pdwNumAttributesModified \
  252. ); \
  253. RRETURN(hr); \
  254. } \
  255. \
  256. STDMETHODIMP \
  257. cls::GetObjectAttributes( \
  258. LPWSTR * pAttributeNames, \
  259. DWORD dwNumberAttributes, \
  260. PADS_ATTR_INFO *ppAttributeEntries, \
  261. DWORD * pdwNumAttributesReturned \
  262. ) \
  263. { \
  264. HRESULT hr = S_OK; \
  265. \
  266. hr = _pDSObject->GetObjectAttributes( \
  267. pAttributeNames, \
  268. dwNumberAttributes, \
  269. ppAttributeEntries, \
  270. pdwNumAttributesReturned \
  271. ); \
  272. RRETURN(hr); \
  273. } \
  274. \
  275. \
  276. STDMETHODIMP \
  277. cls::CreateDSObject( \
  278. LPWSTR pszRDNName, \
  279. PADS_ATTR_INFO pAttributeEntries, \
  280. DWORD dwNumAttributes, \
  281. IDispatch * FAR* ppObject \
  282. ) \
  283. { \
  284. HRESULT hr = S_OK; \
  285. \
  286. hr = _pDSObject->CreateDSObject( \
  287. pszRDNName, \
  288. pAttributeEntries, \
  289. dwNumAttributes, \
  290. ppObject \
  291. ); \
  292. RRETURN(hr); \
  293. } \
  294. \
  295. STDMETHODIMP \
  296. cls::DeleteDSObject( \
  297. LPWSTR pszRDNName \
  298. ) \
  299. \
  300. { \
  301. HRESULT hr = S_OK; \
  302. \
  303. hr = _pDSObject->DeleteDSObject( \
  304. pszRDNName \
  305. ); \
  306. RRETURN(hr); \
  307. } \
  308. \
  309. STDMETHODIMP \
  310. cls::GetObjectInformation( \
  311. THIS_ PADS_OBJECT_INFO * ppObjInfo \
  312. ) \
  313. { \
  314. HRESULT hr = S_OK; \
  315. \
  316. hr = _pDSObject->GetObjectInformation( \
  317. ppObjInfo \
  318. ); \
  319. RRETURN(hr); \
  320. }
  321. #define DEFINE_CONTAINED_IDirectorySearch_Implementation(cls) \
  322. STDMETHODIMP \
  323. cls::SetSearchPreference( \
  324. PADS_SEARCHPREF_INFO pSearchPrefs, \
  325. DWORD dwNumPrefs \
  326. \
  327. ) \
  328. { \
  329. HRESULT hr = S_OK; \
  330. \
  331. hr = _pDSSearch->SetSearchPreference( \
  332. pSearchPrefs, \
  333. dwNumPrefs \
  334. ); \
  335. RRETURN(hr); \
  336. } \
  337. \
  338. STDMETHODIMP \
  339. cls::ExecuteSearch( \
  340. LPWSTR pszSearchFilter, \
  341. LPWSTR * pAttributeNames, \
  342. DWORD dwNumberAttributes, \
  343. PADS_SEARCH_HANDLE phSearchResult \
  344. \
  345. ) \
  346. { \
  347. HRESULT hr = S_OK; \
  348. \
  349. hr = _pDSSearch->ExecuteSearch( \
  350. pszSearchFilter, \
  351. pAttributeNames, \
  352. dwNumberAttributes, \
  353. phSearchResult \
  354. ); \
  355. RRETURN(hr); \
  356. } \
  357. \
  358. STDMETHODIMP \
  359. cls::AbandonSearch( \
  360. ADS_SEARCH_HANDLE hSearchResult \
  361. \
  362. ) \
  363. { \
  364. HRESULT hr = S_OK; \
  365. \
  366. hr = _pDSSearch->AbandonSearch( \
  367. hSearchResult \
  368. ); \
  369. RRETURN(hr); \
  370. } \
  371. \
  372. STDMETHODIMP \
  373. cls::GetFirstRow( \
  374. ADS_SEARCH_HANDLE hSearchResult \
  375. \
  376. ) \
  377. { \
  378. HRESULT hr = S_OK; \
  379. \
  380. hr = _pDSSearch->GetFirstRow( \
  381. hSearchResult \
  382. ); \
  383. RRETURN(hr); \
  384. } \
  385. \
  386. STDMETHODIMP \
  387. cls::GetNextRow( \
  388. ADS_SEARCH_HANDLE hSearchResult \
  389. \
  390. ) \
  391. { \
  392. HRESULT hr = S_OK; \
  393. \
  394. hr = _pDSSearch->GetNextRow( \
  395. hSearchResult \
  396. ); \
  397. RRETURN(hr); \
  398. } \
  399. \
  400. STDMETHODIMP \
  401. cls::GetPreviousRow( \
  402. ADS_SEARCH_HANDLE hSearchResult \
  403. \
  404. ) \
  405. { \
  406. HRESULT hr = S_OK; \
  407. \
  408. hr = _pDSSearch->GetPreviousRow( \
  409. hSearchResult \
  410. ); \
  411. RRETURN(hr); \
  412. } \
  413. \
  414. STDMETHODIMP \
  415. cls::GetNextColumnName( \
  416. ADS_SEARCH_HANDLE hSearchResult, \
  417. LPWSTR * ppszColumnName \
  418. ) \
  419. { \
  420. HRESULT hr = S_OK; \
  421. \
  422. hr = _pDSSearch->GetNextColumnName( \
  423. hSearchResult, \
  424. ppszColumnName \
  425. ); \
  426. RRETURN(hr); \
  427. } \
  428. \
  429. STDMETHODIMP \
  430. cls::GetColumn( \
  431. ADS_SEARCH_HANDLE hSearchResult, \
  432. LPWSTR szColumnName, \
  433. PADS_SEARCH_COLUMN pSearchColumn \
  434. ) \
  435. { \
  436. HRESULT hr = S_OK; \
  437. \
  438. hr = _pDSSearch->GetColumn( \
  439. hSearchResult, \
  440. szColumnName, \
  441. pSearchColumn \
  442. ); \
  443. RRETURN(hr); \
  444. } \
  445. \
  446. \
  447. STDMETHODIMP \
  448. cls::FreeColumn( \
  449. PADS_SEARCH_COLUMN pSearchColumn \
  450. ) \
  451. { \
  452. HRESULT hr = S_OK; \
  453. \
  454. hr = _pDSSearch->FreeColumn( \
  455. pSearchColumn \
  456. ); \
  457. RRETURN(hr); \
  458. } \
  459. \
  460. \
  461. STDMETHODIMP \
  462. cls::CloseSearchHandle( \
  463. ADS_SEARCH_HANDLE hSearchResult \
  464. ) \
  465. { \
  466. HRESULT hr = S_OK; \
  467. \
  468. hr = _pDSSearch->CloseSearchHandle( \
  469. hSearchResult \
  470. ); \
  471. RRETURN(hr); \
  472. }
  473. #define DEFINE_CONTAINED_IDirectorySchemaMgmt_Implementation(cls) \
  474. STDMETHODIMP \
  475. cls::EnumAttributes( \
  476. LPWSTR * ppszAttrNames, \
  477. DWORD dwNumAttributes, \
  478. PADS_ATTR_DEF * ppAttrDefinition, \
  479. DWORD * pdwNumAttributes \
  480. ) \
  481. { \
  482. HRESULT hr = S_OK; \
  483. \
  484. hr = _pDSSchMgmt->EnumAttributes( \
  485. ppszAttrNames, \
  486. dwNumAttributes, \
  487. ppAttrDefinition, \
  488. pdwNumAttributes \
  489. ); \
  490. \
  491. RRETURN(hr); \
  492. } \
  493. \
  494. \
  495. STDMETHODIMP \
  496. cls::CreateAttributeDefinition( \
  497. LPWSTR pszAttributeName, \
  498. PADS_ATTR_DEF pAttributeDefinition \
  499. ) \
  500. { \
  501. HRESULT hr = S_OK; \
  502. \
  503. hr = _pDSSchMgmt->CreateAttributeDefinition( \
  504. pszAttributeName, \
  505. pAttributeDefinition \
  506. ); \
  507. \
  508. RRETURN(hr); \
  509. } \
  510. \
  511. \
  512. STDMETHODIMP \
  513. cls::WriteAttributeDefinition( \
  514. LPWSTR pszAttributeName, \
  515. PADS_ATTR_DEF pAttributeDefinition \
  516. ) \
  517. { \
  518. HRESULT hr = S_OK; \
  519. \
  520. hr = _pDSSchMgmt->WriteAttributeDefinition( \
  521. pszAttributeName, \
  522. pAttributeDefinition \
  523. ); \
  524. \
  525. RRETURN(hr); \
  526. } \
  527. \
  528. STDMETHODIMP \
  529. cls::DeleteAttributeDefinition( \
  530. LPWSTR pszAttributeName \
  531. ) \
  532. { \
  533. HRESULT hr = S_OK; \
  534. \
  535. hr = _pDSSchMgmt->DeleteAttributeDefinition( \
  536. pszAttributeName \
  537. ); \
  538. \
  539. RRETURN(hr); \
  540. } \
  541. \
  542. STDMETHODIMP \
  543. cls::EnumClasss( \
  544. LPWSTR * ppszAttrNames, \
  545. DWORD dwNumClasss, \
  546. PADS_ATTR_DEF * ppAttrDefinition, \
  547. DWORD * pdwNumClasss \
  548. ) \
  549. { \
  550. HRESULT hr = S_OK; \
  551. \
  552. hr = _pDSSchMgmt->EnumClasss( \
  553. ppszAttrNames, \
  554. dwNumClasss, \
  555. ppAttrDefinition, \
  556. pdwNumClasss \
  557. ); \
  558. \
  559. RRETURN(hr); \
  560. } \
  561. \
  562. \
  563. STDMETHODIMP \
  564. cls::CreateClassDefinition( \
  565. LPWSTR pszClassName, \
  566. PADS_ATTR_DEF pClassDefinition \
  567. ) \
  568. { \
  569. HRESULT hr = S_OK; \
  570. \
  571. hr = _pDSSchMgmt->CreateClassDefinition( \
  572. pszClassName, \
  573. pClassDefinition \
  574. ); \
  575. \
  576. RRETURN(hr); \
  577. } \
  578. \
  579. \
  580. STDMETHODIMP \
  581. cls::WriteClassDefinition( \
  582. LPWSTR pszClassName, \
  583. PADS_ATTR_DEF pClassDefinition \
  584. ) \
  585. { \
  586. HRESULT hr = S_OK; \
  587. \
  588. hr = _pDSSchMgmt->WriteClassDefinition( \
  589. pszClassName, \
  590. pClassDefinition \
  591. ); \
  592. \
  593. RRETURN(hr); \
  594. } \
  595. \
  596. STDMETHODIMP \
  597. cls::DeleteClassDefinition( \
  598. LPWSTR pszClassName \
  599. ) \
  600. { \
  601. HRESULT hr = S_OK; \
  602. \
  603. hr = _pDSSchMgmt->DeleteClassDefinition( \
  604. pszClassName \
  605. ); \
  606. \
  607. RRETURN(hr); \
  608. }
  609. #define DEFINE_CONTAINED_IADsObjectOptions_Implementation(cls) \
  610. STDMETHODIMP \
  611. cls::GetOption( \
  612. THIS_ DWORD dwOption, \
  613. void *pValue ) \
  614. { \
  615. RRETURN(_pADsObjectOptions->GetOption(dwOption, pValue)); \
  616. } \
  617. \
  618. STDMETHODIMP \
  619. cls::SetOption( \
  620. THIS_ DWORD dwOption, \
  621. void *pValue ) \
  622. { \
  623. RRETURN(_pADsObjectOptions->SetOption(dwOption, pValue)); \
  624. }