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.

540 lines
33 KiB

  1. //
  2. // This is a macro which is ONLY used in CNWCOMPATUser::SetAccountRestrictions.
  3. //
  4. #define GET_LOGIN_CONTROL() \
  5. if (fUmOK == FALSE) { \
  6. \
  7. hr = NWApiGetLOGIN_CONTROL( \
  8. hConn, \
  9. _Name, \
  10. &LoginCtrl \
  11. ); \
  12. BAIL_ON_FAILURE(hr); \
  13. \
  14. fUmOK = TRUE; \
  15. }
  16. //
  17. // NCP Reply buffer macro.
  18. //
  19. #define INIT_RPLY_SGMT(RS) \
  20. RS## = new RPLY_SGMT_LST; \
  21. if (!##RS##) { \
  22. RRETURN(E_OUTOFMEMORY); \
  23. } \
  24. RS##->lpNext = NULL;
  25. #define DELETE_LIST(ptr) \
  26. if (##ptr##) { \
  27. do { \
  28. lpTemp = (##ptr##)->lpNext; \
  29. delete (##ptr##); \
  30. (##ptr##) = lpTemp; \
  31. } while (##ptr##); \
  32. }
  33. //
  34. // Misc Macro.
  35. //
  36. #define ADSFREESTRING(str) \
  37. if (##str##) { \
  38. ADsFreeString(##str##); \
  39. }
  40. //
  41. // Error flow control macro.
  42. //
  43. #define RRETURN_ENUM_STATUS(hr) \
  44. if (hr != S_OK) { \
  45. RRETURN(S_FALSE); \
  46. } \
  47. RRETURN(S_OK);
  48. #define BAIL_IF_ERROR(hr) \
  49. if (FAILED(hr)) { \
  50. goto cleanup; \
  51. } \
  52. #define BAIL_ON_FAILURE(hr) \
  53. if (FAILED(hr)) { \
  54. goto error; \
  55. } \
  56. //
  57. // DEFINE_IDispatch_Implementation_Unimplemented
  58. //
  59. #define DEFINE_IDispatch_Implementation_Unimplemented(cls) \
  60. STDMETHODIMP \
  61. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  62. { \
  63. RRETURN(E_NOTIMPL); \
  64. } \
  65. \
  66. STDMETHODIMP \
  67. cls::GetTypeInfo( \
  68. unsigned int itinfo, \
  69. LCID lcid, \
  70. ITypeInfo FAR* FAR* pptinfo \
  71. ) \
  72. { \
  73. RRETURN(E_NOTIMPL); \
  74. } \
  75. \
  76. STDMETHODIMP \
  77. cls::GetIDsOfNames( \
  78. REFIID iid, \
  79. LPWSTR FAR* rgszNames, \
  80. unsigned int cNames, \
  81. LCID lcid, \
  82. DISPID FAR* rgdispid \
  83. ) \
  84. { \
  85. RRETURN(E_NOTIMPL); \
  86. } \
  87. \
  88. STDMETHODIMP \
  89. cls::Invoke( \
  90. DISPID dispidMember, \
  91. REFIID iid, LCID lcid, \
  92. unsigned short wFlags, \
  93. DISPPARAMS FAR* pdispparams, \
  94. VARIANT FAR* pvarResult, \
  95. EXCEPINFO FAR* pexcepinfo, \
  96. unsigned int FAR* puArgErr \
  97. ) \
  98. { \
  99. RRETURN(E_NOTIMPL); \
  100. }
  101. //
  102. // DEFINE_IDispatch_Implementation
  103. //
  104. #define DEFINE_IDispatch_Implementation(cls) \
  105. STDMETHODIMP \
  106. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  107. { \
  108. RRETURN(_pDispMgr->GetTypeInfoCount(pctinfo)); \
  109. } \
  110. \
  111. STDMETHODIMP \
  112. cls::GetTypeInfo( \
  113. unsigned int itinfo, \
  114. LCID lcid, \
  115. ITypeInfo FAR* FAR* pptinfo) \
  116. { \
  117. RRETURN(_pDispMgr->GetTypeInfo( \
  118. itinfo, \
  119. lcid, \
  120. pptinfo \
  121. )); \
  122. } \
  123. \
  124. STDMETHODIMP \
  125. cls::GetIDsOfNames( \
  126. REFIID iid, \
  127. LPWSTR FAR* rgszNames, \
  128. unsigned int cNames, \
  129. LCID lcid, \
  130. DISPID FAR* rgdispid \
  131. ) \
  132. { \
  133. RRETURN(_pDispMgr->GetIDsOfNames( \
  134. iid, \
  135. rgszNames, \
  136. cNames, \
  137. lcid, \
  138. rgdispid \
  139. )); \
  140. } \
  141. \
  142. STDMETHODIMP \
  143. cls::Invoke( \
  144. DISPID dispidMember, \
  145. REFIID iid, \
  146. LCID lcid, \
  147. unsigned short wFlags, \
  148. DISPPARAMS FAR* pdispparams, \
  149. VARIANT FAR* pvarResult, \
  150. EXCEPINFO FAR* pexcepinfo, \
  151. unsigned int FAR* puArgErr \
  152. ) \
  153. { \
  154. RRETURN (_pDispMgr->Invoke( \
  155. dispidMember, \
  156. iid, \
  157. lcid, \
  158. wFlags, \
  159. pdispparams, \
  160. pvarResult, \
  161. pexcepinfo, \
  162. puArgErr \
  163. )); \
  164. } \
  165. //
  166. // DEFINE_IADs_Implementation
  167. //
  168. #define DEFINE_IADs_Implementation(cls) \
  169. STDMETHODIMP \
  170. cls::get_Name(THIS_ BSTR FAR* retval) \
  171. { \
  172. RRETURN(get_CoreName(retval)); \
  173. } \
  174. \
  175. STDMETHODIMP \
  176. cls::get_ADsPath(THIS_ BSTR FAR* retval) \
  177. { \
  178. RRETURN(get_CoreADsPath(retval)); \
  179. } \
  180. \
  181. STDMETHODIMP \
  182. cls::get_Class(THIS_ BSTR FAR* retval) \
  183. { \
  184. RRETURN(get_CoreADsClass(retval)); \
  185. } \
  186. \
  187. STDMETHODIMP \
  188. cls::get_Parent(THIS_ BSTR FAR* retval) \
  189. { \
  190. RRETURN(get_CoreParent(retval)); \
  191. } \
  192. \
  193. STDMETHODIMP \
  194. cls::get_Schema(THIS_ BSTR FAR* retval) \
  195. { \
  196. RRETURN(get_CoreSchema(retval)); \
  197. } \
  198. \
  199. STDMETHODIMP \
  200. cls::get_GUID(THIS_ BSTR FAR* retval) \
  201. { \
  202. RRETURN(get_CoreGUID(retval)); \
  203. } \
  204. STDMETHODIMP \
  205. cls::GetEx(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  206. { \
  207. RRETURN(E_NOTIMPL); \
  208. } \
  209. \
  210. STDMETHODIMP \
  211. cls::PutEx(THIS_ long lnControlCode, BSTR bstrName, VARIANT vProp) \
  212. { \
  213. RRETURN(E_NOTIMPL); \
  214. } \
  215. STDMETHODIMP \
  216. cls::Get(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  217. { \
  218. RRETURN(E_NOTIMPL); \
  219. } \
  220. \
  221. STDMETHODIMP \
  222. cls::Put(THIS_ BSTR bstrName, VARIANT vProp) \
  223. { \
  224. RRETURN(E_NOTIMPL); \
  225. } \
  226. STDMETHODIMP \
  227. cls::GetInfoEx(THIS_ VARIANT vProperties, long lnReserved) \
  228. { \
  229. RRETURN(GetInfo()); \
  230. }
  231. //
  232. // DEFINE_IADs_Implementation
  233. //
  234. #define DEFINE_IADs_TempImplementation(cls) \
  235. STDMETHODIMP \
  236. cls::get_Name(THIS_ BSTR FAR* retval) \
  237. { \
  238. RRETURN(get_CoreName(retval)); \
  239. } \
  240. \
  241. STDMETHODIMP \
  242. cls::get_ADsPath(THIS_ BSTR FAR* retval) \
  243. { \
  244. RRETURN(get_CoreADsPath(retval)); \
  245. } \
  246. \
  247. STDMETHODIMP \
  248. cls::get_Class(THIS_ BSTR FAR* retval) \
  249. { \
  250. RRETURN(get_CoreADsClass(retval)); \
  251. } \
  252. \
  253. STDMETHODIMP \
  254. cls::get_Parent(THIS_ BSTR FAR* retval) \
  255. { \
  256. RRETURN(get_CoreParent(retval)); \
  257. } \
  258. \
  259. STDMETHODIMP \
  260. cls::get_Schema(THIS_ BSTR FAR* retval) \
  261. { \
  262. RRETURN(get_CoreSchema(retval)); \
  263. } \
  264. \
  265. STDMETHODIMP \
  266. cls::get_GUID(THIS_ BSTR FAR* retval) \
  267. { \
  268. RRETURN(get_CoreGUID(retval)); \
  269. } \
  270. STDMETHODIMP \
  271. cls::GetInfoEx(THIS_ VARIANT vProperties, long lnReserved) \
  272. { \
  273. RRETURN(GetInfo()); \
  274. }
  275. #define DEFINE_IADs_PutGetImplementation(cls, SchemaClassTable, dwTableSize) \
  276. STDMETHODIMP \
  277. cls::Get(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  278. { \
  279. HRESULT hr = S_OK; \
  280. \
  281. hr = GenericGetPropertyManager( \
  282. _pPropertyCache, \
  283. bstrName, \
  284. pvProp \
  285. ); \
  286. \
  287. RRETURN(hr); \
  288. } \
  289. \
  290. STDMETHODIMP \
  291. cls::Put(THIS_ BSTR bstrName, VARIANT vProp) \
  292. { \
  293. HRESULT hr = S_OK; \
  294. \
  295. hr = GenericPutPropertyManager( \
  296. _pPropertyCache, \
  297. SchemaClassTable, \
  298. dwTableSize, \
  299. bstrName, \
  300. vProp \
  301. ); \
  302. \
  303. RRETURN(hr); \
  304. } \
  305. STDMETHODIMP \
  306. cls::GetEx(THIS_ BSTR bstrName, VARIANT FAR* pvProp) \
  307. { \
  308. HRESULT hr = S_OK; \
  309. \
  310. hr = GenericGetExPropertyManager( \
  311. GetObjectState(), \
  312. _pPropertyCache, \
  313. bstrName, \
  314. pvProp \
  315. ); \
  316. \
  317. RRETURN(hr); \
  318. } \
  319. \
  320. STDMETHODIMP \
  321. cls::PutEx(THIS_ long lnControlCode, BSTR bstrName, VARIANT vProp) \
  322. { \
  323. HRESULT hr = S_OK; \
  324. \
  325. hr = GenericPutExPropertyManager( \
  326. _pPropertyCache, \
  327. SchemaClassTable, \
  328. dwTableSize, \
  329. bstrName, \
  330. vProp \
  331. ); \
  332. \
  333. RRETURN(hr); \
  334. }
  335. #define DEFINE_IADsPropertyList_Implementation(cls, SchemaClassTable, dwTableSize) \
  336. STDMETHODIMP \
  337. cls::get_PropertyCount(THIS_ long FAR * plCount) \
  338. { \
  339. HRESULT hr = E_FAIL; \
  340. \
  341. hr = GenericPropCountPropertyManager( \
  342. _pPropertyCache, \
  343. plCount \
  344. ); \
  345. \
  346. RRETURN(hr); \
  347. } \
  348. \
  349. \
  350. STDMETHODIMP \
  351. cls::Next(THIS_ VARIANT FAR *pVariant) \
  352. { \
  353. HRESULT hr = S_OK; \
  354. \
  355. hr = GenericNextPropertyManager( \
  356. _pPropertyCache, \
  357. pVariant \
  358. ); \
  359. RRETURN(hr); \
  360. } \
  361. \
  362. \
  363. STDMETHODIMP \
  364. cls::Skip(THIS_ long cElements) \
  365. { \
  366. HRESULT hr = S_OK; \
  367. \
  368. \
  369. hr = GenericSkipPropertyManager( \
  370. _pPropertyCache, \
  371. cElements \
  372. ); \
  373. \
  374. RRETURN(hr); \
  375. \
  376. } \
  377. \
  378. \
  379. STDMETHODIMP \
  380. cls::Reset() \
  381. { \
  382. HRESULT hr = S_OK; \
  383. \
  384. hr = GenericResetPropertyManager( \
  385. _pPropertyCache \
  386. ); \
  387. \
  388. RRETURN(hr); \
  389. \
  390. } \
  391. \
  392. STDMETHODIMP \
  393. cls::ResetPropertyItem(THIS_ VARIANT varEntry) \
  394. { \
  395. HRESULT hr = S_OK; \
  396. \
  397. hr = GenericDeletePropertyManager( \
  398. _pPropertyCache, \
  399. varEntry \
  400. ); \
  401. \
  402. RRETURN(hr); \
  403. \
  404. } \
  405. \
  406. STDMETHODIMP \
  407. cls::GetPropertyItem(THIS_ BSTR bstrName, LONG lnADsType, VARIANT * pVariant) \
  408. { \
  409. HRESULT hr = S_OK; \
  410. \
  411. hr = GenericGetPropItemPropertyManager( \
  412. _pPropertyCache, \
  413. GetObjectState(), \
  414. bstrName, \
  415. lnADsType, \
  416. pVariant \
  417. ); \
  418. \
  419. \
  420. RRETURN(hr); \
  421. \
  422. } \
  423. STDMETHODIMP \
  424. cls::PutPropertyItem(THIS_ VARIANT varData) \
  425. { \
  426. HRESULT hr = S_OK; \
  427. \
  428. hr = GenericPutPropItemPropertyManager( \
  429. _pPropertyCache, \
  430. SchemaClassTable, \
  431. dwTableSize, \
  432. varData \
  433. ); \
  434. \
  435. RRETURN(hr); \
  436. } \
  437. \
  438. STDMETHODIMP \
  439. cls::PurgePropertyList(THIS_) \
  440. { \
  441. HRESULT hr = S_OK; \
  442. \
  443. hr = GenericPurgePropertyManager( \
  444. _pPropertyCache \
  445. ); \
  446. \
  447. \
  448. RRETURN(hr); \
  449. } \
  450. STDMETHODIMP \
  451. cls::Item(THIS_ VARIANT varIndex, VARIANT * pVariant) \
  452. { \
  453. HRESULT hr = S_OK; \
  454. \
  455. hr = GenericItemPropertyManager( \
  456. _pPropertyCache, \
  457. GetObjectState(), \
  458. varIndex, \
  459. pVariant \
  460. ); \
  461. \
  462. \
  463. RRETURN(hr); \
  464. } \
  465. #define DEFINE_IDispatch_ExtMgr_Implementation(cls) \
  466. STDMETHODIMP \
  467. cls::GetTypeInfoCount(unsigned int FAR* pctinfo) \
  468. { \
  469. RRETURN(_pExtMgr->GetTypeInfoCount(pctinfo)); \
  470. } \
  471. \
  472. STDMETHODIMP \
  473. cls::GetTypeInfo(unsigned int itinfo, LCID lcid, \
  474. ITypeInfo FAR* FAR* pptinfo) \
  475. { \
  476. RRETURN(_pExtMgr->GetTypeInfo(itinfo, \
  477. lcid, \
  478. pptinfo \
  479. )); \
  480. } \
  481. STDMETHODIMP \
  482. cls::GetIDsOfNames(REFIID iid, LPWSTR FAR* rgszNames, \
  483. unsigned int cNames, LCID lcid, DISPID FAR* rgdispid) \
  484. { \
  485. RRETURN(_pExtMgr->GetIDsOfNames(iid, \
  486. rgszNames, \
  487. cNames, \
  488. lcid, \
  489. rgdispid \
  490. )); \
  491. } \
  492. \
  493. STDMETHODIMP \
  494. cls::Invoke(DISPID dispidMember, REFIID iid, LCID lcid, \
  495. unsigned short wFlags, DISPPARAMS FAR* pdispparams, \
  496. VARIANT FAR* pvarResult, EXCEPINFO FAR* pexcepinfo, \
  497. unsigned int FAR* puArgErr) \
  498. { \
  499. RRETURN (_pExtMgr->Invoke(dispidMember, \
  500. iid, \
  501. lcid, \
  502. wFlags, \
  503. pdispparams, \
  504. pvarResult, \
  505. pexcepinfo, \
  506. puArgErr \
  507. )); \
  508. }