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.

645 lines
45 KiB

  1. #define BAIL_IF_ERROR(hr) \
  2. if (FAILED(hr)) { \
  3. goto cleanup; \
  4. }\
  5. #define BAIL_ON_FAILURE(hr) \
  6. if (FAILED(hr)) { \
  7. goto error; \
  8. }\
  9. #define BAIL_ON_SUCCESS(hr) \
  10. if (SUCCEEDED(hr)) { \
  11. goto error; \
  12. }\
  13. #define QUERY_INTERFACE(hr, ptr, iid, ppObj) \
  14. hr = ptr->QueryInterface(iid, (void **)ppObj); \
  15. if (FAILED(hr)) { \
  16. goto cleanup;\
  17. }\
  18. #define DEFINE_IDispatch_Implementation_Unimplemented(cls) \
  19. STDMETHODIMP \
  20. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  21. { \
  22. RRETURN(E_NOTIMPL); \
  23. } \
  24. \
  25. STDMETHODIMP \
  26. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  27. ITypeInfo FAR* FAR* pptinfo) \
  28. { \
  29. RRETURN(E_NOTIMPL); \
  30. } \
  31. \
  32. STDMETHODIMP \
  33. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  34. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  35. { \
  36. RRETURN(E_NOTIMPL); \
  37. } \
  38. \
  39. STDMETHODIMP \
  40. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  41. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  42. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  43. unsigned int FAR* puArgErr) \
  44. { \
  45. RRETURN(E_NOTIMPL); \
  46. }
  47. #define DEFINE_IDispatch_Implementation(cls) \
  48. STDMETHODIMP \
  49. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  50. { \
  51. RRETURN(_pDispMgr->GetTypeInfoCount(pctinfo)); \
  52. } \
  53. \
  54. STDMETHODIMP \
  55. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  56. ITypeInfo FAR* FAR* pptinfo) \
  57. { \
  58. RRETURN(_pDispMgr->GetTypeInfo(itinfo, \
  59. lcid, \
  60. pptinfo \
  61. )); \
  62. } \
  63. STDMETHODIMP \
  64. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  65. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  66. { \
  67. RRETURN(_pDispMgr->GetIDsOfNames(iid, \
  68. rgszNames, \
  69. cNames, \
  70. lcid, \
  71. rgdispid \
  72. )); \
  73. } \
  74. \
  75. STDMETHODIMP \
  76. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  77. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  78. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  79. unsigned int FAR* puArgErr) \
  80. { \
  81. RRETURN (_pDispMgr->Invoke(dispidMember, \
  82. iid, \
  83. lcid, \
  84. wFlags, \
  85. pdispparams, \
  86. pvarResult, \
  87. pexcepinfo, \
  88. puArgErr \
  89. )); \
  90. }
  91. #define DEFINE_IADs_Implementation(cls) \
  92. STDMETHODIMP \
  93. cls::get_Name(THIS_ BSTR FAR* retval) \
  94. { \
  95. RRETURN(get_CoreName(retval)); \
  96. } \
  97. \
  98. STDMETHODIMP \
  99. cls::get_ADsPath(THIS_ BSTR FAR* retval) \
  100. { \
  101. \
  102. RRETURN(get_CoreADsPath(retval)); \
  103. } \
  104. \
  105. STDMETHODIMP \
  106. cls::get_Class(THIS_ BSTR FAR* retval) \
  107. { \
  108. \
  109. RRETURN(get_CoreADsClass(retval)); \
  110. } \
  111. \
  112. \
  113. STDMETHODIMP \
  114. cls::get_Parent(THIS_ BSTR FAR* retval) \
  115. { \
  116. RRETURN(get_CoreParent(retval)); \
  117. } \
  118. \
  119. STDMETHODIMP \
  120. cls::get_Schema(THIS_ BSTR FAR* retval) \
  121. { \
  122. RRETURN(get_CoreSchema(retval)); \
  123. } \
  124. \
  125. STDMETHODIMP \
  126. cls::get_GUID(THIS_ BSTR FAR* retval) \
  127. { \
  128. RRETURN(get_CoreGUID(retval)); \
  129. } \
  130. \
  131. STDMETHODIMP \
  132. cls::Get(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  133. { \
  134. RRETURN(E_NOTIMPL); \
  135. } \
  136. \
  137. STDMETHODIMP \
  138. cls::Put(THIS_ BSTR bstrName, VARIANT vProp) \
  139. { \
  140. RRETURN(E_NOTIMPL); \
  141. } \
  142. STDMETHODIMP \
  143. cls::GetEx(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  144. { \
  145. RRETURN(E_NOTIMPL); \
  146. } \
  147. \
  148. STDMETHODIMP \
  149. cls::PutEx(THIS_ long lnControlCode, BSTR bstrName, VARIANT vProp) \
  150. { \
  151. RRETURN(E_NOTIMPL); \
  152. } \
  153. STDMETHODIMP \
  154. cls::GetInfoEx(THIS_ VARIANT vProperties, long lnReserved) \
  155. { \
  156. RRETURN(GetInfo()); \
  157. }
  158. #define DEFINE_IADs_TempImplementation(cls) \
  159. STDMETHODIMP \
  160. cls::get_Name(THIS_ BSTR FAR* retval) \
  161. { \
  162. RRETURN(get_CoreName(retval)); \
  163. } \
  164. \
  165. STDMETHODIMP \
  166. cls::get_ADsPath(THIS_ BSTR FAR* retval) \
  167. { \
  168. \
  169. RRETURN(get_CoreADsPath(retval)); \
  170. } \
  171. \
  172. STDMETHODIMP \
  173. cls::get_Class(THIS_ BSTR FAR* retval) \
  174. { \
  175. \
  176. RRETURN(get_CoreADsClass(retval)); \
  177. } \
  178. \
  179. \
  180. STDMETHODIMP \
  181. cls::get_Parent(THIS_ BSTR FAR* retval) \
  182. { \
  183. RRETURN(get_CoreParent(retval)); \
  184. } \
  185. \
  186. STDMETHODIMP \
  187. cls::get_Schema(THIS_ BSTR FAR* retval) \
  188. { \
  189. RRETURN(get_CoreSchema(retval)); \
  190. } \
  191. \
  192. STDMETHODIMP \
  193. cls::get_GUID(THIS_ BSTR FAR* retval) \
  194. { \
  195. RRETURN(get_CoreGUID(retval)); \
  196. } \
  197. STDMETHODIMP \
  198. cls::GetInfoEx(THIS_ VARIANT vProperties, long lnReserved) \
  199. { \
  200. RRETURN(GetInfo()); \
  201. }
  202. #define DEFINE_IADs_PutGetImplementation(cls, SchemaClassTable, dwTableSize) \
  203. STDMETHODIMP \
  204. cls::Get(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  205. { \
  206. HRESULT hr = S_OK; \
  207. \
  208. hr = GenericGetPropertyManager( \
  209. _pPropertyCache, \
  210. bstrName, \
  211. pvProp \
  212. ); \
  213. \
  214. RRETURN(hr); \
  215. } \
  216. \
  217. STDMETHODIMP \
  218. cls::Put(THIS_ BSTR bstrName, VARIANT vProp) \
  219. { \
  220. HRESULT hr = S_OK; \
  221. \
  222. hr = GenericPutPropertyManager( \
  223. _pPropertyCache, \
  224. SchemaClassTable, \
  225. dwTableSize, \
  226. bstrName, \
  227. vProp \
  228. ); \
  229. \
  230. RRETURN(hr); \
  231. } \
  232. STDMETHODIMP \
  233. cls::GetEx(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  234. { \
  235. HRESULT hr = S_OK; \
  236. \
  237. hr = GenericGetExPropertyManager( \
  238. GetObjectState(), \
  239. _pPropertyCache, \
  240. bstrName, \
  241. pvProp \
  242. ); \
  243. \
  244. RRETURN(hr); \
  245. } \
  246. \
  247. STDMETHODIMP \
  248. cls::PutEx(THIS_ long lnControlCode, BSTR bstrName, VARIANT vProp) \
  249. { \
  250. HRESULT hr = S_OK; \
  251. \
  252. hr = GenericPutExPropertyManager( \
  253. _pPropertyCache, \
  254. SchemaClassTable, \
  255. dwTableSize, \
  256. bstrName, \
  257. vProp \
  258. ); \
  259. \
  260. RRETURN(hr); \
  261. }
  262. #define DEFINE_IADsPropertyList_Implementation(cls, SchemaClassTable, dwTableSize) \
  263. STDMETHODIMP \
  264. cls::get_PropertyCount(THIS_ long FAR * plCount) \
  265. { \
  266. HRESULT hr = E_FAIL; \
  267. \
  268. hr = GenericPropCountPropertyManager( \
  269. _pPropertyCache, \
  270. plCount \
  271. ); \
  272. \
  273. RRETURN(hr); \
  274. } \
  275. \
  276. \
  277. STDMETHODIMP \
  278. cls::Next(THIS_ VARIANT FAR *pVariant) \
  279. { \
  280. HRESULT hr = S_OK; \
  281. \
  282. hr = GenericNextPropertyManager( \
  283. _pPropertyCache, \
  284. pVariant \
  285. ); \
  286. RRETURN(hr); \
  287. } \
  288. \
  289. \
  290. STDMETHODIMP \
  291. cls::Skip(THIS_ long cElements) \
  292. { \
  293. HRESULT hr = S_OK; \
  294. \
  295. \
  296. hr = GenericSkipPropertyManager( \
  297. _pPropertyCache, \
  298. cElements \
  299. ); \
  300. \
  301. RRETURN(hr); \
  302. \
  303. } \
  304. \
  305. \
  306. STDMETHODIMP \
  307. cls::Reset() \
  308. { \
  309. HRESULT hr = S_OK; \
  310. \
  311. hr = GenericResetPropertyManager( \
  312. _pPropertyCache \
  313. ); \
  314. \
  315. RRETURN(hr); \
  316. \
  317. } \
  318. \
  319. STDMETHODIMP \
  320. cls::ResetPropertyItem(THIS_ VARIANT varEntry) \
  321. { \
  322. HRESULT hr = S_OK; \
  323. \
  324. hr = GenericDeletePropertyManager( \
  325. _pPropertyCache, \
  326. varEntry \
  327. ); \
  328. \
  329. RRETURN(hr); \
  330. \
  331. } \
  332. STDMETHODIMP \
  333. cls::GetPropertyItem(THIS_ BSTR bstrName, LONG lnADsType, VARIANT * pVariant) \
  334. { \
  335. HRESULT hr = S_OK; \
  336. \
  337. hr = GenericGetPropItemPropertyManager( \
  338. _pPropertyCache, \
  339. GetObjectState(), \
  340. bstrName, \
  341. lnADsType, \
  342. pVariant \
  343. ); \
  344. \
  345. \
  346. RRETURN(hr); \
  347. \
  348. } \
  349. STDMETHODIMP \
  350. cls::PutPropertyItem(VARIANT varData) \
  351. { \
  352. HRESULT hr = S_OK; \
  353. \
  354. hr = GenericPutPropItemPropertyManager( \
  355. _pPropertyCache, \
  356. SchemaClassTable, \
  357. dwTableSize, \
  358. varData \
  359. ); \
  360. \
  361. RRETURN(hr); \
  362. } \
  363. \
  364. STDMETHODIMP \
  365. cls::PurgePropertyList(THIS_) \
  366. { \
  367. HRESULT hr = S_OK; \
  368. \
  369. hr = GenericPurgePropertyManager( \
  370. _pPropertyCache \
  371. ); \
  372. \
  373. \
  374. RRETURN(hr); \
  375. } \
  376. STDMETHODIMP \
  377. cls::Item(THIS_ VARIANT varIndex, VARIANT * pVariant) \
  378. { \
  379. HRESULT hr = S_OK; \
  380. \
  381. hr = GenericItemPropertyManager( \
  382. _pPropertyCache, \
  383. GetObjectState(), \
  384. varIndex, \
  385. pVariant \
  386. ); \
  387. \
  388. \
  389. RRETURN(hr); \
  390. } \
  391. \
  392. #define DEFINE_IDispatch_ExtMgr_Implementation(cls) \
  393. STDMETHODIMP \
  394. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  395. { \
  396. if(_pDispatch != NULL) { \
  397. RRETURN(_pDispatch->GetTypeInfoCount(pctinfo)); \
  398. } \
  399. RRETURN(_pExtMgr->GetTypeInfoCount(pctinfo)); \
  400. } \
  401. \
  402. STDMETHODIMP \
  403. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  404. ITypeInfo FAR* FAR* pptinfo) \
  405. { \
  406. if(_pDispatch != NULL) { \
  407. RRETURN(_pDispatch->GetTypeInfo(itinfo, \
  408. lcid, \
  409. pptinfo \
  410. )); \
  411. } \
  412. RRETURN(_pExtMgr->GetTypeInfo(itinfo, \
  413. lcid, \
  414. pptinfo \
  415. )); \
  416. } \
  417. STDMETHODIMP \
  418. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  419. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  420. { \
  421. if(_pDispatch != NULL) { \
  422. RRETURN(_pDispatch->GetIDsOfNames(iid, \
  423. rgszNames, \
  424. cNames, \
  425. lcid, \
  426. rgdispid \
  427. )); \
  428. } \
  429. RRETURN(_pExtMgr->GetIDsOfNames(iid, \
  430. rgszNames, \
  431. cNames, \
  432. lcid, \
  433. rgdispid \
  434. )); \
  435. } \
  436. \
  437. STDMETHODIMP \
  438. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  439. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  440. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  441. unsigned int FAR* puArgErr) \
  442. { \
  443. if(_pDispatch != NULL) { \
  444. RRETURN(_pDispatch->Invoke(dispidMember, \
  445. iid, \
  446. lcid, \
  447. wFlags, \
  448. pdispparams, \
  449. pvarResult, \
  450. pexcepinfo, \
  451. puArgErr \
  452. )); \
  453. } \
  454. RRETURN (_pExtMgr->Invoke(dispidMember, \
  455. iid, \
  456. lcid, \
  457. wFlags, \
  458. pdispparams, \
  459. pvarResult, \
  460. pexcepinfo, \
  461. puArgErr \
  462. )); \
  463. }
  464. #define DEFINE_IADsExtension_ExtMgr_Implementation(cls) \
  465. HRESULT STDMETHODCALLTYPE \
  466. cls::Operate( \
  467. DWORD dwCode, VARIANT varData1, VARIANT varData2, \
  468. VARIANT varData3) \
  469. { \
  470. RRETURN(S_OK); \
  471. } \
  472. \
  473. HRESULT STDMETHODCALLTYPE \
  474. cls::PrivateGetIDsOfNames( \
  475. REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, \
  476. LCID lcid, DISPID FAR* rgdispid) \
  477. { \
  478. RRETURN(_pExtMgr->GetIDsOfNames(riid, \
  479. rgszNames, \
  480. cNames, \
  481. lcid, \
  482. rgdispid \
  483. )); \
  484. } \
  485. \
  486. HRESULT STDMETHODCALLTYPE \
  487. cls::PrivateInvoke( \
  488. DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, \
  489. DISPPARAMS FAR* pdispparams, VARIANT FAR* pvarResult, \
  490. EXCEPINFO FAR* pexcepinfo, unsigned int FAR* puArgErr) \
  491. { \
  492. RRETURN (_pExtMgr->Invoke(dispidMember, \
  493. riid, \
  494. lcid, \
  495. wFlags, \
  496. pdispparams, \
  497. pvarResult, \
  498. pexcepinfo, \
  499. puArgErr \
  500. )); \
  501. }
  502. #define DEFINE_IADsExtension_Implementation(cls) \
  503. HRESULT STDMETHODCALLTYPE \
  504. cls::Operate( \
  505. DWORD dwCode, VARIANT varData1, VARIANT varData2, \
  506. VARIANT varData3) \
  507. { \
  508. RRETURN(S_OK); \
  509. } \
  510. \
  511. HRESULT STDMETHODCALLTYPE \
  512. cls::PrivateGetIDsOfNames( \
  513. REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, \
  514. LCID lcid, DISPID FAR* rgdispid) \
  515. { \
  516. RRETURN(_pDispMgr->GetIDsOfNames(riid, \
  517. rgszNames, \
  518. cNames, \
  519. lcid, \
  520. rgdispid \
  521. )); \
  522. } \
  523. \
  524. HRESULT STDMETHODCALLTYPE \
  525. cls::PrivateInvoke( \
  526. DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, \
  527. DISPPARAMS FAR* pdispparams, VARIANT FAR* pvarResult, \
  528. EXCEPINFO FAR* pexcepinfo, unsigned int FAR* puArgErr) \
  529. { \
  530. RRETURN (_pDispMgr->Invoke(dispidMember, \
  531. riid, \
  532. lcid, \
  533. wFlags, \
  534. pdispparams, \
  535. pvarResult, \
  536. pexcepinfo, \
  537. puArgErr \
  538. )); \
  539. }
  540. #define DEFINE_IDispatch_Delegating_Implementation(cls) \
  541. STDMETHODIMP \
  542. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  543. { \
  544. if(_pDispatch != NULL) { \
  545. RRETURN(_pDispatch->GetTypeInfoCount(pctinfo)); \
  546. } \
  547. RRETURN(_pDispMgr->GetTypeInfoCount(pctinfo)); \
  548. } \
  549. \
  550. STDMETHODIMP \
  551. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  552. ITypeInfo FAR* FAR* pptinfo) \
  553. { \
  554. if(_pDispatch != NULL) { \
  555. RRETURN(_pDispatch->GetTypeInfo(itinfo, \
  556. lcid, \
  557. pptinfo \
  558. )); \
  559. } \
  560. RRETURN(_pDispMgr->GetTypeInfo(itinfo, \
  561. lcid, \
  562. pptinfo \
  563. )); \
  564. } \
  565. STDMETHODIMP \
  566. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  567. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  568. { \
  569. if(_pDispatch != NULL) { \
  570. RRETURN(_pDispatch->GetIDsOfNames(iid, \
  571. rgszNames, \
  572. cNames, \
  573. lcid, \
  574. rgdispid \
  575. )); \
  576. } \
  577. RRETURN(_pDispMgr->GetIDsOfNames(iid, \
  578. rgszNames, \
  579. cNames, \
  580. lcid, \
  581. rgdispid \
  582. )); \
  583. } \
  584. \
  585. STDMETHODIMP \
  586. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  587. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  588. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  589. unsigned int FAR* puArgErr) \
  590. { \
  591. if(_pDispatch != NULL) { \
  592. RRETURN(_pDispatch->Invoke(dispidMember, \
  593. iid, \
  594. lcid, \
  595. wFlags, \
  596. pdispparams, \
  597. pvarResult, \
  598. pexcepinfo, \
  599. puArgErr \
  600. )); \
  601. } \
  602. RRETURN (_pDispMgr->Invoke(dispidMember, \
  603. iid, \
  604. lcid, \
  605. wFlags, \
  606. pdispparams, \
  607. pvarResult, \
  608. pexcepinfo, \
  609. puArgErr \
  610. )); \
  611. }